Skip to content

Commit 3aae490

Browse files
committed
avoid this-escape by making some methods final
1 parent 9de071f commit 3aae490

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Project.java

+16-14
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.configuration;
@@ -148,6 +148,7 @@ public Project() {
148148
*/
149149
public Project(String name) {
150150
this.name = name;
151+
this.tabSize = 0;
151152
}
152153

153154
/**
@@ -159,6 +160,7 @@ public Project(String name) {
159160
public Project(String name, String path) {
160161
this.name = name;
161162
this.path = Util.fixPathIfWindows(path);
163+
this.tabSize = 0;
162164
completeWithDefaults();
163165
}
164166

@@ -238,7 +240,7 @@ public void setIndexed(boolean flag) {
238240
*
239241
* @param tabSize the size of tabs in this project
240242
*/
241-
public void setTabSize(int tabSize) {
243+
public final void setTabSize(int tabSize) {
242244
this.tabSize = tabSize;
243245
}
244246

@@ -267,7 +269,7 @@ public boolean isNavigateWindowEnabled() {
267269
*
268270
* @param navigateWindowEnabled new value of navigateWindowEnabled
269271
*/
270-
public void setNavigateWindowEnabled(boolean navigateWindowEnabled) {
272+
public final void setNavigateWindowEnabled(boolean navigateWindowEnabled) {
271273
this.navigateWindowEnabled = navigateWindowEnabled;
272274
}
273275

@@ -288,7 +290,7 @@ public boolean isMergeCommitsEnabled() {
288290
/**
289291
* @param flag true if project should handle renamed files, false otherwise.
290292
*/
291-
public void setHandleRenamedFiles(boolean flag) {
293+
public final void setHandleRenamedFiles(boolean flag) {
292294
this.handleRenamedFiles = flag;
293295
}
294296

@@ -302,7 +304,7 @@ public boolean isHistoryEnabled() {
302304
/**
303305
* @param flag true if project should have history cache, false otherwise.
304306
*/
305-
public void setHistoryEnabled(boolean flag) {
307+
public final void setHistoryEnabled(boolean flag) {
306308
this.historyEnabled = flag;
307309
}
308310

@@ -316,7 +318,7 @@ public boolean isHistoryCacheEnabled() {
316318
/**
317319
* @param flag true if project should have history cache, false otherwise.
318320
*/
319-
public void setHistoryCacheEnabled(boolean flag) {
321+
public final void setHistoryCacheEnabled(boolean flag) {
320322
this.historyCacheEnabled = flag;
321323
}
322324

@@ -330,14 +332,14 @@ public boolean isAnnotationCacheEnabled() {
330332
/**
331333
* @param flag true if project should have annotation cache, false otherwise.
332334
*/
333-
public void setAnnotationCacheEnabled(boolean flag) {
335+
public final void setAnnotationCacheEnabled(boolean flag) {
334336
this.annotationCacheEnabled = flag;
335337
}
336338

337339
/**
338340
* @param flag true if project's repositories should deal with merge commits.
339341
*/
340-
public void setMergeCommitsEnabled(boolean flag) {
342+
public final void setMergeCommitsEnabled(boolean flag) {
341343
this.mergeCommitsEnabled = flag;
342344
}
343345

@@ -351,7 +353,7 @@ public boolean isHistoryBasedReindex() {
351353
/**
352354
* @param flag true if project should handle renamed files, false otherwise.
353355
*/
354-
public void setHistoryBasedReindex(boolean flag) {
356+
public final void setHistoryBasedReindex(boolean flag) {
355357
this.historyBasedReindex = flag;
356358
}
357359

@@ -419,7 +421,7 @@ public void addGroup(Group group) {
419421
}
420422
}
421423

422-
public void setBugPage(String bugPage) {
424+
public final void setBugPage(String bugPage) {
423425
this.bugPage = bugPage;
424426
}
425427

@@ -439,7 +441,7 @@ public String getBugPage() {
439441
* does not contain at least one capture group and the group does not
440442
* contain a single character
441443
*/
442-
public void setBugPattern(String bugPattern) throws PatternSyntaxException {
444+
public final void setBugPattern(String bugPattern) throws PatternSyntaxException {
443445
this.bugPattern = compilePattern(bugPattern);
444446
}
445447

@@ -459,7 +461,7 @@ public String getReviewPage() {
459461
}
460462
}
461463

462-
public void setReviewPage(String reviewPage) {
464+
public final void setReviewPage(String reviewPage) {
463465
this.reviewPage = reviewPage;
464466
}
465467

@@ -479,7 +481,7 @@ public String getReviewPattern() {
479481
* does not contain at least one capture group and the group does not
480482
* contain a single character
481483
*/
482-
public void setReviewPattern(String reviewPattern) throws PatternSyntaxException {
484+
public final void setReviewPattern(String reviewPattern) throws PatternSyntaxException {
483485
this.reviewPattern = compilePattern(reviewPattern);
484486
}
485487

@@ -504,7 +506,7 @@ public final void completeWithDefaults() {
504506
* 1) if the project has some non-default value; use that
505507
* 2) if the project has a default value; use the provided configuration
506508
*/
507-
if (getTabSize() == defaultCfg.getTabSize()) {
509+
if (tabSize == defaultCfg.getTabSize()) {
508510
setTabSize(env.getTabSize());
509511
}
510512

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,7 @@ private CountingWriter newXrefWriter(String path, File transientXref, boolean co
22092209
new FileOutputStream(transientXref))));
22102210
}
22112211

2212-
LockFactory pickLockFactory(RuntimeEnvironment env) {
2212+
final LockFactory pickLockFactory(RuntimeEnvironment env) {
22132213
switch (env.getLuceneLocking()) {
22142214
case ON:
22152215
case SIMPLE:

0 commit comments

Comments
 (0)