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

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

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

origin: org.codehaus.groovy/groovy

private boolean isAnInterface() {
  return classNode != null && (classNode.getModifiers() & Opcodes.ACC_INTERFACE) > 0;
}
origin: org.codehaus.groovy/groovy

private boolean checkInnerTypeVisibility(ClassNode enclosingType, ClassNode innerClassNode) {
  if (currentClass == enclosingType) {
    return true;
  }
  int modifiers = innerClassNode.getModifiers();
  return Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers);
}
origin: org.codehaus.groovy/groovy

private void checkClassForOtherModifiers(ClassNode node) {
  checkClassForModifier(node, isTransient(node.getModifiers()), "transient");
  checkClassForModifier(node, isVolatile(node.getModifiers()), "volatile");
  checkClassForModifier(node, isNative(node.getModifiers()), "native");
  if (!(node instanceof InnerClassNode)) {
    checkClassForModifier(node, isStatic(node.getModifiers()), "static");
    checkClassForModifier(node, isPrivate(node.getModifiers()), "private");
  }
  // don't check synchronized here as it overlaps with ACC_SUPER
}
origin: org.codehaus.groovy/groovy

private static boolean validTypeForCall(ClassNode type) {
  // do call only for final classes and primitive types
  if (isPrimitiveType(type)) return true;
  return (type.getModifiers() & ACC_FINAL) > 0;
}
origin: org.codehaus.groovy/groovy

  @Override
  public void call(final SourceUnit source, final GeneratorContext context, final ClassNode classNode) throws CompilationFailedException {
    if ((classNode.getModifiers() & Opcodes.ACC_INTERFACE) > 0) {
      // does not apply on interfaces
      return;
    }
    if (!(classNode instanceof InnerClassNode)) {
      addTimeStamp(classNode);
    }
  }
}
origin: org.codehaus.groovy/groovy

public boolean isAnnotationDefinition() {
  return /* redirect().isPrimaryNode && */
      isInterface() && (getModifiers() & Opcodes.ACC_ANNOTATION) != 0;
}
origin: org.codehaus.groovy/groovy

private boolean isVisibleNestedClass(ClassNode type, ClassNode ceType) {
  if (!type.isRedirectNode()) return false;
  ClassNode redirect = type.redirect();
  if (Modifier.isPublic(redirect.getModifiers()) || Modifier.isProtected(redirect.getModifiers())) return true;
  // package local
  return isDefaultVisibility(redirect.getModifiers()) && inSamePackage(ceType, redirect);
}
origin: org.codehaus.groovy/groovy

/**
 * Detect whether a given ClassNode is a inner class (non-static).
 *
 * @param cNode the ClassNode of interest
 * @return true if the given node is a (non-static) inner class, else false
 */
public static boolean isInnerClass(ClassNode cNode) {
  return cNode.redirect().getOuterClass() != null
      && !Modifier.isStatic(cNode.getModifiers());
}
origin: org.codehaus.groovy/groovy

private void checkAbstractMethodVisibility(ClassNode node) {
  // we only do check abstract classes (including enums), no interfaces or non-abstract classes
  if (!isAbstract(node.getModifiers()) || isInterface(node.getModifiers())) return;
  List<MethodNode> abstractMethods = node.getAbstractMethods();
  if (abstractMethods == null || abstractMethods.isEmpty()) return;
  for (MethodNode method : abstractMethods) {
    if (method.isPrivate()) {
      addError("Method '" + method.getName() + "' from " + getDescription(node) +
          " must not be private as it is declared as an abstract method.", method);
    }
  }
}
origin: org.codehaus.groovy/groovy

private void checkClassForAbstractAndFinal(ClassNode node) {
  if (!isAbstract(node.getModifiers())) return;
  if (!isFinal(node.getModifiers())) return;
  if (node.isInterface()) {
    addError("The " + getDescription(node) + " must not be final. It is by definition abstract.", node);
  } else {
    addError("The " + getDescription(node) + " must not be both final and abstract.", node);
  }
}
origin: org.codehaus.groovy/groovy

private static int adjustedClassModifiersForInnerClassTable(ClassNode classNode) {
  int modifiers = classNode.getModifiers();
  modifiers = modifiers & ~ACC_SUPER;
  modifiers = fixInterfaceModifiers(classNode, modifiers);
  modifiers = fixInnerClassModifiers(classNode, modifiers);
  return modifiers;
}
origin: org.codehaus.groovy/groovy

private static boolean possiblyCloneable(ClassNode type) {
  return !isPrimitiveType(type) && ((isCloneableType(type) || (type.getModifiers() & ACC_FINAL) == 0));
}
origin: org.codehaus.groovy/groovy

private void checkClassForOverwritingFinal(ClassNode cn) {
  ClassNode superCN = cn.getSuperClass();
  if (superCN == null) return;
  if (!isFinal(superCN.getModifiers())) return;
  String msg = "You are not allowed to overwrite the final " + getDescription(superCN) + ".";
  addError(msg, cn);
}
origin: org.codehaus.groovy/groovy

private static int adjustedClassModifiersForClassWriting(ClassNode classNode) {
  int modifiers = classNode.getModifiers();
  boolean needsSuper = !classNode.isInterface();
  modifiers = needsSuper ? modifiers | ACC_SUPER : modifiers & ~ACC_SUPER;
  // eliminate static
  modifiers = modifiers & ~ACC_STATIC;
  modifiers = fixInnerClassModifiers(classNode, modifiers);
  modifiers = fixInterfaceModifiers(classNode, modifiers);
  return modifiers;
}
origin: org.codehaus.groovy/groovy

private void checkAbstractDeclaration(MethodNode methodNode) {
  if (!methodNode.isAbstract()) return;
  if (isAbstract(currentClass.getModifiers())) return;
  addError("Can't have an abstract method in a non-abstract class." +
      " The " + getDescription(currentClass) + " must be declared abstract or the method '" +
      methodNode.getTypeDescriptor() + "' must not be abstract.", methodNode);
}
origin: org.codehaus.groovy/groovy

private static void makeClassFinal(AbstractASTTransformation xform, ClassNode cNode) {
  int modifiers = cNode.getModifiers();
  if ((modifiers & ACC_FINAL) == 0) {
    if ((modifiers & (ACC_ABSTRACT | ACC_SYNTHETIC)) == (ACC_ABSTRACT | ACC_SYNTHETIC)) {
      xform.addError("Error during " + MY_TYPE_NAME + " processing: annotation found on inappropriate class " + cNode.getName(), cNode);
      return;
    }
    cNode.setModifiers(modifiers | ACC_FINAL);
  }
}
origin: org.codehaus.groovy/groovy

private static void checkForAbstractMethods(ClassNode enumClass) {
  List<MethodNode> methods = enumClass.getMethods();
  for (MethodNode m : methods) {
    if (m.isAbstract()) {
      // make the class abstract also see Effective Java p.152
      enumClass.setModifiers(enumClass.getModifiers() | Opcodes.ACC_ABSTRACT);
      break;
    }
  }
}
origin: org.codehaus.groovy/groovy

protected Expression transformConstructorCallExpression(ConstructorCallExpression cce) {
  ClassNode type = cce.getType();
  resolveOrFail(type, cce);
  if (Modifier.isAbstract(type.getModifiers())) {
    addError("You cannot create an instance from the abstract " + getDescription(type) + ".", cce);
  }
  return cce.transformExpression(this);
}
origin: org.codehaus.groovy/groovy

  protected static boolean shouldHandleImplicitThisForInnerClass(ClassNode cn) {
    if (cn.isEnum() || cn.isInterface()) return false;
    if ((cn.getModifiers() & Opcodes.ACC_STATIC) != 0) return false;

    if (!(cn instanceof InnerClassNode)) return false;
    InnerClassNode innerClass = (InnerClassNode) cn;
    // scope != null means aic, we don't handle that here
    if (innerClass.getVariableScope() != null) return false;
    // static inner classes don't need this$0
    return (innerClass.getModifiers() & Opcodes.ACC_STATIC) == 0;
  }
}
origin: org.codehaus.groovy/groovy

private void checkMethodModifiers(MethodNode node) {
  // don't check volatile here as it overlaps with ACC_BRIDGE
  // additional modifiers not allowed for interfaces
  if ((this.currentClass.getModifiers() & ACC_INTERFACE) != 0) {
    checkMethodForModifier(node, isStrict(node.getModifiers()), "strictfp");
    checkMethodForModifier(node, isSynchronized(node.getModifiers()), "synchronized");
    checkMethodForModifier(node, isNative(node.getModifiers()), "native");
  }
}
org.codehaus.groovy.astClassNodegetModifiers

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,
  • getTypeClass

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • setContentView (Activity)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Reference (javax.naming)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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