@@ -82,7 +82,7 @@ public void cleanUp() throws Exception {
8282 @ Test
8383 public void testCheckBuild () throws Exception {
8484 project .build (IncrementalProjectBuilder .FULL_BUILD , null );
85- assertEquals (Set .of ("A.class" , "B.class" , "pack" ),
85+ assertEquals (Set .of ("A.class" , "B.class" , "pack" , "test" ),
8686 new HashSet <>(Arrays .asList (new File (project .getLocation ().toFile (), "bin" ).list ())));
8787 assertArrayEquals (new String [] { "Packaged.class" },
8888 new File (project .getLocation ().toFile (), "bin/pack" ).list ());
@@ -142,6 +142,7 @@ public void testBuildMultipleOutputDirectories2() throws Exception {
142142 }
143143
144144 // https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/issues/955
145+ @ SuppressWarnings ("restriction" )
145146 @ Test
146147 public void testlombok () throws Exception {
147148 Assume .assumeTrue ("javac is not set, skip it" , CompilationUnit .DOM_BASED_OPERATIONS );
@@ -157,6 +158,18 @@ public void testlombok() throws Exception {
157158 assertArrayEquals (new IProblem [0 ], dom .getProblems ());
158159 }
159160
161+ // https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/issues/1140
162+ @ Test
163+ public void testUnusedImport () throws Exception {
164+ ResourcesPlugin .getWorkspace ().build (IncrementalProjectBuilder .CLEAN_BUILD , null );
165+ ResourcesPlugin .getWorkspace ().build (IncrementalProjectBuilder .FULL_BUILD , null );
166+ waitForBackgroundJobs ();
167+ ICompilationUnit unit = (ICompilationUnit )JavaCore .create (project ).findElement (Path .fromOSString ("test/TestUnusedImport.java" ));
168+ unit .becomeWorkingCopy (null );
169+ var dom = unit .reconcile (AST .getJLSLatest (), true , unit .getOwner (), null );
170+ assertArrayEquals (new IProblem [0 ], dom .getProblems ());
171+ }
172+
160173 static IProject importProject (String locationInBundle ) throws URISyntaxException , IOException , CoreException {
161174 File file = new File (FileLocator .toFileURL (RegressionTests .class .getResource ("/" + locationInBundle + "/.project" )).toURI ());
162175 IPath dotProjectPath = Path .fromOSString (file .getAbsolutePath ());
0 commit comments