author | mcimadamore |
Mon, 24 Aug 2015 13:15:12 +0100 | |
changeset 32334 | fd65e32e16b3 |
permissions | -rw-r--r-- |
32334
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
1 |
/* |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
4 |
* |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
8 |
* |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
13 |
* accompanied this code). |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
14 |
* |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
18 |
* |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
21 |
* questions. |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
22 |
*/ |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
23 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
24 |
/* |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
25 |
* @test |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
26 |
* @bug 8129547 |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
27 |
* @summary Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
28 |
* @library lib |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
29 |
* @modules jdk.jdeps/com.sun.tools.classfile |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.javac.api |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.javac.code |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
32 |
* jdk.compiler/com.sun.tools.javac.jvm |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
33 |
* jdk.compiler/com.sun.tools.javac.tree |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
34 |
* jdk.compiler/com.sun.tools.javac.util |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
35 |
* @build JavacTestingAbstractThreadedTest |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
36 |
* @run main/othervm TestBootstrapMethodsCount |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
37 |
*/ |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
38 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
39 |
import java.io.File; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
40 |
import java.net.URI; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
41 |
import java.util.ArrayList; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
42 |
import java.util.Arrays; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
43 |
import java.util.Locale; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
44 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
45 |
import javax.tools.Diagnostic; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
46 |
import javax.tools.JavaFileObject; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
47 |
import javax.tools.SimpleJavaFileObject; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
48 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
49 |
import com.sun.source.tree.MethodInvocationTree; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
50 |
import com.sun.source.tree.MethodTree; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
51 |
import com.sun.source.util.TaskEvent; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
52 |
import com.sun.source.util.TaskListener; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
53 |
import com.sun.source.util.TreeScanner; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
54 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
55 |
import com.sun.tools.classfile.Attribute; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
56 |
import com.sun.tools.classfile.BootstrapMethods_attribute; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
57 |
import com.sun.tools.classfile.ClassFile; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
58 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
59 |
import com.sun.tools.javac.api.JavacTaskImpl; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
60 |
import com.sun.tools.javac.code.Symbol; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
61 |
import com.sun.tools.javac.code.Symbol.MethodSymbol; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
62 |
import com.sun.tools.javac.code.Symtab; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
63 |
import com.sun.tools.javac.code.Types; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
64 |
import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
65 |
import com.sun.tools.javac.tree.JCTree.JCMethodDecl; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
66 |
import com.sun.tools.javac.tree.JCTree.JCIdent; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
67 |
import com.sun.tools.javac.util.Context; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
68 |
import com.sun.tools.javac.util.Names; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
69 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
70 |
import static com.sun.tools.javac.jvm.ClassFile.*; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
71 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
72 |
public class TestBootstrapMethodsCount |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
73 |
extends JavacTestingAbstractThreadedTest |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
74 |
implements Runnable { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
75 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
76 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
77 |
public static void main(String... args) throws Exception { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
78 |
pool.execute(new TestBootstrapMethodsCount()); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
79 |
checkAfterExec(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
80 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
81 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
82 |
DiagChecker dc; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
83 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
84 |
TestBootstrapMethodsCount() { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
85 |
dc = new DiagChecker(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
86 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
87 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
88 |
public void run() { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
89 |
int id = checkCount.incrementAndGet(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
90 |
JavaSource source = new JavaSource(id); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
91 |
JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc, |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
92 |
Arrays.asList("-g"), null, Arrays.asList(source)); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
93 |
Context context = ct.getContext(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
94 |
Symtab syms = Symtab.instance(context); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
95 |
Names names = Names.instance(context); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
96 |
Types types = Types.instance(context); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
97 |
ct.addTaskListener(new Indifier(syms, names, types)); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
98 |
try { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
99 |
ct.generate(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
100 |
} catch (Throwable t) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
101 |
t.printStackTrace(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
102 |
throw new AssertionError( |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
103 |
String.format("Error thrown when compiling following code\n%s", |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
104 |
source.source)); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
105 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
106 |
if (dc.diagFound) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
107 |
throw new AssertionError( |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
108 |
String.format("Diags found when compiling following code\n%s\n\n%s", |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
109 |
source.source, dc.printDiags())); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
110 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
111 |
verifyBytecode(id); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
112 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
113 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
114 |
void verifyBytecode(int id) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
115 |
File compiledTest = new File(String.format("Test%d.class", id)); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
116 |
try { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
117 |
ClassFile cf = ClassFile.read(compiledTest); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
118 |
BootstrapMethods_attribute bsm_attr = |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
119 |
(BootstrapMethods_attribute)cf |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
120 |
.getAttribute(Attribute.BootstrapMethods); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
121 |
int length = bsm_attr.bootstrap_method_specifiers.length; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
122 |
if (length != 1) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
123 |
throw new Error("Bad number of method specifiers " + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
124 |
"in BootstrapMethods attribute: " + length); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
125 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
126 |
} catch (Exception e) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
127 |
e.printStackTrace(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
128 |
throw new Error("error reading " + compiledTest +": " + e); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
129 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
130 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
131 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
132 |
class JavaSource extends SimpleJavaFileObject { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
133 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
134 |
static final String source_template = "import java.lang.invoke.*;\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
135 |
"class Bootstrap {\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
136 |
" public static CallSite bsm(MethodHandles.Lookup lookup, " + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
137 |
"String name, MethodType methodType) {\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
138 |
" return null;\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
139 |
" }\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
140 |
"}\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
141 |
"class Test#ID {\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
142 |
" void m1() { }\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
143 |
" void m2(Object arg1) { }\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
144 |
" void test1() {\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
145 |
" Object o = this; // marker statement \n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
146 |
" m1();\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
147 |
" }\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
148 |
" void test2(Object arg1) {\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
149 |
" Object o = this; // marker statement \n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
150 |
" m2(arg1);\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
151 |
" }\n" + |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
152 |
"}"; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
153 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
154 |
String source; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
155 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
156 |
JavaSource(int id) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
157 |
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
158 |
source = source_template.replace("#ID", String.valueOf(id)); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
159 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
160 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
161 |
@Override |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
162 |
public CharSequence getCharContent(boolean ignoreEncodingErrors) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
163 |
return source; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
164 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
165 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
166 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
167 |
class Indifier extends TreeScanner<Void, Void> implements TaskListener { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
168 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
169 |
MethodSymbol bsm; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
170 |
Symtab syms; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
171 |
Names names; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
172 |
Types types; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
173 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
174 |
Indifier(Symtab syms, Names names, Types types) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
175 |
this.syms = syms; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
176 |
this.names = names; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
177 |
this.types = types; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
178 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
179 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
180 |
@Override |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
181 |
public void started(TaskEvent e) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
182 |
//do nothing |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
183 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
184 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
185 |
@Override |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
186 |
public void finished(TaskEvent e) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
187 |
if (e.getKind() == TaskEvent.Kind.ANALYZE) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
188 |
scan(e.getCompilationUnit(), null); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
189 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
190 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
191 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
192 |
@Override |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
193 |
public Void visitMethodInvocation(MethodInvocationTree node, Void p) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
194 |
super.visitMethodInvocation(node, p); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
195 |
JCMethodInvocation apply = (JCMethodInvocation)node; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
196 |
JCIdent ident = (JCIdent)apply.meth; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
197 |
Symbol oldSym = ident.sym; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
198 |
if (!oldSym.isConstructor()) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
199 |
ident.sym = new Symbol.DynamicMethodSymbol(oldSym.name, |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
200 |
oldSym.owner, REF_invokeStatic, bsm, oldSym.type, new Object[0]); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
201 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
202 |
return null; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
203 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
204 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
205 |
@Override |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
206 |
public Void visitMethod(MethodTree node, Void p) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
207 |
super.visitMethod(node, p); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
208 |
if (node.getName().toString().equals("bsm")) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
209 |
bsm = ((JCMethodDecl)node).sym; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
210 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
211 |
return null; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
212 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
213 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
214 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
215 |
static class DiagChecker |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
216 |
implements javax.tools.DiagnosticListener<JavaFileObject> { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
217 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
218 |
boolean diagFound; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
219 |
ArrayList<String> diags = new ArrayList<>(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
220 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
221 |
public void report(Diagnostic<? extends JavaFileObject> diagnostic) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
222 |
diags.add(diagnostic.getMessage(Locale.getDefault())); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
223 |
diagFound = true; |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
224 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
225 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
226 |
String printDiags() { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
227 |
StringBuilder buf = new StringBuilder(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
228 |
for (String s : diags) { |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
229 |
buf.append(s); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
230 |
buf.append("\n"); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
231 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
232 |
return buf.toString(); |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
233 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
234 |
} |
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
235 |
|
fd65e32e16b3
8129547: Excess entries in BootstrapMethods with the same (bsm, bsmKind, bsmStaticArgs), but different dynamicArgs
mcimadamore
parents:
diff
changeset
|
236 |
} |