Test and fix for Bug 340103 - [assist] FUP of bug 340083
(completion inside base predicate of callin with signatures).
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethodMapping.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethodMapping.java
index 16f2a13..96b7072 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethodMapping.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethodMapping.java
@@ -97,25 +97,30 @@
AstGenerator gen= new AstGenerator(statement.sourceStart, statement.sourceEnd);
// adding a statement to a method mapping is interpreted as adding a guard predicate:
- GuardPredicateDeclaration predicate= new GuardPredicateDeclaration(
+ GuardPredicateDeclaration predicate= null;
+ if (this.methodMappingDeclaration instanceof CallinMappingDeclaration)
+ predicate = ((CallinMappingDeclaration) this.methodMappingDeclaration).predicate;
+ if (predicate == null) {
+ predicate = new GuardPredicateDeclaration(
this.methodMappingDeclaration.compilationResult,
this.foundBase ? IOTConstants.BASE_PREDICATE_PREFIX : IOTConstants.PREDICATE_METHOD_NAME,
this.foundBase,
statement.sourceStart-5, // guess position of "when"
statement.sourceStart-1);// -- " --
- if (this.foundBase) {
- // generate base argument (cf. Parser.consumePredicate):
- // type of this argument will be set in SourceTypeBinding.resolveTypesFor
- // (needs baseclass to be resolved, which might be inherited from super-role).
- long poss = ((long)statement.sourceStart<<32)+statement.sourceStart+1;
- Argument targetArg = new Argument(
- IOTConstants.BASE,
- poss,
- new SingleTypeReference("_OT$unknownBaseType".toCharArray(), poss), //$NON-NLS-1$
- ClassFileConstants.AccFinal);
- predicate.arguments = new Argument[] {targetArg};
+ if (this.foundBase) {
+ // generate base argument (cf. Parser.consumePredicate):
+ // type of this argument will be set in SourceTypeBinding.resolveTypesFor
+ // (needs baseclass to be resolved, which might be inherited from super-role).
+ long poss = ((long)statement.sourceStart<<32)+statement.sourceStart+1;
+ Argument targetArg = new Argument(
+ IOTConstants.BASE,
+ poss,
+ new SingleTypeReference("_OT$unknownBaseType".toCharArray(), poss), //$NON-NLS-1$
+ ClassFileConstants.AccFinal);
+ predicate.arguments = new Argument[] {targetArg};
+ }
+ predicate.returnType= gen.typeReference(TypeBinding.BOOLEAN);
}
- predicate.returnType= gen.typeReference(TypeBinding.BOOLEAN);
// create a suitable return statement:
if (statement instanceof FieldDeclaration)