Repository navigation
[java] Fix #6736: Add JTypeMirror.streamClasses() - #6738
Conversation
d48b9a9 to
d27ab12
Compare
|
Compared to main: (comment created at 2026-06-23 12:17:41+00:00 for 8e5689a) |
bb447f5 to
c18f0da
Compare
Most tests are probably written in Kotlin -> https://github.com/pmd/pmd/tree/main/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types I assume, there are some tests for JTypeMirror.... |
c18f0da to
5ff35cd
Compare
|
@oowekyala Thanks for your comments. I've removed the prefilter. I was going for a similar API between I've also added a single test to |
Implement those methods in ClassTypeImpl, JIntersectionType, JTypeVar and JWildcardType. Implementation mirrors the implementation of .streamMethods() and .streamDeclaredMethods(). Use the new methods to have TestFrameworksUtil.isJUnit5Class for the existence of @nested classes.
For methods, having a filter reduces the amount of objects created. This increases performance. For classes, that's not the case. Let's go for the simple interface.
adeed05 to
59c0a8f
Compare
Co-authored-by: Andreas Dangel <[email protected]>
…/bestpractices/xml/JUnitJupiterTestShouldBePackagePrivate.xml Co-authored-by: Andreas Dangel <[email protected]>
* Split TestFrameworksUtil.isXXXClass into hasXXXTests and isConcreteToplevelClass * Use those for a new TestFrameworksUtil.hasTests() method. * This method automatically supports superclasses because of the work done in previous PRs (pmd#6604, pmd#6680, pmd#6689, pmd#6735, pmd#6738) * Use TestFrameworksUtil.hasTests() in TestClassWithoutTestCasesRule
Describe the PR
This PR
JTypeMirror.streamClasses()and.streamDeclaredClasses(),TestFrameworksUtil.isJunit5Class()and.isTestClass()recognize classes with only @Nested classes as test classesRelated issues
Review notes
I think this is my first time touching the
.typespackage. I believe I've done the right thing here, but please double check.I've used
.streamMethods()and.streamDeclaredMethodsas a template for my code. I didn't implement the two methodsin JArrayType, because I don't think arrays can have nested classes.
Are there existing tests for
JTypeMirrorand related classes where I need to add some tests? Currently, I only test my changes indirectly viaTestFrameworksUtilTest.Ready?
./mvnw clean verifypasses (checked automatically by github actions)