@@ -184,7 +184,7 @@ private static void configureOptions(IJavaProject javaProject, Context context,
184184 if (limitModules != null && !limitModules .isBlank ()) {
185185 options .put (Option .LIMIT_MODULES , limitModules );
186186 }
187- if (!options .isSet (Option .RELEASE ) && javaProject instanceof JavaProject ) {
187+ if (!options .isSet (Option .RELEASE ) && javaProject instanceof JavaProject jp && jp . exists () ) {
188188 try {
189189 IType systemType = javaProject .findType (Object .class .getName ());
190190 if (systemType != null ) {
@@ -262,7 +262,7 @@ private static void configurePaths(JavaProject javaProject, Context context, Jav
262262
263263 if (output != null ) {
264264 fileManager .setLocation (StandardLocation .CLASS_OUTPUT , List .of (ensureDirExists (output )));
265- } else if (javaProject .getProject () != null ) {
265+ } else if (javaProject .getProject () != null && javaProject . getProject (). exists () ) {
266266 IResource member = javaProject .getProject ().getParent ().findMember (javaProject .getOutputLocation ());
267267 if ( member != null ) {
268268 File f = member .getLocation ().toFile ();
@@ -308,7 +308,7 @@ private static void configurePaths(JavaProject javaProject, Context context, Jav
308308 .toList ());
309309 classpathEnabled = true ;
310310 }
311- if (!classpathEnabled ) {
311+ if (!classpathEnabled && javaProject . exists () ) {
312312// Set<JavaProject> moduleProjects = Set.of();
313313 IClasspathEntry [] expandedClasspath = javaProject .getExpandedClasspath ();
314314 Set <JavaProject > moduleProjects = Stream .of (expandedClasspath )
@@ -395,6 +395,9 @@ public static <T> boolean isEmpty(List<T> list) {
395395 private static Collection <File > classpathEntriesToFiles (JavaProject project , boolean source , Predicate <IClasspathEntry > select ) {
396396 try {
397397 LinkedHashSet <File > res = new LinkedHashSet <>();
398+ if ( !project .exists ())
399+ return res ;
400+
398401 ArrayList <IClasspathEntry > seen = new ArrayList <>();
399402 if (project .getModuleDescription () == null ) {
400403 IPath outputLocation = project .getOutputLocation ();
@@ -484,7 +487,7 @@ private static File ensureDirExists(File file) {
484487 }
485488
486489 public static boolean isTest (IJavaProject project , org .eclipse .jdt .internal .compiler .env .ICompilationUnit [] units ) {
487- if (units == null || project == null || project .getResource () == null ) {
490+ if (units == null || project == null || project .getResource () == null || ! project . exists () ) {
488491 return false ;
489492 }
490493 Set <IPath > testFolders = new HashSet <>();
0 commit comments