jdk/test/java/beans/XMLEncoder/Test7080156.java
author mchung
Mon, 23 Nov 2015 12:44:43 -0800
changeset 34253 ba3946143842
parent 17896 271991446515
permissions -rw-r--r--
8140450: Implement JEP 259: Stack-Walking API Reviewed-by: coleenp, dfuchs, bchristi, psandoz, sspitsyn Contributed-by: Mandy Chung <mandy.chung@oracle.com>, Brent Christian <brent.christian@oracle.com>, Daniel Fuchs <daniel.fuchs@oracle.com>, Hamlin Li <huaming.li@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17896
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     1
/*
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     4
 *
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     8
 *
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    13
 * accompanied this code).
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    14
 *
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    18
 *
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    21
 * questions.
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    22
 */
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    23
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    24
/*
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    25
 * @test
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    26
 * @bug 7080156 7094245
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    27
 * @summary Tests beans with public arrays
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    28
 * @author Sergey Malenkov
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    29
 */
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    30
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    31
public class Test7080156 extends AbstractTest {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    32
    public static void main(String[] args) {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    33
        new Test7080156().test(true);
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    34
    }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    35
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    36
    protected Object getObject() {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    37
        Bean bean = new Bean();
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    38
        bean.setArray("something");
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    39
        return bean;
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    40
    }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    41
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    42
    @Override
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    43
    protected Object getAnotherObject() {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    44
        Bean bean = new Bean();
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    45
        bean.setArray("some", "thing");
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    46
        return bean;
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    47
    }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    48
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    49
    public static class Bean {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    50
        public String[] array = {"default"};
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    51
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    52
        public void setArray(String... array) {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    53
            this.array = array;
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    54
        }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    55
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    56
        public String[] getArray() {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    57
            return this.array;
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    58
        }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    59
    }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    60
}