netbeans
netbeans copied to clipboard
ComputeImports: fix package computation.
attempt to fix #7073, #5537 and #6902
-
getPackageElement()requires the full package String or it returns null (e.gjavaxis not sufficient) - this caused a bug where the fix-imports-action imported members which matched root packages of random fully qualified declarations (e.g imports)
// hit ctrl+shift+i, it shouldn't import anything
import java.util.List;
public class FixImports {
public static class SomeClass2 {
public static String java(String value) {
return value;
}
}
}
Minimal nitpick: The test sources seem to be missing package declarations.
@matthiasblaesing good that you mentioned this since I misunderstood how the test works. It uses now one test file since all it has to do is to check that the computed candidates are empty.