25 * @test |
25 * @test |
26 * @bug 8004727 |
26 * @bug 8004727 |
27 * @summary javac should generate method parameters correctly. |
27 * @summary javac should generate method parameters correctly. |
28 * @modules jdk.jdeps/com.sun.tools.classfile |
28 * @modules jdk.jdeps/com.sun.tools.classfile |
29 * jdk.compiler/com.sun.tools.javac.code |
29 * jdk.compiler/com.sun.tools.javac.code |
|
30 * jdk.compiler/com.sun.tools.javac.comp |
30 * jdk.compiler/com.sun.tools.javac.file |
31 * jdk.compiler/com.sun.tools.javac.file |
31 * jdk.compiler/com.sun.tools.javac.main |
32 * jdk.compiler/com.sun.tools.javac.main |
|
33 * jdk.compiler/com.sun.tools.javac.model |
32 * jdk.compiler/com.sun.tools.javac.util |
34 * jdk.compiler/com.sun.tools.javac.util |
33 */ |
35 */ |
34 // key: opt.arg.parameters |
36 // key: opt.arg.parameters |
35 import com.sun.tools.classfile.*; |
37 import com.sun.tools.classfile.*; |
|
38 import com.sun.tools.javac.code.Symtab; |
36 import com.sun.tools.javac.file.JavacFileManager; |
39 import com.sun.tools.javac.file.JavacFileManager; |
37 import com.sun.tools.javac.main.Main; |
40 import com.sun.tools.javac.main.Main; |
38 import com.sun.tools.javac.util.Context; |
41 import com.sun.tools.javac.util.Context; |
39 import com.sun.tools.javac.util.Name; |
42 import com.sun.tools.javac.util.Name; |
40 import com.sun.tools.javac.util.Names; |
43 import com.sun.tools.javac.util.Names; |
136 |
139 |
137 // Now get the class finder, construct a name for Baz, and load it. |
140 // Now get the class finder, construct a name for Baz, and load it. |
138 com.sun.tools.javac.code.ClassFinder cf = |
141 com.sun.tools.javac.code.ClassFinder cf = |
139 com.sun.tools.javac.code.ClassFinder.instance(context); |
142 com.sun.tools.javac.code.ClassFinder.instance(context); |
140 Name name = Names.instance(context).fromString(Baz_name); |
143 Name name = Names.instance(context).fromString(Baz_name); |
|
144 Symtab syms = Symtab.instance(context); |
141 |
145 |
142 // Now walk down the language model and check the name of the |
146 // Now walk down the language model and check the name of the |
143 // parameter. |
147 // parameter. |
144 final Element baz = cf.loadClass(name); |
148 final Element baz = cf.loadClass(syms.unnamedModule, name); |
145 for (Element e : baz.getEnclosedElements()) { |
149 for (Element e : baz.getEnclosedElements()) { |
146 if (e instanceof ExecutableElement) { |
150 if (e instanceof ExecutableElement) { |
147 final ExecutableElement ee = (ExecutableElement) e; |
151 final ExecutableElement ee = (ExecutableElement) e; |
148 final List<? extends VariableElement> params = |
152 final List<? extends VariableElement> params = |
149 ee.getParameters(); |
153 ee.getParameters(); |