Browse Source

updated rules that allow ITDs on generic types using type parameters

tags/V1_5_0M3
acolyer 19 years ago
parent
commit
6fe49e131d

+ 19
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java View File

@@ -24,6 +24,8 @@ import org.aspectj.ajdt.internal.core.builder.EclipseSourceContext;
import org.aspectj.weaver.*;
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.ParameterizedSingleTypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.*;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
@@ -130,12 +132,29 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {

protected void resolveOnType(ClassScope classScope) {
checkSpec();
if (onType instanceof ParameterizedSingleTypeReference) {
resolveTypeParametersForITDOnGenericType();
}

onTypeBinding = (ReferenceBinding)onType.getTypeBindingPublic(classScope);
if (!onTypeBinding.isValidBinding()) {
classScope.problemReporter().invalidType(onType, onTypeBinding);
ignoreFurtherInvestigation = true;
}
}

private void resolveTypeParametersForITDOnGenericType() {
// we have to resolve this to the base type, and in the process
// check that the number of type variables matches.
// Then we work out how the letters in the ITD map onto the letters in
// the type declaration and swap them.

// XXX will this mess up error reporting and independent compliation?
ParameterizedSingleTypeReference pref = (ParameterizedSingleTypeReference) onType;
long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
onType = new SingleTypeReference(pref.token,pos);
}
protected void checkSpec() {

BIN
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip View File


BIN
org.eclipse.jdt.core/jdtcore-for-aspectj.jar View File


Loading…
Cancel
Save