I have an error on this old line of code that used to compile a year or so ago:
public class TreeWalker extends SimpleFileVisitor<Path>;
In the past, maybe upon my pressing Alt+Enter
but maybe automatically, Netbeans had an option to insert imports. For the line above, Netbeans would insert:
import java.nio.file.SimpleFileVisitor;
import java.nio.file.Path;
but now all I can see to do causes me to wind up with this too-hard-to-read version:
public class TreeWalker extends java.nio.file.SimpleFileVisitor<java.nio.file.Path>;
Pressing Alt+Enter
on lines like the original TreeWalker
line above offered an option to include the imports I listed above. That option is not there anymore. Just options to use java.nio.file.Path
or use java.nio.file.Path for all Path in source
and both produce the same objectional line of code.
The old Netbeans 7 or 8 option Add import for java.nio.file.Path
and this is still an option in Netbeans 14, but whatever it used to say, it's gone. Maybe this became frowned upon because some majority considered bad taste to have an excessively-long list of imports. Now I'm frowning. I'm getting eyestrained and brainfogged trying to figure out what dozens of once-clean-to-my-eyes-and-brain lines of code apparently still say.)
Pressing Alt+Shift+I
or Ctrl+Shift+I
produces the same sorts of verbose lines throughout what I used to consider very clean, readable code. So does Fix Imports...
in Source
.
Is the option to provide proper imports gone forever or is it somewhere I haven't looked yet?
EDIT
Here are my first few imports:
package copy;
import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.util.*;
import javax.swing.*;
I delete them and then right-click Fix Imports.
No import statements are added. Every affected line of code has a correct prefix added to it, which makes the code unreadable. Compare first line above (easily read) with the third (with two long prefixes making reading difficult).
How do I get Netbeans 8.2 to insert acceptable import statements and leave my statements alone?
SECOND EDIT
If I click Tools > Options > Editor > Hints > Imports, then maybe this is where my problem is. Not all boxes were checked, so I have just checked every box. And it warns me not to do Star imports and here's the popup of the choices I have and NONE is about adding an import statement and if I pick ANY of those, the line of code gets "mangled".
So I cleared Star import from warning me. Same problem. So I cleared ALL the boxes. Same problem. I could play on-off for 15 minutes with the Import options, but (a) I don't know if this is even where the trouble lies and (b) if it IS the problem area FOR ME, how do YOU have the options set?