issue_id
int64 2.04k
425k
| title
stringlengths 9
251
| body
stringlengths 4
32.8k
⌀ | status
stringclasses 6
values | after_fix_sha
stringlengths 7
7
| project_name
stringclasses 6
values | repo_url
stringclasses 6
values | repo_name
stringclasses 6
values | language
stringclasses 1
value | issue_url
null | before_fix_sha
null | pull_url
null | commit_datetime
timestamp[us, tz=UTC] | report_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 23
187
| chunk_content
stringlengths 1
22k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
foundOneOfIncorrectVisibility = resolvedMember;
}
}
}
}
if (hasNoCtorOrANoArgOne) {
break;
}
}
if (!hasNoCtorOrANoArgOne) {
if (foundOneOfIncorrectVisibility != null) {
reportError(
"@DeclareParents: defaultImpl=\""
+ defaultImplClassName
+ "\" has a no argument constructor, but it is of incorrect visibility. It must be at least as visible as the type.",
struct);
} else {
reportError("@DeclareParents: defaultImpl=\"" + defaultImplClassName
+ "\" has no public no-arg constructor", struct);
}
}
if (!fieldType.isAssignableFrom(impl)) {
reportError("@DeclareParents: defaultImpl=\"" + defaultImplClassName
+ "\" does not implement the interface '" + fieldType.toString() + "'", struct);
}
}
}
boolean hasAtLeastOneMethod = false;
ResolvedMember[] methods = fieldType.getMethodsWithoutIterator(true, false).toArray(new ResolvedMember[0]);
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
for (int i = 0; i < methods.length; i++) {
ResolvedMember method = methods[i];
if (method.isAbstract()) {
hasAtLeastOneMethod = true;
MethodDelegateTypeMunger mdtm = new MethodDelegateTypeMunger(method, struct.enclosingType,
defaultImplClassName, typePattern);
mdtm.setFieldType(fieldType);
mdtm.setSourceLocation(struct.enclosingType.getSourceLocation());
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
struct.ajAttributes.add(new AjAttribute.TypeMunger(mdtm));
}
}
if (hasAtLeastOneMethod && defaultImplClassName != null) {
ResolvedMember fieldHost = AjcMemberMaker.itdAtDeclareParentsField(null, fieldType, struct.enclosingType);
struct.ajAttributes.add(new AjAttribute.TypeMunger(new MethodDelegateTypeMunger.FieldHostTypeMunger(
fieldHost, struct.enclosingType, typePattern)));
}
return true;
} else {
reportError("@DeclareParents: can only be used on a field whose type is an interface", struct);
return false;
}
}
}
return false;
}
/**
* Return a nicely formatted method string, for example: int X.foo(java.lang.String)
*/
public static String getMethodForMessage(AjAttributeMethodStruct methodstructure) {
StringBuffer sb = new StringBuffer();
sb.append("Method '");
sb.append(methodstructure.method.getReturnType().toString());
sb.append(" ").append(methodstructure.enclosingType).append(".").append(methodstructure.method.getName());
sb.append("(");
Type[] args = methodstructure.method.getArgumentTypes();
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
if (args != null) {
for (int t = 0; t < args.length; t++) {
if (t > 0) {
sb.append(",");
}
sb.append(args[t].toString());
}
}
sb.append(")'");
return sb.toString();
}
/**
* Process any @DeclareMixin annotation.
*
* Example Declaration <br>
*
* @DeclareMixin("Foo+") public I createImpl(Object o) { return new Impl(o); }
*
* <br>
* @param runtimeAnnotations
* @param struct
* @return true if found
*/
private static boolean handleDeclareMixinAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct) {
AnnotationGen declareMixinAnnotation = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREMIXIN_ANNOTATION);
if (declareMixinAnnotation == null) {
return false;
}
Method annotatedMethod = struct.method;
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
World world = struct.enclosingType.getWorld();
NameValuePair declareMixinPatternNameValuePair = getAnnotationElement(declareMixinAnnotation, VALUE);
String declareMixinPattern = declareMixinPatternNameValuePair.getValue().stringifyValue();
TypePattern targetTypePattern = parseTypePattern(declareMixinPattern, struct);
ResolvedType methodReturnType = UnresolvedType.forSignature(annotatedMethod.getReturnType().getSignature()).resolve(world);
if (methodReturnType.isPrimitiveType()) {
reportError(getMethodForMessage(struct) + ": factory methods for a mixin cannot return void or a primitive type",
struct);
return false;
}
if (annotatedMethod.getArgumentTypes().length > 1) {
reportError(getMethodForMessage(struct) + ": factory methods for a mixin can take a maximum of one parameter", struct);
return false;
}
NameValuePair interfaceListSpecified = getAnnotationElement(declareMixinAnnotation, "interfaces");
List<TypePattern> newParents = new ArrayList<TypePattern>(1);
List<ResolvedType> newInterfaceTypes = new ArrayList<ResolvedType>(1);
if (interfaceListSpecified != null) {
ArrayElementValue arrayOfInterfaceTypes = (ArrayElementValue) interfaceListSpecified.getValue();
int numberOfTypes = arrayOfInterfaceTypes.getElementValuesArraySize();
ElementValue[] theTypes = arrayOfInterfaceTypes.getElementValuesArray();
for (int i = 0; i < numberOfTypes; i++) {
ClassElementValue interfaceType = (ClassElementValue) theTypes[i];
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
ResolvedType ajInterfaceType = UnresolvedType.forSignature(interfaceType.getClassString().replace("/", "."))
.resolve(world);
if (ajInterfaceType.isMissing() || !ajInterfaceType.isInterface()) {
reportError(
"Types listed in the 'interfaces' DeclareMixin annotation value must be valid interfaces. This is invalid: "
+ ajInterfaceType.getName(), struct);
return false;
}
if (!ajInterfaceType.isAssignableFrom(methodReturnType)) {
reportError(getMethodForMessage(struct) + ": factory method does not return something that implements '"
+ ajInterfaceType.getName() + "'", struct);
return false;
}
newInterfaceTypes.add(ajInterfaceType);
TypePattern newParent = parseTypePattern(ajInterfaceType.getName(), struct);
newParents.add(newParent);
}
} else {
if (methodReturnType.isClass()) {
reportError(
getMethodForMessage(struct)
+ ": factory methods for a mixin must either return an interface type or specify interfaces in the annotation and return a class",
struct);
return false;
}
TypePattern newParent = parseTypePattern(methodReturnType.getName(), struct);
newInterfaceTypes.add(methodReturnType);
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
newParents.add(newParent);
}
if (newParents.size() == 0) {
return false;
}
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
DeclareParents dp = new DeclareParentsMixin(targetTypePattern, newParents);
dp.resolve(binding);
targetTypePattern = dp.getChild();
dp.setLocation(struct.context, -1, -1);
struct.ajAttributes.add(new AjAttribute.DeclareAttribute(dp));
Method implementationFactory = struct.method;
boolean hasAtLeastOneMethod = false;
for (Iterator iterator = newInterfaceTypes.iterator(); iterator.hasNext();) {
ResolvedType typeForDelegation = (ResolvedType) iterator.next();
ResolvedMember[] methods = typeForDelegation.getMethodsWithoutIterator(true, false).toArray(new ResolvedMember[0]);
for (int i = 0; i < methods.length; i++) {
ResolvedMember method = methods[i];
if (method.isAbstract()) {
hasAtLeastOneMethod = true;
MethodDelegateTypeMunger mdtm = new MethodDelegateTypeMunger(method, struct.enclosingType, "",
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
targetTypePattern, struct.method.getName(), struct.method.getSignature());
mdtm.setFieldType(methodReturnType);
mdtm.setSourceLocation(struct.enclosingType.getSourceLocation());
struct.ajAttributes.add(new AjAttribute.TypeMunger(mdtm));
}
}
}
if (hasAtLeastOneMethod) {
ResolvedMember fieldHost = AjcMemberMaker.itdAtDeclareParentsField(null, methodReturnType, struct.enclosingType);
struct.ajAttributes.add(new AjAttribute.TypeMunger(new MethodDelegateTypeMunger.FieldHostTypeMunger(fieldHost,
struct.enclosingType, targetTypePattern)));
}
return true;
}
/**
* Read @Before
*
* @param runtimeAnnotations
* @param struct
* @return true if found
*/
private static boolean handleBeforeAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
ResolvedPointcutDefinition preResolvedPointcut) {
AnnotationGen before = getAnnotation(runtimeAnnotations, AjcMemberMaker.BEFORE_ANNOTATION);
if (before != null) {
NameValuePair beforeAdvice = getAnnotationElement(before, VALUE);
if (beforeAdvice != null) {
String argumentNames = getArgNamesValue(before);
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
if (argumentNames != null) {
struct.unparsedArgumentNames = argumentNames;
}
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
try {
bindings = extractBindings(struct);
} catch (UnreadableDebugInfoException unreadableDebugInfoException) {
return false;
}
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
int extraArgument = extractExtraArgument(struct.method);
Pointcut pc = null;
if (preResolvedPointcut != null) {
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(beforeAdvice.getValue().stringifyValue(), struct, false);
if (pc == null) {
return false;
}
pc = pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
.getDeclarationOffset());
struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.Before, pc, extraArgument, sl.getOffset(), sl
.getOffset() + 1,
struct.context));
return true;
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
}
}
return false;
}
/**
* Read @After
*
* @param runtimeAnnotations
* @param struct
* @return true if found
*/
private static boolean handleAfterAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
ResolvedPointcutDefinition preResolvedPointcut) {
AnnotationGen after = getAnnotation(runtimeAnnotations, AjcMemberMaker.AFTER_ANNOTATION);
if (after != null) {
NameValuePair afterAdvice = getAnnotationElement(after, VALUE);
if (afterAdvice != null) {
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
String argumentNames = getArgNamesValue(after);
if (argumentNames != null) {
struct.unparsedArgumentNames = argumentNames;
}
try {
bindings = extractBindings(struct);
} catch (UnreadableDebugInfoException unreadableDebugInfoException) {
return false;
}
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
int extraArgument = extractExtraArgument(struct.method);
Pointcut pc = null;
if (preResolvedPointcut != null) {
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(afterAdvice.getValue().stringifyValue(), struct, false);
if (pc == null) {
return false;
}
pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
.getDeclarationOffset());
struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.After, pc, extraArgument, sl.getOffset(), sl
.getOffset() + 1,
struct.context));
return true;
}
}
return false;
}
/**
* Read @AfterReturning
*
* @param runtimeAnnotations
* @param struct
* @return true if found
*/
private static boolean handleAfterReturningAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
ResolvedPointcutDefinition preResolvedPointcut, BcelMethod owningMethod)
throws ReturningFormalNotDeclaredInAdviceSignatureException {
AnnotationGen after = getAnnotation(runtimeAnnotations, AjcMemberMaker.AFTERRETURNING_ANNOTATION);
if (after != null) {
NameValuePair annValue = getAnnotationElement(after, VALUE);
NameValuePair annPointcut = getAnnotationElement(after, POINTCUT);
NameValuePair annReturned = getAnnotationElement(after, RETURNING);
String pointcut = null;
String returned = null;
if ((annValue != null && annPointcut != null) || (annValue == null && annPointcut == null)) {
reportError("@AfterReturning: either 'value' or 'poincut' must be provided, not both", struct);
return false;
}
if (annValue != null) {
pointcut = annValue.getValue().stringifyValue();
} else {
pointcut = annPointcut.getValue().stringifyValue();
}
if (isNullOrEmpty(pointcut)) {
reportError("@AfterReturning: either 'value' or 'poincut' must be provided, not both", struct);
return false;
}
if (annReturned != null) {
returned = annReturned.getValue().stringifyValue();
if (isNullOrEmpty(returned)) {
returned = null;
} else {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
String[] pNames = owningMethod.getParameterNames();
if (pNames == null || pNames.length == 0 || !Arrays.asList(pNames).contains(returned)) {
throw new ReturningFormalNotDeclaredInAdviceSignatureException(returned);
}
}
}
String argumentNames = getArgNamesValue(after);
if (argumentNames != null) {
struct.unparsedArgumentNames = argumentNames;
}
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
try {
bindings = (returned == null ? extractBindings(struct) : extractBindings(struct, returned));
} catch (UnreadableDebugInfoException unreadableDebugInfoException) {
return false;
}
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
int extraArgument = extractExtraArgument(struct.method);
if (returned != null) {
extraArgument |= Advice.ExtraArgument;
}
Pointcut pc = null;
if (preResolvedPointcut != null) {
pc = preResolvedPointcut.getPointcut();
} else {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
pc = parsePointcut(pointcut, struct, false);
if (pc == null) {
return false;
}
pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
.getDeclarationOffset());
struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.AfterReturning, pc, extraArgument, sl.getOffset(),
sl.getOffset() + 1,
struct.context));
return true;
}
return false;
}
/**
* Read @AfterThrowing
*
* @param runtimeAnnotations
* @param struct
* @return true if found
*/
private static boolean handleAfterThrowingAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
ResolvedPointcutDefinition preResolvedPointcut, BcelMethod owningMethod)
throws ThrownFormalNotDeclaredInAdviceSignatureException {
AnnotationGen after = getAnnotation(runtimeAnnotations, AjcMemberMaker.AFTERTHROWING_ANNOTATION);
if (after != null) {
NameValuePair annValue = getAnnotationElement(after, VALUE);
NameValuePair annPointcut = getAnnotationElement(after, POINTCUT);
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
NameValuePair annThrown = getAnnotationElement(after, THROWING);
String pointcut = null;
String thrownFormal = null;
if ((annValue != null && annPointcut != null) || (annValue == null && annPointcut == null)) {
reportError("@AfterThrowing: either 'value' or 'poincut' must be provided, not both", struct);
return false;
}
if (annValue != null) {
pointcut = annValue.getValue().stringifyValue();
} else {
pointcut = annPointcut.getValue().stringifyValue();
}
if (isNullOrEmpty(pointcut)) {
reportError("@AfterThrowing: either 'value' or 'poincut' must be provided, not both", struct);
return false;
}
if (annThrown != null) {
thrownFormal = annThrown.getValue().stringifyValue();
if (isNullOrEmpty(thrownFormal)) {
thrownFormal = null;
} else {
String[] pNames = owningMethod.getParameterNames();
if (pNames == null || pNames.length == 0 || !Arrays.asList(pNames).contains(thrownFormal)) {
throw new ThrownFormalNotDeclaredInAdviceSignatureException(thrownFormal);
}
}
}
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
String argumentNames = getArgNamesValue(after);
if (argumentNames != null) {
struct.unparsedArgumentNames = argumentNames;
}
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
try {
bindings = (thrownFormal == null ? extractBindings(struct) : extractBindings(struct, thrownFormal));
} catch (UnreadableDebugInfoException unreadableDebugInfoException) {
return false;
}
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
int extraArgument = extractExtraArgument(struct.method);
if (thrownFormal != null) {
extraArgument |= Advice.ExtraArgument;
}
Pointcut pc = null;
if (preResolvedPointcut != null) {
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(pointcut, struct, false);
if (pc == null) {
return false;
}
pc.resolve(binding);
}
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
setIgnoreUnboundBindingNames(pc, bindings);
ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
.getDeclarationOffset());
struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.AfterThrowing, pc, extraArgument, sl.getOffset(), sl
.getOffset() + 1, struct.context));
return true;
}
return false;
}
/**
* Read @Around
*
* @param runtimeAnnotations
* @param struct
* @return true if found
*/
private static boolean handleAroundAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct,
ResolvedPointcutDefinition preResolvedPointcut) {
AnnotationGen around = getAnnotation(runtimeAnnotations, AjcMemberMaker.AROUND_ANNOTATION);
if (around != null) {
NameValuePair aroundAdvice = getAnnotationElement(around, VALUE);
if (aroundAdvice != null) {
String argumentNames = getArgNamesValue(around);
if (argumentNames != null) {
struct.unparsedArgumentNames = argumentNames;
}
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
try {
bindings = extractBindings(struct);
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
} catch (UnreadableDebugInfoException unreadableDebugInfoException) {
return false;
}
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
int extraArgument = extractExtraArgument(struct.method);
Pointcut pc = null;
if (preResolvedPointcut != null) {
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(aroundAdvice.getValue().stringifyValue(), struct, false);
if (pc == null) {
return false;
}
pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
.getDeclarationOffset());
struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.Around, pc, extraArgument, sl.getOffset(), sl
.getOffset() + 1,
struct.context));
return true;
}
}
return false;
}
/**
* Read @Pointcut and handle the resolving in a lazy way to deal with pointcut references
*
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
* @param runtimeAnnotations
* @param struct
* @return true if a pointcut was handled
*/
private static boolean handlePointcutAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct) {
AnnotationGen pointcut = getAnnotation(runtimeAnnotations, AjcMemberMaker.POINTCUT_ANNOTATION);
if (pointcut == null) {
return false;
}
NameValuePair pointcutExpr = getAnnotationElement(pointcut, VALUE);
if (!(Type.VOID.equals(struct.method.getReturnType()) || (Type.BOOLEAN.equals(struct.method.getReturnType())
&& struct.method.isStatic() && struct.method.isPublic()))) {
reportWarning("Found @Pointcut on a method not returning 'void' or not 'public static boolean'", struct);
}
if (struct.method.getExceptionTable() != null) {
reportWarning("Found @Pointcut on a method throwing exception", struct);
}
String argumentNames = getArgNamesValue(pointcut);
if (argumentNames != null) {
struct.unparsedArgumentNames = argumentNames;
}
final IScope binding;
try {
if (struct.method.isAbstract()) {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
binding = null;
} else {
binding = new BindingScope(struct.enclosingType, struct.context, extractBindings(struct));
}
} catch (UnreadableDebugInfoException e) {
return false;
}
UnresolvedType[] argumentTypes = new UnresolvedType[struct.method.getArgumentTypes().length];
for (int i = 0; i < argumentTypes.length; i++) {
argumentTypes[i] = UnresolvedType.forSignature(struct.method.getArgumentTypes()[i].getSignature());
}
Pointcut pc = null;
if (struct.method.isAbstract()) {
if ((pointcutExpr != null && isNullOrEmpty(pointcutExpr.getValue().stringifyValue())) || pointcutExpr == null) {
} else {
reportError("Found defined @Pointcut on an abstract method", struct);
return false;
}
} else {
if (pointcutExpr == null || isNullOrEmpty(pointcutExpr.getValue().stringifyValue())) {
} else {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
pc = parsePointcut(pointcutExpr.getValue().stringifyValue(), struct, true);
if (pc == null) {
return false;
}
pc.setLocation(struct.context, -1, -1);
}
}
struct.ajAttributes.add(new AjAttribute.PointcutDeclarationAttribute(new LazyResolvedPointcutDefinition(
struct.enclosingType, struct.method.getModifiers(), struct.method.getName(), argumentTypes, UnresolvedType
.forSignature(struct.method.getReturnType().getSignature()), pc,
binding
)));
return true;
}
/**
* Read @DeclareError, @DeclareWarning
*
* @param runtimeAnnotations
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
* @param struct
* @return true if found
*/
private static boolean handleDeclareErrorOrWarningAnnotation(AsmManager model, RuntimeAnnos runtimeAnnotations,
AjAttributeFieldStruct struct) {
AnnotationGen error = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREERROR_ANNOTATION);
boolean hasError = false;
if (error != null) {
NameValuePair declareError = getAnnotationElement(error, VALUE);
if (declareError != null) {
if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
reportError("@DeclareError used on a non String constant field", struct);
return false;
}
Pointcut pc = parsePointcut(declareError.getValue().stringifyValue(), struct, false);
if (pc == null) {
hasError = false;
} else {
DeclareErrorOrWarning deow = new DeclareErrorOrWarning(true, pc, struct.field.getConstantValue().toString());
setDeclareErrorOrWarningLocation(model, deow, struct);
struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
hasError = true;
}
}
}
AnnotationGen warning = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREWARNING_ANNOTATION);
boolean hasWarning = false;
if (warning != null) {
NameValuePair declareWarning = getAnnotationElement(warning, VALUE);
if (declareWarning != null) {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
reportError("@DeclareWarning used on a non String constant field", struct);
return false;
}
Pointcut pc = parsePointcut(declareWarning.getValue().stringifyValue(), struct, false);
if (pc == null) {
hasWarning = false;
} else {
DeclareErrorOrWarning deow = new DeclareErrorOrWarning(false, pc, struct.field.getConstantValue().toString());
setDeclareErrorOrWarningLocation(model, deow, struct);
struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
return hasWarning = true;
}
}
}
return hasError || hasWarning;
}
/**
* Sets the location for the declare error / warning using the corresponding IProgramElement in the structure model. This will
* only fix bug 120356 if compiled with -emacssym, however, it does mean that the cross references view in AJDT will show the
* correct information.
*
* Other possibilities for fix: 1. using the information in ajcDeclareSoft (if this is set correctly) which will fix the problem
* if compiled with ajc but not if compiled with javac. 2. creating an AjAttribute called FieldDeclarationLineNumberAttribute
* (much like MethodDeclarationLineNumberAttribute) which we can ask for the offset. This will again only fix bug 120356 when
* compiled with ajc.
*
* @param deow
* @param struct
*/
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
private static void setDeclareErrorOrWarningLocation(AsmManager model, DeclareErrorOrWarning deow, AjAttributeFieldStruct struct) {
IHierarchy top = (model == null ? null : model.getHierarchy());
if (top != null && top.getRoot() != null) {
IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, struct.field.getName());
if (ipe != null && ipe.getSourceLocation() != null) {
ISourceLocation sourceLocation = ipe.getSourceLocation();
int start = sourceLocation.getOffset();
int end = start + struct.field.getName().length();
deow.setLocation(struct.context, start, end);
return;
}
}
deow.setLocation(struct.context, -1, -1);
}
/**
* Returns a readable representation of a method. Method.toString() is not suitable.
*
* @param method
* @return a readable representation of a method
*/
private static String methodToString(Method method) {
StringBuffer sb = new StringBuffer();
sb.append(method.getName());
sb.append(method.getSignature());
return sb.toString();
}
/**
* Build the bindings for a given method (pointcut / advice)
*
* @param struct
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
* @return null if no debug info is available
*/
private static FormalBinding[] extractBindings(AjAttributeMethodStruct struct) throws UnreadableDebugInfoException {
Method method = struct.method;
String[] argumentNames = struct.getArgumentNames();
if (argumentNames.length != method.getArgumentTypes().length) {
reportError(
"Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)",
struct);
throw new UnreadableDebugInfoException();
}
List<FormalBinding> bindings = new ArrayList<FormalBinding>();
for (int i = 0; i < argumentNames.length; i++) {
String argumentName = argumentNames[i];
UnresolvedType argumentType = UnresolvedType.forSignature(method.getArgumentTypes()[i].getSignature());
if ((AjcMemberMaker.TYPEX_JOINPOINT.equals(argumentType)
|| AjcMemberMaker.TYPEX_PROCEEDINGJOINPOINT.equals(argumentType)
|| AjcMemberMaker.TYPEX_STATICJOINPOINT.equals(argumentType)
|| AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT.equals(argumentType) || AjcMemberMaker.AROUND_CLOSURE_TYPE
.equals(argumentType))) {
bindings.add(new FormalBinding.ImplicitFormalBinding(argumentType, argumentName, i));
} else {
bindings.add(new FormalBinding(argumentType, argumentName, i));
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
}
}
return bindings.toArray(new FormalBinding[] {});
}
private static FormalBinding[] extractBindings(AjAttributeMethodStruct struct, String excludeFormal)
throws UnreadableDebugInfoException {
FormalBinding[] bindings = extractBindings(struct);
for (int i = 0; i < bindings.length; i++) {
FormalBinding binding = bindings[i];
if (binding.getName().equals(excludeFormal)) {
bindings[i] = new FormalBinding.ImplicitFormalBinding(binding.getType(), binding.getName(), binding.getIndex());
break;
}
}
return bindings;
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
}
/**
* Compute the flag for the xxxJoinPoint extra argument
*
* @param method
* @return extra arg flag
*/
private static int extractExtraArgument(Method method) {
Type[] methodArgs = method.getArgumentTypes();
String[] sigs = new String[methodArgs.length];
for (int i = 0; i < methodArgs.length; i++) {
sigs[i] = methodArgs[i].getSignature();
}
return extractExtraArgument(sigs);
}
/**
* Compute the flag for the xxxJoinPoint extra argument
*
* @param argumentSignatures
* @return extra arg flag
*/
public static int extractExtraArgument(String[] argumentSignatures) {
int extraArgument = 0;
for (int i = 0; i < argumentSignatures.length; i++) {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
if (AjcMemberMaker.TYPEX_JOINPOINT.getSignature().equals(argumentSignatures[i])) {
extraArgument |= Advice.ThisJoinPoint;
} else if (AjcMemberMaker.TYPEX_PROCEEDINGJOINPOINT.getSignature().equals(argumentSignatures[i])) {
extraArgument |= Advice.ThisJoinPoint;
} else if (AjcMemberMaker.TYPEX_STATICJOINPOINT.getSignature().equals(argumentSignatures[i])) {
extraArgument |= Advice.ThisJoinPointStaticPart;
} else if (AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT.getSignature().equals(argumentSignatures[i])) {
extraArgument |= Advice.ThisEnclosingJoinPointStaticPart;
}
}
return extraArgument;
}
/**
* Returns the runtime (RV/RIV) annotation of type annotationType or null if no such annotation
*
* @param rvs
* @param annotationType
* @return annotation
*/
private static AnnotationGen getAnnotation(RuntimeAnnos rvs, UnresolvedType annotationType) {
final String annotationTypeName = annotationType.getName();
for (Iterator iterator = rvs.getAnnotations().iterator(); iterator.hasNext();) {
AnnotationGen rv = (AnnotationGen) iterator.next();
if (annotationTypeName.equals(rv.getTypeName())) {
return rv;
}
}
return null;
}
/**
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
* Returns the value of a given element of an annotation or null if not found Caution: Does not handles default value.
*
* @param annotation
* @param elementName
* @return annotation NVP
*/
private static NameValuePair getAnnotationElement(AnnotationGen annotation, String elementName) {
for (Iterator iterator1 = annotation.getValues().iterator(); iterator1.hasNext();) {
NameValuePair element = (NameValuePair) iterator1.next();
if (elementName.equals(element.getNameString())) {
return element;
}
}
return null;
}
/**
* Return the argNames set for an annotation or null if it is not specified.
*/
private static String getArgNamesValue(AnnotationGen anno) {
List<NameValuePair> elements = anno.getValues();
for (NameValuePair element : elements) {
if (ARGNAMES.equals(element.getNameString())) {
return element.getValue().stringifyValue();
}
}
return null;
}
private static String lastbit(String fqname) {
int i = fqname.lastIndexOf(".");
if (i == -1) {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
return fqname;
} else {
return fqname.substring(i + 1);
}
}
/**
* Extract the method argument names. First we try the debug info attached to the method (the LocalVariableTable) - if we cannot
* find that we look to use the argNames value that may have been supplied on the associated annotation. If that fails we just
* don't know and return an empty string.
*
* @param method
* @param argNamesFromAnnotation
* @param methodStruct
* @return method argument names
*/
private static String[] getMethodArgumentNames(Method method, String argNamesFromAnnotation,
AjAttributeMethodStruct methodStruct) {
if (method.getArgumentTypes().length == 0) {
return EMPTY_STRINGS;
}
final int startAtStackIndex = method.isStatic() ? 0 : 1;
final List<MethodArgument> arguments = new ArrayList<MethodArgument>();
LocalVariableTable lt = method.getLocalVariableTable();
if (lt != null) {
for (int j = 0; j < lt.getLocalVariableTable().length; j++) {
LocalVariable localVariable = lt.getLocalVariableTable()[j];
if (localVariable.getStartPC() == 0) {
if (localVariable.getIndex() >= startAtStackIndex) {
arguments.add(new MethodArgument(localVariable.getName(), localVariable.getIndex()));
}
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
}
}
} else {
if (argNamesFromAnnotation != null) {
StringTokenizer st = new StringTokenizer(argNamesFromAnnotation, " ,");
List<String> args = new ArrayList<String>();
while (st.hasMoreTokens()) {
args.add(st.nextToken());
}
if (args.size() != method.getArgumentTypes().length) {
StringBuffer shortString = new StringBuffer().append(lastbit(method.getReturnType().toString())).append(" ")
.append(method.getName());
if (method.getArgumentTypes().length > 0) {
shortString.append("(");
for (int i = 0; i < method.getArgumentTypes().length; i++) {
shortString.append(lastbit(method.getArgumentTypes()[i].toString()));
if ((i + 1) < method.getArgumentTypes().length) {
shortString.append(",");
}
}
shortString.append(")");
}
reportError("argNames annotation value does not specify the right number of argument names for the method '"
+ shortString.toString() + "'", methodStruct);
return EMPTY_STRINGS;
}
return args.toArray(new String[] {});
}
}
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
if (arguments.size() != method.getArgumentTypes().length) {
return EMPTY_STRINGS;
}
Collections.sort(arguments, new Comparator() {
public int compare(Object o, Object o1) {
MethodArgument mo = (MethodArgument) o;
MethodArgument mo1 = (MethodArgument) o1;
if (mo.indexOnStack == mo1.indexOnStack) {
return 0;
} else if (mo.indexOnStack > mo1.indexOnStack) {
return 1;
} else {
return -1;
}
}
});
String[] argumentNames = new String[arguments.size()];
int i = 0;
for (MethodArgument methodArgument : arguments) {
argumentNames[i++] = methodArgument.name;
}
return argumentNames;
}
/**
* A method argument, used for sorting by indexOnStack (ie order in signature)
*
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
private static class MethodArgument {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
String name;
int indexOnStack;
public MethodArgument(String name, int indexOnStack) {
this.name = name;
this.indexOnStack = indexOnStack;
}
}
/**
* LazyResolvedPointcutDefinition lazyly resolve the pointcut so that we have time to register all pointcut referenced before
* pointcut resolution happens
*
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public static class LazyResolvedPointcutDefinition extends ResolvedPointcutDefinition {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
private final Pointcut m_pointcutUnresolved;
private final IScope m_binding;
private Pointcut m_lazyPointcut = null;
public LazyResolvedPointcutDefinition(UnresolvedType declaringType, int modifiers, String name,
UnresolvedType[] parameterTypes, UnresolvedType returnType, Pointcut pointcut, IScope binding) {
super(declaringType, modifiers, name, parameterTypes, returnType, null);
m_pointcutUnresolved = pointcut;
m_binding = binding;
}
@Override
public Pointcut getPointcut() {
if (m_lazyPointcut == null && m_pointcutUnresolved == null) {
m_lazyPointcut = Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
if (m_lazyPointcut == null && m_pointcutUnresolved != null) {
m_lazyPointcut = m_pointcutUnresolved.resolve(m_binding);
m_lazyPointcut.copyLocationFrom(m_pointcutUnresolved);
}
return m_lazyPointcut;
}
}
/**
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
* Helper to test empty strings
*
* @param s
* @return true if empty or null
*/
private static boolean isNullOrEmpty(String s) {
return (s == null || s.length() <= 0);
}
/**
* Set the pointcut bindings for which to ignore unbound issues, so that we can implicitly bind xxxJoinPoint for @AJ advices
*
* @param pointcut
* @param bindings
*/
private static void setIgnoreUnboundBindingNames(Pointcut pointcut, FormalBinding[] bindings) {
List ignores = new ArrayList();
for (int i = 0; i < bindings.length; i++) {
FormalBinding formalBinding = bindings[i];
if (formalBinding instanceof FormalBinding.ImplicitFormalBinding) {
ignores.add(formalBinding.getName());
}
}
pointcut.m_ignoreUnboundBindingForNames = (String[]) ignores.toArray(new String[ignores.size()]);
}
/**
* A check exception when we cannot read debug info (needed for formal binding)
*/
private static class UnreadableDebugInfoException extends Exception {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
}
/**
* Report an error
*
* @param message
* @param location
*/
private static void reportError(String message, AjAttributeStruct location) {
if (!location.handler.isIgnoring(IMessage.ERROR)) {
location.handler.handleMessage(new Message(message, location.enclosingType.getSourceLocation(), true));
}
}
/**
* Report a warning
*
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
* @param message
* @param location
*/
private static void reportWarning(String message, AjAttributeStruct location) {
if (!location.handler.isIgnoring(IMessage.WARNING)) {
location.handler.handleMessage(new Message(message, location.enclosingType.getSourceLocation(), false));
}
}
/**
* Parse the given pointcut, return null on failure and issue an error
*
* @param pointcutString
* @param struct
* @param allowIf
* @return pointcut, unresolved
*/
private static Pointcut parsePointcut(String pointcutString, AjAttributeStruct struct, boolean allowIf) {
try {
PatternParser parser = new PatternParser(pointcutString, struct.context);
Pointcut pointcut = parser.parsePointcut();
parser.checkEof();
pointcut.check(null, struct.enclosingType.getWorld());
if (!allowIf && pointcutString.indexOf("if()") >= 0 && hasIf(pointcut)) {
reportError("if() pointcut is not allowed at this pointcut location '" + pointcutString + "'", struct);
return null;
}
pointcut.setLocation(struct.context, -1, -1);
return pointcut;
} catch (ParserException e) {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
reportError("Invalid pointcut '" + pointcutString + "': " + e.toString()
+ (e.getLocation() == null ? "" : " at position " + e.getLocation().getStart()), struct);
return null;
}
}
private static boolean hasIf(Pointcut pointcut) {
IfFinder visitor = new IfFinder();
pointcut.accept(visitor, null);
return visitor.hasIf;
}
/**
* Parse the given type pattern, return null on failure and issue an error
*
* @param patternString
* @param location
* @return type pattern
*/
private static TypePattern parseTypePattern(String patternString, AjAttributeStruct location) {
try {
TypePattern typePattern = new PatternParser(patternString).parseTypePattern();
typePattern.setLocation(location.context, -1, -1);
return typePattern;
} catch (ParserException e) {
reportError("Invalid type pattern'" + patternString + "' : " + e.getLocation(), location);
return null;
}
}
static class ThrownFormalNotDeclaredInAdviceSignatureException extends Exception {
|
279,298 |
Bug 279298 AspectJ LTW with Cobertura
| null |
resolved fixed
|
35a9649
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-22T23:26:14Z | 2009-06-05T19:26:40Z |
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
|
private final String formalName;
public ThrownFormalNotDeclaredInAdviceSignatureException(String formalName) {
this.formalName = formalName;
}
public String getFormalName() {
return formalName;
}
}
static class ReturningFormalNotDeclaredInAdviceSignatureException extends Exception {
private final String formalName;
public ReturningFormalNotDeclaredInAdviceSignatureException(String formalName) {
this.formalName = formalName;
}
public String getFormalName() {
return formalName;
}
}
}
|
293,351 |
Bug 293351 RuntimeException weaving roo app with advice based on execution pointcut
|
java.lang.RuntimeException at org.aspectj.weaver.ResolvedType.getAnnotations(ResolvedType.java:718) at org.aspectj.weaver.AbstractAnnotationAJ.retrieveAnnotationOnAnnotation(AbstractAnnotationAJ.java:123) at org.aspectj.weaver.AbstractAnnotationAJ.ensureAtTargetInitialized(AbstractAnnotationAJ.java:85) at org.aspectj.weaver.AbstractAnnotationAJ.specifiesTarget(AbstractAnnotationAJ.java:115) at org.aspectj.weaver.bcel.BcelWeaver.verifyTa ... .eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: RuntimeException thrown: ResolvedType.getAnnotations() should never be called
|
resolved fixed
|
a23c7e4
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-27T14:04:12Z | 2009-10-26T18:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
|
/* *******************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Adrian Colyer Initial implementation
* ******************************************************************/
package org.aspectj.weaver;
import java.util.Collections;
import java.util.List;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.context.CompilationAndWeavingContext;
/**
* When we try to resolve a type in the world that we require to be present, and then fail to find it, we return an instance of this
* class. This class defers the production of the "can't find type error" until the first time that someone asks a question that
* can't be answered solely from the signature. This enables the weaver to be more tolerant of missing types.
*
*/
public class MissingResolvedTypeWithKnownSignature extends ResolvedType {
private static ResolvedMember[] NO_MEMBERS = new ResolvedMember[0];
private static ResolvedType[] NO_TYPES = new ResolvedType[0];
private boolean issuedCantFindTypeError = false;
|
293,351 |
Bug 293351 RuntimeException weaving roo app with advice based on execution pointcut
|
java.lang.RuntimeException at org.aspectj.weaver.ResolvedType.getAnnotations(ResolvedType.java:718) at org.aspectj.weaver.AbstractAnnotationAJ.retrieveAnnotationOnAnnotation(AbstractAnnotationAJ.java:123) at org.aspectj.weaver.AbstractAnnotationAJ.ensureAtTargetInitialized(AbstractAnnotationAJ.java:85) at org.aspectj.weaver.AbstractAnnotationAJ.specifiesTarget(AbstractAnnotationAJ.java:115) at org.aspectj.weaver.bcel.BcelWeaver.verifyTa ... .eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: RuntimeException thrown: ResolvedType.getAnnotations() should never be called
|
resolved fixed
|
a23c7e4
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-27T14:04:12Z | 2009-10-26T18:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
|
private boolean issuedJoinPointWarning = false;
private boolean issuedMissingInterfaceWarning = false;
/**
* @param signature
* @param world
*/
public MissingResolvedTypeWithKnownSignature(String signature, World world) {
super(signature, world);
}
public boolean isMissing() {
return true;
}
/**
* @param signature
* @param signatureErasure
* @param world
*/
public MissingResolvedTypeWithKnownSignature(String signature, String signatureErasure, World world) {
super(signature, signatureErasure, world);
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#getDeclaredFields()
*/
public ResolvedMember[] getDeclaredFields() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_FIELDS);
return NO_MEMBERS;
}
/*
|
293,351 |
Bug 293351 RuntimeException weaving roo app with advice based on execution pointcut
|
java.lang.RuntimeException at org.aspectj.weaver.ResolvedType.getAnnotations(ResolvedType.java:718) at org.aspectj.weaver.AbstractAnnotationAJ.retrieveAnnotationOnAnnotation(AbstractAnnotationAJ.java:123) at org.aspectj.weaver.AbstractAnnotationAJ.ensureAtTargetInitialized(AbstractAnnotationAJ.java:85) at org.aspectj.weaver.AbstractAnnotationAJ.specifiesTarget(AbstractAnnotationAJ.java:115) at org.aspectj.weaver.bcel.BcelWeaver.verifyTa ... .eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: RuntimeException thrown: ResolvedType.getAnnotations() should never be called
|
resolved fixed
|
a23c7e4
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-27T14:04:12Z | 2009-10-26T18:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
|
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#getDeclaredMethods()
*/
public ResolvedMember[] getDeclaredMethods() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_METHODS);
return NO_MEMBERS;
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#getDeclaredInterfaces()
*/
public ResolvedType[] getDeclaredInterfaces() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_INTERFACES);
return NO_TYPES;
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#getDeclaredPointcuts()
*/
public ResolvedMember[] getDeclaredPointcuts() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_POINTCUTS);
return NO_MEMBERS;
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#getSuperclass()
|
293,351 |
Bug 293351 RuntimeException weaving roo app with advice based on execution pointcut
|
java.lang.RuntimeException at org.aspectj.weaver.ResolvedType.getAnnotations(ResolvedType.java:718) at org.aspectj.weaver.AbstractAnnotationAJ.retrieveAnnotationOnAnnotation(AbstractAnnotationAJ.java:123) at org.aspectj.weaver.AbstractAnnotationAJ.ensureAtTargetInitialized(AbstractAnnotationAJ.java:85) at org.aspectj.weaver.AbstractAnnotationAJ.specifiesTarget(AbstractAnnotationAJ.java:115) at org.aspectj.weaver.bcel.BcelWeaver.verifyTa ... .eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: RuntimeException thrown: ResolvedType.getAnnotations() should never be called
|
resolved fixed
|
a23c7e4
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-27T14:04:12Z | 2009-10-26T18:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
|
*/
public ResolvedType getSuperclass() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_SUPERCLASS);
return ResolvedType.MISSING;
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#getModifiers()
*/
public int getModifiers() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_MODIFIERS);
return 0;
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#getSourceContext()
*/
public ISourceContext getSourceContext() {
return new ISourceContext() {
public ISourceLocation makeSourceLocation(IHasPosition position) {
return null;
}
public ISourceLocation makeSourceLocation(int line, int offset) {
return null;
}
public int getOffset() {
return 0;
}
|
293,351 |
Bug 293351 RuntimeException weaving roo app with advice based on execution pointcut
|
java.lang.RuntimeException at org.aspectj.weaver.ResolvedType.getAnnotations(ResolvedType.java:718) at org.aspectj.weaver.AbstractAnnotationAJ.retrieveAnnotationOnAnnotation(AbstractAnnotationAJ.java:123) at org.aspectj.weaver.AbstractAnnotationAJ.ensureAtTargetInitialized(AbstractAnnotationAJ.java:85) at org.aspectj.weaver.AbstractAnnotationAJ.specifiesTarget(AbstractAnnotationAJ.java:115) at org.aspectj.weaver.bcel.BcelWeaver.verifyTa ... .eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: RuntimeException thrown: ResolvedType.getAnnotations() should never be called
|
resolved fixed
|
a23c7e4
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-27T14:04:12Z | 2009-10-26T18:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
|
public void tidy() {
}
};
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#isAssignableFrom(org.aspectj.weaver.ResolvedType)
*/
public boolean isAssignableFrom(ResolvedType other) {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_ASSIGNABLE, other.getName());
return false;
}
public boolean isAssignableFrom(ResolvedType other, boolean allowMissing) {
if (allowMissing)
return false;
else
return isAssignableFrom(other);
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.ResolvedType#isCoerceableFrom(org.aspectj.weaver.ResolvedType)
*/
public boolean isCoerceableFrom(ResolvedType other) {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_COERCEABLE, other.getName());
return false;
}
/*
* (non-Javadoc)
|
293,351 |
Bug 293351 RuntimeException weaving roo app with advice based on execution pointcut
|
java.lang.RuntimeException at org.aspectj.weaver.ResolvedType.getAnnotations(ResolvedType.java:718) at org.aspectj.weaver.AbstractAnnotationAJ.retrieveAnnotationOnAnnotation(AbstractAnnotationAJ.java:123) at org.aspectj.weaver.AbstractAnnotationAJ.ensureAtTargetInitialized(AbstractAnnotationAJ.java:85) at org.aspectj.weaver.AbstractAnnotationAJ.specifiesTarget(AbstractAnnotationAJ.java:115) at org.aspectj.weaver.bcel.BcelWeaver.verifyTa ... .eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: RuntimeException thrown: ResolvedType.getAnnotations() should never be called
|
resolved fixed
|
a23c7e4
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-27T14:04:12Z | 2009-10-26T18:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
|
*
* @see org.aspectj.weaver.AnnotatedElement#hasAnnotation(org.aspectj.weaver.UnresolvedType)
*/
public boolean hasAnnotation(UnresolvedType ofType) {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_ANNOTATION);
return false;
}
public List getInterTypeMungers() {
return Collections.EMPTY_LIST;
}
public List getInterTypeMungersIncludingSupers() {
return Collections.EMPTY_LIST;
}
public List getInterTypeParentMungers() {
return Collections.EMPTY_LIST;
}
public List getInterTypeParentMungersIncludingSupers() {
return Collections.EMPTY_LIST;
}
protected void collectInterTypeMungers(List collector) {
return;
}
public void raiseWarningOnJoinPointSignature(String signature) {
if (issuedJoinPointWarning)
return;
String message = WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_JOINPOINT, getName(), signature);
message += "\n" + CompilationAndWeavingContext.getCurrentContext();
world.getLint().cantFindTypeAffectingJoinPointMatch.signal(message, null);
issuedJoinPointWarning = true;
|
293,351 |
Bug 293351 RuntimeException weaving roo app with advice based on execution pointcut
|
java.lang.RuntimeException at org.aspectj.weaver.ResolvedType.getAnnotations(ResolvedType.java:718) at org.aspectj.weaver.AbstractAnnotationAJ.retrieveAnnotationOnAnnotation(AbstractAnnotationAJ.java:123) at org.aspectj.weaver.AbstractAnnotationAJ.ensureAtTargetInitialized(AbstractAnnotationAJ.java:85) at org.aspectj.weaver.AbstractAnnotationAJ.specifiesTarget(AbstractAnnotationAJ.java:115) at org.aspectj.weaver.bcel.BcelWeaver.verifyTa ... .eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: RuntimeException thrown: ResolvedType.getAnnotations() should never be called
|
resolved fixed
|
a23c7e4
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-10-27T14:04:12Z | 2009-10-26T18:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
|
}
public void raiseWarningOnMissingInterfaceWhilstFindingMethods() {
if (issuedMissingInterfaceWarning)
return;
String message = WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_INTERFACE_METHODS, getName(), signature);
message += "\n" + CompilationAndWeavingContext.getCurrentContext();
world.getLint().cantFindTypeAffectingJoinPointMatch.signal(message, null);
issuedMissingInterfaceWarning = true;
}
private void raiseCantFindType(String key) {
if (issuedCantFindTypeError)
return;
String message = WeaverMessages.format(key, getName());
message += "\n" + CompilationAndWeavingContext.getCurrentContext();
world.getLint().cantFindType.signal(message, null);
issuedCantFindTypeError = true;
}
private void raiseCantFindType(String key, String insert) {
if (issuedCantFindTypeError)
return;
String message = WeaverMessages.format(key, getName(), insert);
message += "\n" + CompilationAndWeavingContext.getCurrentContext();
world.getLint().cantFindType.signal(message, null);
issuedCantFindTypeError = true;
}
}
|
293,457 |
Bug 293457 NPE on multiple declare @methods
| null |
resolved fixed
|
dc53b77
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-11-19T17:01:09Z | 2009-10-27T16:13:20Z |
tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java
|
/*******************************************************************************
* Copyright (c) 2008 Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc167;
import java.io.File;
import junit.framework.Test;
import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc167Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
|
293,457 |
Bug 293457 NPE on multiple declare @methods
| null |
resolved fixed
|
dc53b77
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-11-19T17:01:09Z | 2009-10-27T16:13:20Z |
tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java
|
public void testTimers_1() {
runTest("timers - 1");
}
public void testAnnoMatching_pr293203() {
runTest("anno matching");
}
public void testScalaOuterClassNames_pr288064() {
runTest("outer class names - scala");
}
public void testScalaOuterClassNames_pr288064_ltw() {
runTest("outer class names - scala - ltw");
}
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc167Tests.class);
}
@Override
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc167/ajc167.xml");
}
}
|
120,375 |
Bug 120375 Support Load-Time Weaving and HotSwap
| null |
resolved fixed
|
19355dd
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-11-19T18:33:01Z | 2005-12-12T15:06:40Z |
loadtime5/java5-src/org/aspectj/weaver/loadtime/ClassPreProcessorAgentAdapter.java
|
/*******************************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Vasseur initial implementation
*******************************************************************************/
package org.aspectj.weaver.loadtime;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;
/**
* Java 1.5 adapter for class pre processor
*
* @author <a href="mailto:[email protected]">Alexandre Vasseur</a>
*/
public class ClassPreProcessorAgentAdapter implements ClassFileTransformer {
/**
* Concrete preprocessor.
*/
private static ClassPreProcessor s_preProcessor;
|
120,375 |
Bug 120375 Support Load-Time Weaving and HotSwap
| null |
resolved fixed
|
19355dd
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-11-19T18:33:01Z | 2005-12-12T15:06:40Z |
loadtime5/java5-src/org/aspectj/weaver/loadtime/ClassPreProcessorAgentAdapter.java
|
static {
try {
s_preProcessor = new Aj();
s_preProcessor.initialize();
} catch (Exception e) {
throw new ExceptionInInitializerError("could not initialize JSR163 preprocessor due to: " + e.toString());
}
}
/**
* Weaving delegation
*
* @param loader the defining class loader
* @param className the name of class beeing loaded
* @param classBeingRedefined when hotswap is called
* @param protectionDomain
* @param bytes the bytecode before weaving
* @return the weaved bytecode
*/
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
byte[] bytes) throws IllegalClassFormatException {
if (classBeingRedefined == null) {
return s_preProcessor.preProcess(className, bytes, loader);
} else {
new Exception("AspectJ5 does not weave hotswapped class (" + className + ")").printStackTrace();
return bytes;
}
}
}
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
/* *******************************************************************
* Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http:www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* PARC initial implementation
* ******************************************************************/
package org.aspectj.weaver;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.Version;
import org.aspectj.util.FileUtil;
import org.aspectj.weaver.patterns.Declare;
import org.aspectj.weaver.patterns.IScope;
import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.Pointcut;
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
/**
* These attributes are written to and read from .class files (see the JVM spec).
*
* <p>
* Each member or type can have a number of AjAttributes. Each such attribute is in 1-1 correspondence with an Unknown bcel
* attribute. Creating one of these does NOTHING to the underlying thing, so if you really want to add an attribute to a particular
* thing, well, you'd better actually do that.
*
* @author Erik Hilsdale
* @author Jim Hugunin
*/
public abstract class AjAttribute {
public static final String AttributePrefix = "org.aspectj.weaver";
protected abstract void write(DataOutputStream s) throws IOException;
public abstract String getNameString();
public char[] getNameChars() {
return getNameString().toCharArray();
}
/**
* Just writes the contents
*/
public byte[] getBytes() {
try {
ByteArrayOutputStream b0 = new ByteArrayOutputStream();
DataOutputStream s0 = new DataOutputStream(b0);
write(s0);
return b0.toByteArray();
} catch (IOException e) {
throw new RuntimeException("sanity check");
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
}
}
/**
* Writes the full attribute, i.e. name_index, length, and contents
*/
public byte[] getAllBytes(short nameIndex) {
try {
byte[] bytes = getBytes();
ByteArrayOutputStream b0 = new ByteArrayOutputStream();
DataOutputStream s0 = new DataOutputStream(b0);
s0.writeShort(nameIndex);
s0.writeInt(bytes.length);
s0.write(bytes);
return b0.toByteArray();
} catch (IOException e) {
throw new RuntimeException("sanity check");
}
}
public static AjAttribute read(AjAttribute.WeaverVersionInfo v, String name, byte[] bytes, ISourceContext context, World w) {
try {
if (bytes == null) {
bytes = new byte[0];
}
VersionedDataInputStream s = new VersionedDataInputStream(new ByteArrayInputStream(bytes));
s.setVersion(v);
if (name.equals(Aspect.AttributeName)) {
return new Aspect(PerClause.readPerClause(s, context));
} else if (name.equals(MethodDeclarationLineNumberAttribute.AttributeName)) {
return MethodDeclarationLineNumberAttribute.read(s);
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
} else if (name.equals(WeaverState.AttributeName)) {
return new WeaverState(WeaverStateInfo.read(s, context));
} else if (name.equals(WeaverVersionInfo.AttributeName)) {
return WeaverVersionInfo.read(s);
} else if (name.equals(AdviceAttribute.AttributeName)) {
AdviceAttribute aa = AdviceAttribute.read(s, context);
aa.getPointcut().check(context, w);
return aa;
} else if (name.equals(PointcutDeclarationAttribute.AttributeName)) {
PointcutDeclarationAttribute pda = new PointcutDeclarationAttribute(ResolvedPointcutDefinition.read(s, context));
pda.pointcutDef.getPointcut().check(context, w);
return pda;
} else if (name.equals(TypeMunger.AttributeName)) {
return new TypeMunger(ResolvedTypeMunger.read(s, context));
} else if (name.equals(AjSynthetic.AttributeName)) {
return new AjSynthetic();
} else if (name.equals(DeclareAttribute.AttributeName)) {
return new DeclareAttribute(Declare.read(s, context));
} else if (name.equals(PrivilegedAttribute.AttributeName)) {
return PrivilegedAttribute.read(s, context);
} else if (name.equals(SourceContextAttribute.AttributeName)) {
return SourceContextAttribute.read(s);
} else if (name.equals(EffectiveSignatureAttribute.AttributeName)) {
return EffectiveSignatureAttribute.read(s, context);
} else {
if (w == null || w.getMessageHandler() == null) {
throw new BCException("unknown attribute" + name);
}
w.getMessageHandler().handleMessage(MessageUtil.warn("unknown attribute encountered " + name));
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
return null;
}
} catch (BCException e) {
throw new BCException("malformed " + name + " attribute (length:" + bytes.length + ")" + e);
} catch (IOException e) {
throw new BCException("malformed " + name + " attribute (length:" + bytes.length + ")" + e);
}
}
/**
* Synthetic members should have NO advice put on them or on their contents. This attribute is currently unused as we consider
* all members starting with NameMangler.PREFIX to automatically be synthetic. As we use this we might find that we want
* multiple kinds of synthetic. In particular, if we want to treat the call to a synthetic getter (say, of an introduced field)
* as a field reference itself, then a method might want a particular kind of AjSynthetic attribute that also includes a
* signature of what it stands for.
*/
public static class AjSynthetic extends AjAttribute {
public static final String AttributeName = "org.aspectj.weaver.AjSynthetic";
@Override
public String getNameString() {
return AttributeName;
}
public AjSynthetic() {
}
@Override
public void write(DataOutputStream s) throws IOException {
}
}
public static class TypeMunger extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.TypeMunger";
@Override
public String getNameString() {
return AttributeName;
}
private final ResolvedTypeMunger munger;
public TypeMunger(ResolvedTypeMunger munger) {
this.munger = munger;
}
@Override
public void write(DataOutputStream s) throws IOException {
munger.write(s);
}
public ConcreteTypeMunger reify(World world, ResolvedType aspectType) {
return world.getWeavingSupport().concreteTypeMunger(munger, aspectType);
}
}
public static class WeaverState extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.WeaverState";
@Override
public String getNameString() {
return AttributeName;
}
private final WeaverStateInfo kind;
public WeaverState(WeaverStateInfo kind) {
this.kind = kind;
}
@Override
public void write(DataOutputStream s) throws IOException {
kind.write(s);
}
public WeaverStateInfo reify() {
return kind;
}
}
public static class WeaverVersionInfo extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.WeaverVersion";
public final static short WEAVER_VERSION_MAJOR_UNKNOWN = 0;
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public final static short WEAVER_VERSION_MINOR_UNKNOWN = 0;
public final static short WEAVER_VERSION_MAJOR_AJ121 = 1;
public final static short WEAVER_VERSION_MINOR_AJ121 = 0;
public final static short WEAVER_VERSION_MAJOR_AJ150M4 = 3;
public final static short WEAVER_VERSION_MAJOR_AJ150 = 2;
public final static short WEAVER_VERSION_MINOR_AJ150 = 0;
public final static short WEAVER_VERSION_MAJOR_AJ160M2 = 5;
public final static short WEAVER_VERSION_MAJOR_AJ160 = 4;
public final static short WEAVER_VERSION_MINOR_AJ160 = 0;
public final static short WEAVER_VERSION_MAJOR_AJ161 = 6;
public final static short WEAVER_VERSION_MINOR_AJ161 = 0;
private final static short CURRENT_VERSION_MAJOR = WEAVER_VERSION_MAJOR_AJ161;
private final static short CURRENT_VERSION_MINOR = WEAVER_VERSION_MINOR_AJ161;
public final static WeaverVersionInfo UNKNOWN = new WeaverVersionInfo(WEAVER_VERSION_MAJOR_UNKNOWN,
WEAVER_VERSION_MINOR_UNKNOWN);
public final static WeaverVersionInfo CURRENT = new WeaverVersionInfo(CURRENT_VERSION_MAJOR, CURRENT_VERSION_MINOR);
private final short major_version;
private final short minor_version;
private long buildstamp = Version.NOTIME;
@Override
public String getNameString() {
return AttributeName;
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
}
public WeaverVersionInfo() {
major_version = CURRENT_VERSION_MAJOR;
minor_version = CURRENT_VERSION_MINOR;
}
public WeaverVersionInfo(short major, short minor) {
major_version = major;
minor_version = minor;
}
@Override
public void write(DataOutputStream s) throws IOException {
s.writeShort(CURRENT_VERSION_MAJOR);
s.writeShort(CURRENT_VERSION_MINOR);
s.writeLong(Version.getTime());
}
public static WeaverVersionInfo read(VersionedDataInputStream s) throws IOException {
short major = s.readShort();
short minor = s.readShort();
WeaverVersionInfo wvi = new WeaverVersionInfo(major, minor);
if (s.getMajorVersion() >= WEAVER_VERSION_MAJOR_AJ150M4) {
long stamp = 0;
try {
stamp = s.readLong();
wvi.setBuildstamp(stamp);
} catch (EOFException eof) {
}
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
}
return wvi;
}
public short getMajorVersion() {
return major_version;
}
public short getMinorVersion() {
return minor_version;
}
public static short getCurrentWeaverMajorVersion() {
return CURRENT_VERSION_MAJOR;
}
public static short getCurrentWeaverMinorVersion() {
return CURRENT_VERSION_MINOR;
}
public void setBuildstamp(long stamp) {
buildstamp = stamp;
}
public long getBuildstamp() {
return buildstamp;
}
@Override
public String toString() {
return major_version + "." + minor_version;
}
public static String toCurrentVersionString() {
return CURRENT_VERSION_MAJOR + "." + CURRENT_VERSION_MINOR;
}
}
public static class SourceContextAttribute extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.SourceContext";
@Override
public String getNameString() {
return AttributeName;
}
private final String sourceFileName;
private final int[] lineBreaks;
public SourceContextAttribute(String sourceFileName, int[] lineBreaks) {
this.sourceFileName = sourceFileName;
this.lineBreaks = lineBreaks;
}
@Override
public void write(DataOutputStream s) throws IOException {
s.writeUTF(sourceFileName);
FileUtil.writeIntArray(lineBreaks, s);
}
public static SourceContextAttribute read(VersionedDataInputStream s) throws IOException {
return new SourceContextAttribute(s.readUTF(), FileUtil.readIntArray(s));
}
public int[] getLineBreaks() {
return lineBreaks;
}
public String getSourceFileName() {
return sourceFileName;
}
}
public static class MethodDeclarationLineNumberAttribute extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.MethodDeclarationLineNumber";
@Override
public String getNameString() {
return AttributeName;
}
private final int lineNumber;
private final int offset;
public MethodDeclarationLineNumberAttribute(int line, int offset) {
lineNumber = line;
this.offset = offset;
}
public int getLineNumber() {
return lineNumber;
}
public int getOffset() {
return offset;
}
@Override
public void write(DataOutputStream s) throws IOException {
s.writeInt(lineNumber);
s.writeInt(offset);
}
public static MethodDeclarationLineNumberAttribute read(VersionedDataInputStream s) throws IOException {
int line = s.readInt();
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
int offset = 0;
if (s.available() > 0) {
offset = s.readInt();
}
return new MethodDeclarationLineNumberAttribute(line, offset);
}
@Override
public String toString() {
return AttributeName + ": " + lineNumber + ":" + offset;
}
}
public static class PointcutDeclarationAttribute extends AjAttribute {
public static final String AttributeName = "org.aspectj.weaver.PointcutDeclaration";
@Override
public String getNameString() {
return AttributeName;
}
private final ResolvedPointcutDefinition pointcutDef;
public PointcutDeclarationAttribute(ResolvedPointcutDefinition pointcutDef) {
this.pointcutDef = pointcutDef;
}
@Override
public void write(DataOutputStream s) throws IOException {
pointcutDef.write(s);
}
public ResolvedPointcutDefinition reify() {
return pointcutDef;
}
}
public static class DeclareAttribute extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.Declare";
@Override
public String getNameString() {
return AttributeName;
}
private final Declare declare;
public DeclareAttribute(Declare declare) {
this.declare = declare;
}
@Override
public void write(DataOutputStream s) throws IOException {
declare.write(s);
}
public Declare getDeclare() {
return declare;
}
}
public static class AdviceAttribute extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.Advice";
@Override
public String getNameString() {
return AttributeName;
}
private final AdviceKind kind;
private final Pointcut pointcut;
private final int extraParameterFlags;
private final int start;
private final int end;
private final ISourceContext sourceContext;
private boolean proceedInInners;
private ResolvedMember[] proceedCallSignatures;
private boolean[] formalsUnchangedToProceed;
private UnresolvedType[] declaredExceptions;
/**
* @param lexicalPosition must be greater than the lexicalPosition of any advice declared before this one in an aspect,
* otherwise, it can be any value.
*/
public AdviceAttribute(AdviceKind kind, Pointcut pointcut, int extraArgumentFlags, int start, int end,
ISourceContext sourceContext) {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
this.kind = kind;
this.pointcut = pointcut;
extraParameterFlags = extraArgumentFlags;
this.start = start;
this.end = end;
this.sourceContext = sourceContext;
}
public AdviceAttribute(AdviceKind kind, Pointcut pointcut, int extraArgumentFlags, int start, int end,
ISourceContext sourceContext, boolean proceedInInners, ResolvedMember[] proceedCallSignatures,
boolean[] formalsUnchangedToProceed, UnresolvedType[] declaredExceptions) {
this.kind = kind;
this.pointcut = pointcut;
extraParameterFlags = extraArgumentFlags;
this.start = start;
this.end = end;
this.sourceContext = sourceContext;
if (kind != AdviceKind.Around) {
throw new IllegalArgumentException("only for around");
}
this.proceedInInners = proceedInInners;
this.proceedCallSignatures = proceedCallSignatures;
this.formalsUnchangedToProceed = formalsUnchangedToProceed;
this.declaredExceptions = declaredExceptions;
}
public static AdviceAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
AdviceKind kind = AdviceKind.read(s);
if (kind == AdviceKind.Around) {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
return new AdviceAttribute(kind, Pointcut.read(s, context), s.readByte(), s.readInt(), s.readInt(), context, s
.readBoolean(), ResolvedMemberImpl.readResolvedMemberArray(s, context), FileUtil.readBooleanArray(s),
UnresolvedType.readArray(s));
} else {
return new AdviceAttribute(kind, Pointcut.read(s, context), s.readByte(), s.readInt(), s.readInt(), context);
}
}
@Override
public void write(DataOutputStream s) throws IOException {
kind.write(s);
pointcut.write(s);
s.writeByte(extraParameterFlags);
s.writeInt(start);
s.writeInt(end);
if (kind == AdviceKind.Around) {
s.writeBoolean(proceedInInners);
ResolvedMemberImpl.writeArray(proceedCallSignatures, s);
FileUtil.writeBooleanArray(formalsUnchangedToProceed, s);
UnresolvedType.writeArray(declaredExceptions, s);
}
}
public Advice reify(Member signature, World world, ResolvedType concreteAspect) {
return world.getWeavingSupport().createAdviceMunger(this, pointcut, signature, concreteAspect);
}
@Override
public String toString() {
return "AdviceAttribute(" + kind + ", " + pointcut + ", " + extraParameterFlags + ", " + start + ")";
}
public int getExtraParameterFlags() {
return extraParameterFlags;
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
}
public AdviceKind getKind() {
return kind;
}
public Pointcut getPointcut() {
return pointcut;
}
public UnresolvedType[] getDeclaredExceptions() {
return declaredExceptions;
}
public boolean[] getFormalsUnchangedToProceed() {
return formalsUnchangedToProceed;
}
public ResolvedMember[] getProceedCallSignatures() {
return proceedCallSignatures;
}
public boolean isProceedInInners() {
return proceedInInners;
}
public int getEnd() {
return end;
}
public ISourceContext getSourceContext() {
return sourceContext;
}
public int getStart() {
return start;
}
}
public static class Aspect extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.Aspect";
@Override
public String getNameString() {
return AttributeName;
}
private final PerClause perClause;
private IScope resolutionScope;
public Aspect(PerClause perClause) {
this.perClause = perClause;
}
public PerClause reify(ResolvedType inAspect) {
return perClause;
}
public PerClause reifyFromAtAspectJ(ResolvedType inAspect) {
perClause.resolve(resolutionScope);
return perClause;
}
@Override
public void write(DataOutputStream s) throws IOException {
perClause.write(s);
}
public void setResolutionScope(IScope binding) {
resolutionScope = binding;
}
}
public static class PrivilegedAttribute extends AjAttribute {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
public static final String AttributeName = "org.aspectj.weaver.Privileged";
@Override
public String getNameString() {
return AttributeName;
}
private final ResolvedMember[] accessedMembers;
public PrivilegedAttribute(ResolvedMember[] accessedMembers) {
this.accessedMembers = accessedMembers;
}
@Override
public void write(DataOutputStream s) throws IOException {
ResolvedMemberImpl.writeArray(accessedMembers, s);
}
public ResolvedMember[] getAccessedMembers() {
return accessedMembers;
}
public static PrivilegedAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
return new PrivilegedAttribute(ResolvedMemberImpl.readResolvedMemberArray(s, context));
}
}
public static class EffectiveSignatureAttribute extends AjAttribute {
public static final String AttributeName = "org.aspectj.weaver.EffectiveSignature";
@Override
public String getNameString() {
return AttributeName;
}
private final ResolvedMember effectiveSignature;
private final Shadow.Kind shadowKind;
private final boolean weaveBody;
public EffectiveSignatureAttribute(ResolvedMember effectiveSignature, Shadow.Kind shadowKind, boolean weaveBody) {
|
297,013 |
Bug 297013 Unclosed stream in AjAttribute
| null |
resolved fixed
|
28fb861
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2009-12-16T18:10:04Z | 2009-12-06T09:00:00Z |
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
|
this.effectiveSignature = effectiveSignature;
this.shadowKind = shadowKind;
this.weaveBody = weaveBody;
}
@Override
public void write(DataOutputStream s) throws IOException {
effectiveSignature.write(s);
shadowKind.write(s);
s.writeBoolean(weaveBody);
}
public static EffectiveSignatureAttribute read(VersionedDataInputStream s, ISourceContext context) throws IOException {
return new EffectiveSignatureAttribute(ResolvedMemberImpl.readResolvedMember(s, context), Shadow.Kind.read(s), s
.readBoolean());
}
public ResolvedMember getEffectiveSignature() {
return effectiveSignature;
}
@Override
public String toString() {
return "EffectiveSignatureAttribute(" + effectiveSignature + ", " + shadowKind + ")";
}
public Shadow.Kind getShadowKind() {
return shadowKind;
}
public boolean isWeaveBody() {
return weaveBody;
}
}
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
/*******************************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Vasseur initial implementation
* David Knibb weaving context enhancments
*******************************************************************************/
package org.aspectj.weaver.loadtime;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.Constants;
import org.aspectj.util.LangUtil;
import org.aspectj.weaver.Lint;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
import org.aspectj.weaver.Lint.Kind;
import org.aspectj.weaver.bcel.BcelWeakClassLoaderReference;
import org.aspectj.weaver.bcel.BcelWeaver;
import org.aspectj.weaver.bcel.BcelWorld;
import org.aspectj.weaver.bcel.Utility;
import org.aspectj.weaver.loadtime.definition.Definition;
import org.aspectj.weaver.loadtime.definition.DocumentParser;
import org.aspectj.weaver.ltw.LTWWorld;
import org.aspectj.weaver.patterns.PatternParser;
import org.aspectj.weaver.patterns.TypePattern;
import org.aspectj.weaver.tools.GeneratedClassHandler;
import org.aspectj.weaver.tools.Trace;
import org.aspectj.weaver.tools.TraceFactory;
import org.aspectj.weaver.tools.WeavingAdaptor;
/**
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
private final static String AOP_XML = Constants.AOP_USER_XML + ";" + Constants.AOP_AJC_XML + ";" + Constants.AOP_OSGI_XML;
private boolean initialized;
private List m_dumpTypePattern = new ArrayList();
private boolean m_dumpBefore = false;
private boolean dumpDirPerClassloader = false;
private boolean hasExcludes = false;
private List<TypePattern> excludeTypePattern = new ArrayList<TypePattern>();
private List<String> excludeStartsWith = new ArrayList<String>();
private List<String> excludeStarDotDotStar = new ArrayList<String>();
private List<String> excludeExactName = new ArrayList<String>();
private List<String> excludeEndsWith = new ArrayList<String>();
private List<String[]> excludeSpecial = new ArrayList<String[]>();
private boolean hasIncludes = false;
private List<TypePattern> includeTypePattern = new ArrayList<TypePattern>();
private List<String> m_includeStartsWith = new ArrayList<String>();
private List<String> includeExactName = new ArrayList<String>();
private boolean includeStar = false;
private List m_aspectExcludeTypePattern = new ArrayList();
private List m_aspectExcludeStartsWith = new ArrayList();
private List m_aspectIncludeTypePattern = new ArrayList();
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
private List m_aspectIncludeStartsWith = new ArrayList();
private StringBuffer namespace;
private IWeavingContext weavingContext;
private List concreteAspects = new ArrayList();
private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class);
public ClassLoaderWeavingAdaptor() {
super();
if (trace.isTraceEnabled()) {
trace.enter("<init>", this);
}
if (trace.isTraceEnabled()) {
trace.exit("<init>");
}
}
/**
* We don't need a reference to the class loader and using it during construction can cause problems with recursion. It also
* makes sense to supply the weaving context during initialization to.
*
* @deprecated
*/
public ClassLoaderWeavingAdaptor(final ClassLoader deprecatedLoader, final IWeavingContext deprecatedContext) {
super();
if (trace.isTraceEnabled()) {
trace.enter("<init>", this, new Object[] { deprecatedLoader, deprecatedContext });
}
if (trace.isTraceEnabled()) {
trace.exit("<init>");
}
}
class SimpleGeneratedClassHandler implements GeneratedClassHandler {
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
private BcelWeakClassLoaderReference loaderRef;
SimpleGeneratedClassHandler(ClassLoader loader) {
loaderRef = new BcelWeakClassLoaderReference(loader);
}
/**
* Callback when we need to define a Closure in the JVM
*
*/
public void acceptClass(String name, byte[] bytes) {
try {
if (shouldDump(name.replace('/', '.'), false)) {
dump(name, bytes, false);
}
} catch (Throwable throwable) {
throwable.printStackTrace();
}
defineClass(loaderRef.getClassLoader(), name, bytes);
}
}
public void initialize(final ClassLoader classLoader, IWeavingContext context) {
if (initialized) {
return;
}
boolean success = true;
this.weavingContext = context;
if (weavingContext == null) {
weavingContext = new DefaultWeavingContext(classLoader);
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
createMessageHandler();
this.generatedClassHandler = new SimpleGeneratedClassHandler(classLoader);
List definitions = weavingContext.getDefinitions(classLoader, this);
if (definitions.isEmpty()) {
disable();
if (trace.isTraceEnabled()) {
trace.exit("initialize", definitions);
}
return;
}
bcelWorld = new LTWWorld(classLoader, weavingContext, getMessageHandler(), null);
weaver = new BcelWeaver(bcelWorld);
success = registerDefinitions(weaver, classLoader, definitions);
if (success) {
weaver.prepareForWeave();
enable();
success = weaveAndDefineConceteAspects();
}
if (success) {
enable();
} else {
disable();
bcelWorld = null;
weaver = null;
}
initialized = true;
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
if (trace.isTraceEnabled()) {
trace.exit("initialize", isEnabled());
}
}
/**
* Load and cache the aop.xml/properties according to the classloader visibility rules
*
* @param weaver
* @param loader
*/
List parseDefinitions(final ClassLoader loader) {
if (trace.isTraceEnabled()) {
trace.enter("parseDefinitions", this);
}
List definitions = new ArrayList();
try {
info("register classloader " + getClassLoaderName(loader));
if (loader.equals(ClassLoader.getSystemClassLoader())) {
String file = System.getProperty("aj5.def", null);
if (file != null) {
info("using (-Daj5.def) " + file);
definitions.add(DocumentParser.parse((new File(file)).toURL()));
}
}
String resourcePath = System.getProperty("org.aspectj.weaver.loadtime.configuration", AOP_XML);
if (trace.isTraceEnabled()) {
trace.event("parseDefinitions", this, resourcePath);
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
StringTokenizer st = new StringTokenizer(resourcePath, ";");
while (st.hasMoreTokens()) {
String nextDefinition = st.nextToken();
if (nextDefinition.startsWith("file:")) {
try {
String fpath = new URL(nextDefinition).getFile();
File configFile = new File(fpath);
if (!configFile.exists()) {
warn("configuration does not exist: " + nextDefinition);
} else {
definitions.add(DocumentParser.parse(configFile.toURL()));
}
} catch (MalformedURLException mue) {
error("malformed definition url: " + nextDefinition);
}
} else {
Enumeration xmls = weavingContext.getResources(nextDefinition);
Set seenBefore = new HashSet();
while (xmls.hasMoreElements()) {
URL xml = (URL) xmls.nextElement();
if (trace.isTraceEnabled()) {
trace.event("parseDefinitions", this, xml);
}
if (!seenBefore.contains(xml)) {
info("using configuration " + weavingContext.getFile(xml));
definitions.add(DocumentParser.parse(xml));
seenBefore.add(xml);
} else {
warn("ignoring duplicate definition: " + xml);
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
}
}
}
if (definitions.isEmpty()) {
info("no configuration found. Disabling weaver for class loader " + getClassLoaderName(loader));
}
} catch (Exception e) {
definitions.clear();
warn("parse definitions failed", e);
}
if (trace.isTraceEnabled()) {
trace.exit("parseDefinitions", definitions);
}
return definitions;
}
private boolean registerDefinitions(final BcelWeaver weaver, final ClassLoader loader, List definitions) {
if (trace.isTraceEnabled()) {
trace.enter("registerDefinitions", this, definitions);
}
boolean success = true;
try {
registerOptions(weaver, loader, definitions);
registerAspectExclude(weaver, loader, definitions);
registerAspectInclude(weaver, loader, definitions);
success = registerAspects(weaver, loader, definitions);
registerIncludeExclude(weaver, loader, definitions);
registerDump(weaver, loader, definitions);
} catch (Exception ex) {
trace.error("register definition failed", ex);
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
success = false;
warn("register definition failed", (ex instanceof AbortException) ? null : ex);
}
if (trace.isTraceEnabled()) {
trace.exit("registerDefinitions", success);
}
return success;
}
private String getClassLoaderName(ClassLoader loader) {
return weavingContext.getClassLoaderName();
}
/**
* Configure the weaver according to the option directives TODO av - don't know if it is that good to reuse, since we only allow
* a small subset of options in LTW
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerOptions(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
StringBuffer allOptions = new StringBuffer();
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
allOptions.append(definition.getWeaverOptions()).append(' ');
}
Options.WeaverOption weaverOption = Options.parse(allOptions.toString(), loader, getMessageHandler());
World world = weaver.getWorld();
setMessageHandler(weaverOption.messageHandler);
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
world.setXlazyTjp(weaverOption.lazyTjp);
world.setXHasMemberSupportEnabled(weaverOption.hasMember);
world.setTiming(weaverOption.timers, true);
world.setOptionalJoinpoints(weaverOption.optionalJoinpoints);
world.setPinpointMode(weaverOption.pinpoint);
weaver.setReweavableMode(weaverOption.notReWeavable);
world.performExtraConfiguration(weaverOption.xSet);
world.setXnoInline(weaverOption.noInline);
world.setBehaveInJava5Way(LangUtil.is15VMOrGreater());
world.setAddSerialVerUID(weaverOption.addSerialVersionUID);
bcelWorld.getLint().loadDefaultProperties();
bcelWorld.getLint().adviceDidNotMatch.setKind(null);
if (weaverOption.lintFile != null) {
InputStream resource = null;
try {
resource = loader.getResourceAsStream(weaverOption.lintFile);
Exception failure = null;
if (resource != null) {
try {
Properties properties = new Properties();
properties.load(resource);
world.getLint().setFromProperties(properties);
} catch (IOException e) {
failure = e;
}
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
if (failure != null || resource == null) {
warn("Cannot access resource for -Xlintfile:" + weaverOption.lintFile, failure);
}
} finally {
try {
resource.close();
} catch (Throwable t) {
}
}
}
if (weaverOption.lint != null) {
if (weaverOption.lint.equals("default")) {
bcelWorld.getLint().loadDefaultProperties();
} else {
bcelWorld.getLint().setAll(weaverOption.lint);
if (weaverOption.lint.equals("ignore")) {
bcelWorld.setAllLintIgnored();
}
}
}
}
private void registerAspectExclude(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
String fastMatchInfo = null;
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator iterator1 = definition.getAspectExcludePatterns().iterator(); iterator1.hasNext();) {
String exclude = (String) iterator1.next();
TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
m_aspectExcludeTypePattern.add(excludePattern);
fastMatchInfo = looksLikeStartsWith(exclude);
if (fastMatchInfo != null) {
m_aspectExcludeStartsWith.add(fastMatchInfo);
}
}
}
}
private void registerAspectInclude(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
String fastMatchInfo = null;
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator iterator1 = definition.getAspectIncludePatterns().iterator(); iterator1.hasNext();) {
String include = (String) iterator1.next();
TypePattern includePattern = new PatternParser(include).parseTypePattern();
m_aspectIncludeTypePattern.add(includePattern);
fastMatchInfo = looksLikeStartsWith(include);
if (fastMatchInfo != null) {
m_aspectIncludeStartsWith.add(fastMatchInfo);
}
}
}
}
protected void lint(String name, String[] infos) {
Lint lint = bcelWorld.getLint();
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
Kind kind = lint.getLintKind(name);
kind.signal(infos, null, null);
}
@Override
public String getContextId() {
return weavingContext.getId();
}
/**
* Register the aspect, following include / exclude rules
*
* @param weaver
* @param loader
* @param definitions
*/
private boolean registerAspects(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
if (trace.isTraceEnabled()) {
trace.enter("registerAspects", this, new Object[] { weaver, loader, definitions });
}
boolean success = true;
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator aspects = definition.getAspectClassNames().iterator(); aspects.hasNext();) {
String aspectClassName = (String) aspects.next();
if (acceptAspect(aspectClassName)) {
info("register aspect " + aspectClassName);
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
weaver.addLibraryAspect(aspectClassName);
if (namespace == null) {
namespace = new StringBuffer(aspectClassName);
} else {
namespace = namespace.append(";" + aspectClassName);
}
} else {
lint("aspectExcludedByConfiguration", new String[] { aspectClassName, getClassLoaderName(loader) });
}
}
}
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Definition.ConcreteAspect concreteAspect : definition.getConcreteAspects()) {
if (acceptAspect(concreteAspect.name)) {
info("define aspect " + concreteAspect.name);
ConcreteAspectCodeGen gen = new ConcreteAspectCodeGen(concreteAspect, weaver.getWorld());
if (!gen.validate()) {
error("Concrete-aspect '" + concreteAspect.name + "' could not be registered");
success = false;
break;
}
((BcelWorld) weaver.getWorld()).addSourceObjectType(Utility.makeJavaClass(concreteAspect.name, gen.getBytes()),
true);
concreteAspects.add(gen);
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
weaver.addLibraryAspect(concreteAspect.name);
if (namespace == null) {
namespace = new StringBuffer(concreteAspect.name);
} else {
namespace = namespace.append(";" + concreteAspect.name);
}
}
}
}
if (!success) {
warn("failure(s) registering aspects. Disabling weaver for class loader " + getClassLoaderName(loader));
}
else if (namespace == null) {
success = false;
info("no aspects registered. Disabling weaver for class loader " + getClassLoaderName(loader));
}
if (trace.isTraceEnabled()) {
trace.exit("registerAspects", success);
}
return success;
}
private boolean weaveAndDefineConceteAspects() {
if (trace.isTraceEnabled()) {
trace.enter("weaveAndDefineConceteAspects", this, concreteAspects);
}
boolean success = true;
for (Iterator iterator = concreteAspects.iterator(); iterator.hasNext();) {
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
ConcreteAspectCodeGen gen = (ConcreteAspectCodeGen) iterator.next();
String name = gen.getClassName();
byte[] bytes = gen.getBytes();
try {
byte[] newBytes = weaveClass(name, bytes, true);
this.generatedClassHandler.acceptClass(name, newBytes);
} catch (IOException ex) {
trace.error("weaveAndDefineConceteAspects", ex);
error("exception weaving aspect '" + name + "'", ex);
}
}
if (trace.isTraceEnabled()) {
trace.exit("weaveAndDefineConceteAspects", success);
}
return success;
}
/**
* Register the include / exclude filters. We duplicate simple patterns in startWith filters that will allow faster matching
* without ResolvedType
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerIncludeExclude(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
String fastMatchInfo = null;
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator iterator1 = definition.getIncludePatterns().iterator(); iterator1.hasNext();) {
hasIncludes = true;
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
String include = (String) iterator1.next();
fastMatchInfo = looksLikeStartsWith(include);
if (fastMatchInfo != null) {
m_includeStartsWith.add(fastMatchInfo);
} else if (include.equals("*")) {
includeStar = true;
} else if ((fastMatchInfo = looksLikeExactName(include)) != null) {
includeExactName.add(fastMatchInfo);
} else {
TypePattern includePattern = new PatternParser(include).parseTypePattern();
includeTypePattern.add(includePattern);
}
}
for (Iterator iterator1 = definition.getExcludePatterns().iterator(); iterator1.hasNext();) {
hasExcludes = true;
String exclude = (String) iterator1.next();
fastMatchInfo = looksLikeStartsWith(exclude);
if (fastMatchInfo != null) {
excludeStartsWith.add(fastMatchInfo);
} else if ((fastMatchInfo = looksLikeStarDotDotStarExclude(exclude)) != null) {
excludeStarDotDotStar.add(fastMatchInfo);
} else if ((fastMatchInfo = looksLikeExactName(exclude)) != null) {
excludeExactName.add(exclude);
} else if ((fastMatchInfo = looksLikeEndsWith(exclude)) != null) {
excludeEndsWith.add(fastMatchInfo);
} else if (exclude
.equals("org.codehaus.groovy..* && !org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController*")) {
excludeSpecial.add(new String[] { "org.codehaus.groovy.",
"org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController" });
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
} else {
TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
excludeTypePattern.add(excludePattern);
}
}
}
}
/**
* Checks if the pattern looks like "*..*XXXX*" and if so returns XXXX. This will enable fast name matching of CGLIB exclusion
*
*/
private String looksLikeStarDotDotStarExclude(String typePattern) {
if (!typePattern.startsWith("*..*")) {
return null;
}
if (!typePattern.endsWith("*")) {
return null;
}
String subPattern = typePattern.substring(4, typePattern.length() - 1);
if (hasStarDot(subPattern, 0)) {
return null;
}
return subPattern.replace('$', '.');
}
/**
* Checks if the pattern looks like "com.foo.Bar" - an exact name
*/
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
private String looksLikeExactName(String typePattern) {
if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.indexOf("*") != -1) {
return null;
}
return typePattern.replace('$', '.');
}
/**
* Checks if the pattern looks like "*Exception"
*/
private String looksLikeEndsWith(String typePattern) {
if (typePattern.charAt(0) != '*') {
return null;
}
if (hasSpaceAnnotationPlus(typePattern, 1) || hasStarDot(typePattern, 1)) {
return null;
}
return typePattern.substring(1).replace('$', '.');
}
/**
* Determine if something in the string is going to affect our ability to optimize. Checks for: ' ' '@' '+'
*/
private boolean hasSpaceAnnotationPlus(String string, int pos) {
for (int i = pos, max = string.length(); i < max; i++) {
char ch = string.charAt(i);
if (ch == ' ' || ch == '@' || ch == '+') {
return true;
}
}
return false;
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
/**
* Determine if something in the string is going to affect our ability to optimize. Checks for: '*' '.'
*/
private boolean hasStarDot(String string, int pos) {
for (int i = pos, max = string.length(); i < max; i++) {
char ch = string.charAt(i);
if (ch == '*' || ch == '.') {
return true;
}
}
return false;
}
/**
* Checks if the type pattern looks like "com.foo..*"
*/
private String looksLikeStartsWith(String typePattern) {
if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.charAt(typePattern.length() - 1) != '*') {
return null;
}
int length = typePattern.length();
if (typePattern.endsWith("..*") && length > 3) {
if (typePattern.indexOf("..") == length - 3
&& typePattern.indexOf('*') == length - 1) {
return typePattern.substring(0, length - 2).replace('$', '.');
}
}
return null;
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
/**
* Register the dump filter
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerDump(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator iterator1 = definition.getDumpPatterns().iterator(); iterator1.hasNext();) {
String dump = (String) iterator1.next();
TypePattern pattern = new PatternParser(dump).parseTypePattern();
m_dumpTypePattern.add(pattern);
}
if (definition.shouldDumpBefore()) {
m_dumpBefore = true;
}
if (definition.createDumpDirPerClassloader()) {
dumpDirPerClassloader = true;
}
}
}
/**
* Determine whether a type should be accepted for weaving, by checking it against any includes/excludes.
*
* @param className the name of the type to possibly accept
* @param bytes the bytecode for the type (in case we need to look inside, eg. annotations)
* @return true if it should be accepted for weaving
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
*/
@Override
protected boolean accept(String className, byte[] bytes) {
if (!hasExcludes && !hasIncludes) {
return true;
}
String fastClassName = className.replace('/', '.').replace('$', '.');
for (String excludeStartsWithString : excludeStartsWith) {
if (fastClassName.startsWith(excludeStartsWithString)) {
return false;
}
}
if (!excludeStarDotDotStar.isEmpty()) {
for (String namePiece : excludeStarDotDotStar) {
int index = fastClassName.lastIndexOf('.');
if (fastClassName.indexOf(namePiece, index + 1) != -1) {
return false;
}
}
}
if (!excludeEndsWith.isEmpty()) {
for (String lastPiece : excludeEndsWith) {
if (fastClassName.endsWith(lastPiece)) {
return false;
}
}
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
if (!excludeExactName.isEmpty()) {
for (String name : excludeExactName) {
if (fastClassName.equals(name)) {
return false;
}
}
}
if (!excludeSpecial.isEmpty()) {
for (String[] entry : excludeSpecial) {
String excludeThese = entry[0];
String exceptThese = entry[1];
if (fastClassName.startsWith(excludeThese) && !fastClassName.startsWith(exceptThese)) {
return false;
}
}
}
/*
* Bug 120363 If we have an exclude pattern that cannot be matched using "starts with" then we cannot fast accept
*/
boolean didSomeIncludeMatching = false;
if (excludeTypePattern.isEmpty()) {
if (includeStar) {
return true;
}
if (!includeExactName.isEmpty()) {
didSomeIncludeMatching = true;
for (String exactname : includeExactName) {
if (fastClassName.equals(exactname)) {
return true;
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
}
boolean fastAccept = false;
for (int i = 0; i < m_includeStartsWith.size(); i++) {
didSomeIncludeMatching = true;
fastAccept = fastClassName.startsWith(m_includeStartsWith.get(i));
if (fastAccept) {
return true;
}
}
if (includeTypePattern.isEmpty()) {
return !didSomeIncludeMatching;
}
}
boolean accept;
try {
ensureDelegateInitialized(className, bytes);
ResolvedType classInfo = delegateForCurrentClass.getResolvedTypeX();
for (TypePattern typePattern : excludeTypePattern) {
if (typePattern.matchesStatically(classInfo)) {
return false;
}
}
accept = !didSomeIncludeMatching;
for (TypePattern typePattern : includeTypePattern) {
accept = typePattern.matchesStatically(classInfo);
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
if (accept) {
break;
}
}
} finally {
this.bcelWorld.demote();
}
return accept;
}
private boolean acceptAspect(String aspectClassName) {
if (m_aspectExcludeTypePattern.isEmpty() && m_aspectIncludeTypePattern.isEmpty()) {
return true;
}
String fastClassName = aspectClassName.replace('/', '.').replace('.', '$');
for (int i = 0; i < m_aspectExcludeStartsWith.size(); i++) {
if (fastClassName.startsWith((String) m_aspectExcludeStartsWith.get(i))) {
return false;
}
}
for (int i = 0; i < m_aspectIncludeStartsWith.size(); i++) {
if (fastClassName.startsWith((String) m_aspectIncludeStartsWith.get(i))) {
return true;
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(aspectClassName), true);
for (Iterator iterator = m_aspectExcludeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
if (typePattern.matchesStatically(classInfo)) {
return false;
}
}
boolean accept = true;
for (Iterator iterator = m_aspectIncludeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
accept = typePattern.matchesStatically(classInfo);
if (accept) {
break;
}
}
return accept;
}
@Override
protected boolean shouldDump(String className, boolean before) {
if (before && !m_dumpBefore) {
return false;
}
|
298,786 |
Bug 298786 suspected problem with handling of multiple aop.xml files
| null |
resolved fixed
|
a968890
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-01-05T00:44:36Z | 2010-01-04T18:33:20Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
if (m_dumpTypePattern.isEmpty()) {
return false;
}
ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(className), true);
for (Iterator iterator = m_dumpTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
if (typePattern.matchesStatically(classInfo)) {
return true;
}
}
return false;
}
@Override
protected String getDumpDir() {
if (dumpDirPerClassloader) {
StringBuffer dir = new StringBuffer();
dir.append("_ajdump").append(File.separator).append(weavingContext.getId());
return dir.toString();
} else {
return super.getDumpDir();
}
}
/*
* shared classes methods
*/
/**
* @return Returns the key.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.