527 memberEnter(tree.defs, env); |
527 memberEnter(tree.defs, env); |
528 } |
528 } |
529 |
529 |
530 // process the non-static imports and the static imports of types. |
530 // process the non-static imports and the static imports of types. |
531 public void visitImport(JCImport tree) { |
531 public void visitImport(JCImport tree) { |
532 JCTree imp = tree.qualid; |
532 JCFieldAccess imp = (JCFieldAccess)tree.qualid; |
533 Name name = TreeInfo.name(imp); |
533 Name name = TreeInfo.name(imp); |
534 TypeSymbol p; |
|
535 |
534 |
536 // Create a local environment pointing to this tree to disable |
535 // Create a local environment pointing to this tree to disable |
537 // effects of other imports in Resolve.findGlobalType |
536 // effects of other imports in Resolve.findGlobalType |
538 Env<AttrContext> localEnv = env.dup(tree); |
537 Env<AttrContext> localEnv = env.dup(tree); |
539 |
538 |
540 // Attribute qualifying package or class. |
539 TypeSymbol p = attr.attribImportQualifier(tree, localEnv).tsym; |
541 JCFieldAccess s = (JCFieldAccess) imp; |
|
542 p = attr. |
|
543 attribTree(s.selected, |
|
544 localEnv, |
|
545 tree.staticImport ? TYP : (TYP | PCK), |
|
546 Type.noType).tsym; |
|
547 if (name == names.asterisk) { |
540 if (name == names.asterisk) { |
548 // Import on demand. |
541 // Import on demand. |
549 chk.checkCanonical(s.selected); |
542 chk.checkCanonical(imp.selected); |
550 if (tree.staticImport) |
543 if (tree.staticImport) |
551 importStaticAll(tree.pos, p, env); |
544 importStaticAll(tree.pos, p, env); |
552 else |
545 else |
553 importAll(tree.pos, p, env); |
546 importAll(tree.pos, p, env); |
554 } else { |
547 } else { |
555 // Named type import. |
548 // Named type import. |
556 if (tree.staticImport) { |
549 if (tree.staticImport) { |
557 importNamedStatic(tree.pos(), p, name, localEnv); |
550 importNamedStatic(tree.pos(), p, name, localEnv); |
558 chk.checkCanonical(s.selected); |
551 chk.checkCanonical(imp.selected); |
559 } else { |
552 } else { |
560 TypeSymbol c = attribImportType(imp, localEnv).tsym; |
553 TypeSymbol c = attribImportType(imp, localEnv).tsym; |
561 chk.checkCanonical(imp); |
554 chk.checkCanonical(imp); |
562 importNamed(tree.pos(), c, env); |
555 importNamed(tree.pos(), c, env); |
563 } |
556 } |