mirror of https://github.com/apache/maven.git
[MNG-8249] Fix annotation processor to correctly handle inner-inner classes
This commit is contained in:
parent
7ea795b789
commit
30f52651a7
|
@ -24,6 +24,7 @@ import javax.annotation.processing.SupportedAnnotationTypes;
|
||||||
import javax.annotation.processing.SupportedSourceVersion;
|
import javax.annotation.processing.SupportedSourceVersion;
|
||||||
import javax.lang.model.SourceVersion;
|
import javax.lang.model.SourceVersion;
|
||||||
import javax.lang.model.element.Element;
|
import javax.lang.model.element.Element;
|
||||||
|
import javax.lang.model.element.PackageElement;
|
||||||
import javax.lang.model.element.TypeElement;
|
import javax.lang.model.element.TypeElement;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
import javax.tools.FileObject;
|
import javax.tools.FileObject;
|
||||||
|
@ -71,14 +72,19 @@ public class DiIndexProcessor extends AbstractProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFullClassName(TypeElement typeElement) {
|
private String getFullClassName(TypeElement typeElement) {
|
||||||
String className = typeElement.getQualifiedName().toString();
|
StringBuilder className = new StringBuilder(typeElement.getSimpleName());
|
||||||
Element enclosingElement = typeElement.getEnclosingElement();
|
Element enclosingElement = typeElement.getEnclosingElement();
|
||||||
if (enclosingElement instanceof TypeElement) {
|
|
||||||
String enclosingClassName =
|
while (enclosingElement instanceof TypeElement) {
|
||||||
((TypeElement) enclosingElement).getQualifiedName().toString();
|
className.insert(0, "$").insert(0, ((TypeElement) enclosingElement).getSimpleName());
|
||||||
className = enclosingClassName + "$" + typeElement.getSimpleName();
|
enclosingElement = enclosingElement.getEnclosingElement();
|
||||||
}
|
}
|
||||||
return className;
|
|
||||||
|
if (enclosingElement instanceof PackageElement) {
|
||||||
|
className.insert(0, ".").insert(0, ((PackageElement) enclosingElement).getQualifiedName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return className.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFileIfChanged() throws IOException {
|
private void updateFileIfChanged() throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue