/* *******************************************************************
* Copyright (c) 2002-2010 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:
+ * 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, Andy Clement (SpringSource)
* ******************************************************************/
package org.aspectj.ajdt.internal.compiler.ast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Represents an aspect declaration.
- *
+ *
* @author PARC
* @author Andy Clement
*/
public ResolvedMember aspectOfMethod;
public ResolvedMember ptwGetWithinTypeNameMethod;
public ResolvedMember hasAspectMethod;
- public Map<ResolvedMember, Binding> accessForInline = new HashMap<ResolvedMember, Binding>();
+ public Map<ResolvedMember, Binding> accessForInline = new LinkedHashMap<ResolvedMember, Binding>();
public Map<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair> superAccessForInline = new HashMap<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair>();
public boolean isPrivileged;
public EclipseSourceType concreteName;
}
if ((binding.tagBits & TagBits.AnnotationResolved) != 0) {
// possibly resolution occurred during hasUnsatisfiedDependency()...
- binding.tagBits = (binding.tagBits & ~TagBits.AnnotationResolved);
+ binding.tagBits = (binding.tagBits & ~TagBits.AnnotationResolved);
}
Annotation atAspectAnnotation = AtAspectJAnnotationFactory.createAspectAnnotation(perClause.toDeclarationString(),
declarationSourceStart);
/* *******************************************************************
* 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
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * PARC initial implementation
* ******************************************************************/
package org.aspectj.weaver;
/**
* The five kinds of advice in AspectJ.
- *
+ *
* @author Erik Hilsdale
* @author Jim Hugunin
*/
return this == PerThisEntry || this == PerTargetEntry;
}
+ @Override
+ public int hashCode() {
+ return ((super.hashCode()*37 + precedence)*37+(isAfter?0:1))*37 + (isCflow?0:1);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof AdviceKind)) {
+ return false;
+ }
+ AdviceKind ak = (AdviceKind)o;
+ return super.equals(ak) &&
+ ak.precedence == precedence &&
+ ak.isAfter == isAfter &&
+ ak.isCflow == isCflow;
+ }
}
/* *******************************************************************
* 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
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * PARC initial implementation
* ******************************************************************/
package org.aspectj.weaver;
protected final Shadow enclosingShadow;
protected List<ShadowMunger> mungers = Collections.emptyList();
protected boolean needAroundClosureStacking = false;
-
+
public int shadowId = nextShadowID++; // every time we build a shadow, it gets a new id
// ----
/**
* the type of the this object here
- *
+ *
* @throws IllegalStateException if there is no this here
*/
public final UnresolvedType getThisType() {
/**
* a var referencing this
- *
+ *
* @throws IllegalStateException if there is no target here
*/
public abstract Var getThisVar();
/**
* the type of the target object here
- *
+ *
* @throws IllegalStateException if there is no target here
*/
public final UnresolvedType getTargetType() {
/**
* a var referencing the target
- *
+ *
* @throws IllegalStateException if there is no target here
*/
public abstract Var getTargetVar();
/**
* returns the resolved signature of the thing under this shadow
- *
+ *
*/
public ResolvedMember getResolvedSignature() {
if (resolvedSignature == null) {
/**
* These shadow kinds have return values that can be bound in after returning(Dooberry doo) advice.
- *
+ *
* @return
*/
public boolean hasReturnValue() {
/**
* Only does the check if the munger requires it (@AJ aspects don't)
- *
+ *
* @param munger
* @return
*/
/** Actually implement the (non-empty) mungers associated with this shadow */
private void implementMungers() {
- World world = getIWorld();
+ World world = getIWorld();
needAroundClosureStacking = false;
int annotationStyleWithAroundAndProceedCount = 0;
for (ShadowMunger munger: mungers) {
- if (munger.getDeclaringType()!= null &&
+ if (munger.getDeclaringType()!= null &&
munger.getDeclaringType().isAnnotationStyleAspect() &&
munger.isAroundAdvice() &&
munger.bindsProceedingJoinPoint()) {
/* *******************************************************************
* 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:
- * Xerox/PARC initial implementation
+ * 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:
+ * Xerox/PARC initial implementation
* ******************************************************************/
package org.aspectj.util;
-import java.io.*;
+import java.io.DataOutputStream;
+import java.io.IOException;
public class TypeSafeEnum {
private byte key;
public void write(DataOutputStream s) throws IOException {
s.writeByte(key);
}
+ @Override
+ public int hashCode() {
+ return name.hashCode()*37+key;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return (o instanceof TypeSafeEnum) &&
+ ((TypeSafeEnum)o).key == key &&
+ ((TypeSafeEnum)o).name.equals(name);
+ }
}