Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,16 @@ public void getClassesInPackage(List<ClassFile> addTo, String[] pkgs,
public List<ClassFile> getClassesWithNamesStartingWith(String prefix) {
List<ClassFile> res = new ArrayList<>();
String currentPkg = ""; // Don't use null; we're appending to it
packageMap.getClassesWithNamesStartingWith(info, prefix, currentPkg,
res);
try {
info.bulkClassFileCreationStart();
try {
packageMap.getClassesWithNamesStartingWith(info, prefix, currentPkg, res);
} finally {
info.bulkClassFileCreationEnd();
}
} catch (final IOException ioe) {
ioe.printStackTrace();
}
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ public void getClassesInPackage(LibraryInfo info, List<ClassFile> addTo,

/**
* Method used to recursively scan our package map for classes whose names
* start with a given prefix, ignoring case.
* start with a given prefix, ignoring case.<p>
*
* Note: This method assumes you are fetching class files in bulk from the
* {@code LibraryInfo} instance.
*
* @param prefix The prefix that the unqualified class names must match
* (ignoring case).
Expand Down Expand Up @@ -387,7 +390,7 @@ void getClassesWithNamesStartingWith(LibraryInfo info, String prefix,
if (cf==null) {
String fqClassName = currentPkg + className + ".class";
try {
cf = info.createClassFile(fqClassName);
cf = info.createClassFileBulk(fqClassName);
cfEntry.setValue(cf); // Update the map
} catch (IOException ioe) {
ioe.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void testGetClassesWithNamesStartingWith_matches() throws IOException {
LibraryInfo mockInfo = Mockito.mock(LibraryInfo.class);
doReturn(System.currentTimeMillis()).when(mockInfo).getLastModified();
doReturn(packageMap).when(mockInfo).createPackageMap();
when(mockInfo.createClassFile(anyString())).thenAnswer(input -> {
when(mockInfo.createClassFileBulk(anyString())).thenAnswer(input -> {
ClassFile cf = Mockito.mock(ClassFile.class);
doReturn(input.getArgument(0)).when(cf).getClassName(anyBoolean());
return cf;
Expand Down