-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
JavaMember.getAllInvolvedRawTypes()
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: #723 Signed-off-by: Leonard Husmann <[email protected]> Signed-off-by: Peter Gafert <[email protected]>
- Loading branch information
1 parent
f4b0684
commit ea320d8
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
archunit/src/test/java/com/tngtech/archunit/core/domain/JavaFieldTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.tngtech.archunit.core.domain; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import com.tngtech.archunit.core.importer.ClassFileImporter; | ||
import org.junit.Test; | ||
|
||
import static com.tngtech.archunit.testutil.Assertions.assertThatTypes; | ||
|
||
public class JavaFieldTest { | ||
@Test | ||
public void offers_all_involved_raw_types() { | ||
class SomeClass { | ||
@SuppressWarnings("unused") | ||
List<? super Map<? extends Serializable, ? super Set<Number[][]>>> field; | ||
} | ||
|
||
JavaField field = new ClassFileImporter().importClass(SomeClass.class).getField("field"); | ||
|
||
assertThatTypes(field.getAllInvolvedRawTypes()).matchInAnyOrder(List.class, Map.class, Serializable.class, Set.class, Number.class); | ||
} | ||
} |