Allow to retrieve involved raw types of JavaType and JavaMember#1116
Conversation
... which basically disables any automatic wrap for normal use cases. We leave it open to implementer and reviewer to determine the best way to break lines. So far this has worked out fine. Signed-off-by: Peter Gafert <peter.gafert@archunit.org>
e65479f to
08e1b40
Compare
|
Thanks a lot for your contribution! 😃 The code looks quite clean and works 🙂 Here are the bigger things I changed:
But I'm gonna try to give you some feedback on the stuff I noticed so you can hopefully also take some stuff away 🙂 First thing I noticed was the commit structure. For ArchUnit we try to create self-contained logical units. Another thing I noticed was that Javadoc was missing. We don't create Javadoc in a cargo cult way, but every non-trivial method should get it. Regarding the tests, there are a lot of custom assertions that make your life simpler. We never use Last but not least I saw quite some unrelated code reformatting. IMHO you shouldn't touch unrelated code like this, definitely not in the same commit as "real" changes, cause it just makes the review harder (and reasoning about the change later on as well). BTW: We also don't use any branch prefix convention 😁 E.g. in the PR title... |
JavaType and JavaMember
Adds a convenience method to quickly determine all `JavaClass`es any `JavaType` depends on. For a complex type, like the parameterized type `Map<? extends Serializable, List<? super Set<String>>>`, this can otherwise be quite tedious and possibly make it necessary to traverse the whole type parameter hierarchy. Issue: TNG#723 Signed-off-by: Leonard Husmann <leonard.husmann@tum.de> Signed-off-by: Peter Gafert <peter.gafert@archunit.org>
Convenience method to find all `JavaClass`es involved in any member's signature. For a field these are only the raw types involved in the field type, for methods and constructors it's the union of all raw types involved in parameter types, return types and type parameters. Issue: TNG#723 Signed-off-by: Leonard Husmann <leonard.husmann@tum.de> Signed-off-by: Peter Gafert <peter.gafert@archunit.org>
08e1b40 to
ea320d8
Compare
|
Wow! thanks a lot for this extensive feedback 😄🙏🙏 |
This PR adds two new methods:
JavaType.getAllInvolvedRawTypes()andJavaMember.getAllInvolvedRawTypes().JavaType.getAllInvolvedRawTypes()returns all involved types in thisJavaType(e.g. return type of a method)i.e. for a method
public Map<? extends String, ? super Map<Serializable, Object>> method(List<String> input) {...}the methods should return the following:
method.getReturnType().getAllInvolvedRawTypes()would returnSet.of(Map.class, String.class, Serializable.class, Object.class)method.getAllInvolvedRawTypes()would returnSet.of(Map.class, String.class, Serializable.class, Object.class, List.class)WDYT? Feedback is highly appreciated :)
Resolves: #723