Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionProcessor.java @ 21623:d2113f5ae550
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 31 May 2015 23:58:09 +0200 |
parents | 47bebae7454f |
children |
rev | line source |
---|---|
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21096
diff
changeset
|
23 package com.oracle.jvmci.options.processor; |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import java.io.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import java.util.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import javax.annotation.processing.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import javax.lang.model.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import javax.lang.model.element.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import javax.lang.model.type.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 import javax.lang.model.util.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import javax.tools.Diagnostic.Kind; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 import javax.tools.*; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21096
diff
changeset
|
36 import com.oracle.jvmci.options.*; |
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21096
diff
changeset
|
37 |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 /** |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
39 * Processes static fields annotated with {@link Option}. An {@link Options} service is generated |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
40 * for each top level class containing at least one such field. These service objects can be |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
41 * retrieved as follows: |
15043
33eee38d70a3
Fix raw type references in OptionProcessor.
Josef Eisl <josef.eisl@jku.at>
parents:
14763
diff
changeset
|
42 * |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 * <pre> |
16732
c958f16fd52f
use correct class loader when looking up services
Doug Simon <doug.simon@oracle.com>
parents:
16010
diff
changeset
|
44 * ServiceLoader<Options> sl = ServiceLoader.load(Options.class); |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15043
diff
changeset
|
45 * for (Options opts : sl) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15043
diff
changeset
|
46 * for (OptionDescriptor desc : sl) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15043
diff
changeset
|
47 * // use desc |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15043
diff
changeset
|
48 * } |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 * } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 * </pre> |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 */ |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21096
diff
changeset
|
52 @SupportedAnnotationTypes({"com.oracle.jvmci.options.Option"}) |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 public class OptionProcessor extends AbstractProcessor { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 |
14763 | 55 @Override |
56 public SourceVersion getSupportedSourceVersion() { | |
57 return SourceVersion.latest(); | |
58 } | |
59 | |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 private final Set<Element> processed = new HashSet<>(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
62 private void processElement(Element element, OptionsInfo info) { |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 if (!element.getModifiers().contains(Modifier.STATIC)) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 return; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 Option annotation = element.getAnnotation(Option.class); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 assert annotation != null; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 assert element instanceof VariableElement; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 assert element.getKind() == ElementKind.FIELD; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 VariableElement field = (VariableElement) element; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 String fieldName = field.getSimpleName().toString(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 Elements elements = processingEnv.getElementUtils(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 Types types = processingEnv.getTypeUtils(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 TypeMirror fieldType = field.asType(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 if (fieldType.getKind() != TypeKind.DECLARED) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be of type " + OptionValue.class.getName(), element); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 return; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 DeclaredType declaredFieldType = (DeclaredType) fieldType; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 TypeMirror optionValueType = elements.getTypeElement(OptionValue.class.getName()).asType(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 if (!types.isSubtype(fieldType, types.erasure(optionValueType))) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 String msg = String.format("Option field type %s is not a subclass of %s", fieldType, optionValueType); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 processingEnv.getMessager().printMessage(Kind.ERROR, msg, element); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 return; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 if (!field.getModifiers().contains(Modifier.STATIC)) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 return; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 |
11378
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
98 String help = annotation.help(); |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
99 if (help.length() != 0) { |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
100 char firstChar = help.charAt(0); |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
101 if (!Character.isUpperCase(firstChar)) { |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
102 processingEnv.getMessager().printMessage(Kind.ERROR, "Option help text must start with upper case letter", element); |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
103 return; |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
104 } |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
105 } |
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
106 |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 String optionName = annotation.name(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 if (optionName.equals("")) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 optionName = fieldName; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 |
16007
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
112 DeclaredType declaredOptionValueType = declaredFieldType; |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
113 while (!types.isSameType(types.erasure(declaredOptionValueType), types.erasure(optionValueType))) { |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
114 List<? extends TypeMirror> directSupertypes = types.directSupertypes(declaredFieldType); |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
115 assert !directSupertypes.isEmpty(); |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
116 declaredOptionValueType = (DeclaredType) directSupertypes.get(0); |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
117 } |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
118 |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
119 assert !declaredOptionValueType.getTypeArguments().isEmpty(); |
23ae0cbcb2ae
OptionProcessor needs to find the type parameter of an OptionValue field declaration
Doug Simon <doug.simon@oracle.com>
parents:
15370
diff
changeset
|
120 String optionType = declaredOptionValueType.getTypeArguments().get(0).toString(); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 if (optionType.startsWith("java.lang.")) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 optionType = optionType.substring("java.lang.".length()); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 Element enclosing = element.getEnclosingElement(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 String declaringClass = ""; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 String separator = ""; |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
128 Set<Element> originatingElementsList = info.originatingElements; |
9865
9006bc30a951
add all enclosing elements of an annotated field as originating elements
Doug Simon <doug.simon@oracle.com>
parents:
9849
diff
changeset
|
129 originatingElementsList.add(field); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 while (enclosing != null) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 if (enclosing.getKind() == ElementKind.CLASS || enclosing.getKind() == ElementKind.INTERFACE) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 if (enclosing.getModifiers().contains(Modifier.PRIVATE)) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 String msg = String.format("Option field cannot be declared in a private %s %s", enclosing.getKind().name().toLowerCase(), enclosing); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 processingEnv.getMessager().printMessage(Kind.ERROR, msg, element); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 return; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 } |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
137 originatingElementsList.add(enclosing); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 declaringClass = enclosing.getSimpleName() + separator + declaringClass; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 separator = "."; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 } else { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 assert enclosing.getKind() == ElementKind.PACKAGE; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 enclosing = enclosing.getEnclosingElement(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 |
11378
7e297d001c30
option annotation processor ensures that a non-empty help message starts with a capital letter
Doug Simon <doug.simon@oracle.com>
parents:
11363
diff
changeset
|
146 info.options.add(new OptionInfo(optionName, help, optionType, declaringClass, field)); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
147 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
148 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
149 private void createFiles(OptionsInfo info) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
150 String pkg = ((PackageElement) info.topDeclaringType.getEnclosingElement()).getQualifiedName().toString(); |
9986
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
151 Name topDeclaringClass = info.topDeclaringType.getSimpleName(); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
152 |
9986
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
153 String optionsClassName = topDeclaringClass + "_" + Options.class.getSimpleName(); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
154 Element[] originatingElements = info.originatingElements.toArray(new Element[info.originatingElements.size()]); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 Filer filer = processingEnv.getFiler(); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
157 try (PrintWriter out = createSourceFile(pkg, optionsClassName, filer, originatingElements)) { |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 |
9901
4fcd38b13eb1
disabled emitting and checking of copyright header in files generated by OptionProcessor
Doug Simon <doug.simon@oracle.com>
parents:
9865
diff
changeset
|
159 out.println("// CheckStyle: stop header check"); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
160 out.println("// GENERATED CONTENT - DO NOT EDIT"); |
9986
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
161 out.println("// Source: " + topDeclaringClass + ".java"); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 out.println("package " + pkg + ";"); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
163 out.println(""); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
164 out.println("import java.util.*;"); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
165 out.println("import " + Options.class.getPackage().getName() + ".*;"); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
166 out.println(""); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
167 out.println("public class " + optionsClassName + " implements " + Options.class.getSimpleName() + " {"); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
168 out.println(" @Override"); |
9986
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
169 String desc = OptionDescriptor.class.getSimpleName(); |
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
170 out.println(" public Iterator<" + desc + "> iterator() {"); |
11363
b332bfd012a4
added suppression filter so that long help messages for Options can be supported without triggering Checkstyle errors in generated sources
Doug Simon <doug.simon@oracle.com>
parents:
9986
diff
changeset
|
171 out.println(" // CheckStyle: stop line length check"); |
9986
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
172 out.println(" List<" + desc + "> options = Arrays.asList("); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
173 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
174 boolean needPrivateFieldAccessor = false; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
175 int i = 0; |
13944
911e540a2116
Sort options alphabetically so that diffs do not show false positives
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11378
diff
changeset
|
176 Collections.sort(info.options); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
177 for (OptionInfo option : info.options) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
178 String optionValue; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
179 if (option.field.getModifiers().contains(Modifier.PRIVATE)) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
180 needPrivateFieldAccessor = true; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
181 optionValue = "field(" + option.declaringClass + ".class, \"" + option.field.getSimpleName() + "\")"; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
182 } else { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
183 optionValue = option.declaringClass + "." + option.field.getSimpleName(); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
184 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
185 String name = option.name; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
186 String type = option.type; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
187 String help = option.help; |
9986
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
188 String declaringClass = option.declaringClass; |
4f542ceb5fed
added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents:
9937
diff
changeset
|
189 Name fieldName = option.field.getSimpleName(); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
190 String comma = i == info.options.size() - 1 ? "" : ","; |
14596
2e35f6eb8684
Fixed option processor to always produce unix line feeds which led to checkstyle warnings on windows.
Christian Humer <christian.humer@gmail.com>
parents:
14157
diff
changeset
|
191 out.printf(" new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s\n", desc, name, type, help, declaringClass, fieldName, optionValue, comma); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
192 i++; |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
193 } |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
194 out.println(" );"); |
11363
b332bfd012a4
added suppression filter so that long help messages for Options can be supported without triggering Checkstyle errors in generated sources
Doug Simon <doug.simon@oracle.com>
parents:
9986
diff
changeset
|
195 out.println(" // CheckStyle: resume line length check"); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
196 out.println(" return options.iterator();"); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
197 out.println(" }"); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
198 if (needPrivateFieldAccessor) { |
15043
33eee38d70a3
Fix raw type references in OptionProcessor.
Josef Eisl <josef.eisl@jku.at>
parents:
14763
diff
changeset
|
199 out.println(" private static " + OptionValue.class.getSimpleName() + "<?> field(Class<?> declaringClass, String fieldName) {"); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
200 out.println(" try {"); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
201 out.println(" java.lang.reflect.Field field = declaringClass.getDeclaredField(fieldName);"); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
202 out.println(" field.setAccessible(true);"); |
15043
33eee38d70a3
Fix raw type references in OptionProcessor.
Josef Eisl <josef.eisl@jku.at>
parents:
14763
diff
changeset
|
203 out.println(" return (" + OptionValue.class.getSimpleName() + "<?>) field.get(null);"); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
204 out.println(" } catch (Exception e) {"); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 out.println(" throw (InternalError) new InternalError().initCause(e);"); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
206 out.println(" }"); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
207 out.println(" }"); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 out.println("}"); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 try { |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
213 createProviderFile(pkg, optionsClassName, originatingElements); |
21517
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
214 createOptionsFile(info, pkg, topDeclaringClass.toString(), originatingElements); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
215 } catch (IOException e) { |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
216 processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), info.topDeclaringType); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
217 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
219 |
9865
9006bc30a951
add all enclosing elements of an annotated field as originating elements
Doug Simon <doug.simon@oracle.com>
parents:
9849
diff
changeset
|
220 private void createProviderFile(String pkg, String providerClassName, Element... originatingElements) throws IOException { |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
221 String filename = "META-INF/providers/" + pkg + "." + providerClassName; |
9865
9006bc30a951
add all enclosing elements of an annotated field as originating elements
Doug Simon <doug.simon@oracle.com>
parents:
9849
diff
changeset
|
222 FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, originatingElements); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
223 PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8")); |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
224 writer.println(Options.class.getName()); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 writer.close(); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 |
21517
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
228 private void createOptionsFile(OptionsInfo info, String pkg, String relativeName, Element... originatingElements) throws IOException { |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
229 String filename = "META-INF/options/" + pkg + "." + relativeName; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
230 FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, originatingElements); |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
231 PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8")); |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
232 Types types = processingEnv.getTypeUtils(); |
21517
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
233 for (OptionInfo option : info.options) { |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
234 String help = option.help; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
235 if (help.indexOf('\t') >= 0 || help.indexOf('\r') >= 0 || help.indexOf('\n') >= 0) { |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
236 processingEnv.getMessager().printMessage(Kind.WARNING, "Option help should not contain '\\t', '\\r' or '\\n'", option.field); |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
237 help = help.replace('\t', ' ').replace('\n', ' ').replace('\r', ' '); |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
238 } |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
239 try { |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
240 char optionTypeToChar = optionTypeToChar(option); |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
241 String fqDeclaringClass = className(types.erasure(option.field.getEnclosingElement().asType())); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
242 String fqFieldType = className(types.erasure(option.field.asType())); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
243 writer.printf("%s\t%s\t%s\t%s\t%s%n", option.name, optionTypeToChar, help, fqDeclaringClass, fqFieldType); |
21517
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
244 } catch (IllegalArgumentException iae) { |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
245 } |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
246 } |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
247 writer.close(); |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
248 } |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
249 |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
250 private String className(TypeMirror t) { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
251 DeclaredType dt = (DeclaredType) t; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
252 return processingEnv.getElementUtils().getBinaryName((TypeElement) dt.asElement()).toString(); |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
253 } |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21517
diff
changeset
|
254 |
21517
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
255 private char optionTypeToChar(OptionInfo option) { |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
256 switch (option.type) { |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
257 case "Boolean": |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
258 return 'z'; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
259 case "Integer": |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
260 return 'i'; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
261 case "Long": |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
262 return 'j'; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
263 case "Float": |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
264 return 'f'; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
265 case "Double": |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
266 return 'd'; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
267 case "String": |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
268 return 's'; |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
269 default: |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
270 processingEnv.getMessager().printMessage(Kind.ERROR, "Unsoported option type: " + option.type, option.field); |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
271 throw new IllegalArgumentException(); |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
272 } |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
273 } |
4cc6793cda69
Make OptionProcessor create options files
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21096
diff
changeset
|
274 |
9865
9006bc30a951
add all enclosing elements of an annotated field as originating elements
Doug Simon <doug.simon@oracle.com>
parents:
9849
diff
changeset
|
275 protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) { |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
276 try { |
21558
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
277 // Ensure Unix line endings to comply with code style guide checked by Checkstyle |
9865
9006bc30a951
add all enclosing elements of an annotated field as originating elements
Doug Simon <doug.simon@oracle.com>
parents:
9849
diff
changeset
|
278 JavaFileObject sourceFile = filer.createSourceFile(pkg + "." + relativeName, originatingElements); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
279 return new PrintWriter(sourceFile.openWriter()) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
280 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
281 @Override |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
282 public void println() { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
283 print("\n"); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
284 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
285 }; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
286 } catch (IOException e) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
287 throw new RuntimeException(e); |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
288 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
289 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
290 |
13944
911e540a2116
Sort options alphabetically so that diffs do not show false positives
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11378
diff
changeset
|
291 static class OptionInfo implements Comparable<OptionInfo> { |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
292 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
293 final String name; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
294 final String help; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
295 final String type; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
296 final String declaringClass; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
297 final VariableElement field; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
298 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
299 public OptionInfo(String name, String help, String type, String declaringClass, VariableElement field) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
300 this.name = name; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
301 this.help = help; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
302 this.type = type; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
303 this.declaringClass = declaringClass; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
304 this.field = field; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
305 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
306 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
307 @Override |
13944
911e540a2116
Sort options alphabetically so that diffs do not show false positives
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11378
diff
changeset
|
308 public int compareTo(OptionInfo other) { |
911e540a2116
Sort options alphabetically so that diffs do not show false positives
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11378
diff
changeset
|
309 return name.compareTo(other.name); |
911e540a2116
Sort options alphabetically so that diffs do not show false positives
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11378
diff
changeset
|
310 } |
911e540a2116
Sort options alphabetically so that diffs do not show false positives
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11378
diff
changeset
|
311 |
911e540a2116
Sort options alphabetically so that diffs do not show false positives
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11378
diff
changeset
|
312 @Override |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
313 public String toString() { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
314 return declaringClass + "." + field; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
315 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
316 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
317 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
318 static class OptionsInfo { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
319 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
320 final Element topDeclaringType; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
321 final List<OptionInfo> options = new ArrayList<>(); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
322 final Set<Element> originatingElements = new HashSet<>(); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
323 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
324 public OptionsInfo(Element topDeclaringType) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
325 this.topDeclaringType = topDeclaringType; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
326 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
327 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
328 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
329 private static Element topDeclaringType(Element element) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
330 Element enclosing = element.getEnclosingElement(); |
14118
380984cdb29d
fixed incorrect test for null
Doug Simon <doug.simon@oracle.com>
parents:
13944
diff
changeset
|
331 if (enclosing == null || enclosing.getKind() == ElementKind.PACKAGE) { |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
332 assert element.getKind() == ElementKind.CLASS || element.getKind() == ElementKind.INTERFACE; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
333 return element; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
334 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
335 return topDeclaringType(enclosing); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
336 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
337 |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
338 @Override |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
339 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
340 if (roundEnv.processingOver()) { |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
341 return true; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
342 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
343 |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
344 Map<Element, OptionsInfo> map = new HashMap<>(); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
345 for (Element element : roundEnv.getElementsAnnotatedWith(Option.class)) { |
9919
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
346 if (!processed.contains(element)) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
347 processed.add(element); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
348 Element topDeclaringType = topDeclaringType(element); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
349 OptionsInfo options = map.get(topDeclaringType); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
350 if (options == null) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
351 options = new OptionsInfo(topDeclaringType); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
352 map.put(topDeclaringType, options); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
353 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
354 processElement(element, options); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
355 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
356 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
357 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
358 boolean ok = true; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
359 Map<String, OptionInfo> uniqueness = new HashMap<>(); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
360 for (OptionsInfo info : map.values()) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
361 for (OptionInfo option : info.options) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
362 OptionInfo conflict = uniqueness.put(option.name, option); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
363 if (conflict != null) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
364 processingEnv.getMessager().printMessage(Kind.ERROR, "Duplicate option names for " + option + " and " + conflict, option.field); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
365 ok = false; |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
366 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
367 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
368 } |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
369 |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
370 if (ok) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
371 for (OptionsInfo info : map.values()) { |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
372 createFiles(info); |
af909f4b80a9
options are grouped per top level class/interface when accessed via the service mechanism
Doug Simon <doug.simon@oracle.com>
parents:
9901
diff
changeset
|
373 } |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
374 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
375 |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
376 return true; |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
377 } |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
378 } |