public boolean declarationsAreInDefaultPackage() { return getPackageDeclaration() == null; }
private String getClassName(ASTCompilationUnit node) { ASTAnyTypeDeclaration classDecl = node.getFirstDescendantOfType(ASTAnyTypeDeclaration.class); if (classDecl == null) { // package-info.java? return null; } if (node.declarationsAreInDefaultPackage()) { return classDecl.getImage(); } importedOnDemand.add(node.getPackageDeclaration().getPackageNameImage()); return classDecl.getQualifiedName().toString(); }
/** * Creates a new global scope for an AST node. The new scope is stored on * the scope stack. * * @param node * the AST node for which the scope has to be created. */ private void createSourceFileScope(ASTCompilationUnit node) { // When we do full symbol resolution, we'll need to add a truly // top-level GlobalScope. SourceFileScope scope; ASTPackageDeclaration n = node.getPackageDeclaration(); if (n != null) { scope = new SourceFileScope(classLoader, n.jjtGetChild(0).getImage()); } else { scope = new SourceFileScope(classLoader); } scope.configureImports(node.findChildrenOfType(ASTImportDeclaration.class)); scopes.push(scope); node.setScope(scope); }
public boolean declarationsAreInDefaultPackage() { return getPackageDeclaration() == null; }
private String getClassName(ASTCompilationUnit node) { ASTAnyTypeDeclaration classDecl = node.getFirstDescendantOfType(ASTAnyTypeDeclaration.class); if (classDecl == null) { // package-info.java? return null; } if (node.declarationsAreInDefaultPackage()) { return classDecl.getImage(); } importedOnDemand.add(node.getPackageDeclaration().getPackageNameImage()); return classDecl.getQualifiedName().toString(); }
private String getClassName(ASTCompilationUnit node) { ASTClassOrInterfaceDeclaration classDecl = node.getFirstDescendantOfType(ASTClassOrInterfaceDeclaration.class); if (classDecl == null) { // Happens if this compilation unit only contains an // enum return null; } if (node.declarationsAreInDefaultPackage()) { return classDecl.getImage(); } ASTPackageDeclaration pkgDecl = node.getPackageDeclaration(); importedOnDemand.add(pkgDecl.getPackageNameImage()); return pkgDecl.getPackageNameImage() + DOT_STRING + classDecl.getImage(); }
/** * Creates a new global scope for an AST node. The new scope is stored on * the scope stack. * * @param node * the AST node for which the scope has to be created. */ private void createSourceFileScope(ASTCompilationUnit node) { // When we do full symbol resolution, we'll need to add a truly // top-level GlobalScope. SourceFileScope scope; ASTPackageDeclaration n = node.getPackageDeclaration(); if (n != null) { scope = new SourceFileScope(classLoader, n.jjtGetChild(0).getImage()); } else { scope = new SourceFileScope(classLoader); } scope.configureImports(node.findChildrenOfType(ASTImportDeclaration.class)); scopes.push(scope); node.setScope(scope); }