jdk/test/java/beans/XMLEncoder/Test6989223.java
author lana
Tue, 23 May 2017 21:11:42 +0000
changeset 45187 331a6542b5b8
parent 17896 271991446515
permissions -rw-r--r--
Added tag jdk-10+7 for changeset d554736d963e
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 6989223
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    27
 * @summary Tests Rectangle2D.Double encoding
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
import java.awt.geom.Rectangle2D;
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    32
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    33
public class Test6989223 extends AbstractTest {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    34
    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
    35
        new Test6989223().test(true);
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    36
    }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    37
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    38
    protected Object getObject() {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    39
        return new Bean(1, 2, 3, 4);
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
        return new Bean(1, 2, 3, 5);
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    45
    }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    46
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    47
    public static class Bean extends Rectangle2D.Double {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    48
        public Bean() {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    49
        }
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    50
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    51
        public Bean(double x, double y, double w, double h) {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    52
            super(x, y, w, h);
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    53
        }
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
        @Override
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    56
        public boolean equals(Object object) {
271991446515 8013557: XMLEncoder in 1.7 can't encode objects initialized in no argument constructor
malenkov
parents:
diff changeset
    57
            return super.equals(object); // to avoid recursion during validation
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
}