Skip to content

Improve "Ineffective @Order annotation" discovery issue by mentioning meta-annotations #4713

@nxglhez

Description

@nxglhez

The commit 786de29#diff-4b290a2104fbe0c8f688dfe991a5b5c668f62c6a561abb608421953fd8d5edfe introduced a warning about use of @Order without an orderer.

(1) [INFO] Ineffective @Order annotation on class 'com.example.OrderTest'. It will not be applied because ClassOrderer.OrderAnnotation is not in use.
    Source: ClassSource [className = 'com.example.OrderTest', filePosition = null]
            at com.example.OrderTest.<no-method>(SourceFile:0)

I do understand the problem, but the information does not help: in my case, a meta-annotation was annotated with @Order and I had to use debug mode to finally find this was due to a meta annotation.

The annotation was annotated like this:

@Retention(RetentionPolicy.RUNTIME)
@Order(1)
public @interface ComposedAnnotation {
}

And the test:

@ComposedAnnotation
public class OrderTest {

    @Test
    void test() {
        assertTrue(true);
    }
}

This result in the following warnings:

juil. 02, 2025 10:49:05 AM org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssues
INFOS: TestEngine with ID 'junit-jupiter' encountered a non-critical issue during test discovery:

(1) [INFO] Ineffective @Order annotation on class 'com.example.OrderTest'. It will not be applied because ClassOrderer.OrderAnnotation is not in use.
    Source: ClassSource [className = 'com.example.OrderTest', filePosition = null]
            at com.example.OrderTest.<no-method>(SourceFile:0)
juil. 02, 2025 10:49:05 AM org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssues
INFOS: TestEngine with ID 'junit-jupiter' encountered a non-critical issue during test discovery:

(1) [INFO] Ineffective @Order annotation on class 'com.example.OrderTest'. It will not be applied because ClassOrderer.OrderAnnotation is not in use.
    Source: ClassSource [className = 'com.example.OrderTest', filePosition = null]
            at com.example.OrderTest.<no-method>(SourceFile:0)

Could it be possible to add more details in those warnings?

Context

  • Used versions (Jupiter/Vintage/Platform): Jupiter 5.13.2
  • Build Tool/IDE: Eclipse / Maven

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions