Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaType.java @ 24130:0386b21ed2b3
added Services.initializeJVMCI (JDK-8177845)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 18 Apr 2017 17:14:58 +0200 |
parents | 1d4ce2d19e52 |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
23 package jdk.vm.ci.meta; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
25 import static jdk.vm.ci.meta.MetaUtil.internalNameToJava; |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
26 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
28 * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
29 * arrays thereof. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 */ |
23365
30af491f98c5
Remove TrustedInterface (JDK-8155719).
Roland Schatz <roland.schatz@oracle.com>
parents:
22672
diff
changeset
|
31 public interface JavaType { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
34 * Returns the name of this type in internal form. The following are examples of strings |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
35 * returned by this method: |
16476
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
36 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 * <pre> |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 * "Ljava/lang/Object;" |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 * "I" |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 * "[[B" |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 * </pre> |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 */ |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6465
diff
changeset
|
43 String getName(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 /** |
18239
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
46 * Returns an unqualified name of this type. |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
47 * |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
48 * <pre> |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
49 * "Object" |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
50 * "Integer" |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
51 * </pre> |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
52 */ |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
53 default String getUnqualifiedName() { |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
54 String name = getName(); |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
55 if (name.indexOf('/') != -1) { |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
56 name = name.substring(name.lastIndexOf('/') + 1); |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
57 } |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
58 if (name.endsWith(";")) { |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
59 name = name.substring(0, name.length() - 1); |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
60 } |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
61 return name; |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
62 } |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
63 |
9670aff0388b
Add utility for getting the unqualified type name of a Java type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
64 /** |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
65 * Checks whether this type is an array class. |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
66 * |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
67 * @return {@code true} if this type is an array class |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
68 */ |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
69 default boolean isArray() { |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
70 return getComponentType() != null; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
71 } |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
72 |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23365
diff
changeset
|
73 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
74 * For array types, gets the type of the components, or {@code null} if this is not an array |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
75 * type. This method is analogous to {@link Class#getComponentType()}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 */ |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6465
diff
changeset
|
77 JavaType getComponentType(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 /** |
16476
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
80 * Gets the elemental type for this given type. The elemental type is the corresponding zero |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
81 * dimensional type of an array type. For example, the elemental type of {@code int[][][]} is |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
82 * {@code int}. A non-array type is its own elemental type. |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
83 */ |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
84 default JavaType getElementalType() { |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
85 JavaType t = this; |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
86 while (t.getComponentType() != null) { |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
87 t = t.getComponentType(); |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
88 } |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
89 return t; |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
90 } |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
91 |
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
92 /** |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6465
diff
changeset
|
93 * Gets the array class type representing an array with elements of this type. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 */ |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6465
diff
changeset
|
95 JavaType getArrayClass(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 /** |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
98 * Gets the {@link JavaKind} of this type. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 */ |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
100 JavaKind getJavaKind(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 /** |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16487
diff
changeset
|
103 * Resolves this type to a {@link ResolvedJavaType}. |
16476
92f75d104b4b
moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
104 * |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16487
diff
changeset
|
105 * @param accessingClass the context of resolution (must not be null) |
5545
65f832e7476b
Further clean up on api.meta project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
106 * @return the resolved Java type |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16487
diff
changeset
|
107 * @throws LinkageError if the resolution failed |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16487
diff
changeset
|
108 * @throws NullPointerException if {@code accessingClass} is {@code null} |
5545
65f832e7476b
Further clean up on api.meta project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
109 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
110 ResolvedJavaType resolve(ResolvedJavaType accessingClass); |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
111 |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
112 /** |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
113 * Gets the Java programming language name for this type. The following are examples of strings |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
114 * returned by this method: |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
115 * |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
116 * <pre> |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
117 * java.lang.Object |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
118 * int |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
119 * boolean[][] |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
120 * </pre> |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
121 * |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
122 * @return the Java name corresponding to this type |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
123 */ |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
124 default String toJavaName() { |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
125 return internalNameToJava(getName(), true, false); |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
126 } |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
127 |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
128 /** |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
129 * Gets the Java programming language name for this type. The following are examples of strings |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
130 * returned by this method: |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
131 * |
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
132 * <pre> |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
133 * qualified == true: |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
134 * java.lang.Object |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
135 * int |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
136 * boolean[][] |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
137 * qualified == false: |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
138 * Object |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
139 * int |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
140 * boolean[][] |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
141 * </pre> |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
142 * |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
143 * @param qualified specifies if the package prefix of this type should be included in the |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
144 * returned name |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16478
diff
changeset
|
145 * @return the Java name corresponding to this type |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
146 */ |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
147 default String toJavaName(boolean qualified) { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
148 JavaKind kind = getJavaKind(); |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
149 if (kind == JavaKind.Object) { |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
150 return internalNameToJava(getName(), qualified, false); |
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
151 } |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
152 return getJavaKind().getJavaName(); |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
153 } |
16487
1ffe4349f945
moved toClassName(JavaType) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
154 |
1ffe4349f945
moved toClassName(JavaType) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
155 /** |
1ffe4349f945
moved toClassName(JavaType) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
156 * Returns this type's name in the same format as {@link Class#getName()}. |
1ffe4349f945
moved toClassName(JavaType) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
157 */ |
16493
b45bb90c0192
added forwarding methods to MetaUtil and marked them with @Deprecated to simplify adapting new API
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
158 default String toClassName() { |
b45bb90c0192
added forwarding methods to MetaUtil and marked them with @Deprecated to simplify adapting new API
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
159 return internalNameToJava(getName(), true, true); |
16487
1ffe4349f945
moved toClassName(JavaType) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
160 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 } |