Skip to content

Commit

Permalink
Fix misordered modifiers 'final static'.
Browse files Browse the repository at this point in the history
Per the Java Language Specification (Java 17; https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.3.1), 'static' should appear before 'final'.

This is also consistent with source code analysis tools, like Checkstyle, rules: https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheck.html.

Fixes #2881.
  • Loading branch information
thachlp authored and odrotbohm committed Jul 24, 2023
1 parent 2bfa58d commit 9109378
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/springframework/data/domain/Range.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
public final class Range<T> {

private final static Range<?> UNBOUNDED = Range.of(Bound.unbounded(), Bound.unbounded());
private static final Range<?> UNBOUNDED = Range.of(Bound.unbounded(), Bound.unbounded());

/**
* The lower bound of the range.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private Class<PersistentPropertyAccessor<?>> createAccessorClass(PersistentEntit

/**
* Generates {@link PersistentPropertyAccessor} classes to access properties of a {@link PersistentEntity}. This code
* uses {@code private final static} held method handles which perform about the speed of native method invocations
* uses {@code private static final} held method handles which perform about the speed of native method invocations
* for property access which is restricted due to Java rules (such as private fields/methods) or private inner
* classes. All other scoped members (package default, protected and public) are accessed via field or property access
* to bypass reflection overhead. That's only possible if the type and the member access is possible from another
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/
class ProxyProjectionFactory implements ProjectionFactory, BeanClassLoaderAware {

final static GenericConversionService CONVERSION_SERVICE = new DefaultConversionService();
static final GenericConversionService CONVERSION_SERVICE = new DefaultConversionService();

static {
Jsr310Converters.getConvertersToRegister().forEach(CONVERSION_SERVICE::addConverter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
*/
public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware {

final static GenericConversionService CONVERSION_SERVICE = new DefaultConversionService();
static final GenericConversionService CONVERSION_SERVICE = new DefaultConversionService();
private static final Log logger = LogFactory.getLog(RepositoryFactorySupport.class);

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public class SpelEvaluator {

private final static SpelExpressionParser PARSER = new SpelExpressionParser();
private static final SpelExpressionParser PARSER = new SpelExpressionParser();

private final QueryMethodEvaluationContextProvider evaluationContextProvider;
private final Parameters<?, ?> parameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
*/
public class SpelQueryContext {

private final static String SPEL_PATTERN_STRING = "([:?])#\\{([^}]+)}";
private final static Pattern SPEL_PATTERN = Pattern.compile(SPEL_PATTERN_STRING);
private static final String SPEL_PATTERN_STRING = "([:?])#\\{([^}]+)}";
private static final Pattern SPEL_PATTERN = Pattern.compile(SPEL_PATTERN_STRING);

/**
* A function from the index of a SpEL expression in a query and the actual SpEL expression to the parameter name to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
@Deprecated
public class ChainedTransactionManager implements PlatformTransactionManager {

private final static Log logger = LogFactory.getLog(ChainedTransactionManager.class);
private static final Log logger = LogFactory.getLog(ChainedTransactionManager.class);

private final List<PlatformTransactionManager> transactionManagers;
private final SynchronizationManager synchronizationManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
public class QTypeContributor {

private final static Log logger = LogFactory.getLog(QTypeContributor.class);
private static final Log logger = LogFactory.getLog(QTypeContributor.class);

public static void contributeEntityPath(Class<?> type, GenerationContext context, @Nullable ClassLoader classLoader) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public void setStringArray(String[] stringArray) {

// DATACMNS-916
@AccessType(Type.FIELD)
private final static class PrivateFinalFieldAccess {
private static final class PrivateFinalFieldAccess {

int primitiveInteger;
int[] primitiveIntegerArray;
Expand Down Expand Up @@ -558,7 +558,7 @@ private final static class PrivateFinalFieldAccess {

// DATACMNS-916
@AccessType(Type.PROPERTY)
private final static class PrivateFinalPropertyAccess {
private static final class PrivateFinalPropertyAccess {

int primitiveInteger;
int[] primitiveIntegerArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
@SuppressWarnings("WeakerAccess") // public required for class generation due to visibility rules
public class ClassGeneratingPropertyAccessorFactoryTests {

private final static ClassGeneratingPropertyAccessorFactory factory = new ClassGeneratingPropertyAccessorFactory();
private final static SampleMappingContext mappingContext = new SampleMappingContext();
private static final ClassGeneratingPropertyAccessorFactory factory = new ClassGeneratingPropertyAccessorFactory();
private static final SampleMappingContext mappingContext = new SampleMappingContext();


@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public class PersistentPropertyAccessorTests {

private final static SampleMappingContext MAPPING_CONTEXT = new SampleMappingContext();
private static final SampleMappingContext MAPPING_CONTEXT = new SampleMappingContext();

@SuppressWarnings("unchecked")
public static List<Object[]> parameters() {
Expand Down

0 comments on commit 9109378

Please sign in to comment.