@@ -375,7 +375,7 @@ private boolean process(SimpleName node) {
375375 error("Could not resolve method binding: " + builder.getFilename() + " @ " + node.getStartPosition() + " Text: " + node.toString());
376376 else */
377377 error (node , "Null IBinding: " + node .toString ());
378- return false ;
378+ return true ;
379379 }
380380
381381 switch (bind .getKind ()) {
@@ -445,6 +445,52 @@ else if (var.isParameter())
445445 }
446446 }
447447
448+ // This is basically the same as QualifiedName, except it has the potential to have a annotation in the middle.
449+ private boolean process (NameQualifiedType node ) {
450+ IBinding bind = node .resolveBinding ();
451+ if (bind == null ) {
452+ error (node , "Null IBinding: " + node .toString ());
453+ return false ;
454+ }
455+ switch (bind .getKind ()) {
456+ case IBinding .TYPE :
457+ ITypeBinding type = (ITypeBinding )bind ;
458+ if (type .isTypeVariable ()) {
459+ error (node , "Named Qualified generic type variable?: " + node .toString ());
460+ return false ;
461+ }
462+ // Qualified type names are make up of two parts, the qualifier, and the name.
463+ // Optionally they can have an array of annotations stuck in the middle.
464+ // The qualifier itself can be a NameQualifiedType, SimpleName, QualifiedName, or some other node.
465+ // We can recursively parse those nodes and export as normal.
466+ // We need to mark the name reference as not requiring a import so that we don't add one during Apply.
467+ // However, is the qualifier is a package, we need to output a special package reference so we can
468+ // know which class the package belongs to.
469+ IBinding qualifier = node .getQualifier ().resolveBinding ();
470+ if (qualifier .getKind () == IBinding .PACKAGE ) {
471+ Name pkg = node .getQualifier ();
472+ String clsName = getInternalName (type , node );
473+ builder .addClassPackageReference (pkg .getStartPosition (), pkg .getLength (), pkg .toString (), clsName );
474+ } else {
475+ acceptChild (node .getQualifier ());
476+ }
477+ acceptChildren (node .annotations ());
478+
479+ SimpleName name = node .getName ();
480+ ITypeBinding nameBind = name .resolveTypeBinding ();
481+ if (nameBind == null ) {
482+ error (node , "Null ITypeBinding: " + name .toString ());
483+ } else {
484+ String clsName = getInternalName (nameBind , name );
485+ builder .addClassReference (name .getStartPosition (), name .getLength (), name .toString (), clsName , true );
486+ }
487+ return false ;
488+ default :
489+ error (node , "Unknown IBinding Kind: " + bind .getKind () + " Text: " + node .toString ());
490+ return false ;
491+ }
492+ }
493+
448494 private boolean process (QualifiedName node ) {
449495 IBinding bind = node .resolveBinding ();
450496
@@ -740,7 +786,7 @@ public ASTVisitor getVisitor() {
740786 @ Override public boolean visit (ModuleDeclaration node ) { return true ; }
741787 @ Override public boolean visit (ModuleModifier node ) { return true ; }
742788 @ Override public boolean visit (ModuleQualifiedName node ) { return true ; }
743- @ Override public boolean visit (NameQualifiedType node ) { return true ; }
789+ @ Override public boolean visit (NameQualifiedType node ) { return process ( node ) ; }
744790 @ Override public boolean visit (NormalAnnotation node ) { return process (node ); }
745791 @ Override public boolean visit (NullLiteral node ) { return true ; }
746792 @ Override public boolean visit (NullPattern node ) { return true ; }
0 commit comments