How to get parameter type at call time?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading the JavaMethodCall API and the related issue #721, then trace how ArchUnit represents method-call arguments and their types. The issue asks whether call-site type information, such as String passed to a generic parameter, is available; done means determining whether the existing model exposes it or what representation would be needed. No source files or tests are named, so locating the relevant code requires familiarity with the project.
Written by the indexing model from the issue text.
Description
Consider:
class A {
public <T> void foo(T value) {}
}
class B {
public void bar() {
new A().foo("string");
}
}
With a DescribedPredicate<JavaMethodCall> I can get a reference to the call to A.foo, but it appears that the JavaMethodCall object only contains type information defined in the method signature. Is there a way to get access to the type information at the call site? I.e. that we're passing a String to the method?
This is somewhat related to https://github.com/TNG/ArchUnit/issues/721, but subtly different: I'm not looking to get the call value (which isn't generally statically available), but I'm looking for the call type (which is statically available).
- Dominant language
- Java
- Stars
- 3.9k
- Forks
- 350
- Avg merge
- 3d 2m
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TNG/ArchUnit
-
PackageMatcher wildcards don't match package names with non-ASCII lettersPossibly taken @StefanPenndorf claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
beFreeOfCycles() misses cycles: TarjanComponentFinder does not return the component with the lowest node indexPossibly taken @StefanPenndorf claimed this 5 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
TNG/ArchUnit#1773 · 1 comment ·
Maintainers usually reply within 1 day
-
Constructor parameters added by the compiler (inner classes, enums) make `getParameters()` / `getParameterTypes()` inconsistent and misplace parameter annotationsPossibly taken @SamuelAdigos claimed this 7 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 48/100
TNG/ArchUnit#1772 · 3 comments ·
Maintainers usually reply within 1 day
-
breaking change
Difficulty 5/5 Over a week Newbie friendliness 18/100
TNG/ArchUnit#1756 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Mend: dependency security vulnerability
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
needs-area-label
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days
-
critical
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
enhancement Java macOS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freerouting/freerouting#1079 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day