Skip to content

Enum class cast exception when using varargs generic constant parameter in step #123

Closed

Description

@pilshchikov

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lcom.examples.tests.MainTest$Params;

	at com.examples.tests.MainTest$AjcClosure1.run(MainTest.java:1)
	at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
	at io.qameta.allure.aspects.StepsAspects.step(StepsAspects.java:46)
	at com.examples.tests.MainTest.paramSteps(MainTest.java:81)

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

    @Test
    public void testWithParams() {
        paramSteps(FirstParam.PARAM_1, SecondParam.PARAM_2);
    }

    @Step
    public <T extends Params> void paramSteps(T... param) {}

    enum FirstParam implements Params {
        PARAM_1
    }

    enum SecondParam implements Params {
        PARAM_2
    }

    interface Params {}

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Allure version 2+
Test framework junit@4.12
Allure integration allure-junit4@2.0-BETA16
Generate report using allure-maven@2.8
AspectJWeaver 1.8.10

Other information

Activity

  1. changed the title [-][JUnit4] Enum class cast exception when using varargs generic constant parameter for step[/-] [+][JUnit4] Enum class cast exception when using varargs generic constant parameter in step[/+] on Aug 5, 2017
  2. self-assigned this
    on Sep 11, 2017
  3. changed the title [-][JUnit4] Enum class cast exception when using varargs generic constant parameter in step[/-] [+]Enum class cast exception when using varargs generic constant parameter in step[/+] on Nov 12, 2018
  4. added a commit that references this issue on Nov 12, 2018
    5cb4290
  5. added theissue type on Jul 10, 2026
  6. removed
    pr:bugSomething isn't working
    on Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions