Skip to content

Commit

Permalink
fix ProjectClassProvider returns types and AbstractJarIndex access
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed Sep 18, 2024
1 parent e870ea7 commit ee0feb0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 5 additions & 1 deletion enigma/src/main/java/org/quiltmc/enigma/api/Enigma.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;

public class Enigma {
Expand Down Expand Up @@ -134,7 +136,9 @@ private void index(JarIndex index, ProjectClassProvider classProvider, ProgressL
for (var service : indexers) {
if (!(libraries && !service.shouldIndexLibraries())) {
progress.step(i++, I18n.translateFormatted("progress." + progressKey + ".custom_indexing.indexer", service.getId()));
service.acceptJar(libraries ? classProvider.getLibraryClassNames() : classProvider.getMainClassNames(), classProvider, index);
var names = libraries ? classProvider.getLibraryClassNames() : classProvider.getMainClassNames();
Set<String> scope = new HashSet<>(names);
service.acceptJar(scope, classProvider, index);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class ProjectClassProvider implements ClassProvider {
@Nullable
Expand Down Expand Up @@ -80,11 +78,11 @@ public Collection<String> getClassNames() {
return this.classNames;
}

public Set<String> getMainClassNames() {
return this.main != null ? new HashSet<>(this.main.getClassNames()) : Collections.emptySet();
public Collection<String> getMainClassNames() {
return this.main != null ? this.main.getClassNames() : Collections.emptySet();
}

public Set<String> getLibraryClassNames() {
return this.libraries != null ? new HashSet<>(this.libraries.getClassNames()) : Collections.emptySet();
public Collection<String> getLibraryClassNames() {
return this.libraries != null ? this.libraries.getClassNames() : Collections.emptySet();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.quiltmc.enigma.api.translation.representation.entry.ParentedEntry;
import org.quiltmc.enigma.util.I18n;

import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down Expand Up @@ -75,7 +76,7 @@ public <T extends JarIndexer> T getIndex(Class<T> clazz) {
* @param classProvider a class provider containing all classes in the jar
* @param progress a progress listener to track index completion
*/
public void indexJar(Set<String> classNames, ClassProvider classProvider, ProgressListener progress) {
protected void indexJar(Collection<String> classNames, ClassProvider classProvider, ProgressListener progress) {
// for use in processIndex
this.progress = progress;

Expand Down

0 comments on commit ee0feb0

Please sign in to comment.