Skip to content

Commit

Permalink
ROASTER-116: Fixed FQN interface name
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jan 9, 2017
1 parent 73f9839 commit ec80034
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,10 @@ public List<String> getInterfaces()
for (Type type : superTypes)
{
String name = JDTHelper.getTypeName(type);
if (Types.isSimpleName(name) && this.hasImport(name))
String rawName = Types.stripGenerics(name);
if (Types.isSimpleName(rawName) && this.hasImport(rawName))
{
Import imprt = this.getImport(name);
Import imprt = this.getImport(rawName);
String pkg = imprt.getPackage();
if (!Strings.isNullOrEmpty(pkg))
{
Expand Down Expand Up @@ -464,13 +465,15 @@ public O implementInterface(JavaInterface<?> type)
{
O obj = addInterface(type);

if (type instanceof JavaInterfaceSource) {
if (type instanceof JavaInterfaceSource)
{
Set<Import> usedImports = new HashSet<Import>();

JavaInterfaceSource interfaceSource = (JavaInterfaceSource) type;
for (MethodSource<JavaInterfaceSource> method : interfaceSource.getMethods())
{
if (method.isDefault()) {
if (method.isDefault())
{
// Do not add default implementations
continue;
}
Expand Down Expand Up @@ -674,7 +677,8 @@ public List<PropertySource<O>> getProperties(Class<?> type)
final Set<String> propertyNames = new LinkedHashSet<String>();
for (MethodSource<O> method : getMethods())
{
if ((isAccessor(method) || isMutator(method)) && method.getReturnType().getQualifiedName().equals(type.getCanonicalName()))
if ((isAccessor(method) || isMutator(method))
&& method.getReturnType().getQualifiedName().equals(type.getCanonicalName()))
{
propertyNames.add(extractPropertyName(method));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void testGenericTypesExtendsInterfaceDeclaration()
String data = "import com.foo.Bar;\n"
+ "public interface Foo extends Bar<String,Integer>{}";
JavaInterfaceSource iface = Roaster.parse(JavaInterfaceSource.class, data);
assertThat(iface.getInterfaces(), hasItem("Bar<String,Integer>"));
assertThat(iface.getInterfaces(), hasItem("com.foo.Bar<String,Integer>"));
}

}

0 comments on commit ec80034

Please sign in to comment.