Faculty Probleme #47

Closed
opened 2019-05-07 00:58:37 +00:00 by pl · 2 comments
Owner

import java.lang.Integer;
//import java.lang.Long;
//import java.lang.Short;

public class Faculty {
public fact;
Faculty() {
fact = (x) -> {
if (x == 1) {
return 1;
}
else {
return x * (fact.apply(x-1));
}
};
}

public getFact(x) {
    return fact.apply(x);
}
}

liefert

Exception in thread "main" java.lang.VerifyError: Bad return type
Exception Details:
Location:
Faculty.getFact(Ljava/lang/Integer;)Ljava/lang/Integer; @8: areturn
Reason:
Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'java/lang/Integer' (from method signature)
Current Frame:
bci: @8
flags: { }
locals: { 'Faculty', 'java/lang/Integer' }
stack: { 'java/lang/Object' }
Bytecode:
0000000: 2ab4 002c 2bb6 0030 b0

at Main.main(Main.java:31)
import java.lang.Integer; //import java.lang.Long; //import java.lang.Short; public class Faculty { public fact; Faculty() { fact = (x) -> { if (x == 1) { return 1; } else { return x * (fact.apply(x-1)); } }; } public getFact(x) { return fact.apply(x); } } liefert Exception in thread "main" java.lang.VerifyError: Bad return type Exception Details: Location: Faculty.getFact(Ljava/lang/Integer;)Ljava/lang/Integer; @8: areturn Reason: Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'java/lang/Integer' (from method signature) Current Frame: bci: @8 flags: { } locals: { 'Faculty', 'java/lang/Integer' } stack: { 'java/lang/Object' } Bytecode: 0000000: 2ab4 002c 2bb6 0030 b0 at Main.main(Main.java:31)

Gefixt

branch bytecode2
commit 857d63322e

Gefixt branch bytecode2 commit 857d63322eba3c4f201b87f024da476c8b93b0be
Author
Owner

getestet funktioniert

getestet funktioniert
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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#47
No description provided.