[
https://issues.jboss.org/browse/ROASTER-128?page=com.atlassian.jira.plugi...
]
George Gastaldi commented on ROASTER-128:
-----------------------------------------
Hi Kai, thanks for your feedback,
Yes, this looks like a bug indeed. In this case, the second field type should be the fully
qualified name instead.
Are you interested in providing a PR with the changes you described? I'll be glad to
review if you do.
The sources are in
https://github.com/forge/roaster
Best Regards,
George Gastaldi
Roaster doesn't check for invalid imports
-----------------------------------------
Key: ROASTER-128
URL:
https://issues.jboss.org/browse/ROASTER-128
Project: Roaster
Issue Type: Bug
Components: JDT
Affects Versions: 2.20.0.Final
Environment: Windows 10, Java 8
Reporter: Kai Müller
Priority: Major
Hi guys,
while working with your library I ran into the following problem. The method setType adds
an import if possible and needed. But it doesn't check, if e.g. the class to import is
equal to the current class or if another import with the same class name but other package
exists.
The provided example leads to the following result:
package testPackage;
import package1.Type;
import package2.Type;
public class Main {
Type field1;
Type field2;
}
This class will not compile and there is no workaround, because there is no way to tell
this method NOT to add an import.
In addition, I want to ask you, if you can check the following javadoc of
"Importer.Import addImport(Type<?> type)". In this doc it's mentioned
that "The method returns the name that can be used inside the code to reference the
type". But the returned "Import" object has no such method. I's need to
be done via the "resolveType" of the "Importer" object. I would
expect, that either the javadoc should be changed or the "Import" get's an
additional method.
Thank you very much,
Kai
--
This message was sent by Atlassian Jira
(v7.12.1#712002)