Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaField.java @ 21623:d2113f5ae550
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 31 May 2015 23:58:09 +0200 |
parents | 48c1ebd24120 |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
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:
5541
diff
changeset
|
2 * Copyright (c) 2009, 2012, 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 */ |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
18584
diff
changeset
|
23 package com.oracle.jvmci.meta; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
16481
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
25 import java.util.*; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
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 reference to a Java field, either resolved or unresolved fields. Fields, like |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
29 * methods and types, are resolved through {@link ConstantPool constant pools}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 */ |
18584
bf7db79a6e45
only TrustedInterfaces can be checked with VerifyUsageWithEquals
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
31 public interface JavaField extends TrustedInterface { |
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:
5541
diff
changeset
|
32 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 /** |
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:
5541
diff
changeset
|
34 * Returns the name of this field. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 */ |
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:
5541
diff
changeset
|
36 String getName(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 /** |
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:
5541
diff
changeset
|
39 * Returns a {@link JavaType} object that identifies the declared type for this field. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 */ |
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:
5541
diff
changeset
|
41 JavaType getType(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
44 * Returns the kind of this field. This is the same as calling {@link #getType}. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
45 * {@link JavaType#getKind getKind}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 */ |
18372
18b19a6f9851
Add default implementation for Kind accessors of Signature and JavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18267
diff
changeset
|
47 default Kind getKind() { |
18b19a6f9851
Add default implementation for Kind accessors of Signature and JavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18267
diff
changeset
|
48 return getType().getKind(); |
18b19a6f9851
Add default implementation for Kind accessors of Signature and JavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18267
diff
changeset
|
49 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
52 * Returns the {@link JavaType} object representing the class or interface that declares this |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
53 * field. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 */ |
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:
5541
diff
changeset
|
55 JavaType getDeclaringClass(); |
16481
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
56 |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
57 /** |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
58 * Gets a string for this field formatted according to a given format specification. A format |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
59 * specification is composed of characters that are to be copied verbatim to the result and |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
60 * specifiers that denote an attribute of this field that is to be copied to the result. A |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
61 * specifier is a single character preceded by a '%' character. The accepted specifiers and the |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
62 * field attributes they denote are described below: |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
63 * |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
64 * <pre> |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
65 * Specifier | Description | Example(s) |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
66 * ----------+------------------------------------------------------------------------------------------ |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
67 * 'T' | Qualified type | "int" "java.lang.String" |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
68 * 't' | Unqualified type | "int" "String" |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
69 * 'H' | Qualified holder | "java.util.Map.Entry" |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
70 * 'h' | Unqualified holder | "Entry" |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
71 * 'n' | Field name | "age" |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
72 * 'f' | Indicator if field is unresolved, static or instance | "unresolved" "static" "instance" |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
73 * '%' | A '%' character | "%" |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
74 * </pre> |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
75 * |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
76 * @param format a format specification |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
77 * @return the result of formatting this field according to {@code format} |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
78 * @throws IllegalFormatException if an illegal specifier is encountered in {@code format} |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
79 */ |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
80 default String format(String format) throws IllegalFormatException { |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
16481
diff
changeset
|
81 StringBuilder sb = new StringBuilder(); |
16481
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
82 int index = 0; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
83 JavaType type = getType(); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
84 while (index < format.length()) { |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
16481
diff
changeset
|
85 char ch = format.charAt(index++); |
16481
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
86 if (ch == '%') { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
87 if (index >= format.length()) { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
88 throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a field format specification"); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
89 } |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
16481
diff
changeset
|
90 char specifier = format.charAt(index++); |
16481
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
91 boolean qualified = false; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
92 switch (specifier) { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
93 case 'T': |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
94 qualified = true; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
95 // fall through |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
96 case 't': { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
97 sb.append(type.toJavaName(qualified)); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
98 break; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
99 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
100 case 'H': |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
101 qualified = true; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
102 // fall through |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
103 case 'h': { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
104 sb.append(getDeclaringClass().toJavaName(qualified)); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
105 break; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
106 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
107 case 'n': { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
108 sb.append(getName()); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
109 break; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
110 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
111 case 'f': { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
112 sb.append(!(this instanceof ResolvedJavaField) ? "unresolved" : ((ResolvedJavaField) this).isStatic() ? "static" : "instance"); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
113 break; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
114 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
115 case '%': { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
116 sb.append('%'); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
117 break; |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
118 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
119 default: { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
120 throw new UnknownFormatConversionException(String.valueOf(specifier)); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
121 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
122 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
123 } else { |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
124 sb.append(ch); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
125 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
126 } |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
127 return sb.toString(); |
e7fc65330742
moved format(String format, JavaField field) from MetaUtil to be a default method in JavaField
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
128 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 } |