Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

java.lang.VerifyError: Bad type on operand stack

Abierto
#253 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
20/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
java
Área
desktop, testing

Línea de trabajo

Comienza reproduciendo el fallo del ApplicationLauncher setup informado y, después, inspecciona MainClass.java:142 y AbstractDefaultWindow.doJob, donde VerifyError identifica el tipo de operando no válido. Revisa las versiones de los JAR de AssertJ indicadas y la cadena de herencia de DefaultWindow. La tarea estará terminada cuando se haya identificado si el fallo procede de las dependencias, del versionado de Java o de la estructura de clases heredada, y se haya documentado la corrección.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hey,

I want to introduce click-tests to my swing-application and it seems AssertJ is the way to go ^^.

After testing and long investigations I still cant't get rid of one error and I'm very unsure it's a java-bug, a version-thing or related to the structure of the legacy-code.
I would be very happy if someone could point me in the right correction :):

When I run the testcase with in @onSetUp:

ApplicationLauncher withArgs = application(MainClass.class).withArgs("args");
withArgs.start();

the test stops with

org.assertj.swing.dependency.fest_reflect.exception.ReflectionError: Unable to invoke method 'main' with arguments [['abc']]
	at org.assertj.swing.dependency.fest_reflect.method.Invoker.cannotInvokeMethod(Invoker.java:124)
	at org.assertj.swing.dependency.fest_reflect.method.Invoker.invoke(Invoker.java:116)
	at org.assertj.swing.launcher.ApplicationLauncher.start(ApplicationLauncher.java:109)
	at abc.TestClass.onSetUp(TestClass.java:114)
	at abc.AssertJSwingJUnitTestCase.setUp(AssertJSwingJUnitTestCase.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    abc/AbstractDefaultWindow.doJob(I)V @327: invokestatic
  Reason:
    Type 'abc/AbstractDefaultWindow' (current frame, stack[1]) is not assignable to 'java/awt/Component'
  Current Frame:
    bci: @327
    flags: { }
    locals: { 'abc/AbstractDefaultWindow', integer, 'java/lang/Exception' }
    stack: { 'java/lang/Exception', 'abc/AbstractDefaultWindow', 'java/lang/String' }
  Bytecode:
    0x0000000: 1b9b 0024 2ab6 0047 1bb6 00c2 04b8 00c8
    0x0000010: b900 cd02 0099 0010 2a1b b600 d02a 1bb7
    0x0000020: 00d2 a701 282a b400 8ec1 004d 9900 252a
    0x0000030: b400 8ec0 00d4 1bb9 00d7 0200 2a1b b700
    0x0000040: d22a 1b99 0007 04a7 0004 03b6 00db a700
    0x0000050: fc2a b400 8ec6 0032 2ab6 0047 b600 df12
    0x0000060: e1b6 0076 9900 231b 04a0 001e 2ab4 008e
    0x0000070: c000 65b6 00e5 9a00 112a b400 8ec0 00d4
    0x0000080: 1bb9 00d7 0200 b12a b400 8ec6 0030 2ab6
    0x0000090: 0047 b600 df12 e1b6 0076 9a00 122a b600
    0x00000a0: 47b6 00df 12e7 b600 7699 0012 1b04 a000
    0x00000b0: 0d2a b400 8ec0 0065 b600 ea2a 1bb7 00d2
    0x00000c0: 2ab4 008e c600 3f2a b600 47b6 00df 12e1
    0x00000d0: b600 7699 0030 2ab4 008e c000 d41b b900
    0x00000e0: d702 002a b400 8ec0 0065 1b9a 0007 04a7
    0x00000f0: 0004 03b6 00ed 2a1b 9900 0704 a700 0403
    0x0000100: b600 db2a b400 98c6 0043 2ab6 0047 b600
    0x0000110: df12 e1b6 0076 9900 342a b400 98c0 0078
    0x0000120: 1b9a 0007 04a7 0004 03b6 00f0 2a1b 9900
    0x0000130: 0704 a700 0403 b600 dba7 0011 4d2c 2ab2
    0x0000140: 001c 12f2 b600 72b8 00f6 b1            
  Exception Handler Table:
    bci [0, 134] => handler: 316
    bci [135, 313] => handler: 316
  Stackmap Table:
    same_frame(@37)
    same_locals_1_stack_item_frame(@74,Object[#2])
    full_frame(@75,{Object[#2],Integer},{Object[#2],Integer})
    same_frame(@81)
    same_frame(@135)
    same_frame(@172)
    same_frame(@187)
    same_locals_1_stack_item_frame(@242,Object[#101])
    full_frame(@243,{Object[#2],Integer},{Object[#101],Integer})
    same_locals_1_stack_item_frame(@255,Object[#2])
    full_frame(@256,{Object[#2],Integer},{Object[#2],Integer})
    same_frame(@259)
    same_locals_1_stack_item_frame(@296,Object[#120])
    full_frame(@297,{Object[#2],Integer},{Object[#120],Integer})
    same_locals_1_stack_item_frame(@309,Object[#2])
    full_frame(@310,{Object[#2],Integer},{Object[#2],Integer})
    same_locals_1_stack_item_frame(@316,Object[#190])
    same_frame(@330)
...
	at abc.MainClass.main(MainClass.java:142)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.assertj.swing.dependency.fest_reflect.method.Invoker.invoke(Invoker.java:112)
	... 29 more

Class-structure is:

DefaultWindow (gets created - then the error occurs) - extends
AbstractDefaultWindow extends 
AbstractWindow extends JFrame, 
implements IStatusMessageListener, ActionListener, ChangeListener, Observer

As it's a legacy-project - I inserted

assertj-core-3.17.2.jar
assertj-swing-junit-3.9.2.jar

by hand. Can this cause such a error?
I also tried to build my own all-containing-dependency-jar with

<dependencies>
<dependency>
  <groupId>org.assertj</groupId>
  <artifactId>assertj-swing-junit</artifactId>
  <version>3.9.2</version>
</dependency>
</dependencies>
  
  
<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>    
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
  </plugins>
</build>

but it didn't help.

Would be very glad if someone could help me :)

Kind Regards

Lenguaje dominante
Java
Estrellas
121
Forks
52
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de assertj/assertj-swing

Todos los issues de assertj/assertj-swing

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.