Tabnine Logo
CompilationUnit
Code IndexAdd Tabnine to your IDE (free)

How to use
CompilationUnit
in
lombok.ast

Best Java code snippets using lombok.ast.CompilationUnit (Showing top 20 results out of 315)

origin: com.android.tools.external.lombok/lombok-ast

@Override public void visitCompilationUnitDeclaration(CompilationUnitDeclaration node) {
  lombok.ast.CompilationUnit unit = new lombok.ast.CompilationUnit();
  unit.rawPackageDeclaration(toTree(node.currentPackage, FlagKey.IMPORTDECLARATION_IS_PACKAGE));
  if (node.javadoc != null) {
    lombok.ast.PackageDeclaration lombokJavadoc = unit.astPackageDeclaration();
    if (lombokJavadoc != null) {
      lombokJavadoc.rawJavadoc(toTree(node.javadoc));
    }
  }
  fillList(node.imports, unit.rawImportDeclarations());
  
  TypeDeclaration[] newTypes = null;
  if (node.types != null && node.types.length > 0 && CharOperation.equals(EcjTreeBuilder.PACKAGE_INFO, node.types[0].name)) {
    newTypes = new TypeDeclaration[node.types.length - 1];
    System.arraycopy(node.types, 1, newTypes, 0, node.types.length - 1);
  } else {
    newTypes = node.types;
  }
  
  fillList(newTypes, unit.rawTypeDeclarations());
  set(node, unit);
}

origin: com.android.tools.external.lombok/lombok-ast

public Node createCompilationUnit(Node packageDeclaration, List<Node> importDeclarations, List<Node> typeDeclarations) {
  CompilationUnit unit = new CompilationUnit().rawPackageDeclaration(packageDeclaration);
  if (importDeclarations != null) for (Node n : importDeclarations) if (n != null) unit.rawImportDeclarations().addToEnd(n);
  if (typeDeclarations != null) for (Node n : typeDeclarations) if (n != null) unit.rawTypeDeclarations().addToEnd(n);
  return posify(unit);
}

origin: org.projectlombok/lombok.ast

@Override
public boolean visitCompilationUnit(CompilationUnit node) {
  formatter.buildBlock(node);
  if (node.rawPackageDeclaration() != null) {
    visit(node.rawPackageDeclaration());
    if (!node.rawTypeDeclarations().isEmpty() || !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace();
  }
  visitAll(node.rawImportDeclarations(), "", "", "");
  if (!node.rawTypeDeclarations().isEmpty() && !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace();
  visitAll(node.rawTypeDeclarations(), "\n", "", "");
  formatter.closeBlock();
  return true;
}

origin: com.android.tools.external.lombok/lombok-ast

@Override
public boolean visitCompilationUnit(CompilationUnit node) {
  List<JCTree> preamble = toList(JCTree.class, node.astPackageDeclaration());
  List<JCTree> imports = toList(JCTree.class, node.astImportDeclarations());
  List<JCTree> types = toList(JCTree.class, node.astTypeDeclarations());
  int end = node.getPosition().getEnd();
  if (node.astPackageDeclaration() != null) start = Math.min(start, node.astPackageDeclaration().getPosition().getStart());
  if (!node.astImportDeclarations().isEmpty()) start = Math.min(start, node.rawImportDeclarations().first().getPosition().getStart());
  if (!node.astTypeDeclarations().isEmpty()) start = Math.min(start, node.rawTypeDeclarations().first().getPosition().getStart());
  if (start == Integer.MAX_VALUE) start = node.getPosition().getStart();
  return set(node, setPos(start, end, topLevel));
origin: me.tatarka.retrolambda.projectlombok/lombok.ast

cud.bits |= ASTNode.HasAllMethodBodies;
cud.currentPackage = (ImportReference) toTree(node.astPackageDeclaration());
cud.imports = toArray(ImportReference.class, node.astImportDeclarations());
cud.types = toArray(TypeDeclaration.class, node.astTypeDeclarations());
  cud.types = newTypes;
  lombok.ast.PackageDeclaration pkgDeclaration = node.astPackageDeclaration();
  Comment javadoc = pkgDeclaration == null ? null : pkgDeclaration.astJavadoc();
  if (javadoc != null) {
origin: com.android.tools.external.lombok/lombok-ast

private ImportList getImportList(Node n) {
  ImportList il = new ImportList();
  
  while (n != null) {
    if (n instanceof CompilationUnit) {
      CompilationUnit cu = (CompilationUnit) n;
      PackageDeclaration pkg = cu.astPackageDeclaration();
      if (pkg != null) il.stars.add(pkg.getPackageName());
      for (ImportDeclaration imp : cu.astImportDeclarations()) {
        if (imp.astStaticImport()) continue;
        if (imp.astStarImport()) {
          String i = imp.asFullyQualifiedName();
          i = i.substring(0, i.length() - 2);
          il.stars.add(i);
        } else {
          il.explicits.add(imp.asFullyQualifiedName());
        }
      }
    }
    
    n = n.getParent();
  }
  
  return il;
}

origin: me.tatarka.retrolambda.projectlombok/lombok.ast

    stopAtSelf = false;
  } else if (n instanceof CompilationUnit) {
    list = ((CompilationUnit) n).rawTypeDeclarations();
    cu = (CompilationUnit) n;
    stopAtSelf = false;
if (wantedPkg.isEmpty()) return cu == null || cu.rawPackageDeclaration() == null;
origin: com.amazon.device.tools.lint/lint-checks

@Override
public boolean visitClassDeclaration(ClassDeclaration node) {
  String name = node.astName().astValue();
  if (mActivities != null && mActivities.contains(mClassFqn) || name.endsWith(ACTIVITY)
      || node.astExtending() != null &&
        node.astExtending().getTypeName().endsWith(ACTIVITY)) {
    String packageName = "";
    if (node.getParent() instanceof CompilationUnit) {
      CompilationUnit compilationUnit = (CompilationUnit) node.getParent();
      PackageDeclaration packageDeclaration = compilationUnit.astPackageDeclaration();
      if (packageDeclaration == null) {
        // No package declaration: ignore this one
        return true;
      }
      packageName = packageDeclaration.getPackageName();
    }
    mClassFqn = (!packageName.isEmpty() ? (packageName + '.') : "") + name;
    return false;
  }
  return true; // Done: No need to look inside this class
}
origin: org.projectlombok/lombok.ast

@Override
public boolean visitCompilationUnit(CompilationUnit node) {
  List<JCTree> preamble = toList(JCTree.class, node.astPackageDeclaration());
  List<JCTree> imports = toList(JCTree.class, node.astImportDeclarations());
  List<JCTree> types = toList(JCTree.class, node.astTypeDeclarations());
  int end = node.getPosition().getEnd();
  if (node.astPackageDeclaration() != null) start = Math.min(start, node.astPackageDeclaration().getPosition().getStart());
  if (!node.astImportDeclarations().isEmpty()) start = Math.min(start, node.rawImportDeclarations().first().getPosition().getStart());
  if (!node.astTypeDeclarations().isEmpty()) start = Math.min(start, node.rawTypeDeclarations().first().getPosition().getStart());
  if (start == Integer.MAX_VALUE) start = node.getPosition().getStart();
  return set(node, setPos(start, end, topLevel));
origin: org.projectlombok/lombok.ast

cud.bits |= ASTNode.HasAllMethodBodies;
cud.currentPackage = (ImportReference) toTree(node.astPackageDeclaration());
cud.imports = toArray(ImportReference.class, node.astImportDeclarations());
cud.types = toArray(TypeDeclaration.class, node.astTypeDeclarations());
  cud.types = newTypes;
  lombok.ast.PackageDeclaration pkgDeclaration = node.astPackageDeclaration();
  Comment javadoc = pkgDeclaration == null ? null : pkgDeclaration.astJavadoc();
  if (javadoc != null) {
origin: me.tatarka.retrolambda.projectlombok/lombok.ast

@Override
public boolean visitCompilationUnit(CompilationUnit node) {
  formatter.buildBlock(node);
  if (node.rawPackageDeclaration() != null) {
    visit(node.rawPackageDeclaration());
    if (!node.rawTypeDeclarations().isEmpty() || !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace();
  }
  visitAll(node.rawImportDeclarations(), "", "", "");
  if (!node.rawTypeDeclarations().isEmpty() && !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace();
  visitAll(node.rawTypeDeclarations(), "\n", "", "");
  formatter.closeBlock();
  return true;
}

origin: org.projectlombok/lombok.ast

private ImportList getImportList(Node n) {
  ImportList il = new ImportList();
  
  while (n != null) {
    if (n instanceof CompilationUnit) {
      CompilationUnit cu = (CompilationUnit) n;
      PackageDeclaration pkg = cu.astPackageDeclaration();
      if (pkg != null) il.stars.add(pkg.getPackageName());
      for (ImportDeclaration imp : cu.astImportDeclarations()) {
        if (imp.astStaticImport()) continue;
        if (imp.astStarImport()) {
          String i = imp.asFullyQualifiedName();
          i = i.substring(0, i.length() - 2);
          il.stars.add(i);
        } else {
          il.explicits.add(imp.asFullyQualifiedName());
        }
      }
    }
    
    n = n.getParent();
  }
  
  return il;
}

origin: com.android.tools.external.lombok/lombok-ast

    stopAtSelf = false;
  } else if (n instanceof CompilationUnit) {
    list = ((CompilationUnit) n).rawTypeDeclarations();
    cu = (CompilationUnit) n;
    stopAtSelf = false;
if (wantedPkg.isEmpty()) return cu == null || cu.rawPackageDeclaration() == null;
origin: me.tatarka.retrolambda.projectlombok/lombok.ast

public Node createCompilationUnit(Node packageDeclaration, List<Node> importDeclarations, List<Node> typeDeclarations) {
  CompilationUnit unit = new CompilationUnit().rawPackageDeclaration(packageDeclaration);
  if (importDeclarations != null) for (Node n : importDeclarations) if (n != null) unit.rawImportDeclarations().addToEnd(n);
  if (typeDeclarations != null) for (Node n : typeDeclarations) if (n != null) unit.rawTypeDeclarations().addToEnd(n);
  return posify(unit);
}

origin: me.tatarka.retrolambda.projectlombok/lombok.ast

@Override
public boolean visitCompilationUnit(CompilationUnit node) {
  List<JCTree> preamble = toList(JCTree.class, node.astPackageDeclaration());
  List<JCTree> imports = toList(JCTree.class, node.astImportDeclarations());
  List<JCTree> types = toList(JCTree.class, node.astTypeDeclarations());
  int end = node.getPosition().getEnd();
  if (node.astPackageDeclaration() != null) start = Math.min(start, node.astPackageDeclaration().getPosition().getStart());
  if (!node.astImportDeclarations().isEmpty()) start = Math.min(start, node.rawImportDeclarations().first().getPosition().getStart());
  if (!node.astTypeDeclarations().isEmpty()) start = Math.min(start, node.rawTypeDeclarations().first().getPosition().getStart());
  if (start == Integer.MAX_VALUE) start = node.getPosition().getStart();
  return set(node, setPos(start, end, topLevel));
origin: com.android.tools.external.lombok/lombok-ast

cud.bits |= ASTNode.HasAllMethodBodies;
cud.currentPackage = (ImportReference) toTree(node.astPackageDeclaration());
cud.imports = toArray(ImportReference.class, node.astImportDeclarations());
cud.types = toArray(TypeDeclaration.class, node.astTypeDeclarations());
  cud.types = newTypes;
  lombok.ast.PackageDeclaration pkgDeclaration = node.astPackageDeclaration();
  Comment javadoc = pkgDeclaration == null ? null : pkgDeclaration.astJavadoc();
  if (javadoc != null) {
origin: com.android.tools.external.lombok/lombok-ast

@Override
public boolean visitCompilationUnit(CompilationUnit node) {
  formatter.buildBlock(node);
  if (node.rawPackageDeclaration() != null) {
    visit(node.rawPackageDeclaration());
    if (!node.rawTypeDeclarations().isEmpty() || !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace();
  }
  visitAll(node.rawImportDeclarations(), "", "", "");
  if (!node.rawTypeDeclarations().isEmpty() && !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace();
  visitAll(node.rawTypeDeclarations(), "\n", "", "");
  formatter.closeBlock();
  return true;
}

origin: me.tatarka.retrolambda.projectlombok/lombok.ast

private ImportList getImportList(Node n) {
  ImportList il = new ImportList();
  
  while (n != null) {
    if (n instanceof CompilationUnit) {
      CompilationUnit cu = (CompilationUnit) n;
      PackageDeclaration pkg = cu.astPackageDeclaration();
      if (pkg != null) il.stars.add(pkg.getPackageName());
      for (ImportDeclaration imp : cu.astImportDeclarations()) {
        if (imp.astStaticImport()) continue;
        if (imp.astStarImport()) {
          String i = imp.asFullyQualifiedName();
          i = i.substring(0, i.length() - 2);
          il.stars.add(i);
        } else {
          il.explicits.add(imp.asFullyQualifiedName());
        }
      }
    }
    
    n = n.getParent();
  }
  
  return il;
}

origin: org.projectlombok/lombok.ast

    stopAtSelf = false;
  } else if (n instanceof CompilationUnit) {
    list = ((CompilationUnit) n).rawTypeDeclarations();
    cu = (CompilationUnit) n;
    stopAtSelf = false;
if (wantedPkg.isEmpty()) return cu == null || cu.rawPackageDeclaration() == null;
origin: org.projectlombok/lombok.ast

public Node createCompilationUnit(Node packageDeclaration, List<Node> importDeclarations, List<Node> typeDeclarations) {
  CompilationUnit unit = new CompilationUnit().rawPackageDeclaration(packageDeclaration);
  if (importDeclarations != null) for (Node n : importDeclarations) if (n != null) unit.rawImportDeclarations().addToEnd(n);
  if (typeDeclarations != null) for (Node n : typeDeclarations) if (n != null) unit.rawTypeDeclarations().addToEnd(n);
  return posify(unit);
}

lombok.astCompilationUnit

Most used methods

  • astPackageDeclaration
  • <init>
  • astImportDeclarations
  • astTypeDeclarations
  • getPosition
  • rawImportDeclarations
  • rawPackageDeclaration
  • rawTypeDeclarations

Popular in Java

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • setRequestProperty (URLConnection)
  • getSupportFragmentManager (FragmentActivity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now