Unboxing Integer Problem #50
Labels
No Label
Codegen
confirmed
duplicate
Eclipse-Plugin
Feature Request
generics
in progress
invalid
JavaCompilerCore
needs info
Parser
Trash
Type
Unify
won't fix
works for me
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: JavaTX/JavaCompilerCore#50
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Branch: bigRefactoring
commit:
2b7aef5e87
VectorAdd.jav
public class VectorAdd {
vectorAdd(v1, v2) {
var i = 0;
var erg = new Vector<>();
while (i < v1.size()) {
erg.addElement(v1.elementAt(i) + v2.elementAt(i));
i++;
}
return erg;
}
}
liefert
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
VectorAdd.vectorAdd(Ljava/util/Vector;Ljava/util/Vector;)Ljava/util/Vector; @49: iadd
Reason:
Type 'java/lang/Integer' (current frame, stack[2]) is not assignable to integer
Current Frame:
bci: @49
flags: { }
locals: { 'VectorAdd', 'java/util/Vector', 'java/util/Vector', 'java/lang/Integer', 'java/util/Vector' }
stack: { 'java/util/Vector', 'java/lang/Integer', 'java/lang/Integer' }
Bytecode:
0x0000000: 03b8 0012 4ebb 0014 59b7 0015 3a04 2db6
0x0000010: 0019 2bb6 001c a200 2c19 042b 2db6 0019
0x0000020: b600 20c0 000e 2c2d b600 19b6 0020 c000
0x0000030: 0e60 b600 242d b600 1904 60b8 0012 4ea7
0x0000040: ffcf 1904 b0
Stackmap Table:
append_frame(@14,Object[#14],Object[#20])
same_frame(@66)
Jetzt ist der Fehler bei VectorAdd.jav doch noch aufgetreten:
java.lang.ArrayIndexOutOfBoundsException: 0
at org.objectweb.asm.Frame.merge(Frame.java:1263)
at org.objectweb.asm.Frame.merge(Frame.java:1239)
at org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1617)
at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1553)
at de.dhbwstuttgart.bytecode.BytecodeGen.visit(BytecodeGen.java:475)
at de.dhbwstuttgart.syntaxtree.Method.accept(Method.java:61)
at de.dhbwstuttgart.bytecode.BytecodeGen.visit(BytecodeGen.java:272)
at de.dhbwstuttgart.syntaxtree.ClassOrInterface.accept(ClassOrInterface.java:114)
at de.dhbwstuttgart.bytecode.BytecodeGen.visit(BytecodeGen.java:145)
at de.dhbwstuttgart.core.JavaTXCompiler.generateBytecode(JavaTXCompiler.java:665)
at bytecode.VectorAddTest.test(VectorAddTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Gefixt.
branch bytecode 2
commit
3c36c61077
Ich bekomme leider immernoch den gleichen Fehler
Bei
Vector v1 = new Vector ();
v1.add(1);
v1.add(2);
Vector v2 = new Vector ();
v2.add(3);
v2.add(4);
VectorAdd va = new VectorAdd();
System.out.println(va.vectorAdd(v1, v2));
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
VectorAdd.vectorAdd(Ljava/util/Vector;Ljava/util/Vector;)Ljava/util/Vector; @49: iadd
Reason:
Type 'java/lang/Integer' (current frame, stack[2]) is not assignable to integer
Current Frame:
bci: @49
flags: { }
locals: { 'VectorAdd', 'java/util/Vector', 'java/util/Vector', 'java/lang/Integer', 'java/util/Vector' }
stack: { 'java/util/Vector', 'java/lang/Integer', 'java/lang/Integer' }
Bytecode:
0000000: 03b8 0012 4ebb 0014 59b7 0015 3a04 2db6
0000010: 0019 2bb6 001c a200 2f19 042b 2db6 0019
0000020: b600 20c0 000e 2c2d b600 19b6 0020 c000
0000030: 0e60 b800 12b6 0024 2db6 0019 0460 b800
0000040: 124e a7ff cc19 04b0
Stackmap Table:
append_frame(@14,Object[#14],Object[#20])
same_frame(@69)
Gefixt.
branch bytecode2
commit
c2030123d5