-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I don't know if it's my maven setup, windows, or my JVM, but this block of code leads to errors:
private String _getPackage(Element pElement)
{
Element element = pElement;
while (element != null)
{
if (element.getKind() == ElementKind.PACKAGE)
return element.toString();
Element enclosingElement = element.getEnclosingElement();
if (ENCLOSING_TYPES.contains(enclosingElement.getKind()))
element = enclosingElement;
else
{
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Element type not supported", pElement);
break;
}
}
return "";
}In my setup, the element.toString returns "package com.x.y.z" when it sould be "com.x.y.z"
I remedied this with:
private String _getPackage(Element pElement)
{
Element element = pElement;
while (element != null)
{
if (element.getKind() == ElementKind.PACKAGE)
return ((javax.lang.model.element.PackageElement)element).getQualifiedName().toString();
Element enclosingElement = element.getEnclosingElement();
if (ENCLOSING_TYPES.contains(enclosingElement.getKind()))
element = enclosingElement;
else
{
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Element type not supported", pElement);
break;
}
}
return "";
}Metadata
Metadata
Assignees
Labels
No labels