]
George Gastaldi commented on ROASTER-129:
-----------------------------------------
Can you elaborate on how do you plan to change the behavior of the returned import
object?
Improve the javadoc of addImport
--------------------------------
Key: ROASTER-129
URL:
https://issues.jboss.org/browse/ROASTER-129
Project: Roaster
Issue Type: Enhancement
Affects Versions: 2.20.5.Final
Environment: Windows 10, Java 8
Reporter: Kai Müller
Priority: Optional
Hello all,
I want to provide an idea for an enhancement of the javadoc of "Importer.Import
addImport(Type<?> type)".
Currently the javadoc says: "The method returns the name that can be used inside the
code to reference the type".
Please corret me if I'm wrong, but the returned Import object has two methods (simple
name and qualified name), but the result of them are dynamical generated. That means,
regardless if an import happened or not, both methods each returning in both cases the
same result.
So, I want to ask you, about your opinion to change either the code (complex) or the
javadoc (simple). In the case of the second here is an idea: "The method returns a
import object which can be used for further working with the type. Please note, that in
the case the import was skipped because of duplicate import the result of the call is the
same, as the import woudn't be skipped".
Sample code:
public static void main(final String[] args) {
final JavaClassSource javaClassSource = Roaster.create(JavaClassSource.class);
final Import imprtOne = javaClassSource.addImport("packageOne.ClassOne");
final Import imprtTwo = javaClassSource.addImport("packageOne.ClassOne");
System.out.println(imprtOne.getQualifiedName());
System.out.println(imprtOne.getSimpleName());
System.out.println(imprtTwo.getQualifiedName());
System.out.println(imprtTwo.getSimpleName());
}
Best regards,
Kai