Skip to content

Instantly share code, notes, and snippets.

@protogenes
Created October 20, 2017 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save protogenes/93a5d76075b45ba5a946034820f03c76 to your computer and use it in GitHub Desktop.
Save protogenes/93a5d76075b45ba5a946034820f03c76 to your computer and use it in GitHub Desktop.
data.class class [B
data [0, 1, 2, 3, 4, 5, 6, 7]
java data [[0], [1], [2], [3], [4], [5], [6], [7]]
Exception in thread "main" Assertion failed:
assert TestJava.call(data) == 1
| | |
8 | false
[0, 1, 2, 3, 4, 5, 6, 7]
at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:404)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:650)
at TestGroovy.main(TestGroovy.groovy:9)
import groovy.transform.CompileStatic
@CompileStatic
class TestGroovy {
static void main(String... args) {
byte[] data = [0, 1, 2, 3, 4, 5, 6, 7]
System.out.println("data.class " + data.class)
System.out.println("data " + data)
assert TestJava.call(data) == 1
}
}
import java.util.Arrays;
public class TestJava {
public static int call(byte[]... data) {
System.out.println("java data " + Arrays.deepToString(data));
return data.length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment