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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
314,130 |
Bug 314130 [plan] [ltw] [hcr] LTW, Reweaving and Hot Code Replace changes reflected every two saves of files
| null |
resolved fixed
|
cf0ee0c
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-26T22:31:02Z | 2010-05-24T16:53:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
}
public void setDelegate(IMessageHandler messageHandler) {
delegate = messageHandler;
}
/*
* IMessageHandler
*/
@Override
public boolean handleMessage(IMessage message) throws AbortException {
if (traceMessages) {
traceMessage(message);
}
super.handleMessage(message);
if (abortOnError && 0 <= message.getKind().compareTo(IMessage.ERROR)) {
throw new AbortException(message);
}
}
}
if (savedMessages != null) {
delegate.handleMessage(message);
}
return true;
|
314,130 |
Bug 314130 [plan] [ltw] [hcr] LTW, Reweaving and Hot Code Replace changes reflected every two saves of files
| null |
resolved fixed
|
cf0ee0c
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-26T22:31:02Z | 2010-05-24T16:53:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
}
@Override
public boolean isIgnoring(Kind kind) {
return delegate.isIgnoring(kind);
}
@Override
public void dontIgnore(IMessage.Kind kind) {
if (null != kind && delegate != null) {
delegate.dontIgnore(kind);
}
}
@Override
public void ignore(Kind kind) {
if (null != kind && delegate != null) {
delegate.ignore(kind);
}
}
/*
* IMessageHolder
*/
@Override
public List getUnmodifiableListView() {
List allMessages = new ArrayList();
allMessages.addAll(savedMessages);
allMessages.addAll(super.getUnmodifiableListView());
return allMessages;
}
}
protected class WeavingAdaptorMessageWriter extends MessageWriter {
|
314,130 |
Bug 314130 [plan] [ltw] [hcr] LTW, Reweaving and Hot Code Replace changes reflected every two saves of files
| null |
resolved fixed
|
cf0ee0c
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-26T22:31:02Z | 2010-05-24T16:53:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
private final Set ignoring = new HashSet();
private final IMessage.Kind failKind;
public WeavingAdaptorMessageWriter(PrintWriter writer) {
super(writer, true);
ignore(IMessage.WEAVEINFO);
ignore(IMessage.DEBUG);
ignore(IMessage.INFO);
this.failKind = IMessage.ERROR;
}
@Override
public boolean handleMessage(IMessage message) throws AbortException {
super.handleMessage(message);
if (abortOnError && 0 <= message.getKind().compareTo(failKind)) {
throw new AbortException(message);
}
return true;
}
@Override
public boolean isIgnoring(Kind kind) {
return ((null != kind) && (ignoring.contains(kind)));
}
|
314,130 |
Bug 314130 [plan] [ltw] [hcr] LTW, Reweaving and Hot Code Replace changes reflected every two saves of files
| null |
resolved fixed
|
cf0ee0c
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-26T22:31:02Z | 2010-05-24T16:53:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
/**
* Set a message kind to be ignored from now on
*/
@Override
public void ignore(IMessage.Kind kind) {
if ((null != kind) && (!ignoring.contains(kind))) {
ignoring.add(kind);
}
}
/**
* Remove a message kind from the list of those ignored from now on.
*/
@Override
public void dontIgnore(IMessage.Kind kind) {
if (null != kind) {
ignoring.remove(kind);
}
}
@Override
protected String render(IMessage message) {
return "[" + getContextId() + "] " + super.render(message);
}
}
private class WeavingClassFileProvider implements IClassFileProvider {
private final UnwovenClassFile unwovenClass;
private final List unwovenClasses = new ArrayList();
private IUnwovenClassFile wovenClass;
private boolean isApplyAtAspectJMungersOnly = false;
public WeavingClassFileProvider(String name, byte[] bytes) {
ensureDelegateInitialized(name, bytes);
|
314,130 |
Bug 314130 [plan] [ltw] [hcr] LTW, Reweaving and Hot Code Replace changes reflected every two saves of files
| null |
resolved fixed
|
cf0ee0c
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-26T22:31:02Z | 2010-05-24T16:53:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
this.unwovenClass = new UnwovenClassFile(name, delegateForCurrentClass.getResolvedTypeX().getName(), bytes);
this.unwovenClasses.add(unwovenClass);
if (shouldDump(name.replace('/', '.'), true)) {
dump(name, bytes, true);
}
}
public void setApplyAtAspectJMungersOnly() {
isApplyAtAspectJMungersOnly = true;
}
public boolean isApplyAtAspectJMungersOnly() {
return isApplyAtAspectJMungersOnly;
}
public byte[] getBytes() {
if (wovenClass != null) {
return wovenClass.getBytes();
} else {
return unwovenClass.getBytes();
}
}
public Iterator getClassFileIterator() {
return unwovenClasses.iterator();
}
public IWeaveRequestor getRequestor() {
return new IWeaveRequestor() {
public void acceptResult(IUnwovenClassFile result) {
if (wovenClass == null) {
wovenClass = result;
String name = result.getClassName();
if (shouldDump(name.replace('/', '.'), false)) {
dump(name, result.getBytes(), false);
|
314,130 |
Bug 314130 [plan] [ltw] [hcr] LTW, Reweaving and Hot Code Replace changes reflected every two saves of files
| null |
resolved fixed
|
cf0ee0c
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-26T22:31:02Z | 2010-05-24T16:53:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
}
}
else {
String className = result.getClassName();
generatedClasses.put(className, result);
generatedClasses.put(wovenClass.getClassName(), result);
generatedClassHandler.acceptClass(className, result.getBytes());
}
}
public void processingReweavableState() {
}
public void addingTypeMungers() {
}
public void weavingAspects() {
}
public void weavingClasses() {
}
public void weaveCompleted() {
ResolvedType.resetPrimitives();
if (delegateForCurrentClass != null) {
delegateForCurrentClass.weavingCompleted();
}
ResolvedType.resetPrimitives();
}
};
}
}
}
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.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.util.Collections;
import java.util.List;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.weaver.patterns.AndPointcut;
import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.Pointcut;
import org.aspectj.weaver.patterns.TypePattern;
public abstract class Advice extends ShadowMunger {
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
protected AjAttribute.AdviceAttribute attribute;
protected transient AdviceKind kind;
protected Member signature;
protected ResolvedType concreteAspect;
protected List innerCflowEntries = Collections.EMPTY_LIST;
protected int nFreeVars;
protected TypePattern exceptionType;
protected UnresolvedType[] bindingParameterTypes;
protected boolean hasMatchedAtLeastOnce = false;
protected List<Lint.Kind> suppressedLintKinds = null;
public ISourceLocation lastReportedMonitorExitJoinpointLocation = null;
public static Advice makeCflowEntry(World world, Pointcut entry, boolean isBelow, Member stackField, int nFreeVars,
List innerCflowEntries, ResolvedType inAspect) {
Advice ret = world.createAdviceMunger(isBelow ? AdviceKind.CflowBelowEntry : AdviceKind.CflowEntry, entry, stackField, 0,
entry, inAspect);
ret.innerCflowEntries = innerCflowEntries;
ret.nFreeVars = nFreeVars;
return ret;
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
}
public static Advice makePerCflowEntry(World world, Pointcut entry, boolean isBelow, Member stackField, ResolvedType inAspect,
List innerCflowEntries) {
Advice ret = world.createAdviceMunger(isBelow ? AdviceKind.PerCflowBelowEntry : AdviceKind.PerCflowEntry, entry,
stackField, 0, entry, inAspect);
ret.innerCflowEntries = innerCflowEntries;
ret.concreteAspect = inAspect;
return ret;
}
public static Advice makePerObjectEntry(World world, Pointcut entry, boolean isThis, ResolvedType inAspect) {
Advice ret = world.createAdviceMunger(isThis ? AdviceKind.PerThisEntry : AdviceKind.PerTargetEntry, entry, null, 0, entry,
inAspect);
ret.concreteAspect = inAspect;
return ret;
}
public static Advice makePerTypeWithinEntry(World world, Pointcut p, ResolvedType inAspect) {
Advice ret = world.createAdviceMunger(AdviceKind.PerTypeWithinEntry, p, null, 0, p, inAspect);
ret.concreteAspect = inAspect;
return ret;
}
public static Advice makeSoftener(World world, Pointcut entry, TypePattern exceptionType, ResolvedType inAspect,
IHasSourceLocation loc) {
Advice ret = world.createAdviceMunger(AdviceKind.Softener, entry, null, 0, loc, inAspect);
ret.exceptionType = exceptionType;
return ret;
}
public Advice(AjAttribute.AdviceAttribute attribute, Pointcut pointcut, Member signature) {
super(pointcut, attribute.getStart(), attribute.getEnd(), attribute.getSourceContext(), ShadowMungerAdvice);
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
this.attribute = attribute;
this.kind = attribute.getKind();
this.signature = signature;
if (signature != null) {
bindingParameterTypes = signature.getParameterTypes();
} else {
bindingParameterTypes = new UnresolvedType[0];
}
}
@Override
public boolean match(Shadow shadow, World world) {
if (super.match(shadow, world)) {
if (shadow.getKind() == Shadow.ExceptionHandler) {
if (kind.isAfter() || kind == AdviceKind.Around) {
world.showMessage(IMessage.WARNING, WeaverMessages.format(WeaverMessages.ONLY_BEFORE_ON_HANDLER),
getSourceLocation(), shadow.getSourceLocation());
return false;
}
}
if (shadow.getKind() == Shadow.SynchronizationLock || shadow.getKind() == Shadow.SynchronizationUnlock) {
if (kind == AdviceKind.Around
) {
world.showMessage(IMessage.WARNING, WeaverMessages.format(WeaverMessages.NO_AROUND_ON_SYNCHRONIZATION),
getSourceLocation(), shadow.getSourceLocation());
return false;
}
}
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
if (hasExtraParameter() && kind == AdviceKind.AfterReturning) {
ResolvedType resolvedExtraParameterType = getExtraParameterType().resolve(world);
ResolvedType shadowReturnType = shadow.getReturnType().resolve(world);
boolean matches = (resolvedExtraParameterType.isConvertableFrom(shadowReturnType) && shadow.getKind()
.hasReturnValue());
if (matches && resolvedExtraParameterType.isParameterizedType()) {
maybeIssueUncheckedMatchWarning(resolvedExtraParameterType, shadowReturnType, shadow, world);
}
return matches;
} else if (hasExtraParameter() && kind == AdviceKind.AfterThrowing) {
ResolvedType exceptionType = getExtraParameterType().resolve(world);
if (!exceptionType.isCheckedException()) {
return true;
}
UnresolvedType[] shadowThrows = shadow.getSignature().getExceptions(world);
boolean matches = false;
for (int i = 0; i < shadowThrows.length && !matches; i++) {
ResolvedType type = shadowThrows[i].resolve(world);
if (exceptionType.isAssignableFrom(type)) {
matches = true;
}
}
return matches;
} else if (kind == AdviceKind.PerTargetEntry) {
return shadow.hasTarget();
} else if (kind == AdviceKind.PerThisEntry) {
return shadow.hasThis();
} else if (kind == AdviceKind.Around) {
if (shadow.getKind() == Shadow.PreInitialization) {
world.showMessage(IMessage.WARNING, WeaverMessages.format(WeaverMessages.AROUND_ON_PREINIT),
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
getSourceLocation(), shadow.getSourceLocation());
return false;
} else if (shadow.getKind() == Shadow.Initialization) {
world.showMessage(IMessage.WARNING, WeaverMessages.format(WeaverMessages.AROUND_ON_INIT), getSourceLocation(),
shadow.getSourceLocation());
return false;
} else if (shadow.getKind() == Shadow.StaticInitialization
&& shadow.getEnclosingType().resolve(world).isInterface()) {
world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.AROUND_ON_INTERFACE_STATICINIT, shadow
.getEnclosingType().getName()), getSourceLocation(), shadow.getSourceLocation());
return false;
} else {
if (getSignature().getReturnType() == ResolvedType.VOID) {
if (shadow.getReturnType() != ResolvedType.VOID) {
world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.NON_VOID_RETURN, shadow),
getSourceLocation(), shadow.getSourceLocation());
return false;
}
} else if (getSignature().getReturnType().equals(UnresolvedType.OBJECT)) {
return true;
} else {
ResolvedType shadowReturnType = shadow.getReturnType().resolve(world);
ResolvedType adviceReturnType = getSignature().getGenericReturnType().resolve(world);
if (shadowReturnType.isParameterizedType() && adviceReturnType.isRawType()) {
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
ResolvedType shadowReturnGenericType = shadowReturnType.getGenericType();
ResolvedType adviceReturnGenericType = adviceReturnType.getGenericType();
if (shadowReturnGenericType.isAssignableFrom(adviceReturnGenericType)
&& world.getLint().uncheckedAdviceConversion.isEnabled()) {
world.getLint().uncheckedAdviceConversion.signal(new String[] { shadow.toString(),
shadowReturnType.getName(), adviceReturnType.getName() }, shadow.getSourceLocation(),
new ISourceLocation[] { getSourceLocation() });
}
} else if (!shadowReturnType.isAssignableFrom(adviceReturnType)) {
world.showMessage(IMessage.ERROR, WeaverMessages
.format(WeaverMessages.INCOMPATIBLE_RETURN_TYPE, shadow), getSourceLocation(), shadow
.getSourceLocation());
return false;
}
}
}
}
return true;
} else {
return false;
}
}
/**
* In after returning advice if we are binding the extra parameter to a parameterized type we may not be able to do a type-safe
* conversion.
*
* @param resolvedExtraParameterType the type in the after returning declaration
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
* @param shadowReturnType the type at the shadow
* @param world
*/
private void maybeIssueUncheckedMatchWarning(ResolvedType afterReturningType, ResolvedType shadowReturnType, Shadow shadow,
World world) {
boolean inDoubt = !afterReturningType.isAssignableFrom(shadowReturnType);
if (inDoubt && world.getLint().uncheckedArgument.isEnabled()) {
String uncheckedMatchWith = afterReturningType.getSimpleBaseName();
if (shadowReturnType.isParameterizedType() && (shadowReturnType.getRawType() == afterReturningType.getRawType())) {
uncheckedMatchWith = shadowReturnType.getSimpleName();
}
if (!Utils.isSuppressing(getSignature().getAnnotations(), "uncheckedArgument")) {
world.getLint().uncheckedArgument.signal(new String[] { afterReturningType.getSimpleName(), uncheckedMatchWith,
afterReturningType.getSimpleBaseName(), shadow.toResolvedString(world) }, getSourceLocation(),
new ISourceLocation[] { shadow.getSourceLocation() });
}
}
}
public AdviceKind getKind() {
return kind;
}
public Member getSignature() {
return signature;
}
public boolean hasExtraParameter() {
return (getExtraParameterFlags() & ExtraArgument) != 0;
}
protected int getExtraParameterFlags() {
return attribute.getExtraParameterFlags();
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
}
protected int getExtraParameterCount() {
return countOnes(getExtraParameterFlags() & ParameterMask);
}
public UnresolvedType[] getBindingParameterTypes() {
return bindingParameterTypes;
}
public void setBindingParameterTypes(UnresolvedType[] types) {
bindingParameterTypes = types;
}
public static int countOnes(int bits) {
int ret = 0;
while (bits != 0) {
if ((bits & 1) != 0) {
ret += 1;
}
bits = bits >> 1;
}
return ret;
}
public int getBaseParameterCount() {
return getSignature().getParameterTypes().length - getExtraParameterCount();
}
public String[] getBaseParameterNames(World world) {
String[] allNames = getSignature().getParameterNames(world);
int extras = getExtraParameterCount();
if (extras == 0) {
return allNames;
}
String[] result = new String[getBaseParameterCount()];
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
for (int i = 0; i < result.length; i++) {
result[i] = allNames[i];
}
return result;
}
/**
* Return the type of the 'extra argument'. For either after returning or after throwing advice, the extra argument will be the
* returned value or the thrown exception respectively. With annotation style the user may declare the parameters in any order,
* whereas for code style they are in a well defined order. So there is some extra complexity in here for annotation style that
* looks up the correct parameter in the advice signature by name, based on the name specified in the annotation. If this fails
* then we 'fallback' to guessing at positions, where the extra argument is presumed to come at the end.
*
* @return the type of the extraParameter
*/
public UnresolvedType getExtraParameterType() {
if (!hasExtraParameter()) {
return ResolvedType.MISSING;
}
if (signature instanceof ResolvedMember) {
ResolvedMember method = (ResolvedMember) signature;
UnresolvedType[] parameterTypes = method.getGenericParameterTypes();
if (getConcreteAspect().isAnnotationStyleAspect()) {
String[] pnames = method.getParameterNames();
if (pnames != null) {
AnnotationAJ[] annos = getSignature().getAnnotations();
String parameterToLookup = null;
if (annos != null && (getKind() == AdviceKind.AfterThrowing || getKind() == AdviceKind.AfterReturning)) {
for (int i = 0; i < annos.length && parameterToLookup == null; i++) {
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
AnnotationAJ anno = annos[i];
String annosig = anno.getType().getSignature();
if (annosig.equals("Lorg/aspectj/lang/annotation/AfterThrowing;")) {
parameterToLookup = anno.getStringFormOfValue("throwing");
} else if (annosig.equals("Lorg/aspectj/lang/annotation/AfterReturning;")) {
parameterToLookup = anno.getStringFormOfValue("returning");
}
}
}
if (parameterToLookup != null) {
for (int i = 0; i < pnames.length; i++) {
if (pnames[i].equals(parameterToLookup)) {
return parameterTypes[i];
}
}
}
}
int baseParmCnt = getBaseParameterCount();
while ((baseParmCnt + 1 < parameterTypes.length)
&& (parameterTypes[baseParmCnt].equals(AjcMemberMaker.TYPEX_JOINPOINT)
|| parameterTypes[baseParmCnt].equals(AjcMemberMaker.TYPEX_STATICJOINPOINT) || parameterTypes[baseParmCnt]
.equals(AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT))) {
baseParmCnt++;
}
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
return parameterTypes[baseParmCnt];
} else {
return parameterTypes[getBaseParameterCount()];
}
} else {
return signature.getParameterTypes()[getBaseParameterCount()];
}
}
public UnresolvedType getDeclaringAspect() {
return getOriginalSignature().getDeclaringType();
}
protected Member getOriginalSignature() {
return signature;
}
protected String extraParametersToString() {
if (getExtraParameterFlags() == 0) {
return "";
} else {
return "(extraFlags: " + getExtraParameterFlags() + ")";
}
}
@Override
public Pointcut getPointcut() {
return pointcut;
}
/**
* @param fromType is guaranteed to be a non-abstract aspect
* @param clause has been concretized at a higher level
*/
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
@Override
public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
Pointcut p = pointcut.concretize(fromType, getDeclaringType(), signature.getArity(), this);
if (clause != null) {
Pointcut oldP = p;
p = new AndPointcut(clause, p);
p.copyLocationFrom(oldP);
p.state = Pointcut.CONCRETE;
p.m_ignoreUnboundBindingForNames = oldP.m_ignoreUnboundBindingForNames;
}
Advice munger = world.getWeavingSupport().createAdviceMunger(attribute, p, signature, fromType);
munger.bindingParameterTypes = bindingParameterTypes;
munger.setDeclaringType(getDeclaringType());
return munger;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("(").append(getKind()).append(extraParametersToString());
sb.append(": ").append(pointcut).append("->").append(signature).append(")");
return sb.toString();
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Advice)) {
return false;
}
Advice o = (Advice) other;
return o.kind.equals(kind) && ((o.pointcut == null) ? (pointcut == null) : o.pointcut.equals(pointcut))
&& ((o.signature == null) ? (signature == null) : o.signature.equals(signature));
}
private volatile int hashCode = 0;
@Override
public int hashCode() {
if (hashCode == 0) {
int result = 17;
result = 37 * result + kind.hashCode();
result = 37 * result + ((pointcut == null) ? 0 : pointcut.hashCode());
result = 37 * result + ((signature == null) ? 0 : signature.hashCode());
hashCode = result;
|
314,766 |
Bug 314766 NPE when using aop.xml for compile time config
|
Reported on the list: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80) at org.aspectj.weaver.Advice.match(Advice.java:106) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
|
resolved fixed
|
0e5ecd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-05-27T20:11:51Z | 2010-05-27T19:53:20Z |
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
|
}
return hashCode;
}
public static final int ExtraArgument = 0x01;
public static final int ThisJoinPoint = 0x02;
public static final int ThisJoinPointStaticPart = 0x04;
public static final int ThisEnclosingJoinPointStaticPart = 0x08;
public static final int ParameterMask = 0x0f;
public static final int ConstantReference = 0x10;
public static final int ConstantValue = 0x20;
public static final int CanInline = 0x40;
public void setLexicalPosition(int lexicalPosition) {
start = lexicalPosition;
}
public ResolvedType getConcreteAspect() {
return concreteAspect;
}
public boolean hasMatchedSomething() {
return hasMatchedAtLeastOnce;
}
public void setHasMatchedSomething(boolean hasMatchedSomething) {
hasMatchedAtLeastOnce = hasMatchedSomething;
}
public abstract boolean hasDynamicTests();
}
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
/* *******************************************************************
* Copyright (c) 2002 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:
* PARC initial implementation
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
* RonBodkin/AndyClement optimizations for memory consumption/speed
* ******************************************************************/
package org.aspectj.weaver.bcel;
import java.io.PrintStream;
import java.lang.ref.WeakReference;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.AttributeUtils;
import org.aspectj.apache.bcel.classfile.ConstantClass;
import org.aspectj.apache.bcel.classfile.ConstantPool;
import org.aspectj.apache.bcel.classfile.Field;
import org.aspectj.apache.bcel.classfile.InnerClass;
import org.aspectj.apache.bcel.classfile.InnerClasses;
import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.apache.bcel.classfile.Signature;
import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
import org.aspectj.apache.bcel.classfile.annotation.EnumElementValue;
import org.aspectj.apache.bcel.classfile.annotation.NameValuePair;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.util.GenericSignature;
import org.aspectj.util.GenericSignature.FormalTypeParameter;
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
import org.aspectj.weaver.AbstractReferenceTypeDelegate;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.AnnotationAJ;
import org.aspectj.weaver.AnnotationTargetKind;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.BindingScope;
import org.aspectj.weaver.ConcreteTypeMunger;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ReferenceType;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedPointcutDefinition;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.SourceContextImpl;
import org.aspectj.weaver.TypeVariable;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.WeaverStateInfo;
import org.aspectj.weaver.World;
import org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.GenericSignatureFormatException;
import org.aspectj.weaver.patterns.Declare;
import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
import org.aspectj.weaver.patterns.DeclarePrecedence;
import org.aspectj.weaver.patterns.FormalBinding;
import org.aspectj.weaver.patterns.IScope;
import org.aspectj.weaver.patterns.PerClause;
public class BcelObjectType extends AbstractReferenceTypeDelegate {
public JavaClass javaClass;
private boolean artificial;
private LazyClassGen lazyClassGen = null;
private int modifiers;
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
private String className;
private String superclassSignature;
private String superclassName;
private String[] interfaceSignatures;
private ResolvedMember[] fields = null;
private ResolvedMember[] methods = null;
private ResolvedType[] annotationTypes = null;
private AnnotationAJ[] annotations = null;
private TypeVariable[] typeVars = null;
private String retentionPolicy;
private AnnotationTargetKind[] annotationTargetKinds;
private AjAttribute.WeaverVersionInfo wvInfo = AjAttribute.WeaverVersionInfo.UNKNOWN;
private ResolvedPointcutDefinition[] pointcuts = null;
private ResolvedMember[] privilegedAccess = null;
private WeaverStateInfo weaverState = null;
private PerClause perClause = null;
private List<ConcreteTypeMunger> typeMungers = Collections.emptyList();
private List<Declare> declares = Collections.emptyList();
private GenericSignature.FormalTypeParameter[] formalsForResolution = null;
private String declaredSignature = null;
private boolean hasBeenWoven = false;
private boolean isGenericType = false;
private boolean isInterface;
private boolean isEnum;
private boolean isAnnotation;
private boolean isAnonymous;
private boolean isNested;
private boolean isObject = false;
private boolean isAnnotationStyleAspect = false;
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
private boolean isCodeStyleAspect = false;
private WeakReference<ResolvedType> superTypeReference = new WeakReference<ResolvedType>(null);
private WeakReference<ResolvedType[]> superInterfaceReferences = new WeakReference<ResolvedType[]>(null);
private int bitflag = 0x0000;
private static final int DISCOVERED_ANNOTATION_RETENTION_POLICY = 0x0001;
private static final int UNPACKED_GENERIC_SIGNATURE = 0x0002;
private static final int UNPACKED_AJATTRIBUTES = 0x0004;
private static final int DISCOVERED_ANNOTATION_TARGET_KINDS = 0x0008;
private static final int DISCOVERED_DECLARED_SIGNATURE = 0x0010;
private static final int DISCOVERED_WHETHER_ANNOTATION_STYLE = 0x0020;
private static final int ANNOTATION_UNPACK_IN_PROGRESS = 0x0100;
private static final String[] NO_INTERFACE_SIGS = new String[] {};
/*
* Notes: note(1): in some cases (perclause inheritance) we encounter unpacked state when calling getPerClause
*
* note(2): A BcelObjectType is 'damaged' if it has been modified from what was original constructed from the bytecode. This
* currently happens if the parents are modified or an annotation is added - ideally BcelObjectType should be immutable but
* that's a bigger piece of work. XXX
*/
BcelObjectType(ReferenceType resolvedTypeX, JavaClass javaClass, boolean artificial, boolean exposedToWeaver) {
super(resolvedTypeX, exposedToWeaver);
this.javaClass = javaClass;
this.artificial = artificial;
initializeFromJavaclass();
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
resolvedTypeX.setDelegate(this);
ISourceContext sourceContext = resolvedTypeX.getSourceContext();
if (sourceContext == SourceContextImpl.UNKNOWN_SOURCE_CONTEXT) {
sourceContext = new SourceContextImpl(this);
setSourceContext(sourceContext);
}
isObject = (javaClass.getSuperclassNameIndex() == 0);
ensureAspectJAttributesUnpacked();
setSourcefilename(javaClass.getSourceFileName());
}
public void setJavaClass(JavaClass newclass, boolean artificial) {
this.javaClass = newclass;
this.artificial = artificial;
resetState();
initializeFromJavaclass();
}
@Override
public boolean isCacheable() {
return true;
}
private void initializeFromJavaclass() {
isInterface = javaClass.isInterface();
isEnum = javaClass.isEnum();
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
isAnnotation = javaClass.isAnnotation();
isAnonymous = javaClass.isAnonymous();
isNested = javaClass.isNested();
modifiers = javaClass.getModifiers();
superclassName = javaClass.getSuperclassName();
className = javaClass.getClassName();
cachedGenericClassTypeSignature = null;
}
public boolean isInterface() {
return isInterface;
}
public boolean isEnum() {
return isEnum;
}
public boolean isAnnotation() {
return isAnnotation;
}
public boolean isAnonymous() {
return isAnonymous;
}
public boolean isNested() {
return isNested;
}
public int getModifiers() {
return modifiers;
}
/**
* Must take into account generic signature
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
*/
public ResolvedType getSuperclass() {
if (isObject) {
return null;
}
ResolvedType supertype = superTypeReference.get();
if (supertype == null) {
ensureGenericSignatureUnpacked();
if (superclassSignature == null) {
if (superclassName == null) {
superclassName = javaClass.getSuperclassName();
}
superclassSignature = getResolvedTypeX().getWorld().resolve(UnresolvedType.forName(superclassName)).getSignature();
}
World world = getResolvedTypeX().getWorld();
supertype = world.resolve(UnresolvedType.forSignature(superclassSignature));
superTypeReference = new WeakReference<ResolvedType>(supertype);
}
return supertype;
}
public World getWorld() {
return getResolvedTypeX().getWorld();
}
/**
* Retrieves the declared interfaces - this allows for the generic signature on a type. If specified then the generic signature
* is used to work out the types - this gets around the results of erasure when the class was originally compiled.
*/
public ResolvedType[] getDeclaredInterfaces() {
ResolvedType[] cachedInterfaceTypes = superInterfaceReferences.get();
if (cachedInterfaceTypes == null) {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
ensureGenericSignatureUnpacked();
ResolvedType[] interfaceTypes = null;
if (interfaceSignatures == null) {
String[] names = javaClass.getInterfaceNames();
if (names.length == 0) {
interfaceSignatures = NO_INTERFACE_SIGS;
interfaceTypes = ResolvedType.NONE;
} else {
interfaceSignatures = new String[names.length];
interfaceTypes = new ResolvedType[names.length];
for (int i = 0, len = names.length; i < len; i++) {
interfaceTypes[i] = getResolvedTypeX().getWorld().resolve(UnresolvedType.forName(names[i]));
interfaceSignatures[i] = interfaceTypes[i].getSignature();
}
}
} else {
interfaceTypes = new ResolvedType[interfaceSignatures.length];
for (int i = 0, len = interfaceSignatures.length; i < len; i++) {
interfaceTypes[i] = getResolvedTypeX().getWorld().resolve(UnresolvedType.forSignature(interfaceSignatures[i]));
}
}
superInterfaceReferences = new WeakReference<ResolvedType[]>(interfaceTypes);
return interfaceTypes;
} else {
return cachedInterfaceTypes;
}
}
public ResolvedMember[] getDeclaredMethods() {
ensureGenericSignatureUnpacked();
if (methods == null) {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
Method[] ms = javaClass.getMethods();
methods = new ResolvedMember[ms.length];
for (int i = ms.length - 1; i >= 0; i--) {
methods[i] = new BcelMethod(this, ms[i]);
}
}
return methods;
}
public ResolvedMember[] getDeclaredFields() {
ensureGenericSignatureUnpacked();
if (fields == null) {
Field[] fs = javaClass.getFields();
fields = new ResolvedMember[fs.length];
for (int i = 0, len = fs.length; i < len; i++) {
fields[i] = new BcelField(this, fs[i]);
}
}
return fields;
}
public TypeVariable[] getTypeVariables() {
if (!isGeneric()) {
return TypeVariable.NONE;
}
if (typeVars == null) {
GenericSignature.ClassSignature classSig = getGenericClassTypeSignature();
typeVars = new TypeVariable[classSig.formalTypeParameters.length];
for (int i = 0; i < typeVars.length; i++) {
GenericSignature.FormalTypeParameter ftp = classSig.formalTypeParameters[i];
try {
typeVars[i] = BcelGenericSignatureToTypeXConverter.formalTypeParameter2TypeVariable(ftp,
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
classSig.formalTypeParameters, getResolvedTypeX().getWorld());
} catch (GenericSignatureFormatException e) {
throw new IllegalStateException("While getting the type variables for type " + this.toString()
+ " with generic signature " + classSig + " the following error condition was detected: "
+ e.getMessage());
}
}
}
return typeVars;
}
public Collection<ConcreteTypeMunger> getTypeMungers() {
return typeMungers;
}
public Collection<Declare> getDeclares() {
return declares;
}
public Collection<ResolvedMember> getPrivilegedAccesses() {
if (privilegedAccess == null) {
return Collections.emptyList();
}
return Arrays.asList(privilegedAccess);
}
public ResolvedMember[] getDeclaredPointcuts() {
return pointcuts;
}
public boolean isAspect() {
return perClause != null;
}
/**
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
* Check if the type is an @AJ aspect (no matter if used from an LTW point of view). Such aspects are annotated with @Aspect
*
* @return true for @AJ aspect
*/
public boolean isAnnotationStyleAspect() {
if ((bitflag & DISCOVERED_WHETHER_ANNOTATION_STYLE) == 0) {
bitflag |= DISCOVERED_WHETHER_ANNOTATION_STYLE;
isAnnotationStyleAspect = !isCodeStyleAspect && hasAnnotation(AjcMemberMaker.ASPECT_ANNOTATION);
}
return isAnnotationStyleAspect;
}
/**
* Process any org.aspectj.weaver attributes stored against the class.
*/
private void ensureAspectJAttributesUnpacked() {
if ((bitflag & UNPACKED_AJATTRIBUTES) != 0) {
return;
}
bitflag |= UNPACKED_AJATTRIBUTES;
IMessageHandler msgHandler = getResolvedTypeX().getWorld().getMessageHandler();
List<AjAttribute> l = null;
try {
l = Utility.readAjAttributes(className, javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),
getResolvedTypeX().getWorld(), AjAttribute.WeaverVersionInfo.UNKNOWN, new BcelConstantPoolReader(javaClass
.getConstantPool()));
} catch (RuntimeException re) {
throw new RuntimeException("Problem processing attributes in " + javaClass.getFileName(), re);
}
List<ResolvedPointcutDefinition> pointcuts = new ArrayList<ResolvedPointcutDefinition>();
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
typeMungers = new ArrayList<ConcreteTypeMunger>();
declares = new ArrayList<Declare>();
processAttributes(l, pointcuts, false);
l = AtAjAttributes.readAj5ClassAttributes(((BcelWorld) getResolvedTypeX().getWorld()).getModelAsAsmManager(), javaClass,
getResolvedTypeX(), getResolvedTypeX().getSourceContext(), msgHandler, isCodeStyleAspect);
AjAttribute.Aspect deferredAspectAttribute = processAttributes(l, pointcuts, true);
if (pointcuts.size() == 0) {
this.pointcuts = ResolvedPointcutDefinition.NO_POINTCUTS;
} else {
this.pointcuts = pointcuts.toArray(new ResolvedPointcutDefinition[pointcuts.size()]);
}
resolveAnnotationDeclares(l);
if (deferredAspectAttribute != null) {
perClause = deferredAspectAttribute.reifyFromAtAspectJ(this.getResolvedTypeX());
}
if (isAspect() && !Modifier.isAbstract(getModifiers()) && isGeneric()) {
msgHandler.handleMessage(MessageUtil.error("The generic aspect '" + getResolvedTypeX().getName()
+ "' must be declared abstract", getResolvedTypeX().getSourceLocation()));
}
}
private AjAttribute.Aspect processAttributes(List<AjAttribute> attributeList, List<ResolvedPointcutDefinition> pointcuts,
boolean fromAnnotations) {
AjAttribute.Aspect deferredAspectAttribute = null;
for (AjAttribute a : attributeList) {
if (a instanceof AjAttribute.Aspect) {
if (fromAnnotations) {
deferredAspectAttribute = (AjAttribute.Aspect) a;
} else {
perClause = ((AjAttribute.Aspect) a).reify(this.getResolvedTypeX());
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
isCodeStyleAspect = true;
}
} else if (a instanceof AjAttribute.PointcutDeclarationAttribute) {
pointcuts.add(((AjAttribute.PointcutDeclarationAttribute) a).reify());
} else if (a instanceof AjAttribute.WeaverState) {
weaverState = ((AjAttribute.WeaverState) a).reify();
} else if (a instanceof AjAttribute.TypeMunger) {
typeMungers.add(((AjAttribute.TypeMunger) a).reify(getResolvedTypeX().getWorld(), getResolvedTypeX()));
} else if (a instanceof AjAttribute.DeclareAttribute) {
declares.add(((AjAttribute.DeclareAttribute) a).getDeclare());
} else if (a instanceof AjAttribute.PrivilegedAttribute) {
AjAttribute.PrivilegedAttribute privAttribute = (AjAttribute.PrivilegedAttribute) a;
privilegedAccess = privAttribute.getAccessedMembers();
} else if (a instanceof AjAttribute.SourceContextAttribute) {
if (getResolvedTypeX().getSourceContext() instanceof SourceContextImpl) {
AjAttribute.SourceContextAttribute sca = (AjAttribute.SourceContextAttribute) a;
((SourceContextImpl) getResolvedTypeX().getSourceContext()).configureFromAttribute(sca.getSourceFileName(), sca
.getLineBreaks());
setSourcefilename(sca.getSourceFileName());
}
} else if (a instanceof AjAttribute.WeaverVersionInfo) {
wvInfo = (AjAttribute.WeaverVersionInfo) a;
} else {
throw new BCException("bad attribute " + a);
}
}
return deferredAspectAttribute;
}
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
/**
* Extra processing step needed because declares that come from annotations are not pre-resolved. We can't do the resolution
* until *after* the pointcuts have been resolved.
*/
private void resolveAnnotationDeclares(List<AjAttribute> attributeList) {
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
IScope bindingScope = new BindingScope(getResolvedTypeX(), getResolvedTypeX().getSourceContext(), bindings);
for (Iterator<AjAttribute> iter = attributeList.iterator(); iter.hasNext();) {
AjAttribute a = iter.next();
if (a instanceof AjAttribute.DeclareAttribute) {
Declare decl = (((AjAttribute.DeclareAttribute) a).getDeclare());
if (decl instanceof DeclareErrorOrWarning) {
decl.resolve(bindingScope);
} else if (decl instanceof DeclarePrecedence) {
((DeclarePrecedence) decl).setScopeForResolution(bindingScope);
}
}
}
}
public PerClause getPerClause() {
ensureAspectJAttributesUnpacked();
return perClause;
}
public JavaClass getJavaClass() {
return javaClass;
}
public boolean isArtificial() {
return artificial;
}
public void resetState() {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
if (javaClass == null) {
throw new BCException("can't weave evicted type");
}
bitflag = 0x0000;
this.annotationTypes = null;
this.annotations = null;
this.interfaceSignatures = null;
this.superclassSignature = null;
this.superclassName = null;
this.fields = null;
this.methods = null;
this.pointcuts = null;
this.perClause = null;
this.weaverState = null;
this.lazyClassGen = null;
hasBeenWoven = false;
isObject = (javaClass.getSuperclassNameIndex() == 0);
isAnnotationStyleAspect = false;
ensureAspectJAttributesUnpacked();
}
public void finishedWith() {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
}
public WeaverStateInfo getWeaverState() {
return weaverState;
}
void setWeaverState(WeaverStateInfo weaverState) {
this.weaverState = weaverState;
}
public void printWackyStuff(PrintStream out) {
if (typeMungers.size() > 0) {
out.println(" TypeMungers: " + typeMungers);
}
if (declares.size() > 0) {
out.println(" declares: " + declares);
}
}
/**
* Return the lazyClassGen associated with this type. For aspect types, this value will be cached, since it is used to inline
* advice. For non-aspect types, this lazyClassGen is always newly constructed.
*/
public LazyClassGen getLazyClassGen() {
LazyClassGen ret = lazyClassGen;
if (ret == null) {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
ret = new LazyClassGen(this);
if (isAspect()) {
lazyClassGen = ret;
}
}
return ret;
}
public boolean isSynthetic() {
return getResolvedTypeX().isSynthetic();
}
public AjAttribute.WeaverVersionInfo getWeaverVersionAttribute() {
return wvInfo;
}
public ResolvedType[] getAnnotationTypes() {
ensureAnnotationsUnpacked();
return annotationTypes;
}
public AnnotationAJ[] getAnnotations() {
ensureAnnotationsUnpacked();
return annotations;
}
public boolean hasAnnotation(UnresolvedType ofType) {
if (isUnpackingAnnotations()) {
AnnotationGen annos[] = javaClass.getAnnotations();
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
if (annos == null || annos.length == 0) {
return false;
} else {
String lookingForSignature = ofType.getSignature();
for (int a = 0; a < annos.length; a++) {
AnnotationGen annotation = annos[a];
if (lookingForSignature.equals(annotation.getTypeSignature())) {
return true;
}
}
}
return false;
}
ensureAnnotationsUnpacked();
for (int i = 0, max = annotationTypes.length; i < max; i++) {
UnresolvedType ax = annotationTypes[i];
if (ax == null) {
throw new RuntimeException("Annotation entry " + i + " on type " + this.getResolvedTypeX().getName() + " is null!");
}
if (ax.equals(ofType)) {
return true;
}
}
return false;
}
public boolean isAnnotationWithRuntimeRetention() {
return (getRetentionPolicy() == null ? false : getRetentionPolicy().equals("RUNTIME"));
}
public String getRetentionPolicy() {
if ((bitflag & DISCOVERED_ANNOTATION_RETENTION_POLICY) == 0) {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
bitflag |= DISCOVERED_ANNOTATION_RETENTION_POLICY;
retentionPolicy = null;
if (isAnnotation()) {
ensureAnnotationsUnpacked();
for (int i = annotations.length - 1; i >= 0; i--) {
AnnotationAJ ax = annotations[i];
if (ax.getTypeName().equals(UnresolvedType.AT_RETENTION.getName())) {
List<NameValuePair> values = ((BcelAnnotation) ax).getBcelAnnotation().getValues();
for (Iterator<NameValuePair> it = values.iterator(); it.hasNext();) {
NameValuePair element = it.next();
EnumElementValue v = (EnumElementValue) element.getValue();
retentionPolicy = v.getEnumValueString();
return retentionPolicy;
}
}
}
}
}
return retentionPolicy;
}
public boolean canAnnotationTargetType() {
AnnotationTargetKind[] targetKinds = getAnnotationTargetKinds();
if (targetKinds == null) {
return true;
}
for (int i = 0; i < targetKinds.length; i++) {
if (targetKinds[i].equals(AnnotationTargetKind.TYPE)) {
return true;
}
}
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
return false;
}
public AnnotationTargetKind[] getAnnotationTargetKinds() {
if ((bitflag & DISCOVERED_ANNOTATION_TARGET_KINDS) != 0) {
return annotationTargetKinds;
}
bitflag |= DISCOVERED_ANNOTATION_TARGET_KINDS;
annotationTargetKinds = null;
List<AnnotationTargetKind> targetKinds = new ArrayList<AnnotationTargetKind>();
if (isAnnotation()) {
AnnotationAJ[] annotationsOnThisType = getAnnotations();
for (int i = 0; i < annotationsOnThisType.length; i++) {
AnnotationAJ a = annotationsOnThisType[i];
if (a.getTypeName().equals(UnresolvedType.AT_TARGET.getName())) {
Set<String> targets = a.getTargets();
if (targets != null) {
for (String targetKind : targets) {
if (targetKind.equals("ANNOTATION_TYPE")) {
targetKinds.add(AnnotationTargetKind.ANNOTATION_TYPE);
} else if (targetKind.equals("CONSTRUCTOR")) {
targetKinds.add(AnnotationTargetKind.CONSTRUCTOR);
} else if (targetKind.equals("FIELD")) {
targetKinds.add(AnnotationTargetKind.FIELD);
} else if (targetKind.equals("LOCAL_VARIABLE")) {
targetKinds.add(AnnotationTargetKind.LOCAL_VARIABLE);
} else if (targetKind.equals("METHOD")) {
targetKinds.add(AnnotationTargetKind.METHOD);
} else if (targetKind.equals("PACKAGE")) {
targetKinds.add(AnnotationTargetKind.PACKAGE);
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
} else if (targetKind.equals("PARAMETER")) {
targetKinds.add(AnnotationTargetKind.PARAMETER);
} else if (targetKind.equals("TYPE")) {
targetKinds.add(AnnotationTargetKind.TYPE);
}
}
}
}
}
if (!targetKinds.isEmpty()) {
annotationTargetKinds = new AnnotationTargetKind[targetKinds.size()];
return targetKinds.toArray(annotationTargetKinds);
}
}
return annotationTargetKinds;
}
private boolean isUnpackingAnnotations() {
return (bitflag & ANNOTATION_UNPACK_IN_PROGRESS) != 0;
}
private void ensureAnnotationsUnpacked() {
if (isUnpackingAnnotations()) {
throw new BCException("Re-entered weaver instance whilst unpacking annotations on " + this.className);
}
if (annotationTypes == null) {
try {
bitflag |= ANNOTATION_UNPACK_IN_PROGRESS;
AnnotationGen annos[] = javaClass.getAnnotations();
if (annos == null || annos.length == 0) {
annotationTypes = ResolvedType.NONE;
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
annotations = AnnotationAJ.EMPTY_ARRAY;
} else {
World w = getResolvedTypeX().getWorld();
annotationTypes = new ResolvedType[annos.length];
annotations = new AnnotationAJ[annos.length];
for (int i = 0; i < annos.length; i++) {
AnnotationGen annotation = annos[i];
String typeSignature = annotation.getTypeSignature();
ResolvedType rType = w.resolve(UnresolvedType.forSignature(typeSignature));
if (rType == null) {
throw new RuntimeException("Whilst unpacking annotations on '" + getResolvedTypeX().getName()
+ "', failed to resolve type '" + typeSignature + "'");
}
annotationTypes[i] = rType;
annotations[i] = new BcelAnnotation(annotation, rType);
}
}
} finally {
bitflag &= ~ANNOTATION_UNPACK_IN_PROGRESS;
}
}
}
public String getDeclaredGenericSignature() {
ensureGenericInfoProcessed();
return declaredSignature;
}
private void ensureGenericSignatureUnpacked() {
if ((bitflag & UNPACKED_GENERIC_SIGNATURE) != 0) {
return;
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
}
bitflag |= UNPACKED_GENERIC_SIGNATURE;
if (!getResolvedTypeX().getWorld().isInJava5Mode()) {
return;
}
GenericSignature.ClassSignature cSig = getGenericClassTypeSignature();
if (cSig != null) {
formalsForResolution = cSig.formalTypeParameters;
if (isNested()) {
GenericSignature.FormalTypeParameter[] extraFormals = getFormalTypeParametersFromOuterClass();
if (extraFormals.length > 0) {
List<FormalTypeParameter> allFormals = new ArrayList<FormalTypeParameter>();
for (int i = 0; i < formalsForResolution.length; i++) {
allFormals.add(formalsForResolution[i]);
}
for (int i = 0; i < extraFormals.length; i++) {
allFormals.add(extraFormals[i]);
}
formalsForResolution = new GenericSignature.FormalTypeParameter[allFormals.size()];
allFormals.toArray(formalsForResolution);
}
}
GenericSignature.ClassTypeSignature superSig = cSig.superclassSignature;
try {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
ResolvedType rt = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(superSig, formalsForResolution,
getResolvedTypeX().getWorld());
this.superclassSignature = rt.getSignature();
this.superclassName = rt.getName();
} catch (GenericSignatureFormatException e) {
throw new IllegalStateException("While determining the generic superclass of " + this.className
+ " with generic signature " + getDeclaredGenericSignature() + " the following error was detected: "
+ e.getMessage());
}
if (cSig.superInterfaceSignatures.length == 0) {
this.interfaceSignatures = NO_INTERFACE_SIGS;
} else {
this.interfaceSignatures = new String[cSig.superInterfaceSignatures.length];
for (int i = 0; i < cSig.superInterfaceSignatures.length; i++) {
try {
this.interfaceSignatures[i] = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(
cSig.superInterfaceSignatures[i], formalsForResolution, getResolvedTypeX().getWorld())
.getSignature();
} catch (GenericSignatureFormatException e) {
throw new IllegalStateException("While determing the generic superinterfaces of " + this.className
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
+ " with generic signature " + getDeclaredGenericSignature()
+ " the following error was detected: " + e.getMessage());
}
}
}
}
if (isGeneric()) {
ReferenceType genericType = (ReferenceType) this.resolvedTypeX.getGenericType();
genericType.setStartPos(this.resolvedTypeX.getStartPos());
this.resolvedTypeX = genericType;
}
}
public GenericSignature.FormalTypeParameter[] getAllFormals() {
ensureGenericSignatureUnpacked();
if (formalsForResolution == null) {
return new GenericSignature.FormalTypeParameter[0];
} else {
return formalsForResolution;
}
}
public ResolvedType getOuterClass() {
if (!isNested()) {
throw new IllegalStateException("Can't get the outer class of a non-nested type");
}
for (Attribute attr : javaClass.getAttributes()) {
if (attr instanceof InnerClasses) {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
InnerClass[] innerClss = ((InnerClasses) attr).getInnerClasses();
ConstantPool cpool = javaClass.getConstantPool();
for (InnerClass innerCls : innerClss) {
if (innerCls.getInnerClassIndex() == 0 || innerCls.getOuterClassIndex() == 0) {
continue;
}
ConstantClass innerClsInfo = (ConstantClass) cpool.getConstant(innerCls.getInnerClassIndex());
String innerClsName = cpool.getConstantUtf8(innerClsInfo.getNameIndex()).getValue().replace('/', '.');
if (innerClsName.compareTo(className) == 0) {
ConstantClass outerClsInfo = (ConstantClass) cpool.getConstant(innerCls.getOuterClassIndex());
String outerClsName = cpool.getConstantUtf8(outerClsInfo.getNameIndex()).getValue().replace('/', '.');
UnresolvedType outer = UnresolvedType.forName(outerClsName);
return outer.resolve(getResolvedTypeX().getWorld());
}
}
}
}
int lastDollar = className.lastIndexOf('$');
String superClassName = className.substring(0, lastDollar);
UnresolvedType outer = UnresolvedType.forName(superClassName);
return outer.resolve(getResolvedTypeX().getWorld());
}
private void ensureGenericInfoProcessed() {
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
if ((bitflag & DISCOVERED_DECLARED_SIGNATURE) != 0) {
return;
}
bitflag |= DISCOVERED_DECLARED_SIGNATURE;
Signature sigAttr = AttributeUtils.getSignatureAttribute(javaClass.getAttributes());
declaredSignature = (sigAttr == null ? null : sigAttr.getSignature());
if (declaredSignature != null) {
isGenericType = (declaredSignature.charAt(0) == '<');
}
}
public boolean isGeneric() {
ensureGenericInfoProcessed();
return isGenericType;
}
@Override
public String toString() {
return (javaClass == null ? "BcelObjectType" : "BcelObjectTypeFor:" + className);
}
public void evictWeavingState() {
if (getResolvedTypeX().getWorld().couldIncrementalCompileFollow()) {
return;
}
if (javaClass != null) {
ensureAnnotationsUnpacked();
ensureGenericInfoProcessed();
getDeclaredInterfaces();
getDeclaredFields();
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
getDeclaredMethods();
if (getResolvedTypeX().getWorld().isXnoInline()) {
lazyClassGen = null;
}
if (weaverState != null) {
weaverState.setReweavable(false);
weaverState.setUnwovenClassFileData(null);
}
for (int i = methods.length - 1; i >= 0; i--) {
methods[i].evictWeavingState();
}
for (int i = fields.length - 1; i >= 0; i--) {
fields[i].evictWeavingState();
}
javaClass = null;
this.artificial = true;
}
|
317,139 |
Bug 317139 NullPointerException during weaving
| null |
resolved fixed
|
92a52a2
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:07:59Z | 2010-06-17T04:46:40Z |
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
|
}
public void weavingCompleted() {
hasBeenWoven = true;
if (getResolvedTypeX().getWorld().isRunMinimalMemory()) {
evictWeavingState();
}
if (getSourceContext() != null && !getResolvedTypeX().isAspect()) {
getSourceContext().tidy();
}
}
public boolean hasBeenWoven() {
return hasBeenWoven;
}
@Override
public boolean copySourceContext() {
return false;
}
public void setExposedToWeaver(boolean b) {
exposedToWeaver = b;
}
@Override
public int getCompilerVersion() {
return wvInfo.getMajorVersion();
}
public void ensureConsistent() {
superTypeReference.clear();
superInterfaceReferences.clear();
}
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/BindingScope.java
|
/* *******************************************************************
* Copyright (c) 2006-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
*
* ******************************************************************/
package org.aspectj.weaver;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.weaver.patterns.FormalBinding;
import org.aspectj.weaver.patterns.SimpleScope;
/**
* BindingScope that knows the enclosingType, which is needed for pointcut reference resolution
*
* @author Alexandre Vasseur
*/
public class BindingScope extends SimpleScope {
private final ResolvedType m_enclosingType;
private final ISourceContext m_sourceContext;
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/BindingScope.java
|
public BindingScope(ResolvedType type, ISourceContext sourceContext, FormalBinding[] bindings) {
super(type.getWorld(), bindings);
m_enclosingType = type;
m_sourceContext = sourceContext;
}
public ResolvedType getEnclosingType() {
return m_enclosingType;
}
public ISourceLocation makeSourceLocation(IHasPosition location) {
return m_sourceContext.makeSourceLocation(location);
}
public UnresolvedType lookupType(String name, IHasPosition location) {
if (m_enclosingType != null) {
String pkgName = m_enclosingType.getPackageName();
if (pkgName != null && !pkgName.equals("")) {
String[] currentImports = getImportedPrefixes();
String[] newImports = new String[currentImports.length + 1];
for (int i = 0; i < currentImports.length; i++) {
newImports[i] = currentImports[i];
}
newImports[currentImports.length] = pkgName.concat(".");
setImportedPrefixes(newImports);
}
}
return super.lookupType(name, location);
}
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/IScope.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.patterns;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.weaver.IHasPosition;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
public interface IScope {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/IScope.java
|
/** returns the type corresponding to the name in this scope
* returns ResolvedType.MISSING if no such type exists and reports a problem
*/
UnresolvedType lookupType(String name, IHasPosition location);
World getWorld();
ResolvedType getEnclosingType();
IMessageHandler getMessageHandler();
FormalBinding lookupFormal(String name);
FormalBinding getFormal(int i);
int getFormalCount();
String[] getImportedPrefixes();
String[] getImportedNames();
void message(IMessage.Kind kind, IHasPosition location, String message);
void message(IMessage.Kind kind, IHasPosition location1, IHasPosition location2, String message);
void message(IMessage aMessage);
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/SimpleScope.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.patterns;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.Message;
import org.aspectj.bridge.SourceLocation;
import org.aspectj.weaver.IHasPosition;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
public class SimpleScope implements IScope {
private World world;
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/SimpleScope.java
|
private ResolvedType enclosingType;
protected FormalBinding[] bindings;
private String[] importedPrefixes = javaLangPrefixArray;
private String[] importedNames = ZERO_STRINGS;
private static final String[] ZERO_STRINGS = new String[0];
private static final String[] javaLangPrefixArray = new String[] { "java.lang.", };
public SimpleScope(World world, FormalBinding[] bindings) {
super();
this.world = world;
this.bindings = bindings;
}
public UnresolvedType lookupType(String name, IHasPosition location) {
for (int i = 0; i < importedNames.length; i++) {
String importedName = importedNames[i];
if (importedName.endsWith(name)) {
return world.resolve(importedName);
}
}
for (int i = 0; i < importedPrefixes.length; i++) {
String importedPrefix = importedPrefixes[i];
ResolvedType tryType = world.resolve(UnresolvedType.forName(importedPrefix + name), true);
if (!tryType.isMissing()) {
return tryType;
}
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/SimpleScope.java
|
return world.resolve(UnresolvedType.forName(name), true);
}
public IMessageHandler getMessageHandler() {
return world.getMessageHandler();
}
public FormalBinding lookupFormal(String name) {
for (int i = 0, len = bindings.length; i < len; i++) {
if (bindings[i].getName().equals(name))
return bindings[i];
}
return null;
}
public FormalBinding getFormal(int i) {
return bindings[i];
}
public int getFormalCount() {
return bindings.length;
}
public String[] getImportedNames() {
return importedNames;
}
public String[] getImportedPrefixes() {
return importedPrefixes;
}
public void setImportedNames(String[] importedNames) {
this.importedNames = importedNames;
}
public void setImportedPrefixes(String[] importedPrefixes) {
this.importedPrefixes = importedPrefixes;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/SimpleScope.java
|
public static FormalBinding[] makeFormalBindings(UnresolvedType[] types, String[] names) {
int len = types.length;
FormalBinding[] bindings = new FormalBinding[len];
for (int i = 0; i < len; i++) {
bindings[i] = new FormalBinding(types[i], names[i], i);
}
return bindings;
}
public ISourceLocation makeSourceLocation(IHasPosition location) {
return new SourceLocation(ISourceLocation.NO_FILE, 0);
}
public void message(IMessage.Kind kind, IHasPosition location1, IHasPosition location2, String message) {
message(kind, location1, message);
message(kind, location2, message);
}
public void message(IMessage.Kind kind, IHasPosition location, String message) {
getMessageHandler().handleMessage(new Message(message, kind, null, makeSourceLocation(location)));
}
public void message(IMessage aMessage) {
getMessageHandler().handleMessage(aMessage);
}
public World getWorld() {
return world;
}
public ResolvedType getEnclosingType() {
return enclosingType;
}
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.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.patterns;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.Message;
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
import org.aspectj.bridge.MessageUtil;
import org.aspectj.util.FileUtil;
import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.BoundedReferenceType;
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.IHasPosition;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ReferenceType;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.TypeFactory;
import org.aspectj.weaver.TypeVariable;
import org.aspectj.weaver.TypeVariableReference;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.UnresolvedTypeVariableReferenceType;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
/**
* The PatternParser always creates WildTypePatterns for type patterns in pointcut expressions (apart from *, which is sometimes
* directly turned into TypePattern.ANY). resolveBindings() tries to work out what we've really got and turn it into a type pattern
* that we can use for matching. This will normally be either an ExactTypePattern or a WildTypePattern.
*
* Here's how the process pans out for various generic and parameterized patterns: (see GenericsWildTypePatternResolvingTestCase)
*
* Foo where Foo exists and is generic Parser creates WildTypePattern namePatterns={Foo} resolveBindings resolves Foo to RT(Foo -
* raw) return ExactTypePattern(LFoo;)
*
* Foo<String> where Foo exists and String meets the bounds Parser creates WildTypePattern namePatterns = {Foo},
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
* typeParameters=WTP{String} resolveBindings resolves typeParameters to ExactTypePattern(String) resolves Foo to RT(Foo) returns
* ExactTypePattern(PFoo<String>; - parameterized)
*
* Foo<Str*> where Foo exists and takes one bound Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{Str*}
* resolveBindings resolves typeParameters to WTP{Str*} resolves Foo to RT(Foo) returns WildTypePattern(name = Foo, typeParameters =
* WTP{Str*} isGeneric=false)
*
* Fo*<String> Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{String} resolveBindings resolves
* typeParameters to ETP{String} returns WildTypePattern(name = Fo*, typeParameters = ETP{String} isGeneric=false)
*
*
* Foo<?>
*
* Foo<? extends Number>
*
* Foo<? extends Number+>
*
* Foo<? super Number>
*
*/
public class WildTypePattern extends TypePattern {
private static final String GENERIC_WILDCARD_CHARACTER = "?";
private static final String GENERIC_WILDCARD_SIGNATURE_CHARACTER = "*";
private NamePattern[] namePatterns;
private boolean failedResolution = false;
int ellipsisCount;
String[] importedPrefixes;
String[] knownMatches;
int dim;
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
public static boolean boundscheckingoff = false;
TypePattern upperBound;
TypePattern[] additionalInterfaceBounds;
TypePattern lowerBound;
private boolean isGeneric = true;
WildTypePattern(NamePattern[] namePatterns, boolean includeSubtypes, int dim, boolean isVarArgs, TypePatternList typeParams) {
super(includeSubtypes, isVarArgs, typeParams);
this.namePatterns = namePatterns;
this.dim = dim;
ellipsisCount = 0;
for (int i = 0; i < namePatterns.length; i++) {
if (namePatterns[i] == NamePattern.ELLIPSIS) {
ellipsisCount++;
}
}
setLocation(namePatterns[0].getSourceContext(), namePatterns[0].getStart(), namePatterns[namePatterns.length - 1].getEnd());
}
public WildTypePattern(List names, boolean includeSubtypes, int dim) {
this((NamePattern[]) names.toArray(new NamePattern[names.size()]), includeSubtypes, dim, false, TypePatternList.EMPTY);
}
public WildTypePattern(List names, boolean includeSubtypes, int dim, int endPos) {
this(names, includeSubtypes, dim);
this.end = endPos;
}
public WildTypePattern(List names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
this(names, includeSubtypes, dim);
this.end = endPos;
this.isVarArgs = isVarArg;
}
public WildTypePattern(List names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams,
TypePattern upperBound, TypePattern[] additionalInterfaceBounds, TypePattern lowerBound) {
this((NamePattern[]) names.toArray(new NamePattern[names.size()]), includeSubtypes, dim, isVarArg, typeParams);
this.end = endPos;
this.upperBound = upperBound;
this.lowerBound = lowerBound;
this.additionalInterfaceBounds = additionalInterfaceBounds;
}
public WildTypePattern(List names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams) {
this((NamePattern[]) names.toArray(new NamePattern[names.size()]), includeSubtypes, dim, isVarArg, typeParams);
this.end = endPos;
}
public NamePattern[] getNamePatterns() {
return namePatterns;
}
public TypePattern getUpperBound() {
return upperBound;
}
public TypePattern getLowerBound() {
return lowerBound;
}
public TypePattern[] getAdditionalIntefaceBounds() {
return additionalInterfaceBounds;
}
@Override
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
public void setIsVarArgs(boolean isVarArgs) {
this.isVarArgs = isVarArgs;
if (isVarArgs) {
this.dim += 1;
}
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
*/
@Override
protected boolean couldEverMatchSameTypesAs(TypePattern other) {
if (super.couldEverMatchSameTypesAs(other)) {
return true;
}
UnresolvedType otherType = other.getExactType();
if (!ResolvedType.isMissing(otherType)) {
if (namePatterns.length > 0) {
if (!namePatterns[0].matches(otherType.getName())) {
return false;
}
}
}
if (other instanceof WildTypePattern) {
WildTypePattern owtp = (WildTypePattern) other;
String mySimpleName = namePatterns[0].maybeGetSimpleName();
String yourSimpleName = owtp.namePatterns[0].maybeGetSimpleName();
if (mySimpleName != null && yourSimpleName != null) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
return (mySimpleName.startsWith(yourSimpleName) || yourSimpleName.startsWith(mySimpleName));
}
}
return true;
}
public static char[][] splitNames(String s, boolean convertDollar) {
List ret = new ArrayList();
int startIndex = 0;
while (true) {
int breakIndex = s.indexOf('.', startIndex);
if (convertDollar && (breakIndex == -1)) {
breakIndex = s.indexOf('$', startIndex);
}
if (breakIndex == -1) {
break;
}
char[] name = s.substring(startIndex, breakIndex).toCharArray();
ret.add(name);
startIndex = breakIndex + 1;
}
ret.add(s.substring(startIndex).toCharArray());
return (char[][]) ret.toArray(new char[ret.size()][]);
}
/**
* @see org.aspectj.weaver.TypePattern#matchesExactly(IType)
*/
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
@Override
protected boolean matchesExactly(ResolvedType type) {
return matchesExactly(type, type);
}
@Override
protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
String targetTypeName = type.getName();
annotationPattern.resolve(type.getWorld());
return matchesExactlyByName(targetTypeName, type.isAnonymous(), type.isNested()) && matchesParameters(type, STATIC)
&& matchesBounds(type, STATIC)
&& annotationPattern.matches(annotatedType, type.temporaryAnnotationTypes).alwaysTrue();
}
private boolean matchesParameters(ResolvedType aType, MatchKind staticOrDynamic) {
if (!isGeneric && typeParameters.size() > 0) {
if (!aType.isParameterizedType()) {
return false;
}
return typeParameters.matches(aType.getResolvedTypeParameters(), staticOrDynamic).alwaysTrue();
}
return true;
}
private boolean matchesBounds(ResolvedType aType, MatchKind staticOrDynamic) {
if (!(aType instanceof BoundedReferenceType)) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
return true;
}
BoundedReferenceType boundedRT = (BoundedReferenceType) aType;
if (upperBound == null && boundedRT.getUpperBound() != null) {
if (!boundedRT.getUpperBound().getName().equals(UnresolvedType.OBJECT.getName())) {
return false;
}
}
if (lowerBound == null && boundedRT.getLowerBound() != null) {
return false;
}
if (upperBound != null) {
if (aType.isGenericWildcard() && boundedRT.isSuper()) {
return false;
}
if (boundedRT.getUpperBound() == null) {
return false;
}
return upperBound.matches((ResolvedType) boundedRT.getUpperBound(), staticOrDynamic).alwaysTrue();
}
if (lowerBound != null) {
if (!(boundedRT.isGenericWildcard() && boundedRT.isSuper())) {
return false;
}
return lowerBound.matches((ResolvedType) boundedRT.getLowerBound(), staticOrDynamic).alwaysTrue();
}
return true;
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
}
/**
* Used in conjunction with checks on 'isStar()' to tell you if this pattern represents '*' or '*[]' which are different !
*/
public int getDimensions() {
return dim;
}
@Override
public boolean isArray() {
return dim > 1;
}
/**
* @param targetTypeName
* @return
*/
private boolean matchesExactlyByName(String targetTypeName, boolean isAnonymous, boolean isNested) {
if (targetTypeName.indexOf('<') != -1) {
targetTypeName = targetTypeName.substring(0, targetTypeName.indexOf('<'));
}
if (targetTypeName.startsWith(GENERIC_WILDCARD_CHARACTER)) {
targetTypeName = GENERIC_WILDCARD_CHARACTER;
}
if (knownMatches == null && importedPrefixes == null) {
return innerMatchesExactly(targetTypeName, isAnonymous, isNested);
}
if (isNamePatternStar()) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
int numDimensionsInTargetType = 0;
if (dim > 0) {
int index;
while ((index = targetTypeName.indexOf('[')) != -1) {
numDimensionsInTargetType++;
targetTypeName = targetTypeName.substring(index + 1);
}
if (numDimensionsInTargetType == dim) {
return true;
} else {
return false;
}
}
}
if (namePatterns.length == 1) {
if (isAnonymous) {
return false;
}
for (int i = 0, len = knownMatches.length; i < len; i++) {
if (knownMatches[i].equals(targetTypeName)) {
return true;
}
}
} else {
for (int i = 0, len = knownMatches.length; i < len; i++) {
String knownMatch = knownMatches[i];
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (targetTypeName.startsWith(knownMatch) && targetTypeName.length() > knownMatch.length()
&& targetTypeName.charAt(knownMatch.length()) == '$') {
int pos = lastIndexOfDotOrDollar(knownMatch);
if (innerMatchesExactly(targetTypeName.substring(pos + 1), isAnonymous, isNested)) {
return true;
}
}
}
}
for (int i = 0, len = importedPrefixes.length; i < len; i++) {
String prefix = importedPrefixes[i];
if (targetTypeName.startsWith(prefix)) {
if (innerMatchesExactly(targetTypeName.substring(prefix.length()), isAnonymous, isNested)) {
return true;
}
}
}
return innerMatchesExactly(targetTypeName, isAnonymous, isNested);
}
private int lastIndexOfDotOrDollar(String string) {
for (int pos = string.length() - 1; pos > -1; pos--) {
char ch = string.charAt(pos);
if (ch == '.' || ch == '$') {
return pos;
}
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
return -1;
}
private boolean innerMatchesExactly(String s, boolean isAnonymous, boolean convertDollar ) {
List<char[]> ret = new ArrayList<char[]>();
int startIndex = 0;
while (true) {
int breakIndex = s.indexOf('.', startIndex);
if (convertDollar && (breakIndex == -1)) {
breakIndex = s.indexOf('$', startIndex);
}
if (breakIndex == -1) {
break;
}
char[] name = s.substring(startIndex, breakIndex).toCharArray();
ret.add(name);
startIndex = breakIndex + 1;
}
ret.add(s.substring(startIndex).toCharArray());
int namesLength = ret.size();
int patternsLength = namePatterns.length;
int namesIndex = 0;
int patternsIndex = 0;
if ((!namePatterns[patternsLength - 1].isAny()) && isAnonymous) {
return false;
}
if (ellipsisCount == 0) {
if (namesLength != patternsLength) {
return false;
}
while (patternsIndex < patternsLength) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (!namePatterns[patternsIndex++].matches(ret.get(namesIndex++))) {
return false;
}
}
return true;
} else if (ellipsisCount == 1) {
if (namesLength < patternsLength - 1) {
return false;
}
while (patternsIndex < patternsLength) {
NamePattern p = namePatterns[patternsIndex++];
if (p == NamePattern.ELLIPSIS) {
namesIndex = namesLength - (patternsLength - patternsIndex);
} else {
if (!p.matches(ret.get(namesIndex++))) {
return false;
}
}
}
return true;
} else {
boolean b = outOfStar(namePatterns, ret.toArray(new char[ret.size()][]), 0, 0, patternsLength - ellipsisCount,
namesLength, ellipsisCount);
return b;
}
}
private static boolean outOfStar(final NamePattern[] pattern, final char[][] target, int pi, int ti, int pLeft, int tLeft,
final int starsLeft) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (pLeft > tLeft) {
return false;
}
while (true) {
if (tLeft == 0) {
return true;
}
if (pLeft == 0) {
return (starsLeft > 0);
}
if (pattern[pi] == NamePattern.ELLIPSIS) {
return inStar(pattern, target, pi + 1, ti, pLeft, tLeft, starsLeft - 1);
}
if (!pattern[pi].matches(target[ti])) {
return false;
}
pi++;
ti++;
pLeft--;
tLeft--;
}
}
private static boolean inStar(final NamePattern[] pattern, final char[][] target, int pi, int ti, final int pLeft, int tLeft,
int starsLeft) {
NamePattern patternChar = pattern[pi];
while (patternChar == NamePattern.ELLIPSIS) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
starsLeft--;
patternChar = pattern[++pi];
}
while (true) {
if (pLeft > tLeft) {
return false;
}
if (patternChar.matches(target[ti])) {
if (outOfStar(pattern, target, pi + 1, ti + 1, pLeft - 1, tLeft - 1, starsLeft)) {
return true;
}
}
ti++;
tLeft--;
}
}
/**
* @see org.aspectj.weaver.TypePattern#matchesInstanceof(IType)
*/
@Override
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
if (maybeGetSimpleName() != null) {
return FuzzyBoolean.NO;
}
type.getWorld().getMessageHandler().handleMessage(
new Message("can't do instanceof matching on patterns with wildcards", IMessage.ERROR, null, getSourceLocation()));
return FuzzyBoolean.NO;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
public NamePattern extractName() {
if (isIncludeSubtypes() || isVarArgs() || isArray() || (typeParameters.size() > 0)) {
return null;
}
int len = namePatterns.length;
if (len == 1 && !annotationPattern.isAny()) {
return null;
}
NamePattern ret = namePatterns[len - 1];
NamePattern[] newNames = new NamePattern[len - 1];
System.arraycopy(namePatterns, 0, newNames, 0, len - 1);
namePatterns = newNames;
return ret;
}
/**
* Method maybeExtractName.
*
* @param string
* @return boolean
*/
public boolean maybeExtractName(String string) {
int len = namePatterns.length;
NamePattern ret = namePatterns[len - 1];
String simple = ret.maybeGetSimpleName();
if (simple != null && simple.equals(string)) {
extractName();
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
return true;
}
return false;
}
/**
* If this type pattern has no '.' or '*' in it, then return a simple string
*
* otherwise, this will return null;
*/
public String maybeGetSimpleName() {
if (namePatterns.length == 1) {
return namePatterns[0].maybeGetSimpleName();
}
return null;
}
/**
* If this type pattern has no '*' or '..' in it
*/
public String maybeGetCleanName() {
if (namePatterns.length == 0) {
throw new RuntimeException("bad name: " + namePatterns);
}
StringBuffer buf = new StringBuffer();
for (int i = 0, len = namePatterns.length; i < len; i++) {
NamePattern p = namePatterns[i];
String simpleName = p.maybeGetSimpleName();
if (simpleName == null) {
return null;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (i > 0) {
buf.append(".");
}
buf.append(simpleName);
}
return buf.toString();
}
@Override
public TypePattern parameterizeWith(Map typeVariableMap, World w) {
NamePattern[] newNamePatterns = new NamePattern[namePatterns.length];
for (int i = 0; i < namePatterns.length; i++) {
newNamePatterns[i] = namePatterns[i];
}
if (newNamePatterns.length == 1) {
String simpleName = newNamePatterns[0].maybeGetSimpleName();
if (simpleName != null) {
if (typeVariableMap.containsKey(simpleName)) {
String newName = ((ReferenceType) typeVariableMap.get(simpleName)).getName().replace('$', '.');
StringTokenizer strTok = new StringTokenizer(newName, ".");
newNamePatterns = new NamePattern[strTok.countTokens()];
int index = 0;
while (strTok.hasMoreTokens()) {
newNamePatterns[index++] = new NamePattern(strTok.nextToken());
}
}
}
}
WildTypePattern ret = new WildTypePattern(newNamePatterns, includeSubtypes, dim, isVarArgs, typeParameters
.parameterizeWith(typeVariableMap, w));
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
ret.annotationPattern = this.annotationPattern.parameterizeWith(typeVariableMap, w);
if (additionalInterfaceBounds == null) {
ret.additionalInterfaceBounds = null;
} else {
ret.additionalInterfaceBounds = new TypePattern[additionalInterfaceBounds.length];
for (int i = 0; i < additionalInterfaceBounds.length; i++) {
ret.additionalInterfaceBounds[i] = additionalInterfaceBounds[i].parameterizeWith(typeVariableMap, w);
}
}
ret.upperBound = upperBound != null ? upperBound.parameterizeWith(typeVariableMap, w) : null;
ret.lowerBound = lowerBound != null ? lowerBound.parameterizeWith(typeVariableMap, w) : null;
ret.isGeneric = isGeneric;
ret.knownMatches = knownMatches;
ret.importedPrefixes = importedPrefixes;
ret.copyLocationFrom(this);
return ret;
}
/**
* Need to determine if I'm really a pattern or a reference to a formal
*
* We may wish to further optimize the case of pattern vs. non-pattern
*
* We will be replaced by what we return
*/
@Override
public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
if (isNamePatternStar()) {
TypePattern anyPattern = maybeResolveToAnyPattern(scope, bindings, allowBinding, requireExactType);
if (anyPattern != null) {
if (requireExactType) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
scope.getWorld().getMessageHandler().handleMessage(
MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED), getSourceLocation()));
return NO;
} else {
return anyPattern;
}
}
}
TypePattern bindingTypePattern = maybeResolveToBindingTypePattern(scope, bindings, allowBinding, requireExactType);
if (bindingTypePattern != null) {
return bindingTypePattern;
}
annotationPattern = annotationPattern.resolveBindings(scope, bindings, allowBinding);
if (typeParameters != null && typeParameters.size() > 0) {
typeParameters.resolveBindings(scope, bindings, allowBinding, requireExactType);
isGeneric = false;
}
if (upperBound != null) {
upperBound = upperBound.resolveBindings(scope, bindings, allowBinding, requireExactType);
}
if (lowerBound != null) {
lowerBound = lowerBound.resolveBindings(scope, bindings, allowBinding, requireExactType);
}
String fullyQualifiedName = maybeGetCleanName();
if (fullyQualifiedName != null) {
return resolveBindingsFromFullyQualifiedTypeName(fullyQualifiedName, scope, bindings, allowBinding, requireExactType);
} else {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (requireExactType) {
scope.getWorld().getMessageHandler().handleMessage(
MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED), getSourceLocation()));
return NO;
}
importedPrefixes = scope.getImportedPrefixes();
knownMatches = preMatch(scope.getImportedNames());
return this;
}
}
private TypePattern maybeResolveToAnyPattern(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
if (annotationPattern == AnnotationTypePattern.ANY) {
if (dim == 0 && !isVarArgs && upperBound == null && lowerBound == null
&& (additionalInterfaceBounds == null || additionalInterfaceBounds.length == 0)) {
return TypePattern.ANY;
}
} else if (!isVarArgs) {
annotationPattern = annotationPattern.resolveBindings(scope, bindings, allowBinding);
AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(annotationPattern);
ret.setLocation(sourceContext, start, end);
return ret;
}
return null;
}
private TypePattern maybeResolveToBindingTypePattern(IScope scope, Bindings bindings, boolean allowBinding,
boolean requireExactType) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
String simpleName = maybeGetSimpleName();
if (simpleName != null) {
FormalBinding formalBinding = scope.lookupFormal(simpleName);
if (formalBinding != null) {
if (bindings == null) {
scope.message(IMessage.ERROR, this, "negation doesn't allow binding");
return this;
}
if (!allowBinding) {
scope.message(IMessage.ERROR, this, "name binding only allowed in target, this, and args pcds");
return this;
}
BindingTypePattern binding = new BindingTypePattern(formalBinding, isVarArgs);
binding.copyLocationFrom(this);
bindings.register(binding, scope);
return binding;
}
}
return null;
}
private TypePattern resolveBindingsFromFullyQualifiedTypeName(String fullyQualifiedName, IScope scope, Bindings bindings,
boolean allowBinding, boolean requireExactType) {
String originalName = fullyQualifiedName;
ResolvedType resolvedTypeInTheWorld = null;
UnresolvedType type;
resolvedTypeInTheWorld = lookupTypeInWorldIncludingPrefixes(scope.getWorld(), fullyQualifiedName, scope
.getImportedPrefixes());
if (resolvedTypeInTheWorld.isGenericWildcard()) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
type = resolvedTypeInTheWorld;
} else {
type = lookupTypeInScope(scope, fullyQualifiedName, this);
}
if ((type instanceof ResolvedType) && ((ResolvedType) type).isMissing()) {
return resolveBindingsForMissingType(resolvedTypeInTheWorld, originalName, scope, bindings, allowBinding,
requireExactType);
} else {
return resolveBindingsForExactType(scope, type, fullyQualifiedName, requireExactType);
}
}
private UnresolvedType lookupTypeInScope(IScope scope, String typeName, IHasPosition location) {
UnresolvedType type = null;
while (ResolvedType.isMissing(type = scope.lookupType(typeName, location))) {
int lastDot = typeName.lastIndexOf('.');
if (lastDot == -1) {
break;
}
typeName = typeName.substring(0, lastDot) + '$' + typeName.substring(lastDot + 1);
}
return type;
}
/**
* Searches the world for the ResolvedType with the given typeName. If one isn't found then for each of the supplied prefixes,
* it prepends the typeName with the prefix and searches the world for the ResolvedType with this new name. If one still isn't
* found then a MissingResolvedTypeWithKnownSignature is returned with the originally requested typeName (this ensures the
* typeName makes sense).
*/
private ResolvedType lookupTypeInWorldIncludingPrefixes(World world, String typeName, String[] prefixes) {
ResolvedType ret = lookupTypeInWorld(world, typeName);
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (!ret.isMissing()) {
return ret;
}
ResolvedType retWithPrefix = ret;
int counter = 0;
while (retWithPrefix.isMissing() && (counter < prefixes.length)) {
retWithPrefix = lookupTypeInWorld(world, prefixes[counter] + typeName);
counter++;
}
if (!retWithPrefix.isMissing()) {
return retWithPrefix;
}
return ret;
}
private ResolvedType lookupTypeInWorld(World world, String typeName) {
UnresolvedType ut = UnresolvedType.forName(typeName);
ResolvedType ret = world.resolve(ut, true);
while (ret.isMissing()) {
int lastDot = typeName.lastIndexOf('.');
if (lastDot == -1) {
break;
}
typeName = typeName.substring(0, lastDot) + '$' + typeName.substring(lastDot + 1);
ret = world.resolve(UnresolvedType.forName(typeName), true);
}
return ret;
}
private TypePattern resolveBindingsForExactType(IScope scope, UnresolvedType aType, String fullyQualifiedName,
boolean requireExactType) {
TypePattern ret = null;
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (aType.isTypeVariableReference()) {
ret = resolveBindingsForTypeVariable(scope, (UnresolvedTypeVariableReferenceType) aType);
} else if (typeParameters.size() > 0) {
ret = resolveParameterizedType(scope, aType, requireExactType);
} else if (upperBound != null || lowerBound != null) {
ret = resolveGenericWildcard(scope, aType);
} else {
if (dim != 0) {
aType = UnresolvedType.makeArray(aType, dim);
}
ret = new ExactTypePattern(aType, includeSubtypes, isVarArgs);
}
ret.setAnnotationTypePattern(annotationPattern);
ret.copyLocationFrom(this);
return ret;
}
private TypePattern resolveGenericWildcard(IScope scope, UnresolvedType aType) {
if (!aType.getSignature().equals(GENERIC_WILDCARD_SIGNATURE_CHARACTER)) {
throw new IllegalStateException("Can only have bounds for a generic wildcard");
}
boolean canBeExact = true;
if ((upperBound != null) && ResolvedType.isMissing(upperBound.getExactType())) {
canBeExact = false;
}
if ((lowerBound != null) && ResolvedType.isMissing(lowerBound.getExactType())) {
canBeExact = false;
}
if (canBeExact) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
ResolvedType type = null;
if (upperBound != null) {
if (upperBound.isIncludeSubtypes()) {
canBeExact = false;
} else {
ReferenceType upper = (ReferenceType) upperBound.getExactType().resolve(scope.getWorld());
type = new BoundedReferenceType(upper, true, scope.getWorld());
}
} else {
if (lowerBound.isIncludeSubtypes()) {
canBeExact = false;
} else {
ReferenceType lower = (ReferenceType) lowerBound.getExactType().resolve(scope.getWorld());
type = new BoundedReferenceType(lower, false, scope.getWorld());
}
}
if (canBeExact) {
return new ExactTypePattern(type, includeSubtypes, isVarArgs);
}
}
importedPrefixes = scope.getImportedPrefixes();
knownMatches = preMatch(scope.getImportedNames());
return this;
}
private TypePattern resolveParameterizedType(IScope scope, UnresolvedType aType, boolean requireExactType) {
ResolvedType rt = aType.resolve(scope.getWorld());
if (!verifyTypeParameters(rt, scope, requireExactType)) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
return TypePattern.NO;
}
if (typeParameters.areAllExactWithNoSubtypesAllowed()) {
TypePattern[] typePats = typeParameters.getTypePatterns();
UnresolvedType[] typeParameterTypes = new UnresolvedType[typePats.length];
for (int i = 0; i < typeParameterTypes.length; i++) {
typeParameterTypes[i] = ((ExactTypePattern) typePats[i]).getExactType();
}
if (rt.isParameterizedType()) {
rt = rt.getGenericType();
}
ResolvedType type = TypeFactory.createParameterizedType(rt, typeParameterTypes, scope.getWorld());
if (isGeneric) {
type = type.getGenericType();
}
if (dim != 0) {
type = ResolvedType.makeArray(type, dim);
}
return new ExactTypePattern(type, includeSubtypes, isVarArgs);
} else {
importedPrefixes = scope.getImportedPrefixes();
knownMatches = preMatch(scope.getImportedNames());
return this;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
}
private TypePattern resolveBindingsForMissingType(ResolvedType typeFoundInWholeWorldSearch, String nameWeLookedFor,
IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
if (requireExactType) {
if (!allowBinding) {
scope.getWorld().getMessageHandler().handleMessage(
MessageUtil.error(WeaverMessages.format(WeaverMessages.CANT_BIND_TYPE, nameWeLookedFor),
getSourceLocation()));
} else if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
scope.getWorld().getLint().invalidAbsoluteTypeName.signal(nameWeLookedFor, getSourceLocation());
}
return NO;
} else if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
if (typeFoundInWholeWorldSearch.isMissing()) {
scope.getWorld().getLint().invalidAbsoluteTypeName.signal(nameWeLookedFor, getSourceLocation());
this.failedResolution = true;
}
}
importedPrefixes = scope.getImportedPrefixes();
knownMatches = preMatch(scope.getImportedNames());
return this;
}
/**
* We resolved the type to a type variable declared in the pointcut designator. Now we have to create either an exact type
* pattern or a wild type pattern for it, with upper and lower bounds set accordingly. XXX none of this stuff gets serialized
* yet
*
* @param scope
* @param tvrType
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
* @return
*/
private TypePattern resolveBindingsForTypeVariable(IScope scope, UnresolvedTypeVariableReferenceType tvrType) {
Bindings emptyBindings = new Bindings(0);
if (upperBound != null) {
upperBound = upperBound.resolveBindings(scope, emptyBindings, false, false);
}
if (lowerBound != null) {
lowerBound = lowerBound.resolveBindings(scope, emptyBindings, false, false);
}
if (additionalInterfaceBounds != null) {
TypePattern[] resolvedIfBounds = new TypePattern[additionalInterfaceBounds.length];
for (int i = 0; i < resolvedIfBounds.length; i++) {
resolvedIfBounds[i] = additionalInterfaceBounds[i].resolveBindings(scope, emptyBindings, false, false);
}
additionalInterfaceBounds = resolvedIfBounds;
}
if (upperBound == null && lowerBound == null && additionalInterfaceBounds == null) {
ResolvedType rType = tvrType.resolve(scope.getWorld());
if (dim != 0) {
rType = ResolvedType.makeArray(rType, dim);
}
return new ExactTypePattern(rType, includeSubtypes, isVarArgs);
} else {
boolean canCreateExactTypePattern = true;
if (upperBound != null && ResolvedType.isMissing(upperBound.getExactType())) {
canCreateExactTypePattern = false;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (lowerBound != null && ResolvedType.isMissing(lowerBound.getExactType())) {
canCreateExactTypePattern = false;
}
if (additionalInterfaceBounds != null) {
for (int i = 0; i < additionalInterfaceBounds.length; i++) {
if (ResolvedType.isMissing(additionalInterfaceBounds[i].getExactType())) {
canCreateExactTypePattern = false;
}
}
}
if (canCreateExactTypePattern) {
TypeVariable tv = tvrType.getTypeVariable();
if (upperBound != null) {
tv.setSuperclass(upperBound.getExactType());
}
if (additionalInterfaceBounds != null) {
UnresolvedType[] ifBounds = new UnresolvedType[additionalInterfaceBounds.length];
for (int i = 0; i < ifBounds.length; i++) {
ifBounds[i] = additionalInterfaceBounds[i].getExactType();
}
tv.setAdditionalInterfaceBounds(ifBounds);
}
ResolvedType rType = tvrType.resolve(scope.getWorld());
if (dim != 0) {
rType = ResolvedType.makeArray(rType, dim);
}
return new ExactTypePattern(rType, includeSubtypes, isVarArgs);
}
return this;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
}
/**
* When this method is called, we have resolved the base type to an exact type. We also have a set of type patterns for the
* parameters. Time to perform some basic checks: - can the base type be parameterized? (is it generic) - can the type parameter
* pattern list match the number of parameters on the base type - do all parameter patterns meet the bounds of the respective
* type variables If any of these checks fail, a warning message is issued and we return false.
*
* @return
*/
private boolean verifyTypeParameters(ResolvedType baseType, IScope scope, boolean requireExactType) {
ResolvedType genericType = baseType.getGenericType();
if (genericType == null) {
scope.message(MessageUtil.warn(WeaverMessages.format(WeaverMessages.NOT_A_GENERIC_TYPE, baseType.getName()),
getSourceLocation()));
return false;
}
int minRequiredTypeParameters = typeParameters.size();
boolean foundEllipsis = false;
TypePattern[] typeParamPatterns = typeParameters.getTypePatterns();
for (int i = 0; i < typeParamPatterns.length; i++) {
if (typeParamPatterns[i] instanceof WildTypePattern) {
WildTypePattern wtp = (WildTypePattern) typeParamPatterns[i];
if (wtp.ellipsisCount > 0) {
foundEllipsis = true;
minRequiredTypeParameters--;
}
}
}
TypeVariable[] tvs = genericType.getTypeVariables();
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if ((tvs.length < minRequiredTypeParameters) || (!foundEllipsis && minRequiredTypeParameters != tvs.length)) {
String msg = WeaverMessages.format(WeaverMessages.INCORRECT_NUMBER_OF_TYPE_ARGUMENTS, genericType.getName(),
new Integer(tvs.length));
if (requireExactType) {
scope.message(MessageUtil.error(msg, getSourceLocation()));
} else {
scope.message(MessageUtil.warn(msg, getSourceLocation()));
}
return false;
}
if (!boundscheckingoff) {
VerifyBoundsForTypePattern verification = new VerifyBoundsForTypePattern(scope, genericType, requireExactType,
typeParameters, getSourceLocation());
scope.getWorld().getCrosscuttingMembersSet().recordNecessaryCheck(verification);
}
return true;
}
/**
* By capturing the verification in this class, rather than performing it in verifyTypeParameters(), we can cope with situations
* where the interactions between generics and declare parents would otherwise cause us problems. For example, if verifying as
* we go along we may report a problem which would have been fixed by a declare parents that we haven't looked at yet. If we
* create and store a verification object, we can verify this later when the type system is considered 'complete'
*/
static class VerifyBoundsForTypePattern implements IVerificationRequired {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
private final IScope scope;
private final ResolvedType genericType;
private final boolean requireExactType;
private TypePatternList typeParameters = TypePatternList.EMPTY;
private final ISourceLocation sLoc;
public VerifyBoundsForTypePattern(IScope scope, ResolvedType genericType, boolean requireExactType,
TypePatternList typeParameters, ISourceLocation sLoc) {
this.scope = scope;
this.genericType = genericType;
this.requireExactType = requireExactType;
this.typeParameters = typeParameters;
this.sLoc = sLoc;
}
public void verify() {
TypeVariable[] tvs = genericType.getTypeVariables();
TypePattern[] typeParamPatterns = typeParameters.getTypePatterns();
if (typeParameters.areAllExactWithNoSubtypesAllowed()) {
for (int i = 0; i < tvs.length; i++) {
UnresolvedType ut = typeParamPatterns[i].getExactType();
boolean continueCheck = true;
if (ut.isTypeVariableReference()) {
continueCheck = false;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (continueCheck && !tvs[i].canBeBoundTo(ut.resolve(scope.getWorld()))) {
String parameterName = ut.getName();
if (ut.isTypeVariableReference()) {
parameterName = ((TypeVariableReference) ut).getTypeVariable().getDisplayName();
}
String msg = WeaverMessages.format(WeaverMessages.VIOLATES_TYPE_VARIABLE_BOUNDS, parameterName,
new Integer(i + 1), tvs[i].getDisplayName(), genericType.getName());
if (requireExactType) {
scope.message(MessageUtil.error(msg, sLoc));
} else {
scope.message(MessageUtil.warn(msg, sLoc));
}
}
}
}
}
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
}
}
}
}
}
@Override
public boolean isStar() {
boolean annPatternStar = annotationPattern == AnnotationTypePattern.ANY;
return (isNamePatternStar() && annPatternStar && dim == 0);
}
private boolean isNamePatternStar() {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
return namePatterns.length == 1 && namePatterns[0].isAny();
}
/**
* returns those possible matches which I match exactly the last element of
*/
private String[] preMatch(String[] possibleMatches) {
List ret = new ArrayList();
for (int i = 0, len = possibleMatches.length; i < len; i++) {
char[][] names = splitNames(possibleMatches[i], true);
if (namePatterns[0].matches(names[names.length - 1])) {
ret.add(possibleMatches[i]);
continue;
}
if (possibleMatches[i].indexOf("$") != -1) {
names = splitNames(possibleMatches[i], false);
if (namePatterns[0].matches(names[names.length - 1])) {
ret.add(possibleMatches[i]);
}
}
}
return (String[]) ret.toArray(new String[ret.size()]);
}
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (annotationPattern != AnnotationTypePattern.ANY) {
buf.append('(');
buf.append(annotationPattern.toString());
buf.append(' ');
}
for (int i = 0, len = namePatterns.length; i < len; i++) {
NamePattern name = namePatterns[i];
if (name == null) {
buf.append(".");
} else {
if (i > 0) {
buf.append(".");
}
buf.append(name.toString());
}
}
if (upperBound != null) {
buf.append(" extends ");
buf.append(upperBound.toString());
}
if (lowerBound != null) {
buf.append(" super ");
buf.append(lowerBound.toString());
}
if (typeParameters != null && typeParameters.size() != 0) {
buf.append("<");
buf.append(typeParameters.toString());
buf.append(">");
}
if (includeSubtypes) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
buf.append('+');
}
if (isVarArgs) {
buf.append("...");
}
if (annotationPattern != AnnotationTypePattern.ANY) {
buf.append(')');
}
return buf.toString();
}
@Override
public boolean equals(Object other) {
if (!(other instanceof WildTypePattern)) {
return false;
}
WildTypePattern o = (WildTypePattern) other;
int len = o.namePatterns.length;
if (len != this.namePatterns.length) {
return false;
}
if (this.includeSubtypes != o.includeSubtypes) {
return false;
}
if (this.dim != o.dim) {
return false;
}
if (this.isVarArgs != o.isVarArgs) {
return false;
}
if (this.upperBound != null) {
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
if (o.upperBound == null) {
return false;
}
if (!this.upperBound.equals(o.upperBound)) {
return false;
}
} else {
if (o.upperBound != null) {
return false;
}
}
if (this.lowerBound != null) {
if (o.lowerBound == null) {
return false;
}
if (!this.lowerBound.equals(o.lowerBound)) {
return false;
}
} else {
if (o.lowerBound != null) {
return false;
}
}
if (!typeParameters.equals(o.typeParameters)) {
return false;
}
for (int i = 0; i < len; i++) {
if (!o.namePatterns[i].equals(this.namePatterns[i])) {
return false;
}
|
317,743 |
Bug 317743 import handling and type lookup issues
|
Raised by Peter Melnikov on the mailing list. Two problems: 1) the binding scope being used for annotation style aspects accumulates lots of duplicate import prefixes in the SimpleScope object. 2) SimpleScope.lookupType tries the prefixes even if the type is already fully qualified. The combination of these issues causes a terrible mess. Lots of class lookup failures. Since the type cannot be 'partially qualified' it is silly to use the prefixes if the type is fully qualified.
|
resolved fixed
|
767bb85
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2010-06-29T00:12:05Z | 2010-06-23T19:06:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
|
}
return (o.annotationPattern.equals(this.annotationPattern));
}
@Override
public int hashCode() {
int result = 17;
for (int i = 0, len = namePatterns.length; i < len; i++) {
result = 37 * result + namePatterns[i].hashCode();
}
result = 37 * result + annotationPattern.hashCode();
if (upperBound != null) {
result = 37 * result + upperBound.hashCode();
}
if (lowerBound != null) {
result = 37 * result + lowerBound.hashCode();
}
return result;
}
private static final byte VERSION = 1;
@Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(TypePattern.WILD);
s.writeByte(VERSION);
s.writeShort(namePatterns.length);
for (int i = 0; i < namePatterns.length; i++) {
namePatterns[i].write(s);
}
s.writeBoolean(includeSubtypes);
s.writeInt(dim);
s.writeBoolean(isVarArgs);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.