Skip to content

Commit 8fddcaf

Browse files
committed
Sonarqube: Reduce visibility of mutable members
1 parent 62d74da commit 8fddcaf

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/MROMergeState.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@
2727

2828
class MROMergeState {
2929

30+
MROMergeState(PythonAbstractClass[] mro) {
31+
this.mro = mro;
32+
}
33+
3034
/** The mro of the base type we're representing. */
31-
public PythonAbstractClass[] mro;
35+
private final PythonAbstractClass[] mro;
3236

3337
/**
3438
* The index of the next item to be merged from mro, or mro.length if this base has been
3539
* completely merged.
3640
*/
37-
public int next;
41+
private int next;
3842

3943
public boolean isMerged() {
4044
return mro.length == next;
@@ -64,5 +68,4 @@ public boolean pastnextContains(PythonAbstractClass candidate) {
6468
}
6569
return false;
6670
}
67-
6871
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/TypeNodes.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,12 +719,10 @@ private static PythonAbstractClass[] computeMethodResolutionOrder(PythonAbstract
719719
MROMergeState[] toMerge = new MROMergeState[baseClasses.length + 1];
720720

721721
for (int i = 0; i < baseClasses.length; i++) {
722-
toMerge[i] = new MROMergeState();
723-
toMerge[i].mro = GetMroNode.getUncached().execute(baseClasses[i]);
722+
toMerge[i] = new MROMergeState(GetMroNode.getUncached().execute(baseClasses[i]));
724723
}
725724

726-
toMerge[baseClasses.length] = new MROMergeState();
727-
toMerge[baseClasses.length].mro = baseClasses;
725+
toMerge[baseClasses.length] = new MROMergeState(baseClasses);
728726
ArrayList<PythonAbstractClass> mro = new ArrayList<>();
729727
mro.add(cls);
730728
currentMRO = mergeMROs(toMerge, mro);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/zipimporter/PZipImporter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,22 @@ private static enum EntryType {
7575

7676
private static class SearchOrderEntry {
7777

78-
public String suffix;
79-
public EnumSet<EntryType> type;
78+
String suffix;
79+
EnumSet<EntryType> type;
8080

81-
public SearchOrderEntry(String suffix, EnumSet<EntryType> type) {
81+
SearchOrderEntry(String suffix, EnumSet<EntryType> type) {
8282
this.suffix = suffix;
8383
this.type = type;
8484
}
8585
}
8686

8787
protected static class ModuleCodeData {
8888

89-
public String code;
90-
public boolean isPackage;
91-
public String path;
89+
String code;
90+
boolean isPackage;
91+
String path;
9292

93-
public ModuleCodeData(String code, boolean isPackage, String path) {
93+
ModuleCodeData(String code, boolean isPackage, String path) {
9494
this.code = code;
9595
this.isPackage = isPackage;
9696
this.path = path;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/ArgListCompiler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
import java.util.ArrayList;
4646
import java.util.List;
4747

48-
import org.antlr.v4.runtime.ParserRuleContext;
49-
5048
import com.oracle.graal.python.parser.antlr.Python3BaseVisitor;
5149
import com.oracle.graal.python.parser.antlr.Python3Parser.DefparameterContext;
5250
import com.oracle.graal.python.parser.antlr.Python3Parser.KwargsparameterContext;
@@ -56,8 +54,10 @@
5654
import com.oracle.graal.python.parser.antlr.Python3Parser.VsplatparameterContext;
5755
import com.oracle.graal.python.runtime.PythonParser.ParserErrorCallback;
5856

57+
import org.antlr.v4.runtime.ParserRuleContext;
58+
5959
public class ArgListCompiler<T> extends Python3BaseVisitor<T> {
60-
public boolean arglist, keywordlist;
60+
private boolean arglist, keywordlist;
6161
public final List<String> names;
6262
public final List<String> fpnames;
6363
public final List<ParserRuleContext> init_code;

0 commit comments

Comments
 (0)