public boolean isTargettingAspectJRuntime12() { boolean b = false; // pr116679 if (!isInJava5Mode()) { b = true; } else { b = (getTargetAspectjRuntimeLevel() == RuntimeVersion.V1_2); } return b; }
@Override public final boolean isAssignableFrom(ResolvedType other) { if (!other.isPrimitiveType()) { if (!world.isInJava5Mode()) { return false; } return validBoxing.contains(this.getSignature() + other.getSignature()); } return assignTable[((Primitive) other).index][index]; }
protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATWITHINCODE_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } annotationTypePattern = (ExactAnnotationTypePattern) annotationTypePattern.resolveBindings(scope, bindings, true); // must be either a Var, or an annotation type pattern }
@Override protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATWITHIN_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } annotationTypePattern = annotationTypePattern.resolveBindings(scope, bindings, true); // must be either a Var, or an annotation type pattern }
@Override protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATANNOTATION_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } annotationTypePattern = (ExactAnnotationTypePattern) annotationTypePattern.resolveBindings(scope, bindings, true); // must be either a Var, or an annotation type pattern }
protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATARGS_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } arguments.resolveBindings(scope, bindings, true); if (arguments.ellipsisCount > 1) { scope.message(IMessage.ERROR, this, "uses more than one .. in args (compiler limitation)"); } }
return; if (!world.isInJava5Mode()) { this.genericFieldType = getReturnType(); return;
private void makeSyntheticAndTransientIfNeeded(FieldGen field) { if (field.getName().startsWith(NameMangler.PREFIX) && !field.getName().startsWith("ajc$interField$") && !field.getName().startsWith("ajc$instance$")) { // it's an aj added field // first do transient if (!field.isStatic()) { field.setModifiers(field.getModifiers() | Constants.ACC_TRANSIENT); } // then do synthetic if (getWorld().isInJava5Mode()) { // add the synthetic modifier flag field.setModifiers(field.getModifiers() | ACC_SYNTHETIC); } if (!hasSyntheticAttribute(field.getAttributes())) { // belt and braces, do the attribute even on Java 5 in addition // to the modifier flag // Attribute[] oldAttrs = field.getAttributes(); // Attribute[] newAttrs = new Attribute[oldAttrs.length + 1]; // System.arraycopy(oldAttrs, 0, newAttrs, 0, oldAttrs.length); ConstantPool cpg = myGen.getConstantPool(); int index = cpg.addUtf8("Synthetic"); Attribute synthetic = new Synthetic(index, 0, new byte[0], cpg); field.addAttribute(synthetic); // newAttrs[newAttrs.length - 1] = synthetic; // field.setAttributes(newAttrs); } } }
if (!scope.getWorld().isInJava5Mode() || scope.getWorld().getLint().unmatchedTargetKind == null || (patternNode instanceof AnyTypePattern)) { return;
@Override public void resolve(IScope scope) { if (!scope.getWorld().isInJava5Mode()) { String msg = null; if (kind == AT_TYPE) { msg = WeaverMessages.DECLARE_ATTYPE_ONLY_SUPPORTED_AT_JAVA5_LEVEL; } else if (kind == AT_METHOD) { msg = WeaverMessages.DECLARE_ATMETHOD_ONLY_SUPPORTED_AT_JAVA5_LEVEL; } else if (kind == AT_FIELD) { msg = WeaverMessages.DECLARE_ATFIELD_ONLY_SUPPORTED_AT_JAVA5_LEVEL; } else if (kind == AT_CONSTRUCTOR) { msg = WeaverMessages.DECLARE_ATCONS_ONLY_SUPPORTED_AT_JAVA5_LEVEL; } scope.message(MessageUtil.error(WeaverMessages.format(msg), getSourceLocation())); return; } if (typePattern != null) { typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); } if (signaturePattern != null) { signaturePattern = signaturePattern.resolveBindings(scope, Bindings.NONE); } this.containingAspect = scope.getEnclosingType(); }
@Override protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(isThis ? WeaverMessages.ATTHIS_ONLY_SUPPORTED_AT_JAVA5_LEVEL : WeaverMessages.ATTARGET_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } annotationTypePattern = (ExactAnnotationTypePattern) annotationTypePattern.resolveBindings(scope, bindings, true); // must be either a Var, or an annotation type pattern // if annotationType does not have runtime retention, this is an error if (annotationTypePattern.annotationType == null) { // it's a formal with a binding error return; } ResolvedType rAnnotationType = (ResolvedType) annotationTypePattern.annotationType; if (rAnnotationType.isTypeVariableReference()) { return; // we'll deal with this next check when the type var is actually bound... } verifyRuntimeRetention(rAnnotationType); }
return true; if (world.isInJava5Mode()) { if (this.isPrimitiveType() ^ other.isPrimitiveType()) { // If one is
/** * When the world is operating in 1.5 mode, the TypeMap should only contain RAW types and never directly generic types. The RAW * type will contain a reference to the generic type. * * @param type a possibly generic type for which the raw needs creating as it is not currently in the world * @return a type suitable for putting into the world */ private ResolvedType ensureRawTypeIfNecessary(ResolvedType type) { if (!isInJava5Mode() || type.isRawType()) { return type; } // Key requirement here is if it is generic, create a RAW entry to be put in the map that points to it if (type instanceof ReferenceType && ((ReferenceType) type).getDelegate() != null && type.isGenericType()) { ReferenceType rawType = new ReferenceType(type.getSignature(), this); rawType.typeKind = UnresolvedType.TypeKind.RAW; ReferenceTypeDelegate delegate = ((ReferenceType) type).getDelegate(); rawType.setDelegate(delegate); rawType.setGenericType((ReferenceType) type); return rawType; } // probably parameterized... return type; }
private void generatePerTWGetWithinTypeNameMethod(LazyClassGen classGen) { InstructionFactory factory = classGen.getFactory(); LazyMethodGen method = makeMethodGen(classGen, AjcMemberMaker.perTypeWithinGetWithinTypeNameMethod(aspectType, classGen .getWorld().isInJava5Mode())); flagAsSynthetic(method, false); classGen.addMethodGen(method); // 0: aload_0 // 1: getfield #14; //Field ajc$withinType:Ljava/lang/String; // 4: areturn InstructionList il = method.getBody(); il.append(InstructionConstants.ALOAD_0); il.append(Utility.createGet(factory, AjcMemberMaker.perTypeWithinWithinTypeField(aspectType, aspectType))); il.append(InstructionConstants.ARETURN); }
if (!bcelObjectType.getWorld().isInJava5Mode()) { genericReturnType = getReturnType(); genericParameterTypes = getParameterTypes();
private void generatePerTWHasAspectMethod(LazyClassGen classGen) { InstructionFactory factory = classGen.getFactory(); LazyMethodGen method = makeMethodGen(classGen, AjcMemberMaker.perTypeWithinHasAspectMethod(aspectType, classGen.getWorld() .isInJava5Mode())); flagAsSynthetic(method, false); classGen.addMethodGen(method); InstructionList il = method.getBody(); InstructionHandle tryStart = il.append(InstructionConstants.ALOAD_0); il.append(Utility.createInvoke(factory, Constants.INVOKESTATIC, AjcMemberMaker.perTypeWithinGetInstance(aspectType))); InstructionBranch ifNull = InstructionFactory.createBranchInstruction(Constants.IFNULL, null); il.append(ifNull); il.append(InstructionConstants.ICONST_1); il.append(InstructionConstants.IRETURN); InstructionHandle ifElse = il.append(InstructionConstants.ICONST_0); ifNull.setTarget(ifElse); il.append(InstructionConstants.IRETURN); InstructionHandle handler = il.append(InstructionConstants.ASTORE_1); il.append(InstructionConstants.ICONST_0); il.append(InstructionConstants.IRETURN); method.addExceptionHandler(tryStart, handler.getPrev(), handler, new ObjectType("java.lang.Exception"), false); }
if (!w.isInJava5Mode()) { if (toType.needsNoConversionFrom(fromType)) { return; il.append(fact.createInvoke("org.aspectj.runtime.internal.Conversions", name, Type.OBJECT, new Type[] { from }, Constants.INVOKESTATIC)); } else if (toType.getWorld().isInJava5Mode() && validBoxing.get(toType.getSignature() + fromType.getSignature()) != null) {
if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ANNOTATIONS_NEED_JAVA5), getSourceLocation())); return this;
if (enclosingClass.getWorld().isInJava5Mode()) { gen.setModifiers(gen.getModifiers() | Constants.ACC_SYNTHETIC);
private void generatePerTWAspectOfMethod(LazyClassGen classGen) { InstructionFactory factory = classGen.getFactory(); LazyMethodGen method = makeMethodGen(classGen, AjcMemberMaker.perTypeWithinAspectOfMethod(aspectType, classGen.getWorld() .isInJava5Mode())); flagAsSynthetic(method, false); classGen.addMethodGen(method);