Matrix.class nicht ladbar #108

Closed
opened 2023-03-10 21:09:03 +00:00 by pl · 1 comment
Owner

Matrix.jav

import java.util.Vector;
import java.lang.Integer;
import java.lang.Boolean;

public class Matrix extends Vector<Vector> {

   Matrix () {

}

   Matrix(vv) {
 var i = 0;
     while(i < vv.size()) {
             this.add(vv.elementAt(i));
             i=i+1;
     }

}

    mul(m) {
   var ret = new Matrix();
   var i = 0;
   while(i < size()) {
       var v1 = this.elementAt(i);
       var v2 = new Vector<Integer>();
       var j = 0;
       while(j < v1.size()) {
           var erg = 0;
           var k = 0;
           while(k < v1.size()) {
               erg = erg + v1.elementAt(k)
                        * m.elementAt(k).elementAt(j);
               k++; }
           v2.addElement(erg);
           j++; }
       ret.addElement(v2);
       i++;
    }
   return ret;

}
}

und

import java.util.Vector;

public class MainMatrix {
public static void main(String[] args) {
new Matrix();
}
}

java MainMatrix
liefert
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
Matrix.mul(Ljava/util/Vector;)LMatrix; @259: invokevirtual
Reason:
Type 'java/lang/Integer' (current frame, stack[1]) is not assignable to 'java/util/Vector'
Current Frame:
bci: @259
flags: { }
locals: { 'Matrix', 'java/util/Vector', 'Matrix', 'java/lang/Integer', 'java/util/Vector', 'java/util/Vector', 'java/lang/Integer', 'java/lang/Integer', 'java/lang/Integer' }
stack: { 'java/util/Vector', 'java/lang/Integer' }
Bytecode:
0000000: 014d bb00 0259 b700 3059 4d57 014e 120f
0000010: b800 1559 4e57 2db6 0019 2ab6 0031 b600
0000020: 19a1 0007 03a7 0004 0499 0105 013a 042a
0000030: 2db6 0019 b800 15b6 0034 593a 0457 013a
0000040: 05bb 0005 59b7 000a 593a 0557 013a 0612
0000050: 0fb8 0015 593a 0657 1906 b600 1919 04b6
0000060: 001d b600 19a1 0007 03a7 0004 0499 00ab
0000070: 013a 0712 0fb8 0015 593a 0757 013a 0812
0000080: 0fb8 0015 593a 0857 1908 b600 1919 04b6
0000090: 001d b600 19a1 0007 03a7 0004 0499 005c
00000a0: 1907 b600 1919 0419 08b6 0019 b800 15b6
00000b0: 0021 c000 11c0 0011 b600 192b 1908 b600
00000c0: 19b8 0015 b600 21c0 0005 1906 b600 19b8
00000d0: 0015 b600 21c0 0011 c000 11b6 0019 6860
00000e0: b800 1559 3a07 5719 08b6 0019 5912 2c60
00000f0: b800 153a 0857 a7ff 9219 0519 07b6 0019
0000100: b800 15b6 0037 1906 b600 1959 122c 60b8
0000110: 0015 3a06 57a7 ff43 2c19 05b6 0038 2db6
0000120: 0019 5912 2c60 b800 154e 57a7 feeb 2cb0
0000130:
Stackmap Table:
append_frame(@22,Object[#2],Object[#17])
same_frame(@40)
same_locals_1_stack_item_frame(@41,Integer)
append_frame(@88,Object[#5],Object[#5],Object[#17])
same_frame(@108)
same_locals_1_stack_item_frame(@109,Integer)
append_frame(@136,Object[#17],Object[#17])
same_frame(@156)
same_locals_1_stack_item_frame(@157,Integer)
same_frame_extended(@249)
chop_frame(@280,2)
chop_frame(@302,3)

   at MainMatrix.main(MainMatrix.java:5)
Matrix.jav import java.util.Vector; import java.lang.Integer; import java.lang.Boolean; public class Matrix extends Vector<Vector<Integer>> { Matrix () { } Matrix(vv) { var i = 0; while(i < vv.size()) { this.add(vv.elementAt(i)); i=i+1; } } mul(m) { var ret = new Matrix(); var i = 0; while(i < size()) { var v1 = this.elementAt(i); var v2 = new Vector<Integer>(); var j = 0; while(j < v1.size()) { var erg = 0; var k = 0; while(k < v1.size()) { erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j); k++; } v2.addElement(erg); j++; } ret.addElement(v2); i++; } return ret; } } und import java.util.Vector; public class MainMatrix { public static void main(String[] args) { new Matrix(); } } java MainMatrix liefert Exception in thread "main" java.lang.VerifyError: Bad type on operand stack Exception Details: Location: Matrix.mul(Ljava/util/Vector;)LMatrix; @259: invokevirtual Reason: Type 'java/lang/Integer' (current frame, stack[1]) is not assignable to 'java/util/Vector' Current Frame: bci: @259 flags: { } locals: { 'Matrix', 'java/util/Vector', 'Matrix', 'java/lang/Integer', 'java/util/Vector', 'java/util/Vector', 'java/lang/Integer', 'java/lang/Integer', 'java/lang/Integer' } stack: { 'java/util/Vector', 'java/lang/Integer' } Bytecode: 0000000: 014d bb00 0259 b700 3059 4d57 014e 120f 0000010: b800 1559 4e57 2db6 0019 2ab6 0031 b600 0000020: 19a1 0007 03a7 0004 0499 0105 013a 042a 0000030: 2db6 0019 b800 15b6 0034 593a 0457 013a 0000040: 05bb 0005 59b7 000a 593a 0557 013a 0612 0000050: 0fb8 0015 593a 0657 1906 b600 1919 04b6 0000060: 001d b600 19a1 0007 03a7 0004 0499 00ab 0000070: 013a 0712 0fb8 0015 593a 0757 013a 0812 0000080: 0fb8 0015 593a 0857 1908 b600 1919 04b6 0000090: 001d b600 19a1 0007 03a7 0004 0499 005c 00000a0: 1907 b600 1919 0419 08b6 0019 b800 15b6 00000b0: 0021 c000 11c0 0011 b600 192b 1908 b600 00000c0: 19b8 0015 b600 21c0 0005 1906 b600 19b8 00000d0: 0015 b600 21c0 0011 c000 11b6 0019 6860 00000e0: b800 1559 3a07 5719 08b6 0019 5912 2c60 00000f0: b800 153a 0857 a7ff 9219 0519 07b6 0019 0000100: b800 15b6 0037 1906 b600 1959 122c 60b8 0000110: 0015 3a06 57a7 ff43 2c19 05b6 0038 2db6 0000120: 0019 5912 2c60 b800 154e 57a7 feeb 2cb0 0000130: Stackmap Table: append_frame(@22,Object[#2],Object[#17]) same_frame(@40) same_locals_1_stack_item_frame(@41,Integer) append_frame(@88,Object[#5],Object[#5],Object[#17]) same_frame(@108) same_locals_1_stack_item_frame(@109,Integer) append_frame(@136,Object[#17],Object[#17]) same_frame(@156) same_locals_1_stack_item_frame(@157,Integer) same_frame_extended(@249) chop_frame(@280,2) chop_frame(@302,3) at MainMatrix.main(MainMatrix.java:5)
Author
Owner

*** This bug has been marked as a duplicate of bug 249 ***

*** This bug has been marked as a duplicate of bug 249 ***
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: JavaTX/JavaCompilerCore#108
No description provided.