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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.ConstantPool;
import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.apache.bcel.classfile.Synthetic;
import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
import org.aspectj.apache.bcel.generic.BranchHandle;
import org.aspectj.apache.bcel.generic.ClassGenException;
import org.aspectj.apache.bcel.generic.CodeExceptionGen;
import org.aspectj.apache.bcel.generic.Instruction;
import org.aspectj.apache.bcel.generic.InstructionBranch;
import org.aspectj.apache.bcel.generic.InstructionHandle;
import org.aspectj.apache.bcel.generic.InstructionList;
import org.aspectj.apache.bcel.generic.InstructionSelect;
import org.aspectj.apache.bcel.generic.InstructionTargeter;
import org.aspectj.apache.bcel.generic.LineNumberTag;
import org.aspectj.apache.bcel.generic.LocalVariableTag;
import org.aspectj.apache.bcel.generic.MethodGen;
import org.aspectj.apache.bcel.generic.ObjectType;
import org.aspectj.apache.bcel.generic.Tag;
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
import org.aspectj.apache.bcel.generic.TargetLostException;
import org.aspectj.apache.bcel.generic.Type;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
import org.aspectj.weaver.AnnotationAJ;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.MemberImpl;
import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.tools.Traceable;
/**
* A LazyMethodGen should be treated as a MethodGen. It's our way of abstracting over the low-level Method objects. It converts
* through {@link MethodGen} to create and to serialize, but that's it.
*
* <p>
* At any rate, there are two ways to create LazyMethodGens. One is from a method, which does work through MethodGen to do the
* correct thing. The other is the creation of a completely empty LazyMethodGen, and it is used when we're constructing code from
* scratch.
*
* <p>
* We stay away from targeters for rangey things like Shadows and Exceptions.
*/
public final class LazyMethodGen implements Traceable {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
private static final int ACC_SYNTHETIC = 0x1000;
private int modifiers;
private Type returnType;
private final String name;
private Type[] argumentTypes;
private String[] declaredExceptions;
private InstructionList body;
private List<Attribute> attributes;
private List<AnnotationAJ> newAnnotations;
private List<ResolvedType> annotationsForRemoval;
private AnnotationAJ[][] newParameterAnnotations;
private final LazyClassGen enclosingClass;
private BcelMethod memberView;
private AjAttribute.EffectiveSignatureAttribute effectiveSignature;
int highestLineNumber = 0;
boolean wasPackedOptimally = false;
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
private Method savedMethod = null;
private static final AnnotationAJ[] NO_ANNOTATIONAJ = new AnnotationAJ[] {};
/*
* We use LineNumberTags and not Gens.
*
* This option specifies whether we let the BCEL classes create LineNumberGens and LocalVariableGens or if we make it create
* LineNumberTags and LocalVariableTags. Up until 1.5.1 we always created Gens - then on return from the MethodGen ctor we took
* them apart, reprocessed them all and created Tags. (see unpackLocals/unpackLineNumbers). As we have our own copy of Bcel, why
* not create the right thing straightaway? So setting this to true will call the MethodGen ctor() in such a way that it creates
* Tags - removing the need for unpackLocals/unpackLineNumbers - HOWEVER see the ensureAllLineNumberSetup() method for some
* other relevant info.
*
* Whats the difference between a Tag and a Gen? A Tag is more lightweight, it doesn't know which instructions it targets, it
* relies on the instructions targettingit - this reduces the amount of targeter manipulation we have to do.
*/
/**
* This is nonnull if this method is the result of an "inlining". We currently copy methods into other classes for around
* advice. We add this field so we can get JSR45 information correct. If/when we do _actual_ inlining, we'll need to subtype
* LineNumberTag to have external line numbers.
*/
String fromFilename = null;
private int maxLocals;
private boolean canInline = true;
private boolean isSynthetic = false;
List<BcelShadow> matchedShadows;
public ResolvedType definingType = null;
public LazyMethodGen(int modifiers, Type returnType, String name, Type[] paramTypes, String[] declaredExceptions,
LazyClassGen enclosingClass) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
this.memberView = null;
this.modifiers = modifiers;
this.returnType = returnType;
this.name = name;
this.argumentTypes = paramTypes;
this.declaredExceptions = declaredExceptions;
if (!Modifier.isAbstract(modifiers)) {
body = new InstructionList();
setMaxLocals(calculateMaxLocals());
} else {
body = null;
}
this.attributes = new ArrayList<Attribute>();
this.enclosingClass = enclosingClass;
assertGoodBody();
if (memberView != null && isAdviceMethod()) {
if (enclosingClass.getType().isAnnotationStyleAspect()) {
this.canInline = false;
}
}
}
private int calculateMaxLocals() {
int ret = Modifier.isStatic(modifiers) ? 0 : 1;
for (Type type : argumentTypes) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
ret += type.getSize();
}
return ret;
}
public LazyMethodGen(Method m, LazyClassGen enclosingClass) {
savedMethod = m;
this.enclosingClass = enclosingClass;
if (!(m.isAbstract() || m.isNative()) && m.getCode() == null) {
throw new RuntimeException("bad non-abstract method with no code: " + m + " on " + enclosingClass);
}
if ((m.isAbstract() || m.isNative()) && m.getCode() != null) {
throw new RuntimeException("bad abstract method with code: " + m + " on " + enclosingClass);
}
this.memberView = new BcelMethod(enclosingClass.getBcelObjectType(), m);
this.modifiers = m.getModifiers();
this.name = m.getName();
if (memberView != null && isAdviceMethod()) {
if (enclosingClass.getType().isAnnotationStyleAspect()) {
this.canInline = false;
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
}
private boolean isAbstractOrNative(int modifiers) {
return Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers);
}
public LazyMethodGen(BcelMethod m, LazyClassGen enclosingClass) {
savedMethod = m.getMethod();
this.enclosingClass = enclosingClass;
if (!isAbstractOrNative(m.getModifiers()) && savedMethod.getCode() == null) {
throw new RuntimeException("bad non-abstract method with no code: " + m + " on " + enclosingClass);
}
if (isAbstractOrNative(m.getModifiers()) && savedMethod.getCode() != null) {
throw new RuntimeException("bad abstract method with code: " + m + " on " + enclosingClass);
}
this.memberView = m;
this.modifiers = savedMethod.getModifiers();
this.name = m.getName();
if (memberView != null && isAdviceMethod()) {
if (enclosingClass.getType().isAnnotationStyleAspect()) {
this.canInline = false;
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
}
}
public boolean hasDeclaredLineNumberInfo() {
return (memberView != null && memberView.hasDeclarationLineNumberInfo());
}
public int getDeclarationLineNumber() {
if (hasDeclaredLineNumberInfo()) {
return memberView.getDeclarationLineNumber();
} else {
return -1;
}
}
public int getDeclarationOffset() {
if (hasDeclaredLineNumberInfo()) {
return memberView.getDeclarationOffset();
} else {
return 0;
}
}
public void addAnnotation(AnnotationAJ ax) {
initialize();
if (memberView == null) {
if (newAnnotations == null) {
newAnnotations = new ArrayList<AnnotationAJ>();
}
newAnnotations.add(ax);
} else {
memberView.addAnnotation(ax);
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
}
public void removeAnnotation(ResolvedType annotationType) {
initialize();
if (memberView == null) {
if (annotationsForRemoval == null) {
annotationsForRemoval = new ArrayList<ResolvedType>();
}
annotationsForRemoval.add(annotationType);
} else {
memberView.removeAnnotation(annotationType);
}
}
public void addParameterAnnotation(int parameterNumber, AnnotationAJ anno) {
initialize();
if (memberView == null) {
if (newParameterAnnotations == null) {
int pcount = getArgumentTypes().length;
newParameterAnnotations = new AnnotationAJ[pcount][];
for (int i = 0; i < pcount; i++) {
if (i == parameterNumber) {
newParameterAnnotations[i] = new AnnotationAJ[1];
newParameterAnnotations[i][0] = anno;
} else {
newParameterAnnotations[i] = NO_ANNOTATIONAJ;
}
}
} else {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
AnnotationAJ[] currentAnnoArray = newParameterAnnotations[parameterNumber];
AnnotationAJ[] newAnnoArray = new AnnotationAJ[currentAnnoArray.length + 1];
System.arraycopy(currentAnnoArray, 0, newAnnoArray, 0, currentAnnoArray.length);
newAnnoArray[currentAnnoArray.length] = anno;
newParameterAnnotations[parameterNumber] = newAnnoArray;
}
} else {
memberView.addParameterAnnotation(parameterNumber, anno);
}
}
public boolean hasAnnotation(UnresolvedType annotationType) {
initialize();
if (memberView == null) {
if (annotationsForRemoval != null) {
for (ResolvedType at : annotationsForRemoval) {
if (at.equals(annotationType)) {
return false;
}
}
}
if (newAnnotations != null) {
for (AnnotationAJ annotation : newAnnotations) {
if (annotation.getTypeSignature().equals(annotationType.getSignature())) {
return true;
}
}
}
memberView = new BcelMethod(getEnclosingClass().getBcelObjectType(), getMethod());
return memberView.hasAnnotation(annotationType);
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
return memberView.hasAnnotation(annotationType);
}
private void initialize() {
if (returnType != null) {
return;
}
MethodGen gen = new MethodGen(savedMethod, enclosingClass.getName(), enclosingClass.getConstantPool(), true);
this.returnType = gen.getReturnType();
this.argumentTypes = gen.getArgumentTypes();
this.declaredExceptions = gen.getExceptions();
this.attributes = gen.getAttributes();
this.maxLocals = gen.getMaxLocals();
if (gen.isAbstract() || gen.isNative()) {
body = null;
} else {
body = gen.getInstructionList();
unpackHandlers(gen);
ensureAllLineNumberSetup();
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
highestLineNumber = gen.getHighestlinenumber();
}
assertGoodBody();
}
private void unpackHandlers(MethodGen gen) {
CodeExceptionGen[] exns = gen.getExceptionHandlers();
if (exns != null) {
int len = exns.length;
int priority = len - 1;
for (int i = 0; i < len; i++, priority--) {
CodeExceptionGen exn = exns[i];
InstructionHandle start = Range.genStart(body, getOutermostExceptionStart(exn.getStartPC()));
InstructionHandle end = Range.genEnd(body, getOutermostExceptionEnd(exn.getEndPC()));
ExceptionRange er = new ExceptionRange(body, exn.getCatchType() == null ? null : BcelWorld.fromBcel(exn
.getCatchType()), priority);
er.associateWithTargets(start, end, exn.getHandlerPC());
exn.setStartPC(null);
exn.setEndPC(null);
exn.setHandlerPC(null);
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
gen.removeExceptionHandlers();
}
}
private InstructionHandle getOutermostExceptionStart(InstructionHandle ih) {
while (true) {
if (ExceptionRange.isExceptionStart(ih.getPrev())) {
ih = ih.getPrev();
} else {
return ih;
}
}
}
private InstructionHandle getOutermostExceptionEnd(InstructionHandle ih) {
while (true) {
if (ExceptionRange.isExceptionEnd(ih.getNext())) {
ih = ih.getNext();
} else {
return ih;
}
}
}
/**
* On entry to this method we have a method whose instruction stream contains a few instructions that have line numbers assigned
* to them (LineNumberTags). The aim is to ensure every instruction has the right line number. This is necessary because some of
* them may be extracted out into other methods - and it'd be useful for them to maintain the source line number for debugging.
*/
public void ensureAllLineNumberSetup() {
LineNumberTag lastKnownLineNumberTag = null;
boolean skip = false;
for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
skip = false;
for (InstructionTargeter targeter : ih.getTargeters()) {
if (targeter instanceof LineNumberTag) {
lastKnownLineNumberTag = (LineNumberTag) targeter;
skip = true;
}
}
if (lastKnownLineNumberTag != null && !skip) {
ih.addTargeter(lastKnownLineNumberTag);
}
}
}
public int allocateLocal(Type type) {
return allocateLocal(type.getSize());
}
public int allocateLocal(int slots) {
int max = getMaxLocals();
setMaxLocals(max + slots);
return max;
}
public Method getMethod() {
if (savedMethod != null) {
return savedMethod;
}
try {
MethodGen gen = pack();
savedMethod = gen.getMethod();
return savedMethod;
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
} catch (ClassGenException e) {
enclosingClass
.getBcelObjectType()
.getResolvedTypeX()
.getWorld()
.showMessage(
IMessage.ERROR,
WeaverMessages.format(WeaverMessages.PROBLEM_GENERATING_METHOD, this.getClassName(), this.getName(),
e.getMessage()),
this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), null);
body = null;
MethodGen gen = pack();
return gen.getMethod();
} catch (RuntimeException re) {
if (re.getCause() instanceof ClassGenException) {
enclosingClass
.getBcelObjectType()
.getResolvedTypeX()
.getWorld()
.showMessage(
IMessage.ERROR,
WeaverMessages.format(WeaverMessages.PROBLEM_GENERATING_METHOD, this.getClassName(),
this.getName(), re.getCause().getMessage()),
this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), null);
body = null;
MethodGen gen = pack();
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
return gen.getMethod();
}
throw re;
}
}
public void markAsChanged() {
if (wasPackedOptimally) {
throw new RuntimeException("Already packed method is being re-modified: " + getClassName() + " " + toShortString());
}
initialize();
savedMethod = null;
}
@Override
public String toString() {
BcelObjectType bot = enclosingClass.getBcelObjectType();
WeaverVersionInfo weaverVersion = (bot == null ? WeaverVersionInfo.CURRENT : bot.getWeaverVersionAttribute());
return toLongString(weaverVersion);
}
public String toShortString() {
String access = org.aspectj.apache.bcel.classfile.Utility.accessToString(getAccessFlags());
StringBuffer buf = new StringBuffer();
if (!access.equals("")) {
buf.append(access);
buf.append(" ");
}
buf.append(org.aspectj.apache.bcel.classfile.Utility.signatureToString(getReturnType().getSignature(), true));
buf.append(" ");
buf.append(getName());
buf.append("(");
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
{
int len = argumentTypes.length;
if (len > 0) {
buf.append(org.aspectj.apache.bcel.classfile.Utility.signatureToString(argumentTypes[0].getSignature(), true));
for (int i = 1; i < argumentTypes.length; i++) {
buf.append(", ");
buf.append(org.aspectj.apache.bcel.classfile.Utility.signatureToString(argumentTypes[i].getSignature(), true));
}
}
}
buf.append(")");
{
int len = declaredExceptions != null ? declaredExceptions.length : 0;
if (len > 0) {
buf.append(" throws ");
buf.append(declaredExceptions[0]);
for (int i = 1; i < declaredExceptions.length; i++) {
buf.append(", ");
buf.append(declaredExceptions[i]);
}
}
}
return buf.toString();
}
public String toLongString(WeaverVersionInfo weaverVersion) {
ByteArrayOutputStream s = new ByteArrayOutputStream();
print(new PrintStream(s), weaverVersion);
return new String(s.toByteArray());
}
public void print(WeaverVersionInfo weaverVersion) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
print(System.out, weaverVersion);
}
public void print(PrintStream out, WeaverVersionInfo weaverVersion) {
out.print(" " + toShortString());
printAspectAttributes(out, weaverVersion);
InstructionList body = getBody();
if (body == null) {
out.println(";");
return;
}
out.println(":");
new BodyPrinter(out).run();
out.println(" end " + toShortString());
}
private void printAspectAttributes(PrintStream out, WeaverVersionInfo weaverVersion) {
ISourceContext context = null;
if (enclosingClass != null && enclosingClass.getType() != null) {
context = enclosingClass.getType().getSourceContext();
}
List<AjAttribute> as = Utility.readAjAttributes(getClassName(), attributes.toArray(new Attribute[] {}), context, null, weaverVersion,
new BcelConstantPoolReader(this.enclosingClass.getConstantPool()));
if (!as.isEmpty()) {
out.println(" " + as.get(0));
}
}
private class BodyPrinter {
Map<InstructionHandle, String> labelMap = new HashMap<InstructionHandle, String>();
InstructionList body;
PrintStream out;
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
ConstantPool pool;
BodyPrinter(PrintStream out) {
this.pool = enclosingClass.getConstantPool();
this.body = getBodyForPrint();
this.out = out;
}
BodyPrinter(PrintStream out, InstructionList il) {
this.pool = enclosingClass.getConstantPool();
this.body = il;
this.out = out;
}
void run() {
assignLabels();
print();
}
void assignLabels() {
LinkedList<ExceptionRange> exnTable = new LinkedList<ExceptionRange>();
String pendingLabel = null;
int lcounter = 0;
for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) {
Iterator<InstructionTargeter> tIter = ih.getTargeters().iterator();
while (tIter.hasNext()) {
InstructionTargeter t = tIter.next();
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
if (t instanceof ExceptionRange) {
ExceptionRange r = (ExceptionRange) t;
if (r.getStart() == ih) {
insertHandler(r, exnTable);
}
} else if (t instanceof InstructionBranch) {
if (pendingLabel == null) {
pendingLabel = "L" + lcounter++;
}
} else {
}
}
if (pendingLabel != null) {
labelMap.put(ih, pendingLabel);
if (!Range.isRangeHandle(ih)) {
pendingLabel = null;
}
}
}
int ecounter = 0;
for (Iterator i = exnTable.iterator(); i.hasNext();) {
ExceptionRange er = (ExceptionRange) i.next();
String exceptionLabel = "E" + ecounter++;
labelMap.put(Range.getRealStart(er.getHandler()), exceptionLabel);
labelMap.put(er.getHandler(), exceptionLabel);
}
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
void print() {
int depth = 0;
int currLine = -1;
bodyPrint: for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) {
if (Range.isRangeHandle(ih)) {
Range r = Range.getRange(ih);
for (InstructionHandle xx = r.getStart(); Range.isRangeHandle(xx); xx = xx.getNext()) {
if (xx == r.getEnd()) {
continue bodyPrint;
}
}
if (r.getStart() == ih) {
printRangeString(r, depth++);
} else {
if (r.getEnd() != ih) {
throw new RuntimeException("bad");
}
printRangeString(r, --depth);
}
} else {
printInstruction(ih, depth);
int line = getLineNumber(ih, currLine);
if (line != currLine) {
currLine = line;
out.println(" (line " + line + ")");
} else {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
out.println();
}
}
}
}
void printRangeString(Range r, int depth) {
printDepth(depth);
out.println(getRangeString(r, labelMap));
}
String getRangeString(Range r, Map<InstructionHandle, String> labelMap) {
if (r instanceof ExceptionRange) {
ExceptionRange er = (ExceptionRange) r;
return er.toString() + " -> " + labelMap.get(er.getHandler());
} else {
return r.toString();
}
}
void printDepth(int depth) {
pad(BODY_INDENT);
while (depth > 0) {
out.print("| ");
depth--;
}
}
void printLabel(String s, int depth) {
int space = Math.max(CODE_INDENT - depth * 2, 0);
if (s == null) {
pad(space);
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
} else {
space = Math.max(space - (s.length() + 2), 0);
pad(space);
out.print(s);
out.print(": ");
}
}
void printInstruction(InstructionHandle h, int depth) {
printDepth(depth);
printLabel(labelMap.get(h), depth);
Instruction inst = h.getInstruction();
if (inst.isConstantPoolInstruction()) {
out.print(Constants.OPCODE_NAMES[inst.opcode].toUpperCase());
out.print(" ");
out.print(pool.constantToString(pool.getConstant(inst.getIndex())));
} else if (inst instanceof InstructionSelect) {
InstructionSelect sinst = (InstructionSelect) inst;
out.println(Constants.OPCODE_NAMES[sinst.opcode].toUpperCase());
int[] matches = sinst.getMatchs();
InstructionHandle[] targets = sinst.getTargets();
InstructionHandle defaultTarget = sinst.getTarget();
for (int i = 0, len = matches.length; i < len; i++) {
printDepth(depth);
printLabel(null, depth);
out.print(" ");
out.print(matches[i]);
out.print(": \t");
out.println(labelMap.get(targets[i]));
}
printDepth(depth);
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
printLabel(null, depth);
out.print(" ");
out.print("default: \t");
out.print(labelMap.get(defaultTarget));
} else if (inst instanceof InstructionBranch) {
InstructionBranch brinst = (InstructionBranch) inst;
out.print(Constants.OPCODE_NAMES[brinst.getOpcode()].toUpperCase());
out.print(" ");
out.print(labelMap.get(brinst.getTarget()));
} else if (inst.isLocalVariableInstruction()) {
out.print(inst.toString(false).toUpperCase());
int index = inst.getIndex();
LocalVariableTag tag = getLocalVariableTag(h, index);
if (tag != null) {
out.print(" ");
out.print(tag.getType());
out.print(" ");
out.print(tag.getName());
}
} else {
out.print(inst.toString(false).toUpperCase());
}
}
static final int BODY_INDENT = 4;
static final int CODE_INDENT = 16;
void pad(int size) {
for (int i = 0; i < size; i++) {
out.print(" ");
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
}
}
static LocalVariableTag getLocalVariableTag(InstructionHandle ih, int index) {
for (InstructionTargeter t : ih.getTargeters()) {
if (t instanceof LocalVariableTag) {
LocalVariableTag lvt = (LocalVariableTag) t;
if (lvt.getSlot() == index) {
return lvt;
}
}
}
return null;
}
static int getLineNumber(InstructionHandle ih, int prevLine) {
for (InstructionTargeter t : ih.getTargeters()) {
if (t instanceof LineNumberTag) {
return ((LineNumberTag) t).getLineNumber();
}
}
return prevLine;
}
public boolean isStatic() {
return Modifier.isStatic(getAccessFlags());
}
public boolean isAbstract() {
return Modifier.isAbstract(getAccessFlags());
}
public boolean isBridgeMethod() {
return (getAccessFlags() & Constants.ACC_BRIDGE) != 0;
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
public void addExceptionHandler(InstructionHandle start, InstructionHandle end, InstructionHandle handlerStart,
ObjectType catchType, boolean highPriority) {
InstructionHandle start1 = Range.genStart(body, start);
InstructionHandle end1 = Range.genEnd(body, end);
ExceptionRange er = new ExceptionRange(body, (catchType == null ? null : BcelWorld.fromBcel(catchType)), highPriority);
er.associateWithTargets(start1, end1, handlerStart);
}
public int getAccessFlags() {
return modifiers;
}
public int getAccessFlagsWithoutSynchronized() {
if (isSynchronized()) {
return modifiers - Modifier.SYNCHRONIZED;
}
return modifiers;
}
public boolean isSynchronized() {
return (modifiers & Modifier.SYNCHRONIZED) != 0;
}
public void setAccessFlags(int newFlags) {
this.modifiers = newFlags;
}
public Type[] getArgumentTypes() {
initialize();
return argumentTypes;
}
public LazyClassGen getEnclosingClass() {
return enclosingClass;
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
public int getMaxLocals() {
return maxLocals;
}
public String getName() {
return name;
}
public String getGenericReturnTypeSignature() {
if (memberView == null) {
return getReturnType().getSignature();
} else {
return memberView.getGenericReturnType().getSignature();
}
}
public Type getReturnType() {
initialize();
return returnType;
}
public void setMaxLocals(int maxLocals) {
this.maxLocals = maxLocals;
}
public InstructionList getBody() {
markAsChanged();
return body;
}
public InstructionList getBodyForPrint() {
return body;
}
public boolean hasBody() {
if (savedMethod != null) {
return savedMethod.getCode() != null;
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
return body != null;
}
public List<Attribute> getAttributes() {
return attributes;
}
public String[] getDeclaredExceptions() {
return declaredExceptions;
}
public String getClassName() {
return enclosingClass.getName();
}
public MethodGen pack() {
forceSyntheticForAjcMagicMembers();
int flags = getAccessFlags();
if (enclosingClass.getWorld().isJoinpointSynchronizationEnabled()
&& enclosingClass.getWorld().areSynchronizationPointcutsInUse()) {
flags = getAccessFlagsWithoutSynchronized();
}
MethodGen gen = new MethodGen(flags, getReturnType(), getArgumentTypes(), null,
getName(), getEnclosingClass().getName(), new InstructionList(), getEnclosingClass().getConstantPool());
for (int i = 0, len = declaredExceptions.length; i < len; i++) {
gen.addException(declaredExceptions[i]);
}
for (Attribute attr : attributes) {
gen.addAttribute(attr);
}
if (newAnnotations != null) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
for (AnnotationAJ element : newAnnotations) {
gen.addAnnotation(new AnnotationGen(((BcelAnnotation) element).getBcelAnnotation(), gen.getConstantPool(), true));
}
}
if (newParameterAnnotations != null) {
for (int i = 0; i < newParameterAnnotations.length; i++) {
AnnotationAJ[] annos = newParameterAnnotations[i];
for (int j = 0; j < annos.length; j++) {
gen.addParameterAnnotation(i,
new AnnotationGen(((BcelAnnotation) annos[j]).getBcelAnnotation(), gen.getConstantPool(), true));
}
}
}
if (memberView != null && memberView.getAnnotations() != null && memberView.getAnnotations().length != 0) {
AnnotationAJ[] ans = memberView.getAnnotations();
for (int i = 0, len = ans.length; i < len; i++) {
AnnotationGen a = ((BcelAnnotation) ans[i]).getBcelAnnotation();
gen.addAnnotation(new AnnotationGen(a, gen.getConstantPool(), true));
}
}
if (isSynthetic) {
if (enclosingClass.getWorld().isInJava5Mode()) {
gen.setModifiers(gen.getModifiers() | ACC_SYNTHETIC);
}
ConstantPool cpg = gen.getConstantPool();
int index = cpg.addUtf8("Synthetic");
gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg));
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
if (hasBody()) {
if (this.enclosingClass.getWorld().shouldFastPackMethods()) {
if (isAdviceMethod() || getName().equals("<clinit>")) {
packBody(gen);
} else {
optimizedPackBody(gen);
}
} else {
packBody(gen);
}
gen.setMaxLocals();
gen.setMaxStack();
} else {
gen.setInstructionList(null);
}
return gen;
}
private void forceSyntheticForAjcMagicMembers() {
if (NameMangler.isSyntheticMethod(getName(), inAspect())) {
makeSynthetic();
}
}
private boolean inAspect() {
BcelObjectType objectType = enclosingClass.getBcelObjectType();
return (objectType == null ? false : objectType.isAspect());
}
public void makeSynthetic() {
isSynthetic = true;
}
private static class LVPosition {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
InstructionHandle start = null;
InstructionHandle end = null;
}
/**
* fill the newly created method gen with our body, inspired by InstructionList.copy()
*/
public void packBody(MethodGen gen) {
InstructionList fresh = gen.getInstructionList();
Map<InstructionHandle, InstructionHandle> map = copyAllInstructionsExceptRangeInstructionsInto(fresh);
/*
* Update branch targets and insert various attributes. Insert our exceptionHandlers into a sorted list, so they can be
* added in order later.
*/
InstructionHandle oldInstructionHandle = getBody().getStart();
InstructionHandle newInstructionHandle = fresh.getStart();
LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>();
Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>();
int currLine = -1;
int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename);
while (oldInstructionHandle != null) {
if (map.get(oldInstructionHandle) == null) {
handleRangeInstruction(oldInstructionHandle, exceptionList);
oldInstructionHandle = oldInstructionHandle.getNext();
} else {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
Instruction oldInstruction = oldInstructionHandle.getInstruction();
Instruction newInstruction = newInstructionHandle.getInstruction();
if (oldInstruction instanceof InstructionBranch) {
handleBranchInstruction(map, oldInstruction, newInstruction);
}
for (InstructionTargeter targeter : oldInstructionHandle.getTargeters()) {
if (targeter instanceof LineNumberTag) {
int line = ((LineNumberTag) targeter).getLineNumber();
if (line != currLine) {
gen.addLineNumber(newInstructionHandle, line + lineNumberOffset);
currLine = line;
}
} else if (targeter instanceof LocalVariableTag) {
LocalVariableTag lvt = (LocalVariableTag) targeter;
LVPosition p = localVariables.get(lvt);
if (p == null) {
LVPosition newp = new LVPosition();
newp.start = newp.end = newInstructionHandle;
localVariables.put(lvt, newp);
} else {
p.end = newInstructionHandle;
}
}
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
oldInstructionHandle = oldInstructionHandle.getNext();
newInstructionHandle = newInstructionHandle.getNext();
}
}
addExceptionHandlers(gen, map, exceptionList);
if (localVariables.size() == 0) {
createNewLocalVariables(gen);
} else {
addLocalVariables(gen, localVariables);
}
if (gen.getLineNumbers().length == 0) {
gen.addLineNumber(gen.getInstructionList().getStart(), 1);
}
}
private void createNewLocalVariables(MethodGen gen) {
gen.removeLocalVariables();
if (!getName().startsWith("<")) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
int slot = 0;
InstructionHandle start = gen.getInstructionList().getStart();
InstructionHandle end = gen.getInstructionList().getEnd();
if (!isStatic()) {
String cname = this.enclosingClass.getClassName();
if (cname == null) {
return;
}
Type enclosingType = BcelWorld.makeBcelType(UnresolvedType.forName(cname));
gen.addLocalVariable("this", enclosingType, slot++, start, end);
}
String[] paramNames = (memberView == null ? null : memberView.getParameterNames());
if (paramNames != null) {
for (int i = 0; i < argumentTypes.length; i++) {
String pname = paramNames[i];
if (pname == null) {
pname = "arg" + i;
}
gen.addLocalVariable(pname, argumentTypes[i], slot, start, end);
slot += argumentTypes[i].getSize();
}
}
}
}
/*
* Optimized packing that does a 'local packing' of the code rather than building a brand new method and packing into it. Only
* usable when the packing is going to be done just once.
*/
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
public void optimizedPackBody(MethodGen gen) {
InstructionList theBody = getBody();
InstructionHandle iHandle = theBody.getStart();
int currLine = -1;
int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename);
Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>();
LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>();
Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>();
Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>();
while (iHandle != null) {
Instruction inst = iHandle.getInstruction();
if (inst == Range.RANGEINSTRUCTION) {
Range r = Range.getRange(iHandle);
if (r instanceof ExceptionRange) {
ExceptionRange er = (ExceptionRange) r;
if (er.getStart() == iHandle) {
if (!er.isEmpty()) {
insertHandler(er, exceptionList);
}
}
}
forDeletion.add(iHandle);
} else {
if (inst instanceof InstructionBranch) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
branchInstructions.add((BranchHandle) iHandle);
}
for (InstructionTargeter targeter : iHandle.getTargetersCopy()) {
if (targeter instanceof LineNumberTag) {
int line = ((LineNumberTag) targeter).getLineNumber();
if (line != currLine) {
gen.addLineNumber(iHandle, line + lineNumberOffset);
currLine = line;
}
} else if (targeter instanceof LocalVariableTag) {
LocalVariableTag lvt = (LocalVariableTag) targeter;
LVPosition p = localVariables.get(lvt);
if (p == null) {
LVPosition newp = new LVPosition();
newp.start = newp.end = iHandle;
localVariables.put(lvt, newp);
} else {
p.end = iHandle;
}
}
}
}
iHandle = iHandle.getNext();
}
for (BranchHandle branchHandle : branchInstructions) {
handleBranchInstruction(branchHandle, forDeletion);
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
for (ExceptionRange r : exceptionList) {
if (r.isEmpty()) {
continue;
}
gen.addExceptionHandler(jumpForward(r.getRealStart(), forDeletion), jumpForward(r.getRealEnd(), forDeletion),
jumpForward(r.getHandler(), forDeletion),
(r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType()));
}
for (InstructionHandle handle : forDeletion) {
try {
theBody.delete(handle);
} catch (TargetLostException e) {
e.printStackTrace();
}
}
gen.setInstructionList(theBody);
if (localVariables.size() == 0) {
createNewLocalVariables(gen);
} else {
addLocalVariables(gen, localVariables);
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
if (gen.getLineNumbers().length == 0) {
gen.addLineNumber(gen.getInstructionList().getStart(), 1);
}
wasPackedOptimally = true;
}
private void addLocalVariables(MethodGen gen, Map<LocalVariableTag, LVPosition> localVariables) {
gen.removeLocalVariables();
InstructionHandle methodStart = gen.getInstructionList().getStart();
InstructionHandle methodEnd = gen.getInstructionList().getEnd();
int paramSlots = gen.isStatic() ? 0 : 1;
Type[] argTypes = gen.getArgumentTypes();
if (argTypes != null) {
for (int i = 0; i < argTypes.length; i++) {
if (argTypes[i].getSize() == 2) {
paramSlots += 2;
} else {
paramSlots += 1;
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
}
Map<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<InstructionHandle, Set<Integer>>();
for (LocalVariableTag tag : localVariables.keySet()) {
LVPosition lvpos = localVariables.get(tag);
InstructionHandle start = (tag.getSlot() < paramSlots ? methodStart : lvpos.start);
InstructionHandle end = (tag.getSlot() < paramSlots ? methodEnd : lvpos.end);
Set<Integer> slots = duplicatedLocalMap.get(start);
if (slots == null) {
slots = new HashSet<Integer>();
duplicatedLocalMap.put(start, slots);
} else if (slots.contains(new Integer(tag.getSlot()))) {
continue;
}
slots.add(Integer.valueOf(tag.getSlot()));
Type t = tag.getRealType();
if (t == null) {
t = BcelWorld.makeBcelType(UnresolvedType.forSignature(tag.getType()));
}
gen.addLocalVariable(tag.getName(), t, tag.getSlot(), start, end);
}
}
private void addExceptionHandlers(MethodGen gen, Map<InstructionHandle, InstructionHandle> map,
LinkedList<ExceptionRange> exnList) {
for (ExceptionRange r : exnList) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
if (r.isEmpty()) {
continue;
}
InstructionHandle rMappedStart = remap(r.getRealStart(), map);
InstructionHandle rMappedEnd = remap(r.getRealEnd(), map);
InstructionHandle rMappedHandler = remap(r.getHandler(), map);
gen.addExceptionHandler(rMappedStart, rMappedEnd, rMappedHandler, (r.getCatchType() == null) ? null
: (ObjectType) BcelWorld.makeBcelType(r.getCatchType()));
}
}
private void handleBranchInstruction(Map<InstructionHandle, InstructionHandle> map, Instruction oldInstruction,
Instruction newInstruction) {
InstructionBranch oldBranchInstruction = (InstructionBranch) oldInstruction;
InstructionBranch newBranchInstruction = (InstructionBranch) newInstruction;
InstructionHandle oldTarget = oldBranchInstruction.getTarget();
newBranchInstruction.setTarget(remap(oldTarget, map));
if (oldBranchInstruction instanceof InstructionSelect) {
InstructionHandle[] oldTargets = ((InstructionSelect) oldBranchInstruction).getTargets();
InstructionHandle[] newTargets = ((InstructionSelect) newBranchInstruction).getTargets();
for (int k = oldTargets.length - 1; k >= 0; k--) {
newTargets[k] = remap(oldTargets[k], map);
newTargets[k].addTargeter(newBranchInstruction);
}
}
}
private InstructionHandle jumpForward(InstructionHandle t, Set<InstructionHandle> handlesForDeletion) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
InstructionHandle target = t;
if (handlesForDeletion.contains(target)) {
do {
target = target.getNext();
} while (handlesForDeletion.contains(target));
}
return target;
}
/**
* Process a branch instruction with respect to instructions that are about to be deleted. If the target for the branch is a
* candidate for deletion, move it to the next valid instruction after the deleted target.
*/
private void handleBranchInstruction(BranchHandle branchHandle, Set<InstructionHandle> handlesForDeletion) {
InstructionBranch branchInstruction = (InstructionBranch) branchHandle.getInstruction();
InstructionHandle target = branchInstruction.getTarget();
if (handlesForDeletion.contains(target)) {
do {
target = target.getNext();
} while (handlesForDeletion.contains(target));
branchInstruction.setTarget(target);
}
if (branchInstruction instanceof InstructionSelect) {
InstructionSelect iSelect = (InstructionSelect) branchInstruction;
InstructionHandle[] targets = iSelect.getTargets();
for (int k = targets.length - 1; k >= 0; k--) {
InstructionHandle oneTarget = targets[k];
if (handlesForDeletion.contains(oneTarget)) {
do {
oneTarget = oneTarget.getNext();
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
} while (handlesForDeletion.contains(oneTarget));
iSelect.setTarget(k, oneTarget);
oneTarget.addTargeter(branchInstruction);
}
}
}
}
private void handleRangeInstruction(InstructionHandle ih, LinkedList<ExceptionRange> exnList) {
Range r = Range.getRange(ih);
if (r instanceof ExceptionRange) {
ExceptionRange er = (ExceptionRange) r;
if (er.getStart() == ih) {
if (!er.isEmpty()) {
insertHandler(er, exnList);
}
}
} else {
}
}
/*
* Make copies of all instructions, append them to the new list and associate old instruction references with the new ones,
* i.e., a 1:1 mapping.
*/
private Map<InstructionHandle, InstructionHandle> copyAllInstructionsExceptRangeInstructionsInto(InstructionList intoList) {
Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>();
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) {
if (Range.isRangeHandle(ih)) {
continue;
}
Instruction inst = ih.getInstruction();
Instruction copy = Utility.copyInstruction(inst);
if (copy instanceof InstructionBranch) {
map.put(ih, intoList.append((InstructionBranch) copy));
} else {
map.put(ih, intoList.append(copy));
}
}
return map;
}
/**
* This procedure should not currently be used.
*/
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
private static InstructionHandle remap(InstructionHandle handle, Map<InstructionHandle, InstructionHandle> map) {
while (true) {
InstructionHandle ret = map.get(handle);
if (ret == null) {
handle = handle.getNext();
} else {
return ret;
}
}
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
static void insertHandler(ExceptionRange fresh, LinkedList<ExceptionRange> l) {
for (ListIterator<ExceptionRange> iter = l.listIterator(); iter.hasNext();) {
ExceptionRange r = iter.next();
if (fresh.getPriority() >= r.getPriority()) {
iter.previous();
iter.add(fresh);
return;
}
}
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
l.add(fresh);
}
public boolean isPrivate() {
return Modifier.isPrivate(getAccessFlags());
}
public boolean isProtected() {
return Modifier.isProtected(getAccessFlags());
}
public boolean isDefault() {
return !(isProtected() || isPrivate() || isPublic());
}
public boolean isPublic() {
return Modifier.isPublic(getAccessFlags());
}
/**
* A good body is a body with the following properties:
*
* <ul>
* <li>For each branch instruction S in body, target T of S is in body.
* <li>For each branch instruction S in body, target T of S has S as a targeter.
* <li>For each instruction T in body, for each branch instruction S that is a targeter of T, S is in body.
* <li>For each non-range-handle instruction T in body, for each instruction S that is a targeter of T, S is either a branch
* instruction, an exception range or a tag
* <li>For each range-handle instruction T in body, there is exactly one targeter S that is a range.
* <li>For each range-handle instruction T in body, the range R targeting T is in body.
* <li>For each instruction T in body, for each exception range R targeting T, R is in body.
* <li>For each exception range R in body, let T := R.handler. T is in body, and R is one of T's targeters
* <li>All ranges are properly nested: For all ranges Q and R, if Q.start preceeds R.start, then R.end preceeds Q.end.
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
* </ul>
*
* Where the shorthand "R is in body" means "R.start is in body, R.end is in body, and any InstructionHandle stored in a field
* of R (such as an exception handle) is in body".
*/
public void assertGoodBody() {
if (true) {
return;
}
assertGoodBody(getBody(), toString());
}
public static void assertGoodBody(InstructionList il, String from) {
if (true) {
return;
}
}
private static void assertTargetedBy(InstructionHandle target, InstructionTargeter targeter, String from) {
Iterator tIter = target.getTargeters().iterator();
while (tIter.hasNext()) {
if (((InstructionTargeter) tIter.next()) == targeter) {
return;
}
}
throw new RuntimeException("bad targeting relationship in " + from);
}
private static void assertTargets(InstructionTargeter targeter, InstructionHandle target, String from) {
if (targeter instanceof Range) {
Range r = (Range) targeter;
if (r.getStart() == target || r.getEnd() == target) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
return;
}
if (r instanceof ExceptionRange) {
if (((ExceptionRange) r).getHandler() == target) {
return;
}
}
} else if (targeter instanceof InstructionBranch) {
InstructionBranch bi = (InstructionBranch) targeter;
if (bi.getTarget() == target) {
return;
}
if (targeter instanceof InstructionSelect) {
InstructionSelect sel = (InstructionSelect) targeter;
InstructionHandle[] itargets = sel.getTargets();
for (int k = itargets.length - 1; k >= 0; k--) {
if (itargets[k] == target) {
return;
}
}
}
} else if (targeter instanceof Tag) {
return;
}
throw new BCException(targeter + " doesn't target " + target + " in " + from);
}
private static Range getRangeAndAssertExactlyOne(InstructionHandle ih, String from) {
Range ret = null;
Iterator<InstructionTargeter> tIter = ih.getTargeters().iterator();
if (!tIter.hasNext()) {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
throw new BCException("range handle with no range in " + from);
}
while (tIter.hasNext()) {
InstructionTargeter ts = tIter.next();
if (ts instanceof Range) {
if (ret != null) {
throw new BCException("range handle with multiple ranges in " + from);
}
ret = (Range) ts;
}
}
if (ret == null) {
throw new BCException("range handle with no range in " + from);
}
return ret;
}
boolean isAdviceMethod() {
if (memberView == null) {
return false;
}
return memberView.getAssociatedShadowMunger() != null;
}
boolean isAjSynthetic() {
if (memberView == null) {
return true;
}
return memberView.isAjSynthetic();
}
boolean isSynthetic() {
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
if (memberView == null) {
return false;
}
return memberView.isSynthetic();
}
public ISourceLocation getSourceLocation() {
if (memberView != null) {
return memberView.getSourceLocation();
}
return null;
}
public AjAttribute.EffectiveSignatureAttribute getEffectiveSignature() {
if (effectiveSignature != null) {
return effectiveSignature;
}
return memberView.getEffectiveSignature();
}
public void setEffectiveSignature(ResolvedMember member, Shadow.Kind kind, boolean shouldWeave) {
this.effectiveSignature = new AjAttribute.EffectiveSignatureAttribute(member, kind, shouldWeave);
}
public String getSignature() {
if (memberView != null) {
return memberView.getSignature();
}
return MemberImpl.typesToSignature(BcelWorld.fromBcel(getReturnType()), BcelWorld.fromBcel(getArgumentTypes()), false);
}
public String getParameterSignature() {
if (memberView != null) {
return memberView.getParameterSignature();
|
388,971 |
Bug 388971 Double Synthetic attributes on some around advice members
|
Some of the support members in aspects were getting Synthetic attributes added twice (once when compiled, once when used as an aspect library). Some JVMs appear to flag this as a verify error. The fix is simply to check before adding to make sure the attribute isn't added twice.
|
resolved fixed
|
c2ff74f
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-06T16:37:31Z | 2012-09-06T16:46:40Z |
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
|
}
return MemberImpl.typesToSignature(BcelWorld.fromBcel(getArgumentTypes()));
}
public BcelMethod getMemberView() {
return memberView;
}
public void forcePublic() {
markAsChanged();
modifiers = Utility.makePublic(modifiers);
}
public boolean getCanInline() {
return canInline;
}
public void setCanInline(boolean canInline) {
this.canInline = canInline;
}
public void addAttribute(Attribute attribute) {
attributes.add(attribute);
}
public String toTraceString() {
return toShortString();
}
public ConstantPool getConstantPool() {
return enclosingClass.getConstantPool();
}
public static boolean isConstructor(LazyMethodGen aMethod) {
return aMethod.getName().equals("<init>");
}
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.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.ajdt.internal.compiler.ast;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.NameReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.Constant;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.patterns.WildTypePattern;
public class AstUtil {
private AstUtil() {
}
public static void addMethodBinding(SourceTypeBinding sourceType, MethodBinding method) {
int len = sourceType.methods.length;
MethodBinding[] temp = new MethodBinding[len + 1];
System.arraycopy(sourceType.methods, 0, temp, 0, len);
temp[len] = method;
sourceType.methods = temp;
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
public static void addMethodDeclaration(TypeDeclaration typeDec, AbstractMethodDeclaration dec) {
AbstractMethodDeclaration[] methods = typeDec.methods;
int len = methods.length;
AbstractMethodDeclaration[] newMethods = new AbstractMethodDeclaration[len + 1];
System.arraycopy(methods, 0, newMethods, 0, len);
newMethods[len] = dec;
typeDec.methods = newMethods;
}
public static Argument makeFinalArgument(char[] name, TypeBinding typeBinding) {
long pos = 0;
LocalVariableBinding binding = new LocalVariableBinding(name, typeBinding, Modifier.FINAL, true);
Argument ret = new Argument(name, pos, makeTypeReference(typeBinding), Modifier.FINAL);
ret.binding = binding;
return ret;
}
public static TypeReference makeTypeReference(TypeBinding binding) {
QualifiedTypeReference ref = new QualifiedTypeReference(new char[][] { binding.sourceName() }, new long[] { 0 });
ref.resolvedType = binding;
ref.constant = Constant.NotAConstant;
return ref;
}
public static NameReference makeNameReference(TypeBinding binding) {
char[][] name = new char[][] { binding.sourceName() };
long[] dummyPositions = new long[name.length];
QualifiedNameReference ref = new QualifiedNameReference(name, dummyPositions, 0, 0);
ref.binding = binding;
ref.constant = Constant.NotAConstant;
return ref;
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
public static ReturnStatement makeReturnStatement(Expression expr) {
return new ReturnStatement(expr, 0, 0);
}
public static MethodDeclaration makeMethodDeclaration(MethodBinding binding) {
MethodDeclaration ret = new MethodDeclaration(null);
ret.binding = binding;
int nargs = binding.parameters.length;
ret.arguments = new Argument[nargs];
for (int i = 0; i < nargs; i++) {
ret.arguments[i] = makeFinalArgument(("arg" + i).toCharArray(), binding.parameters[i]);
}
return ret;
}
public static void setStatements(MethodDeclaration ret, List statements) {
ret.statements = (Statement[]) statements.toArray(new Statement[statements.size()]);
}
public static SingleNameReference makeLocalVariableReference(LocalVariableBinding binding) {
SingleNameReference ret = new SingleNameReference(binding.name, 0);
ret.binding = binding;
ret.constant = Constant.NotAConstant;
ret.bits &= ~ASTNode.RestrictiveFlagMASK;
ret.bits |= Binding.VARIABLE;
return ret;
}
public static SingleNameReference makeResolvedLocalVariableReference(LocalVariableBinding binding) {
SingleNameReference ret = new SingleNameReference(binding.name, 0);
ret.binding = binding;
ret.constant = Constant.NotAConstant;
ret.bits &= ~ASTNode.RestrictiveFlagMASK;
ret.bits |= Binding.LOCAL;
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
return ret;
}
public static int makePublic(int modifiers) {
return makePackageVisible(modifiers) | ClassFileConstants.AccPublic;
}
public static int makePackageVisible(int modifiers) {
modifiers &= ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected);
return modifiers;
}
public static CompilationUnitScope getCompilationUnitScope(Scope scope) {
if (scope instanceof CompilationUnitScope) {
return (CompilationUnitScope) scope;
}
return getCompilationUnitScope(scope.parent);
}
public static void generateParameterLoads(TypeBinding[] parameters, CodeStream codeStream) {
int paramIndex = 0;
int varIndex = 0;
while (paramIndex < parameters.length) {
TypeBinding param = parameters[paramIndex++];
codeStream.load(param, varIndex);
varIndex += slotsNeeded(param);
}
}
public static void generateParameterLoads(TypeBinding[] parameters, CodeStream codeStream, int offset) {
int paramIndex = 0;
int varIndex = offset;
while (paramIndex < parameters.length) {
TypeBinding param = parameters[paramIndex++];
codeStream.load(param, varIndex);
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
varIndex += slotsNeeded(param);
}
}
public static void generateReturn(TypeBinding returnType, CodeStream codeStream) {
if (returnType.id == TypeIds.T_void) {
codeStream.return_();
} else if (returnType.isBaseType()) {
switch (returnType.id) {
case TypeIds.T_boolean:
case TypeIds.T_int:
case TypeIds.T_byte:
case TypeIds.T_short:
case TypeIds.T_char:
codeStream.ireturn();
break;
case TypeIds.T_float:
codeStream.freturn();
break;
case TypeIds.T_long:
codeStream.lreturn();
break;
case TypeIds.T_double:
codeStream.dreturn();
break;
default:
throw new RuntimeException("huh");
}
} else {
codeStream.areturn();
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
}
public static char[] makeMangledName(ReferenceBinding type) {
return CharOperation.concatWith(type.compoundName, '_');
}
public static final char[] PREFIX = "ajc".toCharArray();
public static char[] makeAjcMangledName(char[] kind, ReferenceBinding type, char[] name) {
return CharOperation.concat(CharOperation.concat(PREFIX, new char[] { '$' }, kind), '$', makeMangledName(type), '$', name);
}
public static char[] makeAjcMangledName(char[] kind, char[] p, char[] name) {
return CharOperation.concat(CharOperation.concat(PREFIX, new char[] { '$' }, kind), '$', p, '$', name);
}
public static List getAjSyntheticAttribute() {
ArrayList ret = new ArrayList(1);
ret.add(new EclipseAttributeAdapter(new AjAttribute.AjSynthetic()));
return ret;
}
public static long makeLongPos(int start, int end) {
return (long) end | ((long) start << 32);
}
public static char[][] getCompoundName(String string) {
return WildTypePattern.splitNames(string, true);
}
public static TypeBinding[] insert(TypeBinding first, TypeBinding[] rest) {
if (rest == null) {
return new TypeBinding[] { first };
}
int len = rest.length;
TypeBinding[] ret = new TypeBinding[len + 1];
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
ret[0] = first;
System.arraycopy(rest, 0, ret, 1, len);
return ret;
}
public static Argument[] insert(Argument first, Argument[] rest) {
if (rest == null) {
return new Argument[] { first };
}
int len = rest.length;
Argument[] ret = new Argument[len + 1];
ret[0] = first;
System.arraycopy(rest, 0, ret, 1, len);
return ret;
}
public static Expression[] insert(Expression first, Expression[] rest) {
if (rest == null) {
return new Expression[] { first };
}
int len = rest.length;
Expression[] ret = new Expression[len + 1];
ret[0] = first;
System.arraycopy(rest, 0, ret, 1, len);
return ret;
}
public static Argument[] copyArguments(Argument[] inArgs) {
if (inArgs == null)
return new Argument[] {};
Argument[] outArgs = new Argument[inArgs.length];
for (int i = 0; i < inArgs.length; i++) {
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
|
Argument argument = inArgs[i];
outArgs[i] = new Argument(argument.name, 0, argument.type, argument.modifiers);
}
return outArgs;
}
public static Statement[] remove(int i, Statement[] statements) {
int len = statements.length;
Statement[] ret = new Statement[len - 1];
System.arraycopy(statements, 0, ret, 0, i);
System.arraycopy(statements, i + 1, ret, i, len - i - 1);
return ret;
}
public static int slotsNeeded(TypeBinding type) {
if (type == TypeBinding.DOUBLE || type == TypeBinding.LONG)
return 2;
else
return 1;
}
public static void replaceMethodBinding(MessageSend send, MethodBinding newBinding) {
send.binding = newBinding;
send.setActualReceiverType(newBinding.declaringClass);
}
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.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.ajdt.internal.compiler.ast;
import java.lang.reflect.Modifier;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseTypeMunger;
import org.aspectj.ajdt.internal.compiler.problem.AjProblemReporter;
import org.aspectj.org.eclipse.jdt.internal.compiler.ClassFile;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes;
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowInfo;
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser;
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.Constants;
import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.NewMethodTypeMunger;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedMemberImpl;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.UnresolvedType;
/**
* An inter-type method declaration.
*
* @author Jim Hugunin
*/
public class InterTypeMethodDeclaration extends InterTypeDeclaration {
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
public InterTypeMethodDeclaration(CompilationResult result, TypeReference onType) {
super(result, onType);
}
public void parseStatements(Parser parser, CompilationUnitDeclaration unit) {
if (ignoreFurtherInvestigation)
return;
if (!Modifier.isAbstract(declaredModifiers)) {
parser.parse(this, unit);
}
}
protected char[] getPrefix() {
return (NameMangler.ITD_PREFIX + "interMethod$").toCharArray();
}
public boolean isFinal() {
return (declaredModifiers & ClassFileConstants.AccFinal) != 0;
}
public void analyseCode(ClassScope currentScope, InitializationFlowContext flowContext, FlowInfo flowInfo) {
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
if (Modifier.isAbstract(declaredModifiers))
return;
super.analyseCode(currentScope, flowContext, flowInfo);
}
public void resolve(ClassScope upperScope) {
if (munger == null)
ignoreFurtherInvestigation = true;
if (binding == null)
ignoreFurtherInvestigation = true;
if (ignoreFurtherInvestigation)
return;
if (!Modifier.isStatic(declaredModifiers)) {
this.arguments = AstUtil.insert(AstUtil.makeFinalArgument("ajc$this_".toCharArray(), onTypeBinding), this.arguments);
binding.parameters = AstUtil.insert(onTypeBinding, binding.parameters);
}
super.resolve(upperScope);
}
public void resolveStatements() {
checkAndSetModifiersForMethod();
if ((modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0) {
if ((declaredModifiers & ClassFileConstants.AccAbstract) == 0)
scope.problemReporter().methodNeedBody(this);
} else {
if (((declaredModifiers & ClassFileConstants.AccAbstract) != 0))
scope.problemReporter().methodNeedingNoBody(this);
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
if (munger.getSignature().getReturnType().isRawType()) {
if (!binding.returnType.isRawType()) {
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(scope);
binding.returnType = world.makeTypeBinding(munger.getSignature().getReturnType());
}
}
checkOverride: {
if (this.binding == null)
break checkOverride;
if (this.scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5)
break checkOverride;
boolean hasOverrideAnnotation = (this.binding.tagBits & TagBits.AnnotationOverride) != 0;
if (hasOverrideAnnotation) {
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(scope);
MethodBinding realthing = world.makeMethodBinding(munger.getSignature(), munger.getTypeVariableAliases());
boolean reportError = true;
ReferenceBinding supertype = onTypeBinding.superclass();
while (supertype != null && reportError) {
MethodBinding[] possibles = supertype.getMethods(declaredSelector);
for (int i = 0; i < possibles.length; i++) {
MethodBinding mb = possibles[i];
boolean couldBeMatch = true;
if (mb.parameters.length != realthing.parameters.length)
couldBeMatch = false;
else {
for (int j = 0; j < mb.parameters.length && couldBeMatch; j++) {
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
if (!mb.parameters[j].equals(realthing.parameters[j]))
couldBeMatch = false;
}
}
if (couldBeMatch && !returnType.resolvedType.isCompatibleWith(mb.returnType))
couldBeMatch = false;
if (couldBeMatch)
reportError = false;
}
supertype = supertype.superclass();
}
if (reportError)
((AjProblemReporter) this.scope.problemReporter()).itdMethodMustOverride(this, realthing);
}
}
if (!Modifier.isAbstract(declaredModifiers))
super.resolveStatements();
if (Modifier.isStatic(declaredModifiers)) {
if (onTypeBinding.isInterface()) {
scope.problemReporter().signalError(sourceStart, sourceEnd, "methods in interfaces cannot be declared static");
}
}
}
public EclipseTypeMunger build(ClassScope classScope) {
EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(classScope);
resolveOnType(classScope);
if (ignoreFurtherInvestigation)
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
return null;
binding = classScope.referenceContext.binding.resolveTypesFor(binding);
if (binding == null) {
this.ignoreFurtherInvestigation = true;
throw new AbortCompilationUnit(compilationResult, null);
}
if (isTargetAnnotation(classScope, "method"))
return null;
if (isTargetEnum(classScope, "method"))
return null;
if (interTypeScope == null)
return null;
ResolvedMemberImpl sig = factory.makeResolvedMemberForITD(binding, onTypeBinding, interTypeScope.getRecoveryAliases());
sig.resetName(new String(declaredSelector));
int resetModifiers = declaredModifiers;
if (binding.isVarargs())
resetModifiers = resetModifiers | Constants.ACC_VARARGS;
sig.resetModifiers(resetModifiers);
NewMethodTypeMunger myMunger = new NewMethodTypeMunger(sig, null, typeVariableAliases);
setMunger(myMunger);
ResolvedType aspectType = factory.fromEclipse(classScope.referenceContext.binding);
ResolvedMember me = myMunger.getInterMethodBody(aspectType);
this.selector = binding.selector = me.getName().toCharArray();
return new EclipseTypeMunger(factory, myMunger, aspectType, this);
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
}
private AjAttribute makeAttribute() {
return new AjAttribute.TypeMunger(munger);
}
public void generateCode(ClassScope classScope, ClassFile classFile) {
if (ignoreFurtherInvestigation) {
return;
}
classFile.extraAttributes.add(new EclipseAttributeAdapter(makeAttribute()));
if (!Modifier.isAbstract(declaredModifiers)) {
super.generateCode(classScope, classFile);
}
generateDispatchMethod(classScope, classFile);
}
public void generateDispatchMethod(ClassScope classScope, ClassFile classFile) {
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);
UnresolvedType aspectType = world.fromBinding(classScope.referenceContext.binding);
ResolvedMember signature = munger.getSignature();
ResolvedMember dispatchMember = AjcMemberMaker.interMethodDispatcher(signature, aspectType);
MethodBinding dispatchBinding = world.makeMethodBinding(dispatchMember, munger.getTypeVariableAliases(), munger
.getSignature().getDeclaringType());
MethodBinding introducedMethod = world.makeMethodBinding(AjcMemberMaker.interMethod(signature, aspectType, onTypeBinding
.isInterface()), munger.getTypeVariableAliases());
classFile.generateMethodInfoHeader(dispatchBinding);
int methodAttributeOffset = classFile.contentsOffset;
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
int attributeNumber = classFile.generateMethodInfoAttributes(binding, makeEffectiveSignatureAttribute(signature,
Shadow.MethodCall, false));
int codeAttributeOffset = classFile.contentsOffset;
classFile.generateCodeAttributeHeader();
CodeStream codeStream = classFile.codeStream;
codeStream.reset(this, classFile);
codeStream.initializeMaxLocals(dispatchBinding);
Argument[] itdArgs = this.arguments;
if (itdArgs != null) {
for (int a = 0; a < itdArgs.length; a++) {
LocalVariableBinding lvb = itdArgs[a].binding;
LocalVariableBinding lvbCopy = new LocalVariableBinding(lvb.name, lvb.type, lvb.modifiers, true);
lvbCopy.declaration = new LocalDeclaration(itdArgs[a].name,0,0);
codeStream.record(lvbCopy);
lvbCopy.recordInitializationStartPC(0);
lvbCopy.resolvedPosition = lvb.resolvedPosition;
}
}
MethodBinding methodBinding = introducedMethod;
TypeBinding[] parameters = methodBinding.parameters;
int length = parameters.length;
int resolvedPosition;
if (methodBinding.isStatic())
resolvedPosition = 0;
else {
codeStream.aload_0();
resolvedPosition = 1;
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
for (int i = 0; i < length; i++) {
codeStream.load(parameters[i], resolvedPosition);
if ((parameters[i] == TypeBinding.DOUBLE) || (parameters[i] == TypeBinding.LONG))
resolvedPosition += 2;
else
resolvedPosition++;
}
if (methodBinding.isStatic())
codeStream.invoke(Opcodes.OPC_invokestatic,methodBinding,null);
else {
if (methodBinding.declaringClass.isInterface()) {
codeStream.invoke(Opcodes.OPC_invokeinterface, methodBinding, null);
} else {
codeStream.invoke(Opcodes.OPC_invokevirtual, methodBinding, null);
}
}
AstUtil.generateReturn(dispatchBinding.returnType, codeStream);
if (itdArgs != null && codeStream.locals != null) {
for (int a = 0; a < itdArgs.length; a++) {
if (codeStream.locals[a] != null) {
codeStream.locals[a].recordInitializationEndPC(codeStream.position);
}
}
}
classFile.completeCodeAttribute(codeAttributeOffset);
attributeNumber++;
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber);
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
protected Shadow.Kind getShadowKindForBody() {
return Shadow.MethodExecution;
}
private void checkAndSetModifiersForMethod() {
char[] realSelector = this.selector;
this.selector = declaredSelector;
final ReferenceBinding declaringClass = this.binding.declaringClass;
if ((declaredModifiers & ExtraCompilerModifiers.AccAlternateModifierProblem) != 0)
scope.problemReporter().duplicateModifierForMethod(onTypeBinding, this);
int realModifiers = declaredModifiers & ExtraCompilerModifiers.AccJustFlag;
int unexpectedModifiers = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected
| ClassFileConstants.AccAbstract | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal
| ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp);
if ((realModifiers & unexpectedModifiers) != 0) {
scope.problemReporter().illegalModifierForMethod(this);
declaredModifiers &= ~ExtraCompilerModifiers.AccJustFlag | ~unexpectedModifiers;
}
int accessorBits = realModifiers
& (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate);
if ((accessorBits & (accessorBits - 1)) != 0) {
scope.problemReporter().illegalVisibilityModifierCombinationForMethod(onTypeBinding, this);
if ((accessorBits & ClassFileConstants.AccPublic) != 0) {
if ((accessorBits & ClassFileConstants.AccProtected) != 0)
declaredModifiers &= ~ClassFileConstants.AccProtected;
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
|
if ((accessorBits & ClassFileConstants.AccPrivate) != 0)
declaredModifiers &= ~ClassFileConstants.AccPrivate;
} else if ((accessorBits & ClassFileConstants.AccProtected) != 0 && (accessorBits & ClassFileConstants.AccPrivate) != 0) {
declaredModifiers &= ~ClassFileConstants.AccPrivate;
}
}
if ((declaredModifiers & ClassFileConstants.AccAbstract) != 0) {
int incompatibleWithAbstract = ClassFileConstants.AccStatic | ClassFileConstants.AccFinal
| ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp;
if ((declaredModifiers & incompatibleWithAbstract) != 0)
scope.problemReporter().illegalAbstractModifierCombinationForMethod(onTypeBinding, this);
if (!onTypeBinding.isAbstract())
scope.problemReporter().abstractMethodInAbstractClass((SourceTypeBinding) onTypeBinding, this);
}
/*
* DISABLED for backward compatibility with javac (if enabled should also mark private methods as final) // methods from a
* final class are final : 8.4.3.3 if (methodBinding.declaringClass.isFinal()) modifiers |= AccFinal;
*/
if ((declaredModifiers & ClassFileConstants.AccNative) != 0 && (declaredModifiers & ClassFileConstants.AccStrictfp) != 0)
scope.problemReporter().nativeMethodsCannotBeStrictfp(onTypeBinding, this);
if (((realModifiers & ClassFileConstants.AccStatic) != 0) && declaringClass.isNestedType() && !declaringClass.isStatic())
scope.problemReporter().unexpectedStaticModifierForMethod(onTypeBinding, this);
this.selector = realSelector;
}
}
|
389,750 |
Bug 389750 Inconsistent classfile encountered: The undefined type parameter xxx is referenced from within yyy
|
With the declare parents pattern below, I'm getting this **runtime** error (compiler completes ok): Inconsistent classfile encountered: The undefined type parameter ID is referenced from within PersistableAspect If I remove the generics part of the interface declaration, the error goes away. Here's the pattern: interface: ========== package example.trait; // imports... public interface Persistable<ID extends Serializable> { Object getOid(); ID getId(); String getIdString(); long getVersion(); } annotation: =========== package example.anno; // imports... @Target(TYPE) @Retention(RUNTIME) @Trait public @interface Persistable { String in() default "MONGO"; StoreType inAsEnum() default StoreType.MONGO; String id() default "STRING"; IdType idAsEnum() default IdType.STRING; } aspect: ======= package example.aspect; // imports... public privileged aspect PersistableAspect { public interface I<ID extends Serializable> extends example.trait.Persistable<ID> { } public interface L extends I<Long> { } public interface S extends I<String> { } declare parents : (@Persistable(id="LONG") *) implements L; declare parents : (@Persistable(id="STRING") *) implements S; // remaining code is ITDs introducing vars & methods... }
|
resolved fixed
|
b9c7a19
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T17:19:17Z | 2012-09-17T19:26:40Z |
tests/src/org/aspectj/systemtest/AllTests17.java
|
/*
* Created on 19-01-2005
*/
package org.aspectj.systemtest;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.aspectj.systemtest.ajc170.AllTestsAspectJ170;
import org.aspectj.systemtest.ajc171.AllTestsAspectJ171;
public class AllTests17 {
public static Test suite() {
TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.7");
suite.addTest(AllTestsAspectJ171.suite());
suite.addTest(AllTestsAspectJ170.suite());
suite.addTest(AllTests16.suite());
suite.addTest(AllTests15.suite());
return suite;
}
}
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/EnumAnnotationValue.java
|
/* *******************************************************************
* Copyright (c) 2006 Contributors
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement IBM initial implementation
* ******************************************************************/
package org.aspectj.weaver;
public class EnumAnnotationValue extends AnnotationValue {
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/EnumAnnotationValue.java
|
private String typeSignature;
private String value;
public EnumAnnotationValue(String typeSignature, String value) {
super(AnnotationValue.ENUM_CONSTANT);
this.typeSignature = typeSignature;
this.value = value;
}
public String getType() {
return typeSignature;
}
public String stringify() {
return value;
}
public String toString() {
return "E(" + typeSignature + " " + value + ")";
}
}
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java
|
/* *******************************************************************
* Copyright (c) 2008 Contributors
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* ******************************************************************/
package org.aspectj.weaver;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/**
* This type represents the weavers abstraction of an annotation - it is not tied to any underlying BCI toolkit. The weaver actualy
* handles these through AnnotationX wrapper objects - until we start transforming the BCEL annotations into this form (expensive)
* or offer a clever visitor mechanism over the BCEL annotation stuff that builds these annotation types directly.
*
* @author AndyClement
*/
public class StandardAnnotation extends AbstractAnnotationAJ {
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java
|
private final boolean isRuntimeVisible;
private List<AnnotationNameValuePair> nvPairs = null;
public StandardAnnotation(ResolvedType type, boolean isRuntimeVisible) {
super(type);
this.isRuntimeVisible = isRuntimeVisible;
}
/**
* {@inheritDoc}
*/
public boolean isRuntimeVisible() {
return isRuntimeVisible;
}
/**
* {@inheritDoc}
*/
public String stringify() {
StringBuffer sb = new StringBuffer();
sb.append("@").append(type.getClassName());
if (hasNameValuePairs()) {
sb.append("(");
for (AnnotationNameValuePair nvPair : nvPairs) {
sb.append(nvPair.stringify());
}
sb.append(")");
}
return sb.toString();
}
public String toString() {
StringBuffer sb = new StringBuffer();
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java
|
sb.append("Anno[" + getTypeSignature() + " " + (isRuntimeVisible ? "rVis" : "rInvis"));
if (nvPairs != null) {
sb.append(" ");
for (Iterator<AnnotationNameValuePair> iter = nvPairs.iterator(); iter.hasNext();) {
AnnotationNameValuePair element = iter.next();
sb.append(element.toString());
if (iter.hasNext()) {
sb.append(",");
}
}
}
sb.append("]");
return sb.toString();
}
/**
* {@inheritDoc}
*/
public boolean hasNamedValue(String n) {
if (nvPairs == null) {
return false;
}
for (int i = 0; i < nvPairs.size(); i++) {
AnnotationNameValuePair pair = nvPairs.get(i);
if (pair.getName().equals(n)) {
return true;
}
}
return false;
}
/**
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java
|
* {@inheritDoc}
*/
public boolean hasNameValuePair(String n, String v) {
if (nvPairs == null) {
return false;
}
for (int i = 0; i < nvPairs.size(); i++) {
AnnotationNameValuePair pair = nvPairs.get(i);
if (pair.getName().equals(n)) {
if (pair.getValue().stringify().equals(v)) {
return true;
}
}
}
return false;
}
/**
* {@inheritDoc}
*/
public Set<String> getTargets() {
if (!type.equals(UnresolvedType.AT_TARGET)) {
return Collections.emptySet();
}
AnnotationNameValuePair nvp = nvPairs.get(0);
ArrayAnnotationValue aav = (ArrayAnnotationValue) nvp.getValue();
AnnotationValue[] avs = aav.getValues();
Set<String> targets = new HashSet<String>();
for (int i = 0; i < avs.length; i++) {
AnnotationValue value = avs[i];
targets.add(value.stringify());
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java
|
}
return targets;
}
public List<AnnotationNameValuePair> getNameValuePairs() {
return nvPairs;
}
public boolean hasNameValuePairs() {
return nvPairs != null && nvPairs.size() != 0;
}
public void addNameValuePair(AnnotationNameValuePair pair) {
if (nvPairs == null) {
nvPairs = new ArrayList<AnnotationNameValuePair>();
}
nvPairs.add(pair);
}
/**
* {@inheritDoc}
*/
public String getStringFormOfValue(String name) {
if (hasNameValuePairs()) {
for (AnnotationNameValuePair nvPair : nvPairs) {
if (nvPair.getName().equals(name)) {
return nvPair.getValue().stringify();
}
}
}
return null;
}
}
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation.
* 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
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
*
* ******************************************************************/
package org.aspectj.weaver.patterns;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
/**
* @author colyer
* @author Andy Clement
*/
public class WildAnnotationTypePattern extends AnnotationTypePattern {
private TypePattern typePattern;
private boolean resolved = false;
Map<String, String> annotationValues;
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
public WildAnnotationTypePattern(TypePattern typePattern) {
super();
this.typePattern = typePattern;
this.setLocation(typePattern.getSourceContext(), typePattern.start, typePattern.end);
}
public WildAnnotationTypePattern(TypePattern typePattern, Map<String, String> annotationValues) {
super();
this.typePattern = typePattern;
this.annotationValues = annotationValues;
this.setLocation(typePattern.getSourceContext(), typePattern.start, typePattern.end);
}
public TypePattern getTypePattern() {
return typePattern;
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.patterns.AnnotationTypePattern#matches(org.aspectj.weaver.AnnotatedElement)
*/
@Override
public FuzzyBoolean matches(AnnotatedElement annotated) {
return matches(annotated, null);
}
/**
* Resolve any annotation values specified, checking they are all well formed (valid names, valid values)
*
* @param annotationType the annotation type for which the values have been specified
* @param scope the scope within which to resolve type references (eg. Color.GREEN)
*/
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
protected void resolveAnnotationValues(ResolvedType annotationType, IScope scope) {
if (annotationValues == null) {
return;
}
Set<String> keys = annotationValues.keySet();
ResolvedMember[] ms = annotationType.getDeclaredMethods();
for (Iterator<String> kIter = keys.iterator(); kIter.hasNext();) {
String k = kIter.next();
String key = k;
if (k.endsWith("!")) {
key = key.substring(0, k.length() - 1);
}
String v = annotationValues.get(k);
boolean validKey = false;
for (int i = 0; i < ms.length; i++) {
ResolvedMember resolvedMember = ms[i];
if (resolvedMember.getName().equals(key) && resolvedMember.isAbstract()) {
validKey = true;
ResolvedType t = resolvedMember.getReturnType().resolve(scope.getWorld());
if (t.isEnum()) {
int pos = v.lastIndexOf(".");
if (pos == -1) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "enum"), getSourceLocation());
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
scope.getWorld().getMessageHandler().handleMessage(m);
} else {
String typename = v.substring(0, pos);
ResolvedType rt = scope.lookupType(typename, this).resolve(scope.getWorld());
v = rt.getSignature() + v.substring(pos + 1);
annotationValues.put(k, v);
}
} else if (t.isPrimitiveType()) {
if (t.getSignature() == "I") {
try {
int value = Integer.parseInt(v);
annotationValues.put(k, Integer.toString(value));
} catch (NumberFormatException nfe) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "int"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
} else if (t.getSignature() == "F") {
try {
float value = Float.parseFloat(v);
annotationValues.put(k, Float.toString(value));
} catch (NumberFormatException nfe) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "float"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
} else if (t.getSignature() == "Z") {
if (v.equalsIgnoreCase("true") || v.equalsIgnoreCase("false")) {
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
} else {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "boolean"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
} else if (t.getSignature() == "S") {
try {
short value = Short.parseShort(v);
annotationValues.put(k, Short.toString(value));
} catch (NumberFormatException nfe) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "short"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
} else if (t.getSignature() == "J") {
try {
long value = Long.parseLong(v);
annotationValues.put(k, Long.toString(value));
} catch (NumberFormatException nfe) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "long"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
} else if (t.getSignature() == "D") {
try {
double value = Double.parseDouble(v);
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
annotationValues.put(k, Double.toString(value));
} catch (NumberFormatException nfe) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "double"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
} else if (t.getSignature() == "B") {
try {
byte value = Byte.parseByte(v);
annotationValues.put(k, Byte.toString(value));
} catch (NumberFormatException nfe) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "byte"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
} else if (t.getSignature() == "C") {
if (v.length() != 3) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "char"),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
} else {
annotationValues.put(k, v.substring(1, 2));
}
} else {
throw new RuntimeException("Not implemented for " + t);
}
} else if (t.equals(ResolvedType.JL_STRING)) {
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
} else if (t.equals(ResolvedType.JL_CLASS)) {
String typename = v.substring(0, v.lastIndexOf('.'));
ResolvedType rt = scope.lookupType(typename, this).resolve(scope.getWorld());
if (rt.isMissing()) {
IMessage m = MessageUtil.error("Unable to resolve type '" + v + "' specified for value '" + k + "'",
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
annotationValues.put(k, rt.getSignature());
} else {
if (t.isAnnotation()) {
if (v.indexOf("(") != -1) {
throw new RuntimeException(
"Compiler limitation: annotation values can only currently be marker annotations (no values): "
+ v);
}
String typename = v.substring(1);
ResolvedType rt = scope.lookupType(typename, this).resolve(scope.getWorld());
if (rt.isMissing()) {
IMessage m = MessageUtil.error(
"Unable to resolve type '" + v + "' specified for value '" + k + "'", getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
}
annotationValues.put(k, rt.getSignature());
} else {
throw new RuntimeException("Compiler limitation: annotation value support not implemented for type "
+ t);
}
}
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
}
}
if (!validKey) {
IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.UNKNOWN_ANNOTATION_VALUE, annotationType, k),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
} else {
break;
}
}
}
@Override
public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {
if (!resolved) {
throw new IllegalStateException("Can't match on an unresolved annotation type pattern");
}
if (annotationValues != null && !typePattern.hasFailedResolution()) {
throw new IllegalStateException("Cannot use annotationvalues with a wild annotation pattern");
}
if (isForParameterAnnotationMatch()) {
if (parameterAnnotations != null && parameterAnnotations.length != 0) {
for (int i = 0; i < parameterAnnotations.length; i++) {
if (typePattern.matches(parameterAnnotations[i], TypePattern.STATIC).alwaysTrue()) {
return FuzzyBoolean.YES;
}
}
}
} else {
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
ResolvedType[] annTypes = annotated.getAnnotationTypes();
if (annTypes != null && annTypes.length != 0) {
for (int i = 0; i < annTypes.length; i++) {
if (typePattern.matches(annTypes[i], TypePattern.STATIC).alwaysTrue()) {
return FuzzyBoolean.YES;
}
}
}
}
return FuzzyBoolean.NO;
}
/*
* (non-Javadoc)
*
* @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolve(org.aspectj.weaver.World)
*/
@Override
public void resolve(World world) {
if (!resolved) {
if (typePattern instanceof WildTypePattern && (annotationValues == null || annotationValues.isEmpty())) {
WildTypePattern wildTypePattern = (WildTypePattern) typePattern;
String fullyQualifiedName = wildTypePattern.maybeGetCleanName();
if (fullyQualifiedName != null && fullyQualifiedName.indexOf(".") != -1) {
ResolvedType resolvedType = world.resolve(UnresolvedType.forName(fullyQualifiedName));
if (resolvedType != null && !resolvedType.isMissing()) {
typePattern = new ExactTypePattern(resolvedType, false, false);
}
}
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
}
resolved = true;
}
}
/**
* This can modify in place, or return a new TypePattern if the type changes.
*/
@Override
public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) {
if (!scope.getWorld().isInJava5Mode()) {
scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ANNOTATIONS_NEED_JAVA5), getSourceLocation()));
return this;
}
if (resolved) {
return this;
}
this.typePattern = typePattern.resolveBindings(scope, bindings, false, false);
resolved = true;
if (typePattern instanceof ExactTypePattern) {
ExactTypePattern et = (ExactTypePattern) typePattern;
if (!et.getExactType().resolve(scope.getWorld()).isAnnotation()) {
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, et.getExactType().getName()),
getSourceLocation());
scope.getWorld().getMessageHandler().handleMessage(m);
resolved = false;
}
ResolvedType annotationType = et.getExactType().resolve(scope.getWorld());
resolveAnnotationValues(annotationType, scope);
ExactAnnotationTypePattern eatp = new ExactAnnotationTypePattern(annotationType, annotationValues);
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
eatp.copyLocationFrom(this);
if (isForParameterAnnotationMatch()) {
eatp.setForParameterAnnotationMatch();
}
return eatp;
} else {
return this;
}
}
@Override
public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
WildAnnotationTypePattern ret = new WildAnnotationTypePattern(typePattern.parameterizeWith(typeVariableMap, w));
ret.copyLocationFrom(this);
ret.resolved = resolved;
return ret;
}
private static final byte VERSION = 1;
@Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(AnnotationTypePattern.WILD);
s.writeByte(VERSION);
typePattern.write(s);
writeLocation(s);
s.writeBoolean(isForParameterAnnotationMatch());
if (annotationValues == null) {
s.writeInt(0);
} else {
s.writeInt(annotationValues.size());
Set<String> key = annotationValues.keySet();
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
for (Iterator<String> keys = key.iterator(); keys.hasNext();) {
String k = keys.next();
s.writeUTF(k);
s.writeUTF(annotationValues.get(k));
}
}
}
public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
WildAnnotationTypePattern ret;
byte version = s.readByte();
if (version > VERSION) {
throw new BCException("ExactAnnotationTypePattern was written by a newer version of AspectJ");
}
TypePattern t = TypePattern.read(s, context);
ret = new WildAnnotationTypePattern(t);
ret.readLocation(context, s);
if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160) {
if (s.readBoolean()) {
ret.setForParameterAnnotationMatch();
}
}
if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160M2) {
int annotationValueCount = s.readInt();
if (annotationValueCount > 0) {
Map<String, String> aValues = new HashMap<String, String>();
for (int i = 0; i < annotationValueCount; i++) {
String key = s.readUTF();
String val = s.readUTF();
aValues.put(key, val);
}
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
|
ret.annotationValues = aValues;
}
}
return ret;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof WildAnnotationTypePattern)) {
return false;
}
WildAnnotationTypePattern other = (WildAnnotationTypePattern) obj;
return other.typePattern.equals(typePattern)
&& this.isForParameterAnnotationMatch() == other.isForParameterAnnotationMatch()
&& (annotationValues == null ? other.annotationValues == null : annotationValues.equals(other.annotationValues));
}
@Override
public int hashCode() {
return (((17 + 37 * typePattern.hashCode()) * 37 + (isForParameterAnnotationMatch() ? 0 : 1)) * 37)
+ (annotationValues == null ? 0 : annotationValues.hashCode());
}
@Override
public String toString() {
return "@(" + typePattern.toString() + ")";
}
@Override
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
|
/*******************************************************************************
* Copyright (c) 2012 Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc172;
import java.io.File;
import junit.framework.Test;
import org.aspectj.testing.XMLBasedAjcTestCase;
/**
* @author Andy Clement
*/
public class Ajc172Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
|
389,752 |
Bug 389752 declare parents & @type not matching on annotation properties of enum types
|
NOTE: real project private git repo demonstrating bug has been shared with Andy Clement privately. I'm reporting bug as Andy requested with as much info as I feel I can. I have a case where 'declare parents' and 'declare @type' instructions are not being applied because their type patterns, which use annotations whose properties are of enumerated types, are not matching. Below find the relevant artifacts and their shapes. The lines in the aspect PersistableJpaAspect that are not matching as they should are the 'declare parents' and 'declare @type'. If I change the annotation properties to be of type String and change the type patterns to use string literals (see "matches" comments in annotation: StoreType.JPA => "JPA" and IdType.LONG => "LONG"), the matching works properly. enums: ====== public enum StoreType { MONGO, JDO, JPA; } ===== public enum IdType { LONG, STRING; } annotation: =========== public @interface Persistable { StoreType in() default StoreType.MONGO; // doesn't match // matches: String in() default "MONGO"; IdType id() default IdType.STRING; // doesn't match // matches: String id() default "STRING"; } aspect: ======= public abstract privileged aspect PersistableAspect { public interface I extends ....trait.interfaces.persistence.Persistable { long version(); void version(long version); } public interface L extends I { Long idLong(); void idLong(Long id); } public interface S extends I { String idString(); void idString(String id); } declare @type : I+ : @Configurable; // ... } ===== public privileged aspect PersistableJpaAspect extends PersistableAspect { public interface JL extends L { } public interface JS extends S { } declare parents : (@Persistable(id = IdType.LONG, in = StoreType.JPA) *) implements JL; declare parents : (@Persistable(id = IdType.STRING, in = StoreType.JPA) *) implements JS; declare @type : @Persistable(in="JPA") JL+ : @Entity; declare @type : @Persistable(in="JPA") JS+ : @Entity; // ... }
|
resolved fixed
|
0d69bd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-19T23:35:53Z | 2012-09-17T19:26:40Z |
tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
|
public void testInconsistentClassFile_pr389750() {
runTest("inconsistent class file");
}
public void testInconsistentClassFile_pr389750_2() {
runTest("inconsistent class file 2");
}
public void testInconsistentClassFile_pr389750_3() {
runTest("inconsistent class file 3");
}
public void testInconsistentClassFile_pr389750_4() {
runTest("inconsistent class file 4");
}
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc172Tests.class);
}
@Override
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc172/ajc172.xml");
}
}
|
389,456 |
Bug 389456 NPE in EclipseTypeMunger.mungeNewMethod()
| null |
resolved fixed
|
b8ebdc3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-20T20:38:35Z | 2012-09-12T22:46:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.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.ajdt.internal.compiler.lookup;
import java.lang.reflect.Modifier;
import java.util.Map;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
|
389,456 |
Bug 389456 NPE in EclipseTypeMunger.mungeNewMethod()
| null |
resolved fixed
|
b8ebdc3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-20T20:38:35Z | 2012-09-12T22:46:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
|
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding;
import org.aspectj.weaver.ConcreteTypeMunger;
import org.aspectj.weaver.NewConstructorTypeMunger;
import org.aspectj.weaver.NewFieldTypeMunger;
import org.aspectj.weaver.NewMemberClassTypeMunger;
import org.aspectj.weaver.NewMethodTypeMunger;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.ResolvedTypeMunger;
import org.aspectj.weaver.World;
public class EclipseTypeMunger extends ConcreteTypeMunger {
private ResolvedType targetTypeX;
public AbstractMethodDeclaration sourceMethod;
private EclipseFactory world;
private ISourceLocation sourceLocation;
public EclipseTypeMunger(EclipseFactory world, ResolvedTypeMunger munger, ResolvedType aspectType,
AbstractMethodDeclaration sourceMethod) {
super(munger, aspectType);
this.world = world;
this.sourceMethod = sourceMethod;
if (sourceMethod != null) {
this.sourceLocation = new EclipseSourceLocation(sourceMethod.compilationResult, sourceMethod.sourceStart,
sourceMethod.sourceEnd);
munger.setSourceLocation(sourceLocation);
|
389,456 |
Bug 389456 NPE in EclipseTypeMunger.mungeNewMethod()
| null |
resolved fixed
|
b8ebdc3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-20T20:38:35Z | 2012-09-12T22:46:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
|
}
targetTypeX = munger.getDeclaringType().resolve(world.getWorld());
if (targetTypeX.isParameterizedType() || targetTypeX.isRawType()) {
targetTypeX = targetTypeX.getGenericType();
}
}
public static boolean supportsKind(ResolvedTypeMunger.Kind kind) {
return kind == ResolvedTypeMunger.Field || kind == ResolvedTypeMunger.Method || kind == ResolvedTypeMunger.Constructor
|| kind == ResolvedTypeMunger.InnerClass;
}
public String toString() {
return "(EclipseTypeMunger " + getMunger() + ")";
}
/**
* Modifies signatures of a TypeBinding through its ClassScope, i.e. adds Method|FieldBindings, plays with inheritance, ...
*/
public boolean munge(SourceTypeBinding sourceType, ResolvedType onType) {
ResolvedType rt = onType;
if (rt.isRawType() || rt.isParameterizedType()) {
rt = rt.getGenericType();
}
boolean isExactTargetType = rt.equals(targetTypeX);
if (!isExactTargetType) {
|
389,456 |
Bug 389456 NPE in EclipseTypeMunger.mungeNewMethod()
| null |
resolved fixed
|
b8ebdc3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2012-09-20T20:38:35Z | 2012-09-12T22:46:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
|
if (munger.getKind() != ResolvedTypeMunger.Method) {
return false;
}
if (onType.isInterface()) {
return false;
}
if (!munger.needsAccessToTopmostImplementor()) {
return false;
}
if (!onType.isTopmostImplementor(targetTypeX)) {
return false;
}
if (!Modifier.isPublic(munger.getSignature().getModifiers())) {
return false;
}
}
if (munger.getKind() == ResolvedTypeMunger.Field) {
mungeNewField(sourceType, (NewFieldTypeMunger) munger);
} else if (munger.getKind() == ResolvedTypeMunger.Method) {
return mungeNewMethod(sourceType, onType, (NewMethodTypeMunger) munger, isExactTargetType);
} else if (munger.getKind() == ResolvedTypeMunger.Constructor) {
mungeNewConstructor(sourceType, (NewConstructorTypeMunger) munger);
} else if (munger.getKind() == ResolvedTypeMunger.InnerClass) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.