summaryrefslogtreecommitdiff
path: root/src/proguard/classfile/util/DynamicMemberReferenceInitializer.java
blob: e35063c99d72b953c356b5446e3269f351da6b9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
/*
 * ProGuard -- shrinking, optimization, obfuscation, and preverification
 *             of Java bytecode.
 *
 * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package proguard.classfile.util;

import proguard.classfile.*;
import proguard.classfile.attribute.CodeAttribute;
import proguard.classfile.constant.*;
import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.visitor.*;
import proguard.util.StringMatcher;

/**
 * This InstructionVisitor initializes any constant
 * <code>Class.get[Declared]{Field,Method}</code> references of all instructions
 * it visits. More specifically, it fills out the references of string constant
 * pool entries that refer to a class member in the program class pool or in the
 * library class pool.
 * <p>
 * It optionally prints notes if on usage of
 * <code>(SomeClass)Class.forName(variable).newInstance()</code>.
 * <p>
 * The class hierarchy and references must be initialized before using this
 * visitor.
 *
 * @see ClassSuperHierarchyInitializer
 * @see ClassReferenceInitializer
 *
 * @author Eric Lafortune
 */
public class DynamicMemberReferenceInitializer
extends      SimplifiedVisitor
implements   InstructionVisitor,
             ConstantVisitor,
             MemberVisitor
{
    //*
    private static final boolean DEBUG = false;
    /*/
    private static       boolean DEBUG = true;
    //*/

    public static final int CLASS_INDEX       = InstructionSequenceMatcher.X;
    public static final int MEMBER_NAME_INDEX = InstructionSequenceMatcher.Y;
    public static final int TYPE_CLASS_INDEX  = InstructionSequenceMatcher.Z;

    public static final int PARAMETER0_CLASS_INDEX = InstructionSequenceMatcher.A;
    public static final int PARAMETER1_CLASS_INDEX = InstructionSequenceMatcher.B;
    public static final int PARAMETER2_CLASS_INDEX = InstructionSequenceMatcher.C;
    public static final int PARAMETER3_CLASS_INDEX = InstructionSequenceMatcher.D;


    private final Constant[] GET_FIELD_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
        new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_FIELD),
        new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_FIELD),
    };

    private final Constant[] GET_DECLARED_FIELD_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
        new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_DECLARED_FIELD),
        new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_DECLARED_FIELD),
    };

    private final Constant[] GET_CONSTRUCTOR_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
        new Utf8Constant(ClassConstants.CONSTRUCTOR_NAME_CLASS_GET_CONSTRUCTOR),
        new Utf8Constant(ClassConstants.CONSTRUCTOR_TYPE_CLASS_GET_CONSTRUCTOR),
    };

    private final Constant[] GET_DECLARED_CONSTRUCTOR_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
        new Utf8Constant(ClassConstants.CONSTRUCTOR_NAME_CLASS_GET_DECLARED_CONSTRUCTOR),
        new Utf8Constant(ClassConstants.CONSTRUCTOR_TYPE_CLASS_GET_DECLARED_CONSTRUCTOR),
    };

    private final Constant[] GET_METHOD_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
        new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_METHOD),
        new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_METHOD),
    };

    private final Constant[] GET_DECLARED_METHOD_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_LANG_CLASS),
        new Utf8Constant(ClassConstants.METHOD_NAME_CLASS_GET_DECLARED_METHOD),
        new Utf8Constant(ClassConstants.METHOD_TYPE_CLASS_GET_DECLARED_METHOD),
    };

    private final Constant[] NEW_INTEGER_UPDATER_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_INTEGER_FIELD_UPDATER),
        new Utf8Constant(ClassConstants.METHOD_NAME_NEW_UPDATER),
        new Utf8Constant(ClassConstants.METHOD_TYPE_NEW_INTEGER_UPDATER),
    };

    private final Constant[] NEW_LONG_UPDATER_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_LONG_FIELD_UPDATER),
        new Utf8Constant(ClassConstants.METHOD_NAME_NEW_UPDATER),
        new Utf8Constant(ClassConstants.METHOD_TYPE_NEW_LONG_UPDATER),
    };

    private final Constant[] NEW_REFERENCE_UPDATER_CONSTANTS = new Constant[]
    {
        new MethodrefConstant(1, 2, null, null),
        new ClassConstant(3, null),
        new NameAndTypeConstant(4, 5),
        new Utf8Constant(ClassConstants.NAME_JAVA_UTIL_CONCURRENT_ATOMIC_ATOMIC_REFERENCE_FIELD_UPDATER),
        new Utf8Constant(ClassConstants.METHOD_NAME_NEW_UPDATER),
        new Utf8Constant(ClassConstants.METHOD_TYPE_NEW_REFERENCE_UPDATER),
    };

    // SomeClass.class.get[Declared]Field("someField").
    private final Instruction[] CONSTANT_GET_FIELD_INSTRUCTIONS = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

//    // SomeClass.class.get[Declared]Constructor(new Class[] {}).
//    private final Instruction[] CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS0 = new Instruction[]
//    {
//        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
//        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
//        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
//        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
//    };
//
//    // SomeClass.class.get[Declared]Constructor(new Class[] { A.class }).
//    private final Instruction[] CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS1 = new Instruction[]
//    {
//        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
//        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
//        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
//        new SimpleInstruction(InstructionConstants.OP_DUP),
//        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
//        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
//        new SimpleInstruction(InstructionConstants.OP_AASTORE),
//        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
//    };
//
//    // SomeClass.class.get[Declared]Constructor(new Class[] { A.class, B.class }).
//    private final Instruction[] CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS2 = new Instruction[]
//    {
//        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
//        new SimpleInstruction(InstructionConstants.OP_ICONST_2),
//        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
//        new SimpleInstruction(InstructionConstants.OP_DUP),
//        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
//        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
//        new SimpleInstruction(InstructionConstants.OP_AASTORE),
//        new SimpleInstruction(InstructionConstants.OP_DUP),
//        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
//        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER1_CLASS_INDEX),
//        new SimpleInstruction(InstructionConstants.OP_AASTORE),
//        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
//    };

    // SomeClass.class.get[Declared]Method("someMethod", new Class[] {}).
    private final Instruction[] CONSTANT_GET_METHOD_INSTRUCTIONS0 = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // SomeClass.class.get[Declared]Method("someMethod", new Class[] { A.class }).
    private final Instruction[] CONSTANT_GET_METHOD_INSTRUCTIONS1 = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // SomeClass.class.get[Declared]Method("someMethod", new Class[] { A.class, B.class }).
    private final Instruction[] CONSTANT_GET_METHOD_INSTRUCTIONS2 = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new SimpleInstruction(InstructionConstants.OP_ICONST_2),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER1_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // AtomicIntegerFieldUpdater.newUpdater(A.class, "someField").
    // AtomicLongFieldUpdater.newUpdater(A.class, "someField").
    private final Instruction[] CONSTANT_NEW_PRIMITIVE_UPDATER_INSTRUCTIONS = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC, 0),
    };

    // AtomicReferenceFieldUpdater.newUpdater(A.class, B.class, "someField").
    private final Instruction[] CONSTANT_NEW_REFERENCE_UPDATER_INSTRUCTIONS = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, CLASS_INDEX),
        new ConstantInstruction(InstructionConstants.OP_LDC, TYPE_CLASS_INDEX),
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC, 0),
    };

    // get[Declared]Field("someField").
    private final Instruction[] GET_FIELD_INSTRUCTIONS = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

//    // get[Declared]Constructor(new Class[] {}).
//    private final Instruction[] GET_CONSTRUCTOR_INSTRUCTIONS0 = new Instruction[]
//    {
//        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
//        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
//        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
//    };

    // get[Declared]Constructor(new Class[] { A.class }).
    private final Instruction[] GET_CONSTRUCTOR_INSTRUCTIONS1 = new Instruction[]
    {
        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // get[Declared]Constructor(new Class[] { A.class, B.class }).
    private final Instruction[] GET_CONSTRUCTOR_INSTRUCTIONS2 = new Instruction[]
    {
        new SimpleInstruction(InstructionConstants.OP_ICONST_2),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER1_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // get[Declared]Method("someMethod", new Class[] {}).
    private final Instruction[] GET_METHOD_INSTRUCTIONS0 = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // get[Declared]Method("someMethod", new Class[] { A.class }).
    private final Instruction[] GET_METHOD_INSTRUCTIONS1 = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // get[Declared]Method("someMethod", new Class[] { A.class, B.class }).
    private final Instruction[] GET_METHOD_INSTRUCTIONS2 = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new SimpleInstruction(InstructionConstants.OP_ICONST_2),
        new ConstantInstruction(InstructionConstants.OP_ANEWARRAY, 1),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_0),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER0_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new SimpleInstruction(InstructionConstants.OP_DUP),
        new SimpleInstruction(InstructionConstants.OP_ICONST_1),
        new ConstantInstruction(InstructionConstants.OP_LDC, PARAMETER1_CLASS_INDEX),
        new SimpleInstruction(InstructionConstants.OP_AASTORE),
        new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, 0),
    };

    // AtomicIntegerFieldUpdater.newUpdater(..., "someField").
    // AtomicLongFieldUpdater.newUpdater(..., "someField").
    // AtomicReferenceFieldUpdater.newUpdater(..., "someField").
    private final Instruction[] NEW_UPDATER_INSTRUCTIONS = new Instruction[]
    {
        new ConstantInstruction(InstructionConstants.OP_LDC, MEMBER_NAME_INDEX),
        new ConstantInstruction(InstructionConstants.OP_INVOKESTATIC, 0),
    };


    private final ClassPool      programClassPool;
    private final ClassPool      libraryClassPool;
    private final WarningPrinter notePrinter;
    private final StringMatcher  noteFieldExceptionMatcher;
    private final StringMatcher  noteMethodExceptionMatcher;


    private final InstructionSequenceMatcher constantGetFieldMatcher =
        new InstructionSequenceMatcher(GET_FIELD_CONSTANTS,
                                       CONSTANT_GET_FIELD_INSTRUCTIONS);

    private final InstructionSequenceMatcher constantGetDeclaredFieldMatcher =
        new InstructionSequenceMatcher(GET_DECLARED_FIELD_CONSTANTS,
                                       CONSTANT_GET_FIELD_INSTRUCTIONS);

//    private final InstructionSequenceMatcher constantGetConstructorMatcher0 =
//        new InstructionSequenceMatcher(GET_CONSTRUCTOR_CONSTANTS,
//                                       CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS0);
//
//    private final InstructionSequenceMatcher constantGetDeclaredConstructorMatcher0 =
//        new InstructionSequenceMatcher(GET_DECLARED_CONSTRUCTOR_CONSTANTS,
//                                       CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS0);
//
//    private final InstructionSequenceMatcher constantGetConstructorMatcher1 =
//        new InstructionSequenceMatcher(GET_CONSTRUCTOR_CONSTANTS,
//                                       CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS1);
//
//    private final InstructionSequenceMatcher constantGetDeclaredConstructorMatcher1 =
//        new InstructionSequenceMatcher(GET_DECLARED_CONSTRUCTOR_CONSTANTS,
//                                       CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS1);
//
//    private final InstructionSequenceMatcher constantGetConstructorMatcher2 =
//        new InstructionSequenceMatcher(GET_CONSTRUCTOR_CONSTANTS,
//                                       CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS2);
//
//    private final InstructionSequenceMatcher constantGetDeclaredConstructorMatcher2 =
//        new InstructionSequenceMatcher(GET_DECLARED_CONSTRUCTOR_CONSTANTS,
//                                       CONSTANT_GET_CONSTRUCTOR_INSTRUCTIONS2);

    private final InstructionSequenceMatcher constantGetMethodMatcher0 =
        new InstructionSequenceMatcher(GET_METHOD_CONSTANTS,
                                       CONSTANT_GET_METHOD_INSTRUCTIONS0);

    private final InstructionSequenceMatcher constantGetDeclaredMethodMatcher0 =
        new InstructionSequenceMatcher(GET_DECLARED_METHOD_CONSTANTS,
                                       CONSTANT_GET_METHOD_INSTRUCTIONS0);

    private final InstructionSequenceMatcher constantGetMethodMatcher1 =
        new InstructionSequenceMatcher(GET_METHOD_CONSTANTS,
                                       CONSTANT_GET_METHOD_INSTRUCTIONS1);

    private final InstructionSequenceMatcher constantGetDeclaredMethodMatcher1 =
        new InstructionSequenceMatcher(GET_DECLARED_METHOD_CONSTANTS,
                                       CONSTANT_GET_METHOD_INSTRUCTIONS1);

    private final InstructionSequenceMatcher constantGetMethodMatcher2 =
        new InstructionSequenceMatcher(GET_METHOD_CONSTANTS,
                                       CONSTANT_GET_METHOD_INSTRUCTIONS2);

    private final InstructionSequenceMatcher constantGetDeclaredMethodMatcher2 =
        new InstructionSequenceMatcher(GET_DECLARED_METHOD_CONSTANTS,
                                       CONSTANT_GET_METHOD_INSTRUCTIONS2);

    private final InstructionSequenceMatcher constantGetIntegerUpdaterMatcher =
        new InstructionSequenceMatcher(NEW_INTEGER_UPDATER_CONSTANTS,
                                       CONSTANT_NEW_PRIMITIVE_UPDATER_INSTRUCTIONS);

    private final InstructionSequenceMatcher constantGetLongUpdaterMatcher =
        new InstructionSequenceMatcher(NEW_LONG_UPDATER_CONSTANTS,
                                       CONSTANT_NEW_PRIMITIVE_UPDATER_INSTRUCTIONS);

    private final InstructionSequenceMatcher constantGetReferenceUpdaterMatcher =
        new InstructionSequenceMatcher(NEW_REFERENCE_UPDATER_CONSTANTS,
                                       CONSTANT_NEW_REFERENCE_UPDATER_INSTRUCTIONS);

    private final InstructionSequenceMatcher getFieldMatcher =
        new InstructionSequenceMatcher(GET_FIELD_CONSTANTS,
                                       GET_FIELD_INSTRUCTIONS);

    private final InstructionSequenceMatcher getDeclaredFieldMatcher =
        new InstructionSequenceMatcher(GET_DECLARED_FIELD_CONSTANTS,
                                       GET_FIELD_INSTRUCTIONS);

//    private final InstructionSequenceMatcher getConstructorMatcher0 =
//        new InstructionSequenceMatcher(GET_CONSTRUCTOR_CONSTANTS,
//                                       GET_CONSTRUCTOR_INSTRUCTIONS0);
//
//    private final InstructionSequenceMatcher getDeclaredConstructorMatcher0 =
//        new InstructionSequenceMatcher(GET_DECLARED_CONSTRUCTOR_CONSTANTS,
//                                       GET_CONSTRUCTOR_INSTRUCTIONS0);

    private final InstructionSequenceMatcher getConstructorMatcher1 =
        new InstructionSequenceMatcher(GET_CONSTRUCTOR_CONSTANTS,
                                       GET_CONSTRUCTOR_INSTRUCTIONS1);

    private final InstructionSequenceMatcher getDeclaredConstructorMatcher1 =
        new InstructionSequenceMatcher(GET_DECLARED_CONSTRUCTOR_CONSTANTS,
                                       GET_CONSTRUCTOR_INSTRUCTIONS1);

    private final InstructionSequenceMatcher getConstructorMatcher2 =
        new InstructionSequenceMatcher(GET_CONSTRUCTOR_CONSTANTS,
                                       GET_CONSTRUCTOR_INSTRUCTIONS2);

    private final InstructionSequenceMatcher getDeclaredConstructorMatcher2 =
        new InstructionSequenceMatcher(GET_DECLARED_CONSTRUCTOR_CONSTANTS,
                                       GET_CONSTRUCTOR_INSTRUCTIONS2);

    private final InstructionSequenceMatcher getMethodMatcher0 =
        new InstructionSequenceMatcher(GET_METHOD_CONSTANTS,
                                       GET_METHOD_INSTRUCTIONS0);

    private final InstructionSequenceMatcher getDeclaredMethodMatcher0 =
        new InstructionSequenceMatcher(GET_DECLARED_METHOD_CONSTANTS,
                                       GET_METHOD_INSTRUCTIONS0);

    private final InstructionSequenceMatcher getMethodMatcher1 =
        new InstructionSequenceMatcher(GET_METHOD_CONSTANTS,
                                       GET_METHOD_INSTRUCTIONS1);

    private final InstructionSequenceMatcher getDeclaredMethodMatcher1 =
        new InstructionSequenceMatcher(GET_DECLARED_METHOD_CONSTANTS,
                                       GET_METHOD_INSTRUCTIONS1);

    private final InstructionSequenceMatcher getMethodMatcher2 =
        new InstructionSequenceMatcher(GET_METHOD_CONSTANTS,
                                       GET_METHOD_INSTRUCTIONS2);

    private final InstructionSequenceMatcher getDeclaredMethodMatcher2 =
        new InstructionSequenceMatcher(GET_DECLARED_METHOD_CONSTANTS,
                                       GET_METHOD_INSTRUCTIONS2);

    private final InstructionSequenceMatcher getIntegerUpdaterMatcher =
        new InstructionSequenceMatcher(NEW_INTEGER_UPDATER_CONSTANTS,
                                       NEW_UPDATER_INSTRUCTIONS);

    private final InstructionSequenceMatcher getLongUpdaterMatcher =
        new InstructionSequenceMatcher(NEW_LONG_UPDATER_CONSTANTS,
                                       NEW_UPDATER_INSTRUCTIONS);

    private final InstructionSequenceMatcher getReferenceUpdaterMatcher =
        new InstructionSequenceMatcher(NEW_REFERENCE_UPDATER_CONSTANTS,
                                       NEW_UPDATER_INSTRUCTIONS);

    private final MemberFinder memberFinder = new MemberFinder();


    // Fields acting as parameters for the visitors.
    private Clazz   referencedClass;
    private String descriptor;
    private boolean isDeclared;
    private boolean isField;



    /**
     * Creates a new DynamicMemberReferenceInitializer.
     */
    public DynamicMemberReferenceInitializer(ClassPool      programClassPool,
                                             ClassPool      libraryClassPool,
                                             WarningPrinter notePrinter,
                                             StringMatcher  noteFieldExceptionMatcher,
                                             StringMatcher  noteMethodExceptionMatcher)
    {
        this.programClassPool           = programClassPool;
        this.libraryClassPool           = libraryClassPool;
        this.notePrinter                = notePrinter;
        this.noteFieldExceptionMatcher  = noteFieldExceptionMatcher;
        this.noteMethodExceptionMatcher = noteMethodExceptionMatcher;
    }


    // Implementations for InstructionVisitor.

    public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
    {
        // Try to match the SomeClass.class.getField("someField") construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetFieldMatcher,
                       getFieldMatcher, true, false, null, null);

        // Try to match the SomeClass.class.getDeclaredField("someField") construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetDeclaredFieldMatcher,
                       getDeclaredFieldMatcher, true, true, null, null);

//        // Try to match the SomeClass.class.getConstructor(new Class[]
//        // {}) construct.
//        matchGetMember(clazz, method, codeAttribute, offset, instruction,
//                       cnull, //onstantGetConstructorMatcher0,
//                       getConstructorMatcher0, false, false,
//                       ClassConstants.METHOD_NAME_INIT, null);
//
//        // Try to match the SomeClass.class.getDeclaredConstructor(new Class[]
//        // {}) construct.
//        matchGetMember(clazz, method, codeAttribute, offset, instruction,
//                       null, //constantGetDeclaredConstructorMatcher0,
//                       getDeclaredConstructorMatcher0, false, true,
//                       ClassConstants.METHOD_NAME_INIT, null);

        // Try to match the SomeClass.class.getConstructor(new Class[]
        // { A.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       null, //constantGetConstructorMatcher1,
                       getConstructorMatcher1, false, false,
                       ClassConstants.METHOD_NAME_INIT, null);

        // Try to match the SomeClass.class.getDeclaredConstructor(new Class[]
        // { A.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       null, //constantGetDeclaredConstructorMatcher1,
                       getDeclaredConstructorMatcher1, false, true,
                       ClassConstants.METHOD_NAME_INIT, null);

        // Try to match the SomeClass.class.getConstructor(new Class[]
        // { A.class, B.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       null, //constantGetConstructorMatcher2,
                       getConstructorMatcher2, false, false,
                       ClassConstants.METHOD_NAME_INIT, null);

        // Try to match the SomeClass.class.getDeclaredConstructor(new Class[]
        // { A.class, B.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       null, //constantGetDeclaredConstructorMatcher2,
                       getDeclaredConstructorMatcher2, false, true,
                       ClassConstants.METHOD_NAME_INIT, null);

        // Try to match the SomeClass.class.getMethod("someMethod", new Class[]
        // {}) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetMethodMatcher0,
                       getMethodMatcher0, false, false, null, null);

        // Try to match the SomeClass.class.getDeclaredMethod("someMethod",
        // new Class[] {}) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetDeclaredMethodMatcher0,
                       getDeclaredMethodMatcher0, false, true, null, null);

        // Try to match the SomeClass.class.getMethod("someMethod", new Class[]
        // { A.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetMethodMatcher1,
                       getMethodMatcher1, false, false, null, null);

        // Try to match the SomeClass.class.getDeclaredMethod("someMethod",
        //  new Class[] { A.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetDeclaredMethodMatcher1,
                       getDeclaredMethodMatcher1, false, true, null, null);

        // Try to match the SomeClass.class.getMethod("someMethod", new Class[]
        // { A.class, B.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetMethodMatcher2,
                       getMethodMatcher2, false, false, null, null);

        // Try to match the SomeClass.class.getDeclaredMethod("someMethod",
        // new Class[] { A.class, B.class }) construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetDeclaredMethodMatcher2,
                       getDeclaredMethodMatcher2, false, true, null, null);

        // Try to match the AtomicIntegerFieldUpdater.newUpdater(
        // SomeClass.class, "someField") construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetIntegerUpdaterMatcher,
                       getIntegerUpdaterMatcher, true, false, null,
                       "" + ClassConstants.TYPE_INT);

        // Try to match the AtomicLongFieldUpdater.newUpdater(
        // SomeClass.class, "someField") construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetLongUpdaterMatcher,
                       getLongUpdaterMatcher, true, false, null,
                       "" + ClassConstants.TYPE_LONG);

        // Try to match the AtomicReferenceFieldUpdater.newUpdater(
        // SomeClass.class, SomeClass.class, "someField") construct.
        matchGetMember(clazz, method, codeAttribute, offset, instruction,
                       constantGetReferenceUpdaterMatcher,
                       getReferenceUpdaterMatcher, true, false, null, null);
    }


    /**
     * Tries to match the next instruction and fills out the string constant
     * or prints out a note accordingly.
     */
    private void matchGetMember(Clazz                      clazz,
                                Method                     method,
                                CodeAttribute              codeAttribute,
                                int                        offset,
                                Instruction                instruction,
                                InstructionSequenceMatcher constantSequenceMatcher,
                                InstructionSequenceMatcher variableSequenceMatcher,
                                boolean                    isField,
                                boolean                    isDeclared,
                                String                     defaultName,
                                String                     defaultDescriptor)
    {
        if (constantSequenceMatcher != null)
        {
            // Try to match the next instruction in the constant sequence.
            instruction.accept(clazz, method, codeAttribute, offset,
                               constantSequenceMatcher);

            // Did we find a match to fill out the string constant?
            if (constantSequenceMatcher.isMatching())
            {
                initializeStringReference(clazz,
                                          constantSequenceMatcher,
                                          isField,
                                          isDeclared,
                                          defaultDescriptor);

                // Don't look for the dynamic construct.
                variableSequenceMatcher.reset();
            }
        }

        // Try to match the next instruction in the variable sequence.
        instruction.accept(clazz, method, codeAttribute, offset,
                           variableSequenceMatcher);

        // Did we find a match to print out a note?
        if (variableSequenceMatcher.isMatching())
        {
            // Print out a note about the dynamic invocation.
            printDynamicInvocationNote(clazz,
                                       variableSequenceMatcher,
                                       isField,
                                       isDeclared,
                                       defaultName,
                                       defaultDescriptor);
        }
    }


    /**
     * Initializes the reference of the matched string constant to the
     * referenced class member and its class.
     */
    private void initializeStringReference(Clazz                      clazz,
                                           InstructionSequenceMatcher constantSequenceMatcher,
                                           boolean                    isField,
                                           boolean                    isDeclared,
                                           String                     defaultDescriptor)
    {
        this.isField    = isField;
        this.isDeclared = isDeclared;

        // Get the member's class.
        int classIndex = constantSequenceMatcher.matchedConstantIndex(CLASS_INDEX);
        clazz.constantPoolEntryAccept(classIndex, this);

        // Get the field's reference type, if applicable.
        int typeClassIndex = constantSequenceMatcher.matchedConstantIndex(TYPE_CLASS_INDEX);
        descriptor = typeClassIndex <= 0 ? defaultDescriptor :
            ClassUtil.internalTypeFromClassName(clazz.getClassName(typeClassIndex));

        // Fill out the matched string constant.
        int memberNameIndex = constantSequenceMatcher.matchedConstantIndex(MEMBER_NAME_INDEX);
        clazz.constantPoolEntryAccept(memberNameIndex, this);
    }


    // Implementations for ConstantVisitor.

    /**
     * Remembers the referenced class.
     */
    public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
    {
        if (DEBUG)
        {
            System.out.println("DynamicMemberReferenceInitializer: ["+clazz.getName()+"] matched class ["+classConstant.getName(clazz)+"]");
        }

        // Remember the referenced class.
        referencedClass = ClassUtil.isInternalArrayType(classConstant.getName(clazz)) ?
            null :
            classConstant.referencedClass;
    }


    /**
     * Fills out the link to the referenced class member.
     */
    public void visitStringConstant(Clazz clazz, StringConstant stringConstant)
    {
        if (referencedClass != null)
        {
            String name = stringConstant.getString(clazz);

            if (DEBUG)
            {
                System.out.println("DynamicMemberReferenceInitializer: ["+clazz.getName()+"] matched string ["+name+"]");
            }

            // See if we can find the referenced class member locally, or
            // somewhere in the hierarchy.
            Member referencedMember = isDeclared ? isField ?
                (Member)referencedClass.findField(name, descriptor) :
                (Member)referencedClass.findMethod(name, descriptor) :
                (Member)memberFinder.findMember(clazz,
                                                referencedClass,
                                                name,
                                                descriptor,
                                                isField);
            if (referencedMember != null)
            {
                stringConstant.referencedMember = referencedMember;
                stringConstant.referencedClass  = isDeclared ?
                    referencedClass :
                    memberFinder.correspondingClass();
            }
        }
    }


    // Small utility methods.

    /**
     * Prints out a note on the matched dynamic invocation, if necessary.
     */
    private void printDynamicInvocationNote(Clazz                      clazz,
                                            InstructionSequenceMatcher noteSequenceMatcher,
                                            boolean                    isField,
                                            boolean                    isDeclared,
                                            String                     defaultName,
                                            String                     defaultDescriptor)
    {
        // Print out a note about the dynamic invocation.
        if (notePrinter != null &&
            notePrinter.accepts(clazz.getName()))
        {
            // Is the class member name in the list of exceptions?
            StringMatcher noteExceptionMatcher = isField ?
                noteFieldExceptionMatcher :
                noteMethodExceptionMatcher;

            int memberNameIndex = noteSequenceMatcher.matchedConstantIndex(MEMBER_NAME_INDEX);
            String memberName = memberNameIndex <= 0 ? defaultName :
                clazz.getStringString(memberNameIndex);

            if (noteExceptionMatcher == null ||
                !noteExceptionMatcher.matches(memberName))
            {
                // Compose the external member name and partial descriptor.
                String externalMemberDescription = memberName;

                if (!isField)
                {
                    externalMemberDescription += '(';
                    for (int count = 0; count < 2; count++)
                    {
                        int memberArgumentIndex = noteSequenceMatcher.matchedConstantIndex(
                            PARAMETER0_CLASS_INDEX + count);
                        if (memberArgumentIndex > 0)
                        {
                            if (count > 0)
                            {
                                externalMemberDescription += ',';
                            }
                            String className = clazz.getClassName(memberArgumentIndex);
                            externalMemberDescription += ClassUtil.isInternalArrayType(className) ?
                                ClassUtil.externalType(className) :
                                ClassUtil.externalClassName(className);
                        }
                    }
                    externalMemberDescription += ')';
                }

                // Print out the actual note.
                notePrinter.print(clazz.getName(),
                                  "Note: " +
                                  ClassUtil.externalClassName(clazz.getName()) +
                                  " accesses a " +
                                  (isDeclared ? "declared " : "") +
                                  (isField    ? "field" :
                                   memberName.equals(ClassConstants.METHOD_NAME_INIT) ?
                                                "constructor" : "method") +
                                  " '" +
                                  externalMemberDescription +
                                  "' dynamically");

                // Print out notes about potential candidates.
                ClassVisitor classVisitor;

                if (isField)
                {
                    classVisitor = defaultDescriptor == null ?
                       new AllFieldVisitor(
                       new MemberNameFilter(memberName, this)) :
                       new AllFieldVisitor(
                       new MemberNameFilter(memberName,
                       new MemberDescriptorFilter(defaultDescriptor, this)));
                }
                else
                {
                    // Compose the partial method descriptor.
                    String methodDescriptor = "(";
                    for (int count = 0; count < 2; count++)
                    {
                        int memberArgumentIndex = noteSequenceMatcher.matchedConstantIndex(PARAMETER0_CLASS_INDEX + count);
                        if (memberArgumentIndex > 0)
                        {
                            String className = clazz.getClassName(memberArgumentIndex);
                            methodDescriptor += ClassUtil.isInternalArrayType(className) ?
                                className :
                                ClassUtil.internalTypeFromClassName(className);
                        }
                    }
                    methodDescriptor += ")L***;";

                    classVisitor =
                        new AllMethodVisitor(
                        new MemberNameFilter(memberName,
                        new MemberDescriptorFilter(methodDescriptor, this)));
                }

                programClassPool.classesAcceptAlphabetically(classVisitor);
                libraryClassPool.classesAcceptAlphabetically(classVisitor);
            }
        }
    }


    // Implementations for MemberVisitor.

    public void visitProgramField(ProgramClass programClass, ProgramField programField)
    {
        if (notePrinter.accepts(programClass.getName()))
        {
            System.out.println("      Maybe this is program field '" +
                               ClassUtil.externalFullClassDescription(0, programClass.getName()) +
                               " { " +
                               ClassUtil.externalFullFieldDescription(0, programField.getName(programClass), programField.getDescriptor(programClass)) +
                               "; }'");
        }
    }


    public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
    {
        if (notePrinter.accepts(programClass.getName()))
        {
            System.out.println("      Maybe this is program method '" +
                               ClassUtil.externalFullClassDescription(0, programClass.getName()) +
                               " { " +
                               ClassUtil.externalFullMethodDescription(programClass.getName(), 0, programMethod.getName(programClass), programMethod.getDescriptor(programClass)) +
                               "; }'");
        }
    }


    public void visitLibraryField(LibraryClass libraryClass, LibraryField libraryField)
    {
        if (notePrinter.accepts(libraryClass.getName()))
        {
            System.out.println("      Maybe this is library field '" +
                               ClassUtil.externalFullClassDescription(0, libraryClass.getName()) +
                               " { " +
                               ClassUtil.externalFullFieldDescription(0, libraryField.getName(libraryClass), libraryField.getDescriptor(libraryClass)) +
                               "; }'");
        }
    }


    public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
    {
        if (notePrinter.accepts(libraryClass.getName()))
        {
            System.out.println("      Maybe this is library method '" +
                               ClassUtil.externalFullClassDescription(0, libraryClass.getName()) +
                               " { " +
                               ClassUtil.externalFullMethodDescription(libraryClass.getName(), 0, libraryMethod.getName(libraryClass), libraryMethod.getDescriptor(libraryClass)) +
                               "; }'");
        }
    }
}