Debian Codegraph @

test/harness/jpype/varargs/VarArgs.java

raw symbols SCIP
1 /* ****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 **************************************************************************** */
16 package jpype.varargs;
17
18 import java.util.Map;
19
20 class VarArgs
21 {
22
23 public Object[] rest;
24
25 public static Object[] call(Object... args)
26 {
27 return args;
28 }
29
30 public static String[] callString(String... args)
31 {
32 return args;
33 }
34
35 public static int callString0(String str, String... args)
36 {
37 return args.length;
38 }
39
40 public int callString1(String str, String... args)
41 {
42 return args.length;
43 }
44
45 public static Integer callOverload(Integer i)
46 {
47 return i;
48 }
49
50 public static String[] callOverload(String str, String... rest)
51 {
52 return rest;
53 }
54
55 public VarArgs()
56 {
57 }
58
59 public VarArgs(String s, Object... rest)
60 {
61 this.rest = rest;
62 }
63
64 public String[] method(String s, String... rest)
65 {
66 return rest;
67 }
68
69 public int conflict1(Object... j)
70 {
71 return 1;
72 }
73
74 public int conflict1(Map j)
75 {
76 return 2;
77 }
78
79 public int conflict2(Object... j)
80 {
81 return 1;
82 }
83
84 public int conflict2(Map j, Map k)
85 {
86 return 2;
87 }
88
89
90 public int conflict3(char... j)
91 {
92 return 1;
93 }
94
95 public int conflict3(String j)
96 {
97 return 2;
98 }
99
100 // Conflict 4 - overloaded multi-param signature, vararg of identical type
101
102 public int conflict4(Object o, double... j)
103 {
104 return 1;
105 }
106
107 public int conflict4(Object o, double j)
108 {
109 return 2;
110 }
111
112 // Conflict 5 - overloaded single-param signature, vararg of identical type
113 // NB: pre-patch, conflict4 deterministically generated an ambiguous match error.
114 // However, conflict5 would arbitrarily pick between these two signatures when
115 // called with a single variable, resulting in unpredictable failures.
116
117 public int conflict5(double... j)
118 {
119 return 1;
120 }
121
122 public int conflict5(double j)
123 {
124 return 2;
125 }
126 }