| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8902ed1 commit b7011c8
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | package processing.mode.java.pdex; | |
| 2 | 2 | ||
| 3 | 3 | import com.google.classpath.ClassPath; | |
| 4 | + import com.google.classpath.ClassPathFactory; | ||
| 4 | 5 | import com.google.classpath.RegExpResourceFilter; | |
| 5 | 6 | ||
| 6 | 7 | import org.eclipse.jdt.core.compiler.IProblem; | |
@@ -44,6 +45,7 @@ | |||
| 44 | 45 | import java.util.concurrent.ScheduledExecutorService; | |
| 45 | 46 | import java.util.concurrent.ScheduledFuture; | |
| 46 | 47 | import java.util.concurrent.TimeUnit; | |
| 48 | + import java.util.concurrent.atomic.AtomicReference; | ||
| 47 | 49 | import java.util.function.Consumer; | |
| 48 | 50 | import java.util.function.Predicate; | |
| 49 | 51 | import java.util.regex.Pattern; | |
@@ -1106,6 +1108,8 @@ private void handleSketchProblems(PreprocessedSketch ps) { | |||
| 1106 | 1108 | } | |
| 1107 | 1109 | } | |
| 1108 | 1110 | ||
| 1111 | + AtomicReference<ClassPath> searchClassPath = new AtomicReference<>(null); | ||
| 1112 | + | ||
| 1109 | 1113 | if (problems.isEmpty()) { | |
| 1110 | 1114 | List<Problem> cuProblems = Arrays.stream(iproblems) | |
| 1111 | 1115 | // Filter Warnings if they are not enabled | |
@@ -1129,7 +1133,8 @@ private void handleSketchProblems(PreprocessedSketch ps) { | |||
| 1129 | 1133 | ||
| 1130 | 1134 | // Handle import suggestions | |
| 1131 | 1135 | if (JavaMode.importSuggestEnabled && isUndefinedTypeProblem(iproblem)) { | |
| 1132 | - ClassPath cp = ps.searchClassPath; | ||
| 1136 | + ClassPath cp = searchClassPath.updateAndGet(prev -> prev != null ? | ||
| 1137 | + prev : new ClassPathFactory().createFromPaths(ps.searchClassPathArray)); | ||
| 1133 | 1138 | String[] s = suggCache.computeIfAbsent(iproblem.getArguments()[0], | |
| 1134 | 1139 | name -> getImportSuggestions(cp, name)); | |
| 1135 | 1140 | p.setImportSuggestions(s); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,7 @@ public class PreprocessedSketch { | |||
| 26 | 26 | public final ClassPath classPath; | |
| 27 | 27 | public final URLClassLoader classLoader; | |
| 28 | 28 | ||
| 29 | - public final ClassPath searchClassPath; | ||
| 29 | + public final String[] searchClassPathArray; | ||
| 30 | 30 | ||
| 31 | 31 | public final int[] tabStartOffsets; | |
| 32 | 32 | ||
@@ -206,7 +206,7 @@ public static class Builder { | |||
| 206 | 206 | public ClassPath classPath; | |
| 207 | 207 | public URLClassLoader classLoader; | |
| 208 | 208 | ||
| 209 | - public ClassPath searchClassPath; | ||
| 209 | + public String[] searchClassPathArray; | ||
| 210 | 210 | ||
| 211 | 211 | public int[] tabStartOffsets = new int[0]; | |
| 212 | 212 | ||
@@ -242,7 +242,7 @@ private PreprocessedSketch(Builder b) { | |||
| 242 | 242 | classPath = b.classPath; | |
| 243 | 243 | classLoader = b.classLoader; | |
| 244 | 244 | ||
| 245 | - searchClassPath = b.searchClassPath; | ||
| 245 | + searchClassPathArray = b.searchClassPathArray; | ||
| 246 | 246 | ||
| 247 | 247 | tabStartOffsets = b.tabStartOffsets; | |
| 248 | 248 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -341,7 +341,7 @@ private PreprocessedSketch preprocessSketch(PreprocessedSketch prevResult) { | |||
| 341 | 341 | ||
| 342 | 342 | boolean rebuildClassPath = reloadCodeFolder || rebuildLibraryClassPath || | |
| 343 | 343 | prevResult.classLoader == null || prevResult.classPath == null || | |
| 344 | - prevResult.classPathArray == null || prevResult.searchClassPath == null; | ||
| 344 | + prevResult.classPathArray == null || prevResult.searchClassPathArray == null; | ||
| 345 | 345 | ||
| 346 | 346 | if (reloadCodeFolder) { | |
| 347 | 347 | codeFolderClassPath = buildCodeFolderClassPath(sketch); | |
@@ -381,13 +381,12 @@ private PreprocessedSketch preprocessSketch(PreprocessedSketch prevResult) { | |||
| 381 | 381 | searchClassPath.addAll(coreLibraryClassPath); | |
| 382 | 382 | searchClassPath.addAll(codeFolderClassPath); | |
| 383 | 383 | ||
| 384 | - String[] searchClassPathArray = searchClassPath.stream().toArray(String[]::new); | ||
| 385 | - result.searchClassPath = classPathFactory.createFromPaths(searchClassPathArray); | ||
| 384 | + result.searchClassPathArray = searchClassPath.stream().toArray(String[]::new); | ||
| 386 | 385 | } | |
| 387 | 386 | } else { | |
| 388 | 387 | result.classLoader = prevResult.classLoader; | |
| 389 | 388 | result.classPath = prevResult.classPath; | |
| 390 | - result.searchClassPath = prevResult.searchClassPath; | ||
| 389 | + result.searchClassPathArray = prevResult.searchClassPathArray; | ||
| 391 | 390 | result.classPathArray = prevResult.classPathArray; | |
| 392 | 391 | } | |
| 393 | 392 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments