langtools/test/tools/javac/MethodParameters/CaptureTest.java
author darcy
Tue, 07 Jan 2014 15:00:23 -0800
changeset 22171 71073f4a867e
parent 19657 48226ff07b84
child 22445 8a8fab3afa0b
permissions -rw-r--r--
8000962: Update JDK_MINOR_VERSION for JDK 9 Reviewed-by: jjg, ksrini
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
22171
71073f4a867e 8000962: Update JDK_MINOR_VERSION for JDK 9
darcy
parents: 19657
diff changeset
    27
 * @ignore 8030656 Bad version check for parameter information in src/share/vm/classfile/javaClasses.cpp
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    28
 * @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
    29
 * @compile -parameters CaptureTest.java
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    30
 * @run main CaptureTest
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    31
 */
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    32
import java.lang.Class;
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    33
import java.lang.reflect.Constructor;
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    34
import java.lang.reflect.Parameter;
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    35
import java.lang.reflect.Modifier;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    36
import java.util.List;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    37
import java.util.ArrayList;
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    38
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    39
public class CaptureTest {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    40
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    41
    private static final int SYNTHETIC = 0x1000;
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    42
    private static final int MANDATED = 0x8000;
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    43
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    44
    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
    45
        new CaptureTest().run();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    46
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    47
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    48
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    49
    private void run() throws Exception {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    50
        final Encloser pn = new Encloser();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    51
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    52
        /* Cases covered here:
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    53
         *
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    54
         * - Local class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    55
         * - Inner class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    56
         * - Anonymous class
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    57
         * - Anonymous class extending a local
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    58
         * - Anonymous class extending an inner
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    59
         */
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    60
        pn.makeLocal("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    61
        pn.makeInner("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    62
        pn.makeAnon("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    63
        pn.makeAnonExtendsLocal("hello").check();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    64
        pn.makeAnonExtendsInner("hello").check();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    65
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    66
        if (0 != errors)
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    67
            throw new Exception("MethodParameters test failed with " +
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    68
                                errors + " errors");
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    69
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    70
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    71
    private void error(final String msg) {
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    72
        System.err.println("Error: " + msg);
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    73
        errors++;
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
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    76
    int errors;
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    77
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    78
    abstract class Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    79
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    80
        public Tester(final int param) {}
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    81
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    82
        protected abstract String[] names();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    83
        protected abstract int[] modifiers();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    84
        protected abstract Class[] types();
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    85
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    86
        public void check() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    87
            final Class<?> cls = this.getClass();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    88
            final Constructor<?> ctor = cls.getDeclaredConstructors()[0];
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    89
            final Parameter[] params = ctor.getParameters();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    90
            final String[] names = names();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    91
            final int[] modifiers = modifiers();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    92
            final Class[] types = types();
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    93
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    94
            System.err.println("Testing class " + cls);
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
    95
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    96
            if (params.length == names.length) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
    97
                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
    98
                    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
    99
                    if (!params[i].getName().equals(names[i]))
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   100
                        error("Expected parameter name " + names[i] +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   101
                              " got " + params[i].getName());
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   102
                    if (params[i].getModifiers() != modifiers[i])
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   103
                        error("Expected parameter modifiers " +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   104
                              modifiers[i] + " got " +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   105
                              params[i].getModifiers());
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   106
                    if (!params[i].getType().equals(types[i]))
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   107
                        error("Expected parameter type " + types[i] +
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   108
                              " got " + params[i].getType());
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   109
                }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   110
            } else
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   111
                error("Expected " + names.length + " parameters");
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
        }
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   114
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   115
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   116
19657
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   117
    class Encloser {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   118
        private class InnerTester extends Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   119
            public InnerTester(final int innerparam) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   120
                super(innerparam);
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   123
            protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   124
                return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   125
                    "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   126
                    "innerparam"
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   130
            protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   131
                return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   132
                    Modifier.FINAL | SYNTHETIC,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   133
                    Modifier.FINAL
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   137
            protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   138
                return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   139
                    Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   140
                    int.class
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   145
        public Tester makeInner(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   146
            return new InnerTester(2);
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   149
        public Tester makeLocal(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   150
            class LocalTester extends Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   151
                public LocalTester(final int localparam) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   152
                    super(localparam);
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   155
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   156
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   157
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   158
                        "localparam",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   159
                        "val$message"
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   163
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   164
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   165
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   166
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   167
                        Modifier.FINAL | SYNTHETIC
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   171
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   172
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   173
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   174
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   175
                        String.class
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   179
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   180
                    return message;
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   184
            return new LocalTester(2);
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   187
        public Tester makeAnonExtendsLocal(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   188
            abstract class LocalTester extends Tester {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   189
                public LocalTester(final int localparam) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   190
                    super(localparam);
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   193
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   194
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   195
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   196
                        "localparam",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   197
                        "val$message"
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   201
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   202
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   203
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   204
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   205
                        Modifier.FINAL | SYNTHETIC
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   209
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   210
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   211
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   212
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   213
                        String.class
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   219
            return new LocalTester(2) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   220
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   221
                    return message;
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   226
        public Tester makeAnonExtendsInner(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   227
            return new InnerTester(2) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   228
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   229
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   230
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   231
                        "innerparam",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   232
                        "val$message"
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   236
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   237
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   238
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   239
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   240
                        Modifier.FINAL | SYNTHETIC
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   244
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   245
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   246
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   247
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   248
                        String.class
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   252
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   253
                    return message;
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   258
        public Tester makeAnon(final String message) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   259
            return new Tester(2) {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   260
                protected String[] names() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   261
                    return new String[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   262
                        "this$1",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   263
                        "param",
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   264
                        "val$message"
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   268
                protected int[] modifiers() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   269
                    return new int[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   270
                        Modifier.FINAL | MANDATED,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   271
                        Modifier.FINAL,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   272
                        Modifier.FINAL | SYNTHETIC
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   276
                protected Class[] types() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   277
                    return new Class[] {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   278
                        Encloser.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   279
                        int.class,
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   280
                        String.class
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
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   284
                public String message() {
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   285
                    return message;
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
            };
48226ff07b84 8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables
emc
parents: 18377
diff changeset
   288
        }
18377
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   289
    }
3f5b364f9d22 8015701: MethodParameters are not filled in for synthetic captured local variables
emc
parents:
diff changeset
   290
}