Skip to content

Commit cc02ab8

Browse files
committed
[GR-17457] Adopt the JLS modifier order for Java code and check it with CheckStyle
PullRequest: truffleruby/2498
2 parents fe39446 + 02780b1 commit cc02ab8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+280
-280
lines changed

src/main/.checkstyle_checks.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
<!--</module>-->
101101
<module name="EmptyForInitializerPad"/>
102102
<module name="EmptyForIteratorPad"/>
103-
<!--<module name="ModifierOrder"/>-->
103+
<module name="ModifierOrder"/>
104104
<!--<module name="DefaultComesLast"/>-->
105105
<module name="InnerAssignment">
106106
<property name="severity" value="ignore"/>

src/main/java/org/truffleruby/cext/UnwrapNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static UnwrapNode create() {
4646

4747
@GenerateUncached
4848
@ImportStatic(ValueWrapperManager.class)
49-
public static abstract class UnwrapNativeNode extends RubyBaseNode {
49+
public abstract static class UnwrapNativeNode extends RubyBaseNode {
5050

5151
public abstract Object execute(long handle);
5252

@@ -107,7 +107,7 @@ public static UnwrapNativeNode create() {
107107

108108
@GenerateUncached
109109
@ImportStatic(ValueWrapperManager.class)
110-
public static abstract class NativeToWrapperNode extends RubyBaseNode {
110+
public abstract static class NativeToWrapperNode extends RubyBaseNode {
111111

112112
public abstract ValueWrapper execute(long handle);
113113

@@ -155,7 +155,7 @@ public static NativeToWrapperNode create() {
155155
}
156156

157157
@ImportStatic({ ValueWrapperManager.class })
158-
public static abstract class ToWrapperNode extends RubyContextNode {
158+
public abstract static class ToWrapperNode extends RubyContextNode {
159159

160160
public abstract ValueWrapper execute(Object value);
161161

src/main/java/org/truffleruby/cext/ValueWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
public class ValueWrapper implements TruffleObject {
3434

3535
private final Object object;
36-
volatile private long handle;
36+
private volatile long handle;
3737
@SuppressWarnings("unused")
3838
// The handleBlock is held here to stop it being GCed and the memory freed while wrappers still
3939
// exist with handles in it.
40-
volatile private HandleBlock handleBlock;
40+
private volatile HandleBlock handleBlock;
4141

4242
public ValueWrapper(Object object, long handle, HandleBlock handleBlock) {
4343
this.object = object;

src/main/java/org/truffleruby/cext/ValueWrapperManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public HandleBlock makeNewBlock(RubyContext context) {
271271
}
272272

273273
@GenerateUncached
274-
public static abstract class GetHandleBlockHolderNode extends RubyBaseNode {
274+
public abstract static class GetHandleBlockHolderNode extends RubyBaseNode {
275275

276276
public abstract HandleThreadData execute(ValueWrapper wrapper);
277277

@@ -289,7 +289,7 @@ protected HandleThreadData getBlockHolder(ValueWrapper wrapper,
289289
return context.getValueWrapperManager().getBlockHolder();
290290
}
291291

292-
static protected Thread currentJavaThread(ValueWrapper wrapper) {
292+
protected static Thread currentJavaThread(ValueWrapper wrapper) {
293293
return Thread.currentThread();
294294
}
295295

@@ -303,7 +303,7 @@ public static GetHandleBlockHolderNode create() {
303303
}
304304

305305
@GenerateUncached
306-
public static abstract class AllocateHandleNode extends RubyBaseNode {
306+
public abstract static class AllocateHandleNode extends RubyBaseNode {
307307

308308
public abstract long execute(ValueWrapper wrapper);
309309

src/main/java/org/truffleruby/core/GCNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public abstract class GCNodes {
3939

4040
@Primitive(name = "gc_start")
41-
public static abstract class GCStartPrimitiveNode extends PrimitiveArrayArgumentsNode {
41+
public abstract static class GCStartPrimitiveNode extends PrimitiveArrayArgumentsNode {
4242

4343
@TruffleBoundary
4444
@Specialization
@@ -60,7 +60,7 @@ protected Object vmGCStart() {
6060
* Note that even when GC is triggered, there is not guarantee that the all the garbage has been cleared or all the
6161
* memory reclaimed. */
6262
@Primitive(name = "gc_force")
63-
public static abstract class GCForce extends PrimitiveArrayArgumentsNode {
63+
public abstract static class GCForce extends PrimitiveArrayArgumentsNode {
6464

6565
@TruffleBoundary
6666
@Specialization
@@ -136,7 +136,7 @@ protected long time() {
136136
}
137137

138138
@Primitive(name = "gc_stat")
139-
public static abstract class GCStatPrimitiveNode extends PrimitiveArrayArgumentsNode {
139+
public abstract static class GCStatPrimitiveNode extends PrimitiveArrayArgumentsNode {
140140

141141
@TruffleBoundary
142142
@Specialization

src/main/java/org/truffleruby/core/MarkingServiceNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class MarkingServiceNodes {
2626

2727
@GenerateUncached
28-
public static abstract class KeepAliveNode extends RubyBaseNode {
28+
public abstract static class KeepAliveNode extends RubyBaseNode {
2929

3030
public abstract void execute(Object object);
3131

@@ -47,7 +47,7 @@ public static KeepAliveNode create() {
4747
}
4848

4949
@GenerateUncached
50-
public static abstract class GetMarkerThreadLocalDataNode extends RubyBaseNode {
50+
public abstract static class GetMarkerThreadLocalDataNode extends RubyBaseNode {
5151

5252
public final MarkerThreadLocalData execute() {
5353
return executeInternal(Boolean.TRUE);
@@ -69,7 +69,7 @@ protected MarkerThreadLocalData getData(Object dynamicParameter,
6969
return context.getMarkingService().getThreadLocalData();
7070
}
7171

72-
static protected Thread currentJavaThread(Object dynamicParameter) {
72+
protected static Thread currentJavaThread(Object dynamicParameter) {
7373
return Thread.currentThread();
7474
}
7575

src/main/java/org/truffleruby/core/VMPrimitiveNodes.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected Object doCatch(Object tag, RubyProc block,
115115

116116
// The hard #exit!
117117
@Primitive(name = "vm_exit", lowerFixnum = 0)
118-
public static abstract class VMExitNode extends PrimitiveArrayArgumentsNode {
118+
public abstract static class VMExitNode extends PrimitiveArrayArgumentsNode {
119119

120120
@Specialization
121121
protected Object vmExit(int status) {
@@ -125,7 +125,7 @@ protected Object vmExit(int status) {
125125
}
126126

127127
@Primitive(name = "vm_extended_modules")
128-
public static abstract class VMExtendedModulesNode extends PrimitiveArrayArgumentsNode {
128+
public abstract static class VMExtendedModulesNode extends PrimitiveArrayArgumentsNode {
129129

130130
@Specialization
131131
protected Object vmExtendedModules(Object object, RubyProc block,
@@ -146,7 +146,7 @@ protected Object vmExtendedModules(Object object, RubyProc block,
146146
}
147147

148148
@Primitive(name = "vm_method_is_basic")
149-
public static abstract class VMMethodIsBasicNode extends PrimitiveArrayArgumentsNode {
149+
public abstract static class VMMethodIsBasicNode extends PrimitiveArrayArgumentsNode {
150150

151151
@Specialization
152152
protected boolean vmMethodIsBasic(RubyMethod method) {
@@ -156,7 +156,7 @@ protected boolean vmMethodIsBasic(RubyMethod method) {
156156
}
157157

158158
@Primitive(name = "vm_method_lookup")
159-
public static abstract class VMMethodLookupNode extends PrimitiveArrayArgumentsNode {
159+
public abstract static class VMMethodLookupNode extends PrimitiveArrayArgumentsNode {
160160

161161
@Specialization
162162
protected Object vmMethodLookup(VirtualFrame frame, Object receiver, Object name,
@@ -180,7 +180,7 @@ protected Object vmMethodLookup(VirtualFrame frame, Object receiver, Object name
180180
}
181181

182182
@Primitive(name = "vm_raise_exception")
183-
public static abstract class VMRaiseExceptionNode extends PrimitiveArrayArgumentsNode {
183+
public abstract static class VMRaiseExceptionNode extends PrimitiveArrayArgumentsNode {
184184

185185
@Specialization
186186
protected Object vmRaiseException(RubyException exception,
@@ -224,7 +224,7 @@ protected Object doThrow(Object tag, Object value) {
224224
}
225225

226226
@Primitive(name = "vm_watch_signal")
227-
public static abstract class VMWatchSignalNode extends PrimitiveArrayArgumentsNode {
227+
public abstract static class VMWatchSignalNode extends PrimitiveArrayArgumentsNode {
228228

229229
@TruffleBoundary
230230
@Specialization(guards = { "libSignalString.isRubyString(signalString)", "libAction.isRubyString(action)" })

src/main/java/org/truffleruby/core/array/library/ArrayStoreLibrary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static ArrayAllocator allocatorForValue(Object value) {
164164
}
165165

166166
/** Class for allocating array stores and querying properties related to that. */
167-
public static abstract class ArrayAllocator {
167+
public abstract static class ArrayAllocator {
168168

169169
/** Return a new array store with {@code capacity} elements. */
170170
public abstract Object allocate(int capacity);

src/main/java/org/truffleruby/core/array/library/NativeArrayStorage.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected static String toString(NativeArrayStorage storage) {
8282
}
8383

8484
@ExportMessage
85-
public static abstract class Read {
85+
public abstract static class Read {
8686

8787
@Specialization
8888
protected static Object read(NativeArrayStorage storage, int index,
@@ -92,7 +92,7 @@ protected static Object read(NativeArrayStorage storage, int index,
9292
}
9393

9494
@ExportMessage
95-
public static abstract class Write {
95+
public abstract static class Write {
9696

9797
@Specialization
9898
protected static void write(NativeArrayStorage storage, int index, Object value,
@@ -123,7 +123,7 @@ protected int capacity() {
123123
}
124124

125125
@ExportMessage
126-
public static abstract class Expand {
126+
public abstract static class Expand {
127127

128128
@Specialization
129129
protected static NativeArrayStorage expand(NativeArrayStorage storage, int newCapacity) {
@@ -149,7 +149,7 @@ protected Object[] boxedCopyOfRange(int start, int length,
149149

150150
@ExportMessage
151151
@ImportStatic(ArrayGuards.class)
152-
public static abstract class CopyContents {
152+
public abstract static class CopyContents {
153153

154154
@Specialization
155155
protected static void copyContents(

src/main/java/org/truffleruby/core/encoding/EncodingConverterNodes.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ protected RubyEncodingConverter allocate(RubyClass rubyClass) {
160160
}
161161

162162
@Primitive(name = "encoding_transcoders_from_encoding")
163-
public static abstract class TranscodersFromEncodingNode extends PrimitiveArrayArgumentsNode {
163+
public abstract static class TranscodersFromEncodingNode extends PrimitiveArrayArgumentsNode {
164164

165165
@TruffleBoundary
166166
@Specialization
@@ -183,7 +183,7 @@ protected Object search(RubySymbol source) {
183183
}
184184

185185
@Primitive(name = "encoding_converter_primitive_convert", lowerFixnum = { 3, 4, 5 })
186-
public static abstract class PrimitiveConvertNode extends PrimitiveArrayArgumentsNode {
186+
public abstract static class PrimitiveConvertNode extends PrimitiveArrayArgumentsNode {
187187

188188
@Child private RopeNodes.SubstringNode substringNode = RopeNodes.SubstringNode.create();
189189

@@ -339,7 +339,7 @@ private EConvResult convert(EConv ec, byte[] in, Ptr inPtr, int inStop, byte[] o
339339
}
340340

341341
@CoreMethod(names = "putback", optional = 1, lowerFixnum = 1)
342-
public static abstract class EncodingConverterPutbackNode extends CoreMethodArrayArgumentsNode {
342+
public abstract static class EncodingConverterPutbackNode extends CoreMethodArrayArgumentsNode {
343343

344344
@Child private StringNodes.MakeStringNode makeStringNode = StringNodes.MakeStringNode.create();
345345

@@ -378,7 +378,7 @@ private RubyString putback(RubyEncodingConverter encodingConverter, int n) {
378378
}
379379

380380
@Primitive(name = "encoding_converter_last_error")
381-
public static abstract class EncodingConverterLastErrorNode extends PrimitiveArrayArgumentsNode {
381+
public abstract static class EncodingConverterLastErrorNode extends PrimitiveArrayArgumentsNode {
382382

383383
@TruffleBoundary
384384
@Specialization
@@ -439,7 +439,7 @@ private RubySymbol eConvResultToSymbol(EConvResult result) {
439439
}
440440

441441
@CoreMethod(names = "primitive_errinfo")
442-
public static abstract class EncodingConverterErrinfoNode extends CoreMethodArrayArgumentsNode {
442+
public abstract static class EncodingConverterErrinfoNode extends CoreMethodArrayArgumentsNode {
443443

444444
@TruffleBoundary
445445
@Specialization

0 commit comments

Comments
 (0)