[
https://issues.jboss.org/browse/ROASTER-128?page=com.atlassian.jira.plugi...
]
Kai Müller commented on ROASTER-128:
------------------------------------
Hello George,
thank you for that fast response. I already investigated the issue furthermore and I have
an idea how to solve it.
I'll prepare a fix, make a PR and let you know when it's done.
Have a nice weekend,
Kai
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)