[forge-issues] [JBoss JIRA] (ROASTER-129) Improve the javadoc of addImport

Kai Müller (Jira) issues at jboss.org
Wed Jan 16 14:44:03 EST 2019


Kai Müller created ROASTER-129:
----------------------------------

             Summary: 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


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



--
This message was sent by Atlassian Jira
(v7.12.1#712002)



More information about the forge-issues mailing list