aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2018-02-05 11:00:34 -0800
committerAndy Clement <aclement@pivotal.io>2018-02-05 11:00:34 -0800
commit68ed282a061b875e0a5be4e88d10f76d7d9a0bbf (patch)
treeff63e46e2fd86a4cb274214c9d0a3d2a83b90aed /org.aspectj.ajdt.core
parentd6378eeec8c1928462f8561d23fafda5012b790c (diff)
downloadaspectj-68ed282a061b875e0a5be4e88d10f76d7d9a0bbf.tar.gz
aspectj-68ed282a061b875e0a5be4e88d10f76d7d9a0bbf.zip
JDT Upgrade for 1.9.0.rc3
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java7
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java34
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java67
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java22
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java6
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java2
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java36
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBatchImageBuilder.java7
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java2
12 files changed, 132 insertions, 67 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties
index 2ee1fcb74..69edaa836 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties
@@ -4,8 +4,8 @@
The -Xlintfile:lint.properties allows fine-grained control. In tools.jar, see
org/aspectj/weaver/XlintDefault.properties for the default behavior and a template to copy.
### AspectJ-specific messages
-compiler.name = AspectJ Compiler 1.9.0.RC2
-compiler.version = Eclipse Compiler BETA_JAVA9_062ac5d7a6bf9(Sep2017), 3.13
+compiler.name = AspectJ Compiler 1.9.0.RC3
+compiler.version = Eclipse Compiler #1bfc7b4202e874c(Feb2018), 3.14
compiler.copyright =
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
index e17aa5d3d..89d2482c7 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
@@ -63,7 +63,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
* them. This is a list of strings representing the alternative names - the position in the list is used to
* match it to the real type variable in the target generic type.
*/
- protected List typeVariableAliases;
+ protected List<String> typeVariableAliases;
protected InterTypeScope interTypeScope;
@@ -140,6 +140,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
return false;
}
+ @Override
public void resolve(ClassScope upperScope) {
if (ignoreFurtherInvestigation) return;
@@ -264,7 +265,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
// check if they used stupid names for type variables
if (aliasCount>0) {
for (int i = 0; i < aliasCount; i++) {
- String array_element = (String)typeVariableAliases.get(i);
+ String array_element = typeVariableAliases.get(i);
SingleTypeReference str = new SingleTypeReference(array_element.toCharArray(),0);
TypeBinding tb = str.getTypeBindingPublic(classScope);
if (tb!=null && !(tb instanceof ProblemReferenceBinding)) {// && !(tb instanceof TypeVariableBinding)) {
@@ -314,6 +315,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
this.munger = munger;
}
+ @Override
protected int generateInfoAttributes(ClassFile classFile) {
List l;
Shadow.Kind kind = getShadowKindForBody();
@@ -378,6 +380,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
* by the ITD can be resolved. For example, if type variables are referred to in the ontype for the ITD,
* they have to be resolved against the ontype, not the aspect containing the ITD.
*/
+ @Override
public void ensureScopeSetup() {
if (scopeSetup) return; // don't do it again
MethodScope scope = this.scope;
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
index 935eb3cee..efd1a2ba2 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
@@ -27,17 +27,38 @@ import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration;
import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration;
import org.aspectj.asm.AsmManager;
import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.WeaveMessage;
import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.*;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
+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.env.AccessRestriction;
import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ITypeRequestor;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.*;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding;
+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.SourceTypeCollisionException;
+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.problem.ProblemReporter;
import org.aspectj.weaver.AnnotationAJ;
import org.aspectj.weaver.ConcreteTypeMunger;
@@ -113,6 +134,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
}
// ??? duplicates some of super's code
+ @Override
public void completeTypeBindings() {
AsmManager.setCompletingTypeBindings(true);
ContextToken completeTypeBindingsToken = CompilationAndWeavingContext.enteringPhase(
@@ -1389,7 +1411,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
ReferenceTypeDelegate rtd = rt.getDelegate();
if (rtd instanceof BcelObjectType) {
if (rt.isRawType()) {
- rt = (ReferenceType)rt.getGenericType();
+ rt = rt.getGenericType();
}
rt.addParent(parent);
// ((BcelObjectType) rtd).addParent(parent);
@@ -1412,6 +1434,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
boolean inBinaryTypeCreationAndWeaving = false;
boolean processingTheQueue = false;
+ @Override
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding,
boolean needFieldsAndMethods, AccessRestriction accessRestriction) {
@@ -1452,6 +1475,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
*
* @param aBinding
*/
+ @Override
public void anonymousTypeBindingCreated(LocalTypeBinding aBinding) {
factory.addSourceTypeBinding(aBinding, null);
}
@@ -1480,7 +1504,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
}
@Override
- public LookupEnvironment wrapInModuleEnvironment(ModuleBinding moduleBinding) {
+public LookupEnvironment wrapInModuleEnvironment(ModuleBinding moduleBinding) {
AjLookupEnvironment newAjLookupEnvironment = new AjLookupEnvironment(this, moduleBinding);
newAjLookupEnvironment.factory = this.factory;
return newAjLookupEnvironment;
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
index db77600b1..f52422ad5 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
@@ -17,7 +17,6 @@ package org.aspectj.ajdt.internal.compiler.lookup;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -96,8 +95,8 @@ public class EclipseFactory {
// We can get clashes if we don't treat raw types differently - we end up looking
// up a raw and getting the generic type (pr115788)
- private final Map/* UnresolvedType, TypeBinding */typexToBinding = new HashMap();
- private final Map/* UnresolvedType, TypeBinding */rawTypeXToBinding = new HashMap();
+ private final Map<UnresolvedType, TypeBinding> typexToBinding = new HashMap<>();
+ private final Map<UnresolvedType, TypeBinding> rawTypeXToBinding = new HashMap<>();
// XXX currently unused
// private Map/*TypeBinding, ResolvedType*/ bindingToResolvedTypeX = new HashMap();
@@ -143,7 +142,7 @@ public class EclipseFactory {
if (binding == null) {
return ResolvedType.MISSING;
}
- // ??? this seems terribly inefficient
+ // ??? this seems terribly inefficient
// System.err.println("resolving: " + binding.getClass() + ", name = " + getName(binding));
ResolvedType ret = getWorld().resolve(fromBinding(binding));
// System.err.println(" got: " + ret);
@@ -362,7 +361,7 @@ public class EclipseFactory {
/**
* Some type variables refer to themselves recursively, this enables us to avoid recursion problems.
*/
- private static Map typeVariableBindingsInProgress = new HashMap();
+ private static Map<TypeVariableBinding,UnresolvedType> typeVariableBindingsInProgress = new HashMap<>();
/**
* Convert from the eclipse form of type variable (TypeVariableBinding) to the AspectJ form (TypeVariable).
@@ -370,12 +369,12 @@ public class EclipseFactory {
private UnresolvedType fromTypeVariableBinding(TypeVariableBinding aTypeVariableBinding) {
// first, check for recursive call to this method for the same tvBinding
if (typeVariableBindingsInProgress.containsKey(aTypeVariableBinding)) {
- return (UnresolvedType) typeVariableBindingsInProgress.get(aTypeVariableBinding);
+ return typeVariableBindingsInProgress.get(aTypeVariableBinding);
}
// Check if its a type variable binding that we need to recover to an alias...
if (typeVariablesForAliasRecovery != null) {
- String aliasname = (String) typeVariablesForAliasRecovery.get(aTypeVariableBinding);
+ String aliasname = typeVariablesForAliasRecovery.get(aTypeVariableBinding);
if (aliasname != null) {
UnresolvedTypeVariableReferenceType ret = new UnresolvedTypeVariableReferenceType();
ret.setTypeVariable(new TypeVariable(aliasname));
@@ -384,7 +383,7 @@ public class EclipseFactory {
}
if (typeVariablesForThisMember.containsKey(new String(aTypeVariableBinding.sourceName))) {
- return (UnresolvedType) typeVariablesForThisMember.get(new String(aTypeVariableBinding.sourceName));
+ return typeVariablesForThisMember.get(new String(aTypeVariableBinding.sourceName));
}
// Create the UnresolvedTypeVariableReferenceType for the type variable
@@ -534,24 +533,21 @@ public class EclipseFactory {
* Before converting the parts of a methodbinding (params, return type) we store the type variables in this structure, then
* should any component of the method binding refer to them, we grab them from the map.
*/
- private final Map typeVariablesForThisMember = new HashMap();
+ private final Map<String,UnresolvedType> typeVariablesForThisMember = new HashMap<>();
/**
* This is a map from typevariablebindings (eclipsey things) to the names the user originally specified in their ITD. For
* example if the target is 'interface I<N extends Number> {}' and the ITD was 'public void I<X>.m(List<X> lxs) {}' then this
* map would contain a pointer from the eclipse type 'N extends Number' to the letter 'X'.
*/
- private Map typeVariablesForAliasRecovery;
+ private Map<TypeVariableBinding, String> typeVariablesForAliasRecovery;
/**
* Construct a resolvedmember from a methodbinding. The supplied map tells us about any typevariablebindings that replaced
* typevariables whilst the compiler was resolving types - this only happens if it is a generic itd that shares type variables
* with its target type.
*/
- public ResolvedMemberImpl makeResolvedMemberForITD(MethodBinding binding, TypeBinding declaringType, Map /*
- * TypeVariableBinding >
- * original alias name
- */recoveryAliases) {
+ public ResolvedMemberImpl makeResolvedMemberForITD(MethodBinding binding, TypeBinding declaringType, Map<TypeVariableBinding,String> recoveryAliases) {
ResolvedMemberImpl result = null;
try {
typeVariablesForAliasRecovery = recoveryAliases;
@@ -630,9 +626,9 @@ public class EclipseFactory {
// looking up type variables can get us into trouble
if (!typeX.isTypeVariableReference() && !isParameterizedWithTypeVariables(typeX)) {
if (typeX.isRawType()) {
- ret = (TypeBinding) rawTypeXToBinding.get(typeX);
+ ret = rawTypeXToBinding.get(typeX);
} else {
- ret = (TypeBinding) typexToBinding.get(typeX);
+ ret = typexToBinding.get(typeX);
}
}
@@ -818,7 +814,7 @@ public class EclipseFactory {
/**
* Convert a resolvedmember into an eclipse field binding
*/
- public FieldBinding makeFieldBinding(ResolvedMember member, List aliases) {
+ public FieldBinding makeFieldBinding(ResolvedMember member, List<String> aliases) {
return internalMakeFieldBinding(member, aliases);
}
@@ -849,7 +845,7 @@ public class EclipseFactory {
* to being a generic itd. Any aliases are put into the typeVariableToBinding map so that they will be substituted as
* appropriate in the returned fieldbinding.
*/
- public FieldBinding internalMakeFieldBinding(ResolvedMember member, List aliases) {
+ public FieldBinding internalMakeFieldBinding(ResolvedMember member, List<String> aliases) {
typeVariableToTypeBinding.clear();
ReferenceBinding declaringType = (ReferenceBinding) makeTypeBinding(member.getDeclaringType());
@@ -858,8 +854,9 @@ public class EclipseFactory {
if (aliases != null && aliases.size() > 0 && declaringType.typeVariables() != null
&& declaringType.typeVariables().length != 0) {
int i = 0;
- for (Iterator iter = aliases.iterator(); iter.hasNext();) {
- String element = (String) iter.next();
+ for (String element: aliases) {
+// for (Iterator iter = aliases.iterator(); iter.hasNext();) {
+// String element = (String) iter.next();
typeVariableToTypeBinding.put(element, declaringType.typeVariables()[i++]);
}
}
@@ -894,7 +891,7 @@ public class EclipseFactory {
/**
* Convert a resolvedmember into an eclipse method binding.
*/
- public MethodBinding makeMethodBinding(ResolvedMember member, List aliases) {
+ public MethodBinding makeMethodBinding(ResolvedMember member, List<String> aliases) {
return internalMakeMethodBinding(member, aliases);
}
@@ -913,7 +910,7 @@ public class EclipseFactory {
return internalMakeMethodBinding(member, null); // there are no aliases
}
- public MethodBinding internalMakeMethodBinding(ResolvedMember member, List aliases) {
+ public MethodBinding internalMakeMethodBinding(ResolvedMember member, List<String> aliases) {
return internalMakeMethodBinding(member, aliases, member.getDeclaringType());
}
@@ -938,8 +935,21 @@ public class EclipseFactory {
ReferenceBinding declaringType = (ReferenceBinding) makeTypeBinding(member.getDeclaringType());
// If there are aliases, place them in the map
- if (aliases != null && aliases.size() != 0 && declaringType.typeVariables() != null
- && declaringType.typeVariables().length != 0) {
+ if (aliases != null && aliases.size() != 0
+
+ // Not sure what this check is trying to check for?
+ // In latest JDT (2-Feb-2018) there seem to be some code (in LookupEnvironment ~860 and
+ // TypeSystem ~340) related to avoiding raw'ifying the enclosing type if the type to
+ // be rawed is static. These changes cause these checks to fail and the sophisticated
+ // test variant V fails. It checks declaring type typevariables and then
+ // uses aliasTargetType ... I'm switching it to check aliasTargetType
+
+// && declaringType.typeVariables() != null
+// && declaringType.typeVariables().length != 0
+ && aliasTargetType != null
+ && aliasTargetType.getTypeVariables() != null
+ && aliasTargetType.getTypeVariables().length!=0
+ ) {
int i = 0;
ReferenceBinding aliasTarget = (ReferenceBinding) makeTypeBinding(aliasTargetType);
if (aliasTarget.isRawType()) {
@@ -952,7 +962,8 @@ public class EclipseFactory {
currentType = declaringType;
MethodBinding mb = new MethodBinding(member.getModifiers(), member.getName().toCharArray(),
- makeTypeBinding(member.getReturnType()), makeTypeBindings(member.getParameterTypes()),
+ makeTypeBinding(member.getReturnType()),
+ makeTypeBindings(member.getParameterTypes()),
makeReferenceBindings(member.getExceptions()), declaringType);
if (tvbs != null) {
@@ -992,7 +1003,7 @@ public class EclipseFactory {
// map back to the same type binding - this is important later when Eclipse code is processing
// a methodbinding trying to come up with possible bindings for the type variables.
// key is currently the name of the type variable...is that ok?
- private final Map typeVariableToTypeBinding = new HashMap();
+ private final Map<String,TypeVariableBinding> typeVariableToTypeBinding = new HashMap<>();
// /**
// * Converts from an TypeVariableReference to a TypeVariableBinding. A TypeVariableReference
@@ -1035,7 +1046,7 @@ public class EclipseFactory {
// }
private TypeVariableBinding makeTypeVariableBindingFromAJTypeVariable(TypeVariable tv) {
- TypeVariableBinding tvBinding = (TypeVariableBinding) typeVariableToTypeBinding.get(tv.getName());
+ TypeVariableBinding tvBinding = typeVariableToTypeBinding.get(tv.getName());
if (currentType != null) {
TypeVariableBinding tvb = currentType.getTypeVariable(tv.getName().toCharArray());
if (tvb != null) {
@@ -1142,7 +1153,7 @@ public class EclipseFactory {
ReferenceType complexName = null;
if (!resolvedGenericType.isMissing()) {
complexName = (ReferenceType) resolvedGenericType;
- complexName = (ReferenceType) complexName.getGenericType();
+ complexName = complexName.getGenericType();
if (complexName == null) {
complexName = new ReferenceType(unresolvedGenericType, world);
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java
index af1ad6705..96659fbe3 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseScope.java
@@ -61,6 +61,7 @@ public class EclipseScope implements IScope {
enclosingType = world.fromEclipse(scope.enclosingSourceType());
}
+ @Override
public UnresolvedType lookupType(String name, IHasPosition location) {
char[][] splitName = WildTypePattern.splitNames(name, true);
TypeBinding b = scope.getType(splitName, splitName.length);
@@ -156,8 +157,8 @@ public class EclipseScope implements IScope {
if (importedNames != null)
return;
- List importedNamesList = new ArrayList();
- List importedPrefixesList = new ArrayList();
+ List<String> importedNamesList = new ArrayList<>();
+ List<String> importedPrefixesList = new ArrayList<>();
Scope currentScope = scope;
// add any enclosing types to this list
@@ -197,12 +198,12 @@ public class EclipseScope implements IScope {
importedNamesList.add(world.fromBinding(topTypes[i]).getName());
}
- importedNames = (String[]) importedNamesList.toArray(new String[importedNamesList.size()]);
+ importedNames = importedNamesList.toArray(new String[importedNamesList.size()]);
- importedPrefixes = (String[]) importedPrefixesList.toArray(new String[importedPrefixesList.size()]);
+ importedPrefixes = importedPrefixesList.toArray(new String[importedPrefixesList.size()]);
}
- private void addClassAndParentsToPrefixes(ReferenceBinding binding, List importedPrefixesList) {
+ private void addClassAndParentsToPrefixes(ReferenceBinding binding, List<String> importedPrefixesList) {
if (binding == null)
return;
importedPrefixesList.add(world.fromBinding(binding).getName() + "$");
@@ -216,11 +217,13 @@ public class EclipseScope implements IScope {
}
}
+ @Override
public String[] getImportedNames() {
computeImports();
return importedNames;
}
+ @Override
public String[] getImportedPrefixes() {
computeImports();
// System.err.println("prefixes: " + Arrays.asList(importedPrefixes));
@@ -228,6 +231,7 @@ public class EclipseScope implements IScope {
}
// XXX add good errors when would bind to extra parameters
+ @Override
public FormalBinding lookupFormal(String name) {
for (int i = 0, len = bindings.length; i < len; i++) {
if (bindings[i].getName().equals(name))
@@ -236,10 +240,12 @@ public class EclipseScope implements IScope {
return null;
}
+ @Override
public FormalBinding getFormal(int i) {
return bindings[i];
}
+ @Override
public int getFormalCount() {
return bindings.length;
}
@@ -249,15 +255,18 @@ public class EclipseScope implements IScope {
location.getEnd());
}
+ @Override
public IMessageHandler getMessageHandler() {
return world.getWorld().getMessageHandler();
}
+ @Override
public void message(IMessage.Kind kind, IHasPosition location1, IHasPosition location2, String message) {
message(kind, location1, message);
message(kind, location2, message);
}
+ @Override
public void message(IMessage.Kind kind, IHasPosition location, String message) {
// System.out.println("message: " + message + " loc: " +
// makeSourceLocation(location));
@@ -265,14 +274,17 @@ public class EclipseScope implements IScope {
}
+ @Override
public void message(IMessage aMessage) {
getMessageHandler().handleMessage(aMessage);
}
+ @Override
public World getWorld() {
return world.getWorld();
}
+ @Override
public ResolvedType getEnclosingType() {
return enclosingType;
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
index f1dea7300..4fbdfa849 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java
@@ -35,6 +35,7 @@ import org.aspectj.weaver.NewMethodTypeMunger;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.ResolvedTypeMunger;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
public class EclipseTypeMunger extends ConcreteTypeMunger {
@@ -77,6 +78,7 @@ public class EclipseTypeMunger extends ConcreteTypeMunger {
|| kind == ResolvedTypeMunger.InnerClass;
}
+ @Override
public String toString() {
return "(EclipseTypeMunger " + getMunger() + ")";
}
@@ -275,6 +277,7 @@ public class EclipseTypeMunger extends ConcreteTypeMunger {
return finder;
}
+ @Override
public ISourceLocation getSourceLocation() {
return sourceLocation;
}
@@ -290,11 +293,12 @@ public class EclipseTypeMunger extends ConcreteTypeMunger {
return sourceMethod;
}
+ @Override
public ConcreteTypeMunger parameterizedFor(ResolvedType target) {
return new EclipseTypeMunger(world, munger.parameterizedFor(target), aspectType, sourceMethod);
}
- public ConcreteTypeMunger parameterizeWith(Map m, World w) {
+ public ConcreteTypeMunger parameterizeWith(Map<String,UnresolvedType> m, World w) {
return new EclipseTypeMunger(world, munger.parameterizeWith(m, w), aspectType, sourceMethod);
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java
index c71d8e821..b47978f62 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java
@@ -41,7 +41,7 @@ public class InterTypeFieldBinding extends FieldBinding {
// We called the super() with null, we must now do the last step that will have been skipped because of this, see the
// supers() final line:
// OPTIMIZE dont makeFieldBinding twice, HORRIBLE
- setAnnotations(world.makeFieldBinding(munger.getSignature(), munger.getTypeVariableAliases()).getAnnotations());
+ setAnnotations(world.makeFieldBinding(munger.getSignature(), munger.getTypeVariableAliases()).getAnnotations(), false);
reader = new SimpleSyntheticAccessMethodBinding(world.makeMethodBinding(AjcMemberMaker.interFieldGetDispatcher(munger
.getSignature(), withinType)));
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java
index 9784710f4..19bea5bfc 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java
@@ -17,7 +17,6 @@ import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -40,11 +39,12 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
* The member finder looks after intertype declared members on a type, there is one member finder per type that was hit by an ITD.
*/
public class InterTypeMemberFinder implements IMemberFinder {
- private List interTypeFields = new ArrayList();
- private List interTypeMethods = new ArrayList();
+ private List<FieldBinding> interTypeFields = new ArrayList<>();
+ private List<MethodBinding> interTypeMethods = new ArrayList<>();
public SourceTypeBinding sourceTypeBinding;
+ @Override
public FieldBinding getField(SourceTypeBinding sourceTypeBinding, char[] fieldName, InvocationSite site, Scope scope) {
FieldBinding retField = sourceTypeBinding.getFieldBase(fieldName, true); // XXX may need to get the correct value for second
// parameter in the future (see #55341)
@@ -54,7 +54,7 @@ public class InterTypeMemberFinder implements IMemberFinder {
int fieldLength = fieldName.length;
for (int i = 0, len = interTypeFields.size(); i < len; i++) {
- FieldBinding field = (FieldBinding) interTypeFields.get(i);
+ FieldBinding field = interTypeFields.get(i);
if (field.name.length == fieldLength && CharOperation.prefixEquals(field.name, fieldName)) {
retField = resolveConflicts(sourceTypeBinding, retField, field, site, scope);
}
@@ -250,13 +250,14 @@ public class InterTypeMemberFinder implements IMemberFinder {
// find all of my methods, including ITDs
// PLUS: any public ITDs made on interfaces that I implement
+ @Override
public MethodBinding[] methods(SourceTypeBinding sourceTypeBinding) {
MethodBinding[] orig = sourceTypeBinding.methodsBase();
// if (interTypeMethods.isEmpty()) return orig;
- List ret = new ArrayList(Arrays.asList(orig));
+ List<MethodBinding> ret = new ArrayList<>(Arrays.asList(orig));
for (int i = 0, len = interTypeMethods.size(); i < len; i++) {
- MethodBinding method = (MethodBinding) interTypeMethods.get(i);
+ MethodBinding method = interTypeMethods.get(i);
ret.add(method);
}
@@ -271,26 +272,26 @@ public class InterTypeMemberFinder implements IMemberFinder {
if (ret.isEmpty()) {
return Binding.NO_METHODS;
}
- return (MethodBinding[]) ret.toArray(new MethodBinding[ret.size()]);
+ return ret.toArray(new MethodBinding[ret.size()]);
}
- private void addPublicITDSFrom(SourceTypeBinding anInterface, List toAList) {
+ private void addPublicITDSFrom(SourceTypeBinding anInterface, List<MethodBinding> accumulator) {
if (anInterface.memberFinder != null) {
InterTypeMemberFinder finder = (InterTypeMemberFinder) anInterface.memberFinder;
- for (Iterator iter = finder.interTypeMethods.iterator(); iter.hasNext();) {
- MethodBinding aBinding = (MethodBinding) iter.next();
+ for (MethodBinding aBinding: finder.interTypeMethods) {
if (Modifier.isPublic(aBinding.modifiers)) {
- toAList.add(aBinding);
+ accumulator.add(aBinding);
}
}
}
ReferenceBinding superType = anInterface.superclass;
if (superType instanceof SourceTypeBinding && superType.isInterface()) {
- addPublicITDSFrom((SourceTypeBinding) superType, toAList);
+ addPublicITDSFrom((SourceTypeBinding) superType, accumulator);
}
}
// XXX conflicts
+ @Override
public MethodBinding[] getMethods(SourceTypeBinding sourceTypeBinding, char[] selector) {
// System.err.println("getMethods: " + new String(sourceTypeBinding.signature()) +
// ", " + new String(selector));
@@ -304,7 +305,7 @@ public class InterTypeMemberFinder implements IMemberFinder {
// System.err.println("declared method: " + ret + " inters = " + interTypeMethods);
for (int i = 0, len = interTypeMethods.size(); i < len; i++) {
- MethodBinding method = (MethodBinding) interTypeMethods.get(i);
+ MethodBinding method = interTypeMethods.get(i);
if (CharOperation.equals(selector, method.selector)) {
ret.add(method);
@@ -331,16 +332,17 @@ public class InterTypeMemberFinder implements IMemberFinder {
// System.err.println("got methods: " + ret + " on " + sourceTypeBinding);
- return (MethodBinding[]) ret.toArray(new MethodBinding[ret.size()]);
+ return ret.toArray(new MethodBinding[ret.size()]);
}
+ @Override
public MethodBinding getExactMethod(SourceTypeBinding sourceTypeBinding, char[] selector, TypeBinding[] argumentTypes,
CompilationUnitScope refScope) {
MethodBinding ret = sourceTypeBinding.getExactMethodBase(selector, argumentTypes, refScope);
// An intertype declaration may override an inherited member (Bug#50776)
for (int i = 0, len = interTypeMethods.size(); i < len; i++) {
- MethodBinding im = (MethodBinding) interTypeMethods.get(i);
+ MethodBinding im = interTypeMethods.get(i);
if (matches(im, selector, argumentTypes)) {
return im;
}
@@ -512,11 +514,11 @@ public class InterTypeMemberFinder implements IMemberFinder {
* @return true if already know about an intertype field declaration for that field
*/
public boolean definesField(String name) {
- List l = interTypeFields;
+ List<FieldBinding> l = interTypeFields;
if (l.size() > 0) {
char[] nameChars = name.toCharArray();
for (int i = 0; i < l.size(); i++) {
- FieldBinding fieldBinding = (FieldBinding) interTypeFields.get(i);
+ FieldBinding fieldBinding = interTypeFields.get(i);
if (CharOperation.equals(fieldBinding.name, nameChars)) {
return true;
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java
index 953e7d9ee..10e93ae00 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMethodBinding.java
@@ -14,7 +14,6 @@ package org.aspectj.ajdt.internal.compiler.lookup;
import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.IPrivilegedHandler;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
@@ -88,6 +87,7 @@ public class InterTypeMethodBinding extends MethodBinding {
}
// XXX this is identical to InterTypeFieldBinding
+ @Override
public boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invocationSite, Scope scope) {
scope.compilationUnitScope().recordTypeReference(declaringClass);
@@ -155,12 +155,14 @@ public class InterTypeMethodBinding extends MethodBinding {
return false;
}
+ @Override
public boolean isFinal() {
if (sourceMethod == null || !(sourceMethod instanceof InterTypeMethodDeclaration))
return super.isFinal();
return ((InterTypeMethodDeclaration) sourceMethod).isFinal();
}
+ @Override
public MethodBinding getAccessMethod(boolean staticReference) {
if (staticReference)
return postDispatchMethod;
@@ -168,10 +170,12 @@ public class InterTypeMethodBinding extends MethodBinding {
return syntheticMethod;
}
+ @Override
public boolean alwaysNeedsAccessMethod() {
return true;
}
+ @Override
public AbstractMethodDeclaration sourceMethod() {
return sourceMethod;
}
@@ -181,10 +185,12 @@ public class InterTypeMethodBinding extends MethodBinding {
}
// override method in MethodBinding to ensure correct behaviour in some of JDTs generics checks.
+ @Override
public ReferenceBinding getOwningClass() {
return targetType;
}
+ @Override
public String toString() {
return "InterTypeMethodBinding(" + super.toString() + ", " + getTargetType() + ")";
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java
index 9179e286d..c4c7e1f84 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java
@@ -45,6 +45,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
this.inAspect = inAspect;
}
+ @Override
public boolean definesPrivilegedAccessToField(FieldBinding field) {
if (field instanceof ParameterizedFieldBinding) {
field = ((ParameterizedFieldBinding) field).originalField;
@@ -53,6 +54,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
return (accessors.containsKey(key));
}
+ @Override
public FieldBinding getPrivilegedAccessField(FieldBinding baseField, ASTNode location) {
if (baseField instanceof ParameterizedFieldBinding) {
baseField = ((ParameterizedFieldBinding) baseField).originalField;
@@ -76,6 +78,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
return ret;
}
+ @Override
public MethodBinding getPrivilegedAccessMethod(MethodBinding baseMethod, ASTNode location) {
if (baseMethod.alwaysNeedsAccessMethod())
return baseMethod;
@@ -113,6 +116,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
return ret;
}
+ @Override
public void notePrivilegedTypeAccess(ReferenceBinding type, ASTNode location) {
ResolvedMember key = new ResolvedMemberImpl(Member.STATIC_INITIALIZATION, inAspect.factory.fromEclipse(type), 0,
UnresolvedType.VOID, "", UnresolvedType.NONE);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBatchImageBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBatchImageBuilder.java
index c37269e48..ce61a4704 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBatchImageBuilder.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBatchImageBuilder.java
@@ -11,6 +11,7 @@
package org.aspectj.ajdt.internal.core.builder;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.aspectj.org.eclipse.jdt.internal.core.CompilationGroup;
import org.aspectj.org.eclipse.jdt.internal.core.builder.BatchImageBuilder;
import org.aspectj.org.eclipse.jdt.internal.core.builder.SourceFile;
@@ -22,12 +23,10 @@ import org.aspectj.org.eclipse.jdt.internal.core.builder.SourceFile;
public class AjBatchImageBuilder extends BatchImageBuilder {
public AjBatchImageBuilder(AspectJBuilder builder) {
- super(builder,true);
+ super(builder, true, CompilationGroup.MAIN);
}
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.ICompilerRequestor#acceptResult(org.eclipse.jdt.internal.compiler.CompilationResult)
- */
+ @Override
public void acceptResult(CompilationResult result) {
if ((result.getCompilationUnit() != null) && (result.getCompilationUnit() instanceof SourceFile)) {
super.acceptResult(result);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
index 85b665dcd..b81e8ed4b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
@@ -952,7 +952,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour
if (buildConfig.getCheckedClasspaths() == null) {
nameEnvironment = new FileSystem(classpaths, filenames, defaultEncoding, ClasspathLocation.BINARY);
} else {
- nameEnvironment = new FileSystem(buildConfig.getCheckedClasspaths(), filenames, false);
+ nameEnvironment = new FileSystem(buildConfig.getCheckedClasspaths(), filenames, false, null);
}
nameEnvironment.module = buildConfig.getModuleDesc();
return nameEnvironment;