langtools/test/tools/javac/MethodParameters/CaptureTest.java
author sogoel
Thu, 05 Jun 2014 10:57:10 -0700
changeset 24797 850ebd4d80a7
parent 22445 8a8fab3afa0b
permissions -rw-r--r--
8044072: Group 2: create .out files for OverrideChecks tests in tools/javac dir Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     1
/*
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     2
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     4
 *
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     8
 *
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    13
 * accompanied this code).
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    14
 *
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    18
 *
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    21
 * questions.
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    22
 */
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    23
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    24
/*
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    25
 * @test
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    26
 * @bug 8015701
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    27
 * @summary Test method parameter attribute generation with captured locals.
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    28
 * @compile -parameters CaptureTest.java
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    29
 * @run main CaptureTest
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    30
 */
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    31
import java.lang.Class;
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    32
import java.lang.reflect.Constructor;
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    33
import java.lang.reflect.Parameter;
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    34
import java.lang.reflect.Modifier;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    35
import java.util.List;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    36
import java.util.ArrayList;
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    37
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    38
public class CaptureTest {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    39
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    40
    private static final int SYNTHETIC = 0x1000;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    41
    private static final int MANDATED = 0x8000;
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    42
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    43
    public static void main(String... args) throws Exception {
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    44
        new CaptureTest().run();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    45
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    46
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    47
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    48
    private void run() throws Exception {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    49
        final Encloser pn = new Encloser();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    50
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    51
        /* Cases covered here:
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    52
         *
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    53
         * - Local class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    54
         * - Inner class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    55
         * - Anonymous class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    56
         * - Anonymous class extending a local
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    57
         * - Anonymous class extending an inner
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    58
         */
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    59
        pn.makeLocal("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    60
        pn.makeInner("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    61
        pn.makeAnon("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    62
        pn.makeAnonExtendsLocal("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    63
        pn.makeAnonExtendsInner("hello").check();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    64
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    65
        if (0 != errors)
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    66
            throw new Exception("MethodParameters test failed with " +
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    67
                                errors + " errors");
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    68
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    69
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    70
    private void error(final String msg) {
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    71
        System.err.println("Error: " + msg);
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    72
        errors++;
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    73
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    74
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    75
    int errors;
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    76
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    77
    abstract class Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    78
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    79
        public Tester(final int param) {}
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    80
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    81
        protected abstract String[] names();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    82
        protected abstract int[] modifiers();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    83
        protected abstract Class[] types();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    84
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    85
        public void check() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    86
            final Class<?> cls = this.getClass();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    87
            final Constructor<?> ctor = cls.getDeclaredConstructors()[0];
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    88
            final Parameter[] params = ctor.getParameters();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    89
            final String[] names = names();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    90
            final int[] modifiers = modifiers();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    91
            final Class[] types = types();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    92
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    93
            System.err.println("Testing class " + cls);
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    94
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    95
            if (params.length == names.length) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    96
                for (int i = 0; i < names.length; i++) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    97
                    System.err.println("Testing parameter " + params[i].getName());
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    98
                    if (!params[i].getName().equals(names[i]))
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    99
                        error("Expected parameter name " + names[i] +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   100
                              " got " + params[i].getName());
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   101
                    if (params[i].getModifiers() != modifiers[i])
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   102
                        error("Expected parameter modifiers " +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   103
                              modifiers[i] + " got " +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   104
                              params[i].getModifiers());
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   105
                    if (!params[i].getType().equals(types[i]))
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   106
                        error("Expected parameter type " + types[i] +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   107
                              " got " + params[i].getType());
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   108
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   109
            } else
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   110
                error("Expected " + names.length + " parameters");
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   111
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   112
        }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   113
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   114
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   115
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   116
    class Encloser {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   117
        private class InnerTester extends Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   118
            public InnerTester(final int innerparam) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   119
                super(innerparam);
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   120
            }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   121
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   122
            protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   123
                return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   124
                    "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   125
                    "innerparam"
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   126
                };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   127
            }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   128
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   129
            protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   130
                return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   131
                    Modifier.FINAL | SYNTHETIC,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   132
                    Modifier.FINAL
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   133
                };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   134
            }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   135
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   136
            protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   137
                return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   138
                    Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   139
                    int.class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   140
                };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   141
            }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   142
        }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   143
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   144
        public Tester makeInner(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   145
            return new InnerTester(2);
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   146
        }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   147
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   148
        public Tester makeLocal(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   149
            class LocalTester extends Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   150
                public LocalTester(final int localparam) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   151
                    super(localparam);
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   152
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   153
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   154
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   155
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   156
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   157
                        "localparam",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   158
                        "val$message"
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   159
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   160
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   161
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   162
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   163
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   164
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   165
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   166
                        Modifier.FINAL | SYNTHETIC
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   167
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   168
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   169
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   170
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   171
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   172
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   173
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   174
                        String.class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   175
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   176
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   177
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   178
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   179
                    return message;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   180
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   181
            }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   182
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   183
            return new LocalTester(2);
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   184
        }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   185
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   186
        public Tester makeAnonExtendsLocal(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   187
            abstract class LocalTester extends Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   188
                public LocalTester(final int localparam) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   189
                    super(localparam);
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   190
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   191
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   192
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   193
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   194
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   195
                        "localparam",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   196
                        "val$message"
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   197
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   198
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   199
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   200
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   201
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   202
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   203
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   204
                        Modifier.FINAL | SYNTHETIC
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   205
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   206
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   207
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   208
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   209
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   210
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   211
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   212
                        String.class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   213
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   214
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   215
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   216
            }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   217
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   218
            return new LocalTester(2) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   219
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   220
                    return message;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   221
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   222
            };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   223
        }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   224
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   225
        public Tester makeAnonExtendsInner(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   226
            return new InnerTester(2) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   227
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   228
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   229
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   230
                        "innerparam",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   231
                        "val$message"
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   232
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   233
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   234
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   235
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   236
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   237
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   238
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   239
                        Modifier.FINAL | SYNTHETIC
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   240
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   241
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   242
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   243
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   244
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   245
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   246
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   247
                        String.class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   248
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   249
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   250
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   251
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   252
                    return message;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   253
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   254
            };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   255
        }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   256
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   257
        public Tester makeAnon(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   258
            return new Tester(2) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   259
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   260
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   261
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   262
                        "param",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   263
                        "val$message"
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   264
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   265
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   266
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   267
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   268
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   269
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   270
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   271
                        Modifier.FINAL | SYNTHETIC
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   272
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   273
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   274
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   275
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   276
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   277
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   278
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   279
                        String.class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   280
                    };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   281
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   282
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   283
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   284
                    return message;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   285
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   286
            };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   287
        }
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   288
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   289
}