Bug 507254 - Run tests with assertions enabled
- remove obviously bogus assert (see CallinMappingTest.testMapping2)
- cleanup: avoid redundant lookup
diff --git a/org.eclipse.jdt.core/model/org/eclipse/objectteams/otdt/internal/core/MethodMapping.java b/org.eclipse.jdt.core/model/org/eclipse/objectteams/otdt/internal/core/MethodMapping.java
index c21df99..74dc4b4 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/objectteams/otdt/internal/core/MethodMapping.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/objectteams/otdt/internal/core/MethodMapping.java
@@ -81,6 +81,7 @@
private int declarationSourceEnd;
private IMethod roleMethod;
protected MethodData roleMethodHandle;
+ private boolean hasSearchedRoleMethod;
private boolean hasSignature;
public MethodMapping(int declarationSourceStart,
@@ -198,17 +199,14 @@
public IMethod getRoleMethod()
{
- if (this.roleMethod == null)
- {
- try
- {
+ if (!this.hasSearchedRoleMethod) {
+ try {
this.roleMethod = findRoleMethod();
- assert (this.roleMethod != null);
- }
- catch (JavaModelException ex)
- {
+ } catch (JavaModelException ex) {
Util.log(ex, "Failed to lookup original role method element!"); //$NON-NLS-1$
- }
+ } finally {
+ this.hasSearchedRoleMethod = true;
+ }
}
return this.roleMethod;
@@ -222,9 +220,12 @@
public IMethod getRoleMethodThrowingException() throws JavaModelException
{
- if (this.roleMethod == null)
- {
- this.roleMethod = findRoleMethod();
+ if (!this.hasSearchedRoleMethod) {
+ try {
+ this.roleMethod = findRoleMethod();
+ } finally {
+ this.hasSearchedRoleMethod = true;
+ }
}
return this.roleMethod;