Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mandy Chung <[email protected]>
  • Loading branch information
koppor and mlchung committed Jul 1, 2023
1 parent e62e7aa commit 1bc4f79
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ private void genModuleDescriptorsMethod(ClassBuilder clb) {
currentModuleInfos.add(moduleInfos.get(index));
}

final String helperMethodNamePrefix = "moduleDescriptorsSub";
String helperMethodNamePrefix = "sub";
final ClassDesc arrayListClassDesc = ClassDesc.ofInternalName("java/util/ArrayList");

final int firstVariableForDedup = nextLocalVar;
Expand Down Expand Up @@ -750,14 +750,15 @@ private void genModuleDescriptorsMethod(ClassBuilder clb) {
.areturn();
});

final int[] globalCount = {0};
for (final int[] index = {0}; index[0] < splitModuleInfos.size(); index[0]++) {
for (int n = 0, count = 0; n < splitModuleInfos.size(); count += splitModuleInfos.get(n).size(), n++) {
int index = n; // the index of which ModuleInfo being processed in the current batch
int start = count; // the start index to the return ModuleDescriptor array for the current batch
clb.withMethodBody(
helperMethodNamePrefix + index[0],
MethodTypeDesc.of(CD_void, CD_MODULE_DESCRIPTOR.arrayType(), arrayListClassDesc),
ACC_PUBLIC,
cob -> {
List<ModuleInfo> moduleInfosPackage = splitModuleInfos.get(index[0]);
List<ModuleInfo> currentBatch = splitModuleInfos.get(index[0]);

if (nextLocalVar > firstVariableForDedup) {
for (int i = nextLocalVar-1; i >= firstVariableForDedup; i--) {
Expand Down

0 comments on commit 1bc4f79

Please sign in to comment.