comparison test/compiler/types/correctness/hierarchies/TypeHierarchy.java @ 17881:534fbe3d90f0

8038418: New tests development for type profiling and speculation Reviewed-by: roland, iignatyev Contributed-by: Pavel Punegov <pavel.punegov@oracle.com>
author iignatyev
date Fri, 11 Apr 2014 18:46:35 +0400
parents
children
comparison
equal deleted inserted replaced
17880:e1fc9306859a 17881:534fbe3d90f0
1 /*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package hierarchies;
25
26 /**
27 * Type hierarchy contains classes the type profiling and speculation are tested with
28 */
29 public abstract class TypeHierarchy<M extends TypeHierarchy.I, N extends TypeHierarchy.I> {
30 // Magic numbers
31 public static final int ANSWER = 42;
32 public static final int TEMP = 451;
33 public static final int YEAR = 1984;
34
35 private final M m;
36 private final N n;
37 private final Class<M> classM;
38 private final Class<N> classN;
39
40 protected TypeHierarchy(M m, N n, Class<M> classM, Class<N> classN) {
41 this.m = m;
42 this.n = n;
43 this.classM = classM;
44 this.classN = classN;
45 }
46
47 public final M getM() {
48 return m;
49 }
50
51 public final N getN() {
52 return n;
53 }
54
55 public final Class<M> getClassM() {
56 return classM;
57 }
58
59 public final Class<N> getClassN() {
60 return classN;
61 }
62
63 public interface I {
64 int m();
65 }
66
67 public static class A implements I {
68 @Override
69 public int m() {
70 return TypeHierarchy.ANSWER;
71 }
72 }
73 }