Examples of SourceTypeBinding


Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

            "inner aspects must be static");
        return;
      }
    }

    SourceTypeBinding binding = typeDecl.binding;
    if (binding != null) {
      if (binding.isEnum() || binding.isInterface() || binding.isAnnotationType()) {
        typeDecl.scope.problemReporter().signalError(typeDecl.sourceStart, typeDecl.sourceEnd,
            "only classes can have an @Aspect annotation");
      }
    }

    // FIXME AV - do we really want that
    // if (!Modifier.isPublic(typeDecl.modifiers)) {
    // typeDecl.scope.problemReporter().signalError(typeDecl.sourceStart,
    // typeDecl.sourceEnd,"@Aspect class must be public");
    // }

    TypeReference parentRef = typeDecl.superclass;
    if (parentRef != null) {
      TypeBinding parentBinding = parentRef.resolvedType;
      if (parentBinding instanceof SourceTypeBinding) {
        SourceTypeBinding parentSTB = (SourceTypeBinding) parentBinding;
        if (parentSTB.scope != null) { // scope is null if its a
          // binarytypebinding (in AJ
          // world, thats a subclass of
          // SourceTypeBinding)
          TypeDeclaration parentDecl = parentSTB.scope.referenceContext;
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

    PerClause perClause;
    if (binding instanceof BinaryTypeBinding) {
      ResolvedType superTypeX = factory.fromEclipse(binding);
      perClause = superTypeX.getPerClause();
    } else if (binding instanceof SourceTypeBinding) {
      SourceTypeBinding sourceSc = (SourceTypeBinding) binding;
      if (sourceSc.scope.referenceContext instanceof AspectDeclaration) {
        perClause = ((AspectDeclaration) sourceSc.scope.referenceContext).perClause;
      } else {
        return null;
      }
    } else if (binding instanceof ParameterizedTypeBinding) {
      ParameterizedTypeBinding pBinding = (ParameterizedTypeBinding) binding;
      if (pBinding.type instanceof SourceTypeBinding) {
        SourceTypeBinding sourceSc = (SourceTypeBinding) pBinding.type;
        if (sourceSc.scope != null && sourceSc.scope.referenceContext instanceof AspectDeclaration) {
          perClause = ((AspectDeclaration) sourceSc.scope.referenceContext).perClause;
        } else {
          return null;
        }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

    NewMemberClassTypeMunger munger = (NewMemberClassTypeMunger) m.getMunger();

    // private boolean mungeNewInnerClass(SourceTypeBinding sourceType, ResolvedType onType, NewMemberClassTypeMunger munger,
    // boolean isExactTargetType) {

    SourceTypeBinding aspectTypeBinding = (SourceTypeBinding) world.makeTypeBinding(m.getAspectType());

    char[] mungerMemberTypeName = ("$" + munger.getMemberTypeName()).toCharArray();
    ReferenceBinding innerTypeBinding = null;
    for (ReferenceBinding innerType : aspectTypeBinding.memberTypes) {
      char[] compounded = CharOperation.concatWith(innerType.compoundName, '.');
      if (org.aspectj.org.eclipse.jdt.core.compiler.CharOperation.endsWith(compounded, mungerMemberTypeName)) {
        innerTypeBinding = innerType;
        break;
      }
    }
    // may be unresolved if the aspect type binding was a BinaryTypeBinding
    if (innerTypeBinding instanceof UnresolvedReferenceBinding) {
      innerTypeBinding = BinaryTypeBinding.resolveType(innerTypeBinding, world.getLookupEnvironment(), true);
    }
    if (innerTypeBinding == null) {
      throw new IllegalStateException("Could not find inner type binding for '" + munger.getMemberTypeName() + "'");
    }

    // TODO adjust modifier?
    // TODO deal with itd of it onto an interface

    SourceTypeBinding targetSourceTypeBinding = (SourceTypeBinding) world.makeTypeBinding(munger.getTargetType());

    // if it is a binary type binding it is likely to be something we ITD'd on before
    // TODO should probably avoid putting it onto BTBs at all (since already there)
    if (!(targetSourceTypeBinding instanceof BinaryTypeBinding)) {
      ReferenceBinding[] existingMemberTypes = targetSourceTypeBinding.memberTypes();
      for (int i = 0; i < existingMemberTypes.length; i++) {
        char[] compounded = CharOperation.concatWith(existingMemberTypes[i].compoundName, '.');
        if (CharOperation.endsWith(compounded, mungerMemberTypeName)) {
          scope.problemReporter().signalError(sourceStart(), sourceEnd(),
              "target type already declares a member type with the name '" + munger.getMemberTypeName() + "'");
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

      PrivilegedHandler handler = (PrivilegedHandler) Scope.findPrivilegedHandler(binding.declaringClass);
      if (handler == null) {
        // one is now required!
        ReferenceBinding typebinding = binding.declaringClass;
        if (typebinding instanceof ReferenceBinding) {
          SourceTypeBinding sourceBinding = (SourceTypeBinding) typebinding;
          handler = new PrivilegedHandler((AspectDeclaration) sourceBinding.scope.referenceContext);
          sourceBinding.privilegedHandler = handler;
        }
      }
      PrivilegedFieldBinding fBinding = (PrivilegedFieldBinding) handler.getPrivilegedAccessField(field, null);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

      name[length-1] = this.secondarySimpleName;
      binding = this.environment.getType(name);
      if (!(binding instanceof SourceTypeBinding))
        return null;
    }
    SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) binding;
    if (sourceTypeBinding.scope == null)
      return null;
    return sourceTypeBinding.scope.compilationUnitScope().referenceContext;
  }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

  private void maybeDispatch(Expression expression, TypeBinding binding) {
    assert (binding != null);

    if (binding instanceof SourceTypeBinding) {
      SourceTypeBinding type = (SourceTypeBinding) binding;
      onTypeRef(type, cud);
    } else if (binding instanceof ArrayBinding) {
      maybeDispatch(expression, ((ArrayBinding) binding).leafComponentType);
    } else if (binding instanceof BinaryTypeBinding) {
      onBinaryTypeRef((BinaryTypeBinding) binding, cud, expression);
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

  /**
   * Returns <code>true</code> if this is a local type, or if this type is
   * nested inside of any local type.
   */
  private static boolean isLocalType(SourceTypeBinding binding) {
    SourceTypeBinding b = binding;
    while (!b.isStatic()) {
      if (b instanceof LocalTypeBinding) {
        return true;
      }
      b = ((NestedTypeBinding) b).enclosingType;
    }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

  private transient NameEnvironmentAnswer nameEnvironmentAnswer;

  CompiledClass(TypeDeclaration typeDeclaration, CompiledClass enclosingClass) {
    this.enclosingClass = enclosingClass;
    SourceTypeBinding binding = typeDeclaration.binding;
    this.internalName = CharOperation.charToString(binding.constantPoolName());
    ClassFile classFile = getClassFile(typeDeclaration, internalName);
    byte[] bytes = classFile.getBytes();
    this.cacheToken = diskCache.writeByteArray(bytes);
    this.isLocal = isLocalType(binding);
  }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

      }
    }

    JExpression processExpression(AllocationExpression x) {
      SourceInfo info = makeSourceInfo(x);
      SourceTypeBinding typeBinding = erasure(x.resolvedType);
      if (typeBinding.constantPoolName() == null) {
        /*
         * Weird case: if JDT determines that this local class is totally
         * uninstantiable, it won't bother allocating a local name.
         */
        return program.getLiteralNull();
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding

      }
    }

    JExpression processExpression(AllocationExpression x) {
      SourceInfo info = makeSourceInfo(x);
      SourceTypeBinding typeBinding = erasure(x.resolvedType);
      if (typeBinding.constantPoolName() == null) {
        /*
         * Weird case: if JDT determines that this local class is totally
         * uninstantiable, it won't bother allocating a local name.
         */
        return program.getLiteralNull();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.