Line | |
---|
1 | package testcode;
|
---|
2 |
|
---|
3 | import org.eclipse.jdt.annotation.NonNull;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Test to see if overloaded methods are handled properly. This is in separate
|
---|
7 | * directory because this will require a venv to test as overloading has to be
|
---|
8 | * handled by the external module "multipledispatch".
|
---|
9 | */
|
---|
10 | public class Overload {
|
---|
11 |
|
---|
12 | public Overload() {
|
---|
13 | System.out.println(f(4));
|
---|
14 | System.out.println(f(5, 3));
|
---|
15 | System.out.println(f(1.2).toString());
|
---|
16 | System.out.println(f("something") == null);
|
---|
17 |
|
---|
18 | }
|
---|
19 |
|
---|
20 | private @NonNull String f(Integer v) {
|
---|
21 | return "1=" + v.toString();
|
---|
22 | }
|
---|
23 |
|
---|
24 | private @NonNull String f(Integer v, Integer w) {
|
---|
25 | return "2=" + v.toString() + w.toString();
|
---|
26 | }
|
---|
27 |
|
---|
28 | private @NonNull Double f(double v) {
|
---|
29 | return v + 1;
|
---|
30 | }
|
---|
31 |
|
---|
32 | // shows #382
|
---|
33 | private int[] f(@NonNull String x) {
|
---|
34 | return null;
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | *
|
---|
39 | * @param args the arguments of the call.
|
---|
40 | */
|
---|
41 | static public void main(String[] args) {
|
---|
42 | new Overload();
|
---|
43 | }
|
---|
44 |
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.