-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of import #121
Comments
That would make classes in the default package ambiguous, but I suppose that's already true due to the java.lang pruning that already exists. It would require doing an extra pass over the class before writing out the source code, but that could be done. |
If this is being added, I would request adding it as optional behavior. Personally, I much prefer FQNs because there's no ambiguity and it's easier to add in newlines than it is to jump back and forth between imports. For example, if there are 5 packages |
Thats why duplicate short class names should be referenced as FQNs (and only one "a" class should be imported) as i described before, fernflower for example uses the same behaviour. |
Yeah, I would use FQNs whenever there are multiple identifiers with the same short name to avoid confusion. The real question is how to handle java.lang classes and classes in the default package. There's also the separate question of class members shadowing classes, but I don't think there's any way to reliably avoid ambiguity in those cases. |
By the way, as long as you're here, do you have any opinions on new assembler syntax for the Java 9 Module attribute? |
If you want to make this an optional feature, then I have no objections. However, if you plan to make it the only style of output, then consider this example: The exampleGiven the following classes in the JAR:
and this code public class Test {
public int doMath() {
return a.a.a.addition(5, 6);
}
} It's immediately obvious which package's Re: |
If there is, for example, a class called "Integer" in the default package, you could use FQNs on the java.lang.Integer class. You can't handle that case in a good way. Maybe force FQNs if this happens I would also recommend to add an option to turn off imports. |
I'm all for FQN with the option of disabling them. If there's one thing I hate more than verbosity it's obscurity. |
Instead of using fully qualified names, you should use imports to make the code more readable. only use full names if an import with the same (short!) name already exists.
The text was updated successfully, but these errors were encountered: