Tabnine Logo
ClassNode.getCompileUnit
Code IndexAdd Tabnine to your IDE (free)

How to use
getCompileUnit
method
in
org.codehaus.groovy.ast.ClassNode

Best Java code snippets using org.codehaus.groovy.ast.ClassNode.getCompileUnit (Showing top 20 results out of 315)

origin: org.codehaus.groovy/groovy

/**
 * Returns true if the two classes share the same compilation unit.
 * @param a class a
 * @param b class b
 * @return true if both classes share the same compilation unit
 */
public static boolean isSameCompilationUnit(ClassNode a, ClassNode b) {
  CompileUnit cu1 = a.getCompileUnit();
  CompileUnit cu2 = b.getCompileUnit();
  return cu1 !=null && cu2 !=null && cu1==cu2;
}
origin: org.codehaus.groovy/groovy

public static boolean isBeingCompiled(ClassNode node) {
  return node.getCompileUnit() != null;
}
origin: org.codehaus.groovy/groovy

/**
 * Creates a ClassNode from a real class. The resulting
 * ClassNode will not be a primary ClassNode.
 */
public ClassNode(Class c) {
  this(c.getName(), c.getModifiers(), null, null ,MixinNode.EMPTY_ARRAY);
  clazz=c;
  lazyInitDone=false;
  CompileUnit cu = getCompileUnit();
  if (cu!=null) cu.addClass(this);
  isPrimaryNode=false;
}
origin: org.codehaus.groovy/groovy

protected CompileUnit getCompileUnit() {
  CompileUnit answer = classNode.getCompileUnit();
  if (answer == null) {
    answer = context.getCompileUnit();
  }
  return answer;
}
origin: org.codehaus.groovy/groovy

protected CompileUnit getCompileUnit() {
  CompileUnit answer = controller.getClassNode().getCompileUnit();
  if (answer == null) {
    answer = context.getCompileUnit();
  }
  return answer;
}
origin: org.codehaus.groovy/groovy

public CompileUnit getCompileUnit() {
  if (redirect!=null) return redirect().getCompileUnit();
  if (compileUnit == null && module != null) {
    compileUnit = module.getUnit();
  }
  return compileUnit;
}
origin: org.codehaus.groovy/groovy

private boolean resolveFromCompileUnit(ClassNode type) {
  // look into the compile unit if there is a class with that name
  CompileUnit compileUnit = currentClass.getCompileUnit();
  if (compileUnit == null) return false;
  ClassNode cuClass = compileUnit.getClass(type.getName());
  if (cuClass != null) {
    if (type != cuClass) type.setRedirect(cuClass);
    return true;
  }
  return false;
}
origin: org.codehaus.groovy/groovy

public void call(SourceUnit source) throws CompilationFailedException {
  List<ClassNode> classes = source.ast.getClasses();
  for (ClassNode node : classes) {
    CompileUnit cu = node.getCompileUnit();
    for (Iterator iter = cu.iterateClassNodeToCompile(); iter.hasNext();) {
      String name = (String) iter.next();
origin: org.codehaus.groovy/groovy

private boolean resolveToOuter(ClassNode type) {
  String name = type.getName();
  // We do not need to check instances of LowerCaseClass
  // to be a Class, because unless there was an import for
  // for this we do not lookup these cases. This was a decision
  // made on the mailing list. To ensure we will not visit this
  // method again we set a NO_CLASS for this name
  if (type instanceof LowerCaseClass) {
    classNodeResolver.cacheClass(name, ClassNodeResolver.NO_CLASS);
    return false;
  }
  if (currentClass.getModule().hasPackageName() && name.indexOf('.') == -1) return false;
  LookupResult lr = classNodeResolver.resolveName(name, compilationUnit);
  if (lr != null) {
    if (lr.isSourceUnit()) {
      SourceUnit su = lr.getSourceUnit();
      currentClass.getCompileUnit().addClassNodeToCompile(type, su);
    } else {
      type.setRedirect(lr.getClassNode());
    }
    return true;
  }
  return false;
}
origin: org.codehaus.groovy/groovy

public void init(AsmClassGenerator asmClassGenerator, GeneratorContext gcon, ClassVisitor cv, ClassNode cn) {
  CompilerConfiguration config = cn.getCompileUnit().getConfig();
  Map<String,Boolean> optOptions = config.getOptimizationOptions();
  boolean invokedynamic=false;
origin: org.codehaus.groovy/groovy

@Override
public void init(final AsmClassGenerator asmClassGenerator, final GeneratorContext gcon, final ClassVisitor cv, final ClassNode cn) {
  super.init(asmClassGenerator, gcon, cv, cn);
  this.callSiteWriter = new StaticTypesCallSiteWriter(this);
  this.statementWriter = new StaticTypesStatementWriter(this);
  this.typeChooser = new StaticTypesTypeChooser();
  this.invocationWriter = new StaticInvocationWriter(this);
  this.closureWriter = new StaticTypesClosureWriter(this);
  this.unaryExpressionHelper = new StaticTypesUnaryExpressionHelper(this);
  CompilerConfiguration config = cn.getCompileUnit().getConfig();
  this.binaryExprHelper = config.isIndyEnabled()
      ? new IndyStaticTypesMultiTypeDispatcher(this)
      : new StaticTypesBinaryExpressionMultiTypeDispatcher(this);
}
origin: org.codehaus.groovy/groovy

public boolean implementsInterfaceOrIsSubclassOf(ClassNode type, ClassNode superOrInterface) {
  boolean result = type.equals(superOrInterface)
      || type.isDerivedFrom(superOrInterface)
      || type.implementsInterface(superOrInterface);
  if (result) {
    return true;
  }
  if (GROOVY_OBJECT_TYPE.equals(superOrInterface) && type.getCompileUnit()!=null) {
    // type is being compiled so it will implement GroovyObject later
    return true;
  }
  if (superOrInterface instanceof WideningCategories.LowestUpperBoundClassNode) {
    WideningCategories.LowestUpperBoundClassNode cn = (WideningCategories.LowestUpperBoundClassNode) superOrInterface;
    result = implementsInterfaceOrIsSubclassOf(type, cn.getSuperClass());
    if (result) {
      for (ClassNode interfaceNode : cn.getInterfaces()) {
        result = implementsInterfaceOrIsSubclassOf(type,interfaceNode);
        if (!result) break;
      }
    }
    if (result) return true;
  }
  if (type.isArray() && superOrInterface.isArray()) {
    return implementsInterfaceOrIsSubclassOf(type.getComponentType(), superOrInterface.getComponentType());
  }
  return false;
}
origin: org.codehaus.groovy/groovy-all-minimal

/**
 * Creates a ClassNode from a real class. The resulting 
 * ClassNode will be no primary ClassNode.
 */
public ClassNode(Class c) {
  this(c.getName(), c.getModifiers(), null, null ,MixinNode.EMPTY_ARRAY);
  clazz=c;
  lazyInitDone=false;
  CompileUnit cu = getCompileUnit();
  if (cu!=null) cu.addClass(this);
  isPrimaryNode=false;
}    

origin: org.codehaus.groovy/groovy-jdk14

protected CompileUnit getCompileUnit() {
  CompileUnit answer = classNode.getCompileUnit();
  if (answer == null) {
    answer = context.getCompileUnit();
  }
  return answer;
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

/**
 * Creates a ClassNode from a real class. The resulting
 * ClassNode will not be a primary ClassNode.
 */
public ClassNode(Class c) {
  this(c.getName(), c.getModifiers(), null, null ,MixinNode.EMPTY_ARRAY);
  clazz=c;
  lazyInitDone=false;
  CompileUnit cu = getCompileUnit();
  if (cu!=null) cu.addClass(this);
  isPrimaryNode=false;
}
origin: org.codehaus.groovy/groovy-all-minimal

protected CompileUnit getCompileUnit() {
  CompileUnit answer = classNode.getCompileUnit();
  if (answer == null) {
    answer = context.getCompileUnit();
  }
  return answer;
}
origin: org.codehaus.groovy/groovy-all-minimal

public CompileUnit getCompileUnit() {
  if (redirect!=null) return redirect().getCompileUnit();
  if (compileUnit == null && module != null) {
    compileUnit = module.getUnit();
  }
  return compileUnit;
}

origin: org.codehaus.groovy/groovy-jdk14

public CompileUnit getCompileUnit() {
  if (redirect!=null) return redirect().getCompileUnit();
  if (compileUnit == null && module != null) {
    compileUnit = module.getUnit();
  }
  return compileUnit;
}
origin: org.kohsuke.droovy/groovy

public CompileUnit getCompileUnit() {
  if (redirect!=null) return redirect().getCompileUnit();
  if (compileUnit == null && module != null) {
    compileUnit = module.getUnit();
  }
  return compileUnit;
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

protected CompileUnit getCompileUnit() {
  CompileUnit answer = controller.getClassNode().getCompileUnit();
  if (answer == null) {
    answer = context.getCompileUnit();
  }
  return answer;
}
org.codehaus.groovy.astClassNodegetCompileUnit

Popular methods of ClassNode

  • getName
  • getMethods
    This methods creates a list of all methods with this name of the current class and of all super clas
  • <init>
    Constructor used by makeArray() if no real class is available
  • getSuperClass
  • equals
  • addMethod
  • getAnnotations
  • addField
  • getFields
    Returns a list containing FieldNode objects for each field in the class represented by this ClassNod
  • getPlainNodeReference
  • getField
    Finds a field matching the given name in this class or a parent class.
  • getMethod
    Finds a method matching the given name and parameters in this class or any parent class.
  • getField,
  • getMethod,
  • isInterface,
  • getNameWithoutPackage,
  • isScript,
  • getDeclaredMethod,
  • getGenericsTypes,
  • getDeclaredConstructors,
  • getModifiers,
  • getTypeClass

Popular in Java

  • Making http post requests using okhttp
  • getSystemService (Context)
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Reference (javax.naming)
  • Github Copilot alternatives
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