-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7b87a2
commit 5afe379
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
mod utils; | ||
use utils::get_int; | ||
use vm::vm::VM; | ||
|
||
#[test] | ||
fn should_check_if_class_is_interface() { | ||
let last_frame_value = | ||
VM::run("samples.reflection.trivial.classisinterface.ClassIsInterfaceExample").unwrap(); | ||
assert_eq!(1, get_int(last_frame_value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package samples.reflection.trivial.classisinterface; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.util.AbstractMap; | ||
import java.util.HashMap; | ||
|
||
public class ClassIsInterfaceExample { | ||
public static void main(String[] args) { | ||
boolean runnableIsInterface = Runnable.class.isInterface(); | ||
boolean hashMapIsInterface = HashMap.class.isInterface(); | ||
boolean abstractMapIsInterface = AbstractMap.class.isInterface(); | ||
boolean elementTypeIsInterface = ElementType.class.isInterface(); | ||
|
||
int result = runnableIsInterface && !hashMapIsInterface && !abstractMapIsInterface && !elementTypeIsInterface | ||
? 1 | ||
: 0; | ||
} | ||
} |
Binary file added
BIN
+640 Bytes
tests/test_data/samples/reflection/trivial/classisinterface/ClassIsInterfaceExample.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters