Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 335777
Collapse All | Expand All

(-)compiler/org/eclipse/objectteams/otdt/internal/core/compiler/lookup/PrecedenceBinding.java (-3 / +4 lines)
Lines 31-36 Link Here
31
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
31
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
32
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
32
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
33
import org.eclipse.jdt.internal.compiler.lookup.Scope;
33
import org.eclipse.jdt.internal.compiler.lookup.Scope;
34
import org.eclipse.objectteams.otdt.internal.core.compiler.model.TeamModel;
34
35
35
/**
36
/**
36
 * NEW for OTDT.
37
 * NEW for OTDT.
Lines 227-239 Link Here
227
						return false;
228
						return false;
228
				}
229
				}
229
			}
230
			}
231
			ReferenceBinding role1 = callin1._declaringRoleClass;
232
			ReferenceBinding role2 = callin2._declaringRoleClass;
230
			if (CharOperation.equals(callin1.name, callin2.name)) {
233
			if (CharOperation.equals(callin1.name, callin2.name)) {
231
				ReferenceBinding role1 = callin1._declaringRoleClass;
232
				ReferenceBinding role2 = callin2._declaringRoleClass;
233
				if (role1.isCompatibleWith(role2) || role2.isCompatibleWith(role1))
234
				if (role1.isCompatibleWith(role2) || role2.isCompatibleWith(role1))
234
					return false; // callin overriding
235
					return false; // callin overriding
235
			}
236
			}
236
			return true;
237
			return TeamModel.areCompatibleEnclosings(role1.enclosingType(), role2.enclosingType());
237
		}
238
		}
238
		return false;
239
		return false;
239
	}
240
	}
(-)otjld/org/eclipse/objectteams/otdt/tests/otjld/callinbinding/CallinMethodBinding.java (-1 / +43 lines)
Lines 34-40 Link Here
34
	// Static initializer to specify tests subset using TESTS_* static variables
34
	// Static initializer to specify tests subset using TESTS_* static variables
35
	// All specified tests which does not belong to the class are skipped...
35
	// All specified tests which does not belong to the class are skipped...
36
	static {
36
	static {
37
//		TESTS_NAMES = new String[] { "test4125_resultInMethodSpec3"};
37
//		TESTS_NAMES = new String[] { "test4127_precedenceDeclaration19"};
38
//		TESTS_NUMBERS = new int[] { 1459 };
38
//		TESTS_NUMBERS = new int[] { 1459 };
39
//		TESTS_RANGE = new int[] { 1097, -1 };
39
//		TESTS_RANGE = new int[] { 1097, -1 };
40
	}
40
	}
Lines 4801-4806 Link Here
4801
    		"\'precedence\' declaration can only refer to direct role classes, however PrecBug.RA.RB is a nested role of team PrecBug.RA (OTJLD 4.8).\n" + 
4801
    		"\'precedence\' declaration can only refer to direct role classes, however PrecBug.RA.RB is a nested role of team PrecBug.RA (OTJLD 4.8).\n" + 
4802
    		"----------\n");
4802
    		"----------\n");
4803
    }
4803
    }
4804
    
4805
    // Bug 335777 - [compiler] don't flag missing precedence if different enclosing teams
4806
    public void test4127_precedenceDeclaration19 () {
4807
    	runConformTest(
4808
    		new String[] {
4809
    			"PrecBug19.java",
4810
    			"public team class PrecBug19 {\n" + 
4811
    			"    protected team class RA playedBy A {\n" + 
4812
    			"        void some(String v) <- before void myMethod2()\n" +
4813
    			"            with { v <- \"RA\" }\n" + 
4814
    			"        void some(String v) <- after void myMethod2()\n" +
4815
    			"            with { v <- \"RA\" }\n" + 
4816
    			"        void some(String v) {\n" +
4817
    			"            System.out.print(\"some\"+v);\n" + 
4818
    			"        }\n" + 
4819
    			"        protected class RB playedBy B {\n" + 
4820
    			"            void some(String v) <- before void myMethod2()" +
4821
    			"                with { v <- \"RB\" }\n" +
4822
				"            void some(String v) <- after void myMethod2()" +
4823
    			"                with { v <- \"RB\" }\n" +
4824
    			"        }\n" + 
4825
    			"    }\n" +
4826
    			"    public PrecBug19(A as RA a) {\n" +
4827
    			"        a.activate();\n" +
4828
    			"    }\n" +
4829
    			"    public static void main(String... args) {\n" +
4830
    			"        B b = new B();\n" +
4831
    			"        new PrecBug19(b).activate();\n" +
4832
    			"        new B().myMethod2();\n" +
4833
    			"    }\n" + 
4834
    			"}\n",
4835
    			"A.java",
4836
    			"public class A {\n" +
4837
    			"    void myMethod2() { System.out.print(\"-\"); }\n" +
4838
    			"}\n",
4839
    			"B.java",
4840
    			"public class B extends A {\n" +
4841
    			"}\n"
4842
    		}, 
4843
    		"someRAsomeRB-someRBsomeRA");
4844
    }
4845
4804
    // a regular class has a precedence declaration
4846
    // a regular class has a precedence declaration
4805
    // 4.1.28-otjld-invalid-precedence-declaration-1
4847
    // 4.1.28-otjld-invalid-precedence-declaration-1
4806
    public void test4128_invalidPrecedenceDeclaration1() {
4848
    public void test4128_invalidPrecedenceDeclaration1() {

Return to bug 335777