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

Implement all checks for kinds of type references #7

Open
14 of 17 tasks
gunnarmorling opened this issue Jan 2, 2019 · 10 comments
Open
14 of 17 tasks

Implement all checks for kinds of type references #7

gunnarmorling opened this issue Jan 2, 2019 · 10 comments
Assignees

Comments

@gunnarmorling
Copy link
Member

gunnarmorling commented Jan 2, 2019

Currently still missing are references in:

  • method return values
  • (nested) type arguments
  • constructor calls
  • super-class and implemented interfaces
  • annotations
  • annotation parameters
  • assignments to Class variables (Class<?> cls = InvalidAcess.class)
  • unused "named" import (com.foo.bar)
  • import "on demand" (com.foo.*)
  • usages of qualified Types without importing it (eg private other.Bar bar)
  • a static method call on an imported type: Bar.bar() (interestingly it is, if the type is not imported and the invocation is other.Bar.bar())
  • accessing static fields (String s = Bar.BAR);
  • Class literals: foo(Bar.class);
  • Generic bounds: Class<? extends Bar> clazz = null;
  • Class literal in annotation: @MyAnno(Bar.class)
  • Parameters of lambda expressions: v -> { }
  • Local inferred variables: var s = getSomething()
@gunnarmorling
Copy link
Member Author

@nilshartmann FYI, logged this issue for completing the detection logic in the visitor.

gunnarmorling added a commit that referenced this issue Jan 2, 2019
@gunnarmorling
Copy link
Member Author

I've already expanded the BasicPluginTest to cover the ones above except the super-type ones (commented out the assertions for now).

@nilshartmann
Copy link
Contributor

ok, I'll merge with my tests and push my work-in-progress state

nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
@gunnarmorling
Copy link
Member Author

Thanks, @nilshartmann!

nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
gunnarmorling added a commit that referenced this issue Jan 2, 2019
nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 2, 2019
gunnarmorling added a commit that referenced this issue Jan 2, 2019
nilshartmann added a commit that referenced this issue Jan 3, 2019
gunnarmorling pushed a commit that referenced this issue Jan 4, 2019
* #7 Finding more invalid references; reworking getQualifiedName()
@gunnarmorling
Copy link
Member Author

gunnarmorling commented Jan 7, 2019

@nilshartmann Just noticed some more situation where no error is raised:

  • a static method call on an imported type: Bar.bar() (interestingly it is, if the type is not imported and the invocation is other.Bar.bar())
  • accessing static fields (String s = Bar.BAR);
  • Class literals: foo(Bar.class);
  • Generic bounds: Class<? extends Bar> clazz = null;
  • Class literal in annotation: @MyAnno(Bar.class)

@nilshartmann
Copy link
Contributor

I'll have a look!

nilshartmann added a commit to nilshartmann/deptective that referenced this issue Jan 11, 2019
@gunnarmorling
Copy link
Member Author

@nilshartmann, added two more cases to the check list above.

@nilshartmann
Copy link
Contributor

@gunnarmorling , I'll add tests for them. If you don't mind you could merge #25 already. Even the new tests in that PR doesn't cover all cases, they'll provide some more safety.

@gunnarmorling
Copy link
Member Author

If you don't mind you could merge #25 already

We can merge it, but it's still missing license headers in some files. Can you run mvn license:format, update the PR and merge it yourself? Thanks!

gunnarmorling pushed a commit that referenced this issue Jan 18, 2019
gunnarmorling added a commit that referenced this issue Jan 18, 2019
@gunnarmorling
Copy link
Member Author

@nilshartmann Added the license headers and merged #25. Thanks!

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

2 participants