Skip to content

Commit 6596064

Browse files
committed
Fixed typos and style
1 parent 417dca1 commit 6596064

File tree

7 files changed

+78
-33
lines changed

7 files changed

+78
-33
lines changed

graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/ArgumentClinic.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
* configuration for the conversion routine. Note that not all routines support all the
5959
* configuration options.
6060
*
61-
* Conversion routines are implemented in {@code ArgumentClinicModel#BuiltinConvertor}. It
62-
* creates Java code snippets that instantiate the actual cast nodes, which should implement
61+
* Conversion routines are implemented in {@code ConverterFactory}. It creates Java code
62+
* snippets that instantiate the actual cast nodes, which should implement
6363
* {@code ArgumentCastNode}.
6464
*/
6565
ClinicConversion conversion() default ClinicConversion.None;
@@ -74,11 +74,12 @@
7474
/**
7575
* The boxing optimized execute method variants will not attempt to cast the listed primitive
7676
* types and will just pass them directly to the specializations. This does not apply to
77-
* primitive values that are already boxed: those are always passed to the convertor.
77+
* primitive values that are already boxed: those are always passed to the converter.
7878
*
7979
* It is not necessary to set this when using a builtin conversion or
80-
* {@link #conversionClass()}. Built-in convertors and {@link ClinicConverterFactory} provide their
81-
* own list of short circuit types, which is applied if this field is set to its default value.
80+
* {@link #conversionClass()}. Built-in converters and {@link ClinicConverterFactory} provide
81+
* their own list of short circuit types, which is applied if this field is set to its default
82+
* value.
8283
*/
8384
PrimitiveType[] shortCircuitPrimitive() default {};
8485

@@ -97,7 +98,8 @@
9798

9899
/**
99100
* Specifies the name of the conversion node class, which must include a static factory method
100-
* annotated with {@link ClinicConverterFactory}. Must not be used with {@link #customConversion()}.
101+
* annotated with {@link ClinicConverterFactory}. Must not be used with
102+
* {@link #customConversion()}.
101103
*/
102104
Class<?> conversionClass() default void.class;
103105

@@ -116,36 +118,36 @@ enum PrimitiveType {
116118

117119
enum ClinicConversion {
118120
/**
119-
* No builtin convertor will be used.
121+
* No builtin converter will be used.
120122
*/
121123
None,
122124
/**
123-
* Corresponds to CPython's {@code bool} convertor. Supports {@link #defaultValue()}.
125+
* Corresponds to CPython's {@code bool} converter. Supports {@link #defaultValue()}.
124126
* {@code PNone.NONE} is, for now, always converted to {@code false}.
125127
*/
126128
Boolean,
127129
/**
128-
* GraalPython specific convertor that narrows any String representation to Java String.
130+
* GraalPython specific converter that narrows any String representation to Java String.
129131
* Supports {@link #defaultValue()}, and {@link #useDefaultForNone()}.
130132
*/
131133
String,
132134
/**
133-
* Corresponds to CPython's {@code int} convertor. Supports {@link #defaultValue()}, and
135+
* Corresponds to CPython's {@code int} converter. Supports {@link #defaultValue()}, and
134136
* {@link #useDefaultForNone()}.
135137
*/
136138
Int,
137139
/**
138-
* Corresponds to CPython's {@code Py_ssize_t} convertor. Supports {@link #defaultValue()},
140+
* Corresponds to CPython's {@code Py_ssize_t} converter. Supports {@link #defaultValue()},
139141
* and {@link #useDefaultForNone()}.
140142
*/
141143
Index,
142144
/**
143-
* Corresponds to CPython's {@code int(accept={str})} convertor. Supports
145+
* Corresponds to CPython's {@code int(accept={str})} converter. Supports
144146
* {@link #defaultValue()}, and {@link #useDefaultForNone()}.
145147
*/
146148
CodePoint,
147149
/**
148-
* Corresponds to CPython's {@code Py_buffer} convertor.
150+
* Corresponds to CPython's {@code Py_buffer} converter.
149151
*/
150152
Buffer,
151153
}

graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/ClinicConverterFactory.java

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* The Universal Permissive License (UPL), Version 1.0
6+
*
7+
* Subject to the condition set forth below, permission is hereby granted to any
8+
* person obtaining a copy of this software, associated documentation and/or
9+
* data (collectively the "Software"), free of charge and under any and all
10+
* copyright rights in the Software, and any and all patent rights owned or
11+
* freely licensable by each licensor hereunder covering either (i) the
12+
* unmodified Software as contributed to or provided by such licensor, or (ii)
13+
* the Larger Works (as defined below), to deal in both
14+
*
15+
* (a) the Software, and
16+
*
17+
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
18+
* one is included with the Software each a "Larger Work" to which the Software
19+
* is contributed by such licensors),
20+
*
21+
* without restriction, including without limitation the rights to copy, create
22+
* derivative works of, display, perform, and distribute the Software and make,
23+
* use, sell, offer for sale, import, export, have made, and have sold the
24+
* Software and the Larger Work(s), and to sublicense the foregoing rights on
25+
* either these or other terms.
26+
*
27+
* This license is subject to the following condition:
28+
*
29+
* The above copyright notice and either this complete permission notice or at a
30+
* minimum a reference to the UPL must be included in all copies or substantial
31+
* portions of the Software.
32+
*
33+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39+
* SOFTWARE.
40+
*/
141
package com.oracle.graal.python.annotations;
242

343
import java.lang.annotation.ElementType;
@@ -11,43 +51,47 @@
1151
public @interface ClinicConverterFactory {
1252

1353
/**
14-
* The boxing optimized execute method variants will not attempt to cast the listed
15-
* primitive types and will just pass them directly to the specializations. This does not
16-
* apply to primitive values that are already boxed: those are always passed to the
17-
* convertor.
54+
* The boxing optimized execute method variants will not attempt to cast the listed primitive
55+
* types and will just pass them directly to the specializations. This does not apply to
56+
* primitive values that are already boxed: those are always passed to the converter.
1857
*/
1958
ArgumentClinic.PrimitiveType[] shortCircuitPrimitive() default {};
2059

2160
/**
22-
* Annotates parameter of the factory method which will receive the default value {@link ArgumentClinic#defaultValue()}.
61+
* Annotates parameter of the factory method which will receive the default value
62+
* {@link ArgumentClinic#defaultValue()}.
2363
*/
2464
@Target(ElementType.PARAMETER)
2565
@interface DefaultValue {
2666
}
2767

2868
/**
29-
* Annotates parameter of the factory method which will receive the value of {@link ArgumentClinic#useDefaultForNone()}.
69+
* Annotates parameter of the factory method which will receive the value of
70+
* {@link ArgumentClinic#useDefaultForNone()}.
3071
*/
3172
@Target(ElementType.PARAMETER)
3273
@interface UseDefaultForNone {
3374
}
3475

3576
/**
36-
* Annotates parameter of the factory method which will receive the name of the builtin function.
77+
* Annotates parameter of the factory method which will receive the name of the builtin
78+
* function.
3779
*/
3880
@Target(ElementType.PARAMETER)
3981
@interface BuiltinName {
4082
}
4183

4284
/**
43-
* Annotates parameter of the factory method which will receive the index of the argument of the builtin functions.
85+
* Annotates parameter of the factory method which will receive the index of the argument of the
86+
* builtin functions.
4487
*/
4588
@Target(ElementType.PARAMETER)
4689
@interface ArgumentIndex {
4790
}
4891

4992
/**
50-
* Annotates parameter of the factory method which will receive the name of the argument of the builtin functions.
93+
* Annotates parameter of the factory method which will receive the name of the argument of the
94+
* builtin functions.
5195
*/
5296
@Target(ElementType.PARAMETER)
5397
@interface ArgumentName {

graalpython/com.oracle.graal.python.processor/src/com/oracle/graal/python/processor/ArgumentClinicModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public static ArgumentClinicData create(ArgumentClinic annotation, TypeElement t
162162
args[i] = String.valueOf(index);
163163
break;
164164
case ArgumentName:
165-
args[i] = String.format("\"%s\"", builtinAnnotation.argumentNames[index]);
165+
args[i] = String.format("\"%s\"", builtinAnnotation.argumentNames[index]);
166166
break;
167167
case DefaultValue:
168168
args[i] = annotation.defaultValue();

graalpython/com.oracle.graal.python.processor/src/com/oracle/graal/python/processor/ConverterFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ enum Param {
8484
Extra,
8585
}
8686

87-
8887
private static final Map<TypeElement, ConverterFactory> cache = new HashMap<>();
8988

9089
public final String fullClassName;
@@ -107,15 +106,15 @@ private ConverterFactory(String className, Param[] params, PrimitiveType[] accep
107106
this(CLINIC_PACKAGE + "." + className, className, "create", 0, params, acceptedPrimitiveTypes);
108107
}
109108

110-
private static final ConverterFactory BuiltinBoolean = new ConverterFactory("JavaBooleanConvertorNodeGen",
109+
private static final ConverterFactory BuiltinBoolean = new ConverterFactory("JavaBooleanConverterNodeGen",
111110
new Param[]{Param.DefaultValue},
112111
new PrimitiveType[]{PrimitiveType.Boolean});
113112

114-
private static final ConverterFactory BuiltinString = new ConverterFactory("JavaStringConvertorNodeGen",
113+
private static final ConverterFactory BuiltinString = new ConverterFactory("JavaStringConverterNodeGen",
115114
new Param[]{Param.BuiltinName},
116115
new PrimitiveType[]{});
117116

118-
private static final ConverterFactory BuiltinStringWithDefault = new ConverterFactory("JavaStringConvertorWithDefaultValueNodeGen",
117+
private static final ConverterFactory BuiltinStringWithDefault = new ConverterFactory("JavaStringConverterWithDefaultValueNodeGen",
119118
new Param[]{Param.BuiltinName, Param.DefaultValue, Param.UseDefaultForNone},
120119
new PrimitiveType[]{});
121120

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
* Implements the {@code bool} argument clinic conversion, which in CPython calls to
5151
* {@code PyObject_IsTrue}.
5252
*/
53-
public abstract class JavaBooleanConvertorNode extends ArgumentCastNode {
53+
public abstract class JavaBooleanConverterNode extends ArgumentCastNode {
5454
private final boolean defaultValue;
5555

56-
protected JavaBooleanConvertorNode(boolean defaultValue) {
56+
protected JavaBooleanConverterNode(boolean defaultValue) {
5757
this.defaultValue = defaultValue;
5858
}
5959

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
import com.oracle.truffle.api.dsl.Cached;
4949
import com.oracle.truffle.api.dsl.Specialization;
5050

51-
public abstract class JavaStringConvertorNode extends ArgumentCastNodeWithRaise {
51+
public abstract class JavaStringConverterNode extends ArgumentCastNodeWithRaise {
5252
private final String builtinName;
5353

54-
public JavaStringConvertorNode(String builtinName) {
54+
public JavaStringConverterNode(String builtinName) {
5555
this.builtinName = builtinName;
5656
}
5757

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
import com.oracle.graal.python.builtins.objects.PNone;
4444
import com.oracle.truffle.api.dsl.Specialization;
4545

46-
public abstract class JavaStringConvertorWithDefaultValue extends JavaStringConvertorNode {
46+
public abstract class JavaStringConverterWithDefaultValue extends JavaStringConverterNode {
4747
private final Object defaultValue;
4848
protected final boolean useDefaultForNone;
4949

50-
public JavaStringConvertorWithDefaultValue(String builtinName, Object defaultValue, boolean useDefaultForNone) {
50+
public JavaStringConverterWithDefaultValue(String builtinName, Object defaultValue, boolean useDefaultForNone) {
5151
super(builtinName);
5252
this.defaultValue = defaultValue;
5353
this.useDefaultForNone = useDefaultForNone;

0 commit comments

Comments
 (0)