Get JEM synchronized correctly so that we don't have race conditions.
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java
index 4c406ea..792524d 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JDOMAdaptor.java,v $
- *  $Revision: 1.2 $  $Date: 2004/01/13 16:17:42 $ 
+ *  $Revision: 1.3 $  $Date: 2004/06/16 20:49:23 $ 
  */
 
 import java.io.File;
@@ -175,17 +175,6 @@
 		resource.setID(newMethod, computeMethodID(jdomMethod, getType(), getTypeResolutionCache()));
 		return newMethod;
 	}
-	/*
-	 *  Leave the target as is, but flush it so
-	 *  that notifications go through, and clear
-	 *  the source.
-	 */
-
-	public void deprecateSource() {
-		hasReflected = false; // Note:  There is a potential race condidtion here as already existing in
-		//        the flushReflectedValuesIfNecessary()/reflectValues()
-		flushReflectedValuesIfNecessary(true); // induce clients to get Notified.
-	}
 	protected IPath getBinaryPathFromQualifiedName(String qualifiedName) {
 		return new Path(qualifiedName.replace('.', File.separatorChar) + ".class"); //$NON-NLS-1$
 	}
@@ -259,12 +248,10 @@
 	protected abstract Map getTypeResolutionCache();
 
 	public void releaseSourceType() {
-		deprecateSource();
+		flushReflectedValuesIfNecessary(true); // induce clients to get Notified.
 	}
 
 	public Notification releaseSourceTypeNoNotification() {
-		hasReflected = false; // Note:  There is a potential race condidtion here as already existing in
-		//        the flushReflectedValuesIfNecessary()/reflectValues()
 		return flushReflectedValuesIfNecessaryNoNotification(true); // induce clients to get Notified.
 	}
 	/**
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaClassJDOMAdaptor.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaClassJDOMAdaptor.java
index fc960c8..2bceb0f 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaClassJDOMAdaptor.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaClassJDOMAdaptor.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaClassJDOMAdaptor.java,v $
- *  $Revision: 1.6 $  $Date: 2004/06/09 22:47:06 $ 
+ *  $Revision: 1.7 $  $Date: 2004/06/16 20:49:23 $ 
  */
 
 import java.util.*;
@@ -20,13 +20,17 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.emf.ecore.xmi.XMIResource;
 import org.eclipse.jdt.core.*;
 
 import com.ibm.wtp.common.UIContextDetermination;
+import com.ibm.wtp.common.logger.proxy.Logger;
 
 import org.eclipse.jem.internal.java.adapters.*;
 import org.eclipse.jem.internal.java.adapters.nls.ResourceHandler;
@@ -41,46 +45,157 @@
 	protected IType sourceType = null;
 	protected JavaReflectionAdapterFactory adapterFactory;
 	private Map typeResolutionCache = new HashMap(25);
+	private boolean hasReflectedFields, isReflectingFields;
+	private boolean hasReflectedMethods, isReflectingMethods;
+	
 	public JavaClassJDOMAdaptor(Notifier target, IJavaProject workingProject, JavaReflectionAdapterFactory inFactory) {
 		super(target, workingProject);
 		setAdapterFactory(inFactory);
 	}
-	/**
+	
+	private Map existingFields = new HashMap(); 
+	/*
 	 * addFields - reflect our fields
 	 */
-	protected void addFields() {
+	protected boolean addFields() {
+
+		// The algorithm we will use is:
+		// 1) Pass through the IField's of this class
+		//    a) If it is in existingFields, then add to newExisting the entry from
+		//       oldExisting (deleting from oldExisting at the same time), and flush the field. This is so next we re-get any changed parts of it.
+		//    b) else not existing, then create new field and add to the new fields list.
+		// 2) Remove from the fields list any still left in oldExisting. These are ones that no longer exist.
+		// 3) Add all of the news ones to the fields.
+		//       
+		IField[] fields = null;
 		try {
-			XMIResource resource = (XMIResource) getJavaClassTarget().eResource();
-			IField[] fields = getSourceType().getFields();
-			List targetFields = getJavaClassTarget().getFieldsGen();
-			for (int i = 0; i < fields.length; i++) {
-				targetFields.add(createJavaField(fields[i], resource));
-			}
-		} catch (JavaModelException npe) {
-			// name stays null and we carry on
+			fields = getSourceType().getFields();
+		} catch (JavaModelException e) {
+			Logger.getLogger().log(e, Level.WARNING);
+			return false;	
 		}
+		XMIResource resource = (XMIResource) getJavaClassTarget().eResource();		
+		Field field = null;
+		JavaFieldJDOMAdaptor adapter = null;
+		Map newExisting = new HashMap(fields.length);
+		List newFields = new ArrayList();
+		for (int i = 0; i < fields.length; i++) {
+			IField ifield = fields[i];
+			field = (Field) existingFields.remove(ifield);	// Get the existing field (which is the value) from the collection keyed by IField.
+			if (field != null) {
+				// It is an existing method. So just put over to newExisting. Then flush it.
+				newExisting.put(ifield, field);
+				// Since this is a new method, it is not attached to a resource, so we need to explicitly create the adapter.
+				adapter = (JavaFieldJDOMAdaptor) getAdapterFactory().adaptNew(field, ReadAdaptor.TYPE_KEY);
+				if (adapter != null) {
+					adapter.flushReflectedValuesIfNecessaryNoNotification(true);
+					adapter.setSourceField(ifield);	// Give it this new IField
+				}
+			} else {
+				// It is a new method. Create the new method, add to newExisting, and add to newMethods list.
+				field = createJavaField(ifield, resource);
+				newExisting.put(ifield, field);				
+				newFields.add(field);
+				adapter = (JavaFieldJDOMAdaptor) retrieveAdaptorFrom(field);
+				if (adapter != null)
+					adapter.setSourceField(fields[i]);
+			}
+		}
+		
+		BasicEList fieldsList = (BasicEList) getJavaClassTarget().getFieldsGen();
+		if (!existingFields.isEmpty()) {
+			// Now any still left in old existing are deleted. So we make them proxies and then remove them from fields list.			
+			URI baseURI = resource.getURI();
+			Collection toDelete = existingFields.values();
+			for (Iterator itr = toDelete.iterator(); itr.hasNext();) {
+				InternalEObject m = (InternalEObject) itr.next();
+				String id = resource.getID(m);
+				if (id != null)
+					m.eSetProxyURI(baseURI.appendFragment(id));
+			}
+			fieldsList.removeAll(toDelete);
+		}
+		
+		if (!newFields.isEmpty()) {
+			// Now add in the news ones
+			fieldsList.addAllUnique(newFields);
+		}
+		
+		// Finally set current existing to the new map we created.
+		existingFields = newExisting;
+		return true;			
 	}
-	/**
-	 * addMethods - reflect our methods
+	
+	private Map existingMethods = new HashMap(); 
+	/*
+	 * addMethods - reflect our methods. Merge in with the previous.
 	 */
-	protected void addMethods() {
+	protected boolean addMethods() {
+		// The algorithm we will use is:
+		// 1) Pass through the IMethod's of this class
+		//    a) If it is in existingMethods, then add to newExisting the entry from
+		//       oldExisting (deleting from oldExisting at the same time), and flush the method. This is so next we re-get any changed parts of it.
+		//    b) else not existing, then create new method and add to the new methods list.
+		// 2) Remove from the methods list any still left in oldExisting. These are ones that no longer exist.
+		// 3) Add all of the news ones to the methods.
+		//       
+		IMethod[] methods = null;
 		try {
-			XMIResource resource = (XMIResource) getJavaClassTarget().eResource();
-			IMethod[] methods = getSourceType().getMethods();
-			List targetMethods = getJavaClassTarget().getMethodsGen();
-			Method method = null;
-			JavaMethodJDOMAdaptor adaptor = null;
-			for (int i = 0; i < methods.length; i++) {
-				adaptor = null;
-				method = createJavaMethod(methods[i], resource);
-				targetMethods.add(method);
-				adaptor = (JavaMethodJDOMAdaptor) retrieveAdaptorFrom(method);
-				if (adaptor != null)
-					adaptor.setSourceMethod(methods[i]);
-			}
-		} catch (JavaModelException npe) {
-			// name stays null and we carry on
+			methods = getSourceType().getMethods();
+		} catch (JavaModelException e) {
+			Logger.getLogger().log(e, Level.WARNING);
+			return false;	
 		}
+		XMIResource resource = (XMIResource) getJavaClassTarget().eResource();		
+		Method method = null;
+		JavaMethodJDOMAdaptor adapter = null;
+		Map newExisting = new HashMap(methods.length);
+		List newMethods = new ArrayList();
+		for (int i = 0; i < methods.length; i++) {
+			IMethod im = methods[i];
+			method = (Method) existingMethods.remove(im);	// Get the existing method (which is the value) from the collection keyed by IMethod.
+			if (method != null) {
+				// It is an existing method. So just put over to newExisting. Then flush it.
+				newExisting.put(im, method);
+				adapter = (JavaMethodJDOMAdaptor) retrieveAdaptorFrom(method);
+				if (adapter != null) {
+					adapter.flushReflectedValuesIfNecessaryNoNotification(true);
+					adapter.setSourceMethod(im);	// Give it this new IMethod
+				}
+			} else {
+				// It is a new method. Create the new method, add to newExisting, and add to newMethods list.
+				method = createJavaMethod(im, resource);
+				newExisting.put(im, method);				
+				newMethods.add(method);
+				// Since this is a new method, it is not attached to a resource, so we need to explicitly create the adapter.
+				adapter = (JavaMethodJDOMAdaptor) getAdapterFactory().adaptNew(method, ReadAdaptor.TYPE_KEY);
+				if (adapter != null)
+					adapter.setSourceMethod(methods[i]);
+			}
+		}
+		
+		BasicEList methodsList = (BasicEList) getJavaClassTarget().getMethodsGen();
+		if (!existingMethods.isEmpty()) {
+			// Now any still left in old existing are deleted. So we make them proxies and then remove them from methods list.
+			URI baseURI = resource.getURI();
+			Collection toDelete = existingMethods.values();
+			for (Iterator itr = toDelete.iterator(); itr.hasNext();) {
+				InternalEObject m = (InternalEObject) itr.next();
+				String id = resource.getID(m);
+				if (id != null)
+					m.eSetProxyURI(baseURI.appendFragment(id));
+			}
+			methodsList.removeAll(toDelete);
+		}
+		
+		if (!newMethods.isEmpty()) {
+			// Now add in the news ones
+			methodsList.addAllUnique(newMethods);
+		}
+		
+		// Finally set current existing to the new map we created.
+		existingMethods = newExisting;
+		return true;
 	}
 	/**
 	 * Clear source Type ;
@@ -93,9 +208,21 @@
 	 * Clear the reflected fields list.
 	 */
 	protected boolean flushFields() {
-		getJavaClassTarget().getFieldsGen().clear();
+		// First turn them all into proxies so that any holders will re-resolve to maybe the new one if class comes back.
+		existingFields.clear();
+		XMIResource res = (XMIResource) getJavaClassTarget().eResource();
+		URI baseURI = res.getURI();
+		List fields = getJavaClassTarget().getFieldsGen();
+		int msize = fields.size();
+		for (int i = 0; i < msize; i++) {
+			InternalEObject f = (InternalEObject) fields.get(i);
+			String id = res.getID(f);
+			if (id != null)
+				f.eSetProxyURI(baseURI.appendFragment(id));
+		}
+		fields.clear();	// Now we can clear it.
 		return true;
-	}
+		}
 	/**
 	 * Clear the implements list.
 	 */
@@ -107,7 +234,19 @@
 	 * Clear the reflected methods list.
 	 */
 	protected boolean flushMethods() {
-		getJavaClassTarget().getMethodsGen().clear();
+		// First turn them all into proxies so that any holders will re-resolve to maybe the new one if class comes back.
+		existingMethods.clear();
+		XMIResource res = (XMIResource) getJavaClassTarget().eResource();
+		URI baseURI = res.getURI();
+		List methods = getJavaClassTarget().getMethodsGen();
+		int msize = methods.size();
+		for (int i = 0; i < msize; i++) {
+			InternalEObject m = (InternalEObject) methods.get(i);
+			String id = res.getID(m);
+			if (id != null)
+				m.eSetProxyURI(baseURI.appendFragment(id));
+		}
+		methods.clear();	// Now we can clear it.
 		return true;
 	}
 	protected boolean flushModifiers() {
@@ -129,7 +268,20 @@
 		if (clearCachedModelObject)
 			setSourceType(null);
 		typeResolutionCache.clear();
-		return primFlushReflectedValues();
+		flushModifiers();
+		flushSuper();
+		flushImplements();
+		if (clearCachedModelObject) {
+			// Don't flush these yet. We will try to reuse them on the next reflush. If clear model too, then flush them. This usually means class has been deleted, so why keep them around.
+			flushMethods();
+			flushFields();
+		}
+		// Even if we didn't flush the fields/methods, we do need to mark as not reflected so on next usage we will merge in the changes.
+		hasReflectedMethods = false;
+		hasReflectedFields = false;
+		
+		flushInnerClasses();
+		return true;
 	}
 
 	/**
@@ -202,18 +354,7 @@
 			return false; //must be new?
 		return getSourceType().isBinary();
 	}
-	/**
-	 * Clear the reflected values.
-	 */
-	protected boolean primFlushReflectedValues() {
-		boolean result = flushModifiers();
-		result &= flushSuper();
-		result &= flushImplements();
-		result &= flushMethods();
-		result &= flushFields();
-		result &= flushInnerClasses();
-		return result;
-	}
+
 
 	protected JavaClass reflectJavaClass(String qualifiedName) {
 		IType type = JDOMSearchHelper.findType(qualifiedName, true, getSourceProject(), this);
@@ -251,7 +392,6 @@
 	 */
 	public boolean reflectValues() {
 		super.reflectValues();
-		primFlushReflectedValues();
 		boolean isHeadless = UIContextDetermination.getCurrentContext() == UIContextDetermination.HEADLESS_CONTEXT;
 		if (getSourceProject() != null && getSourceType() != null && getSourceType().exists()) {
 			ICompilationUnit cu = getSourceType().getCompilationUnit();
@@ -272,8 +412,6 @@
 					JavaPlugin.getDefault().getLogger().log(e);
 				}
 				setImplements();
-				addMethods();
-				addFields();
 				reflectInnerClasses();
 				//addImports();
 				if (isHeadless) {
@@ -289,6 +427,48 @@
 			return true;
 		}
 	}
+	
+	
+	public synchronized boolean reflectFieldsIfNecessary() {
+		if (reflectValuesIfNecessary()) {
+			if (!hasReflectedFields && !isReflectingFields) {
+				isReflectingFields = true;
+				try {
+					addFields();
+					hasReflectedFields = true;
+				} catch (Throwable e) {
+					hasReflectedFields = false;
+					Logger.getLogger().log(ResourceHandler.getString("Failed_reflecting_values_ERROR_"), Level.WARNING); //$NON-NLS-1$ = "Failed reflecting values!!!"
+					Logger.getLogger().log(e);					
+				} finally {
+					isReflectingFields = false;
+				}
+			}
+			return hasReflectedFields;
+		} else
+			return false;	// Couldn't reflect the base values, so couldn't do fields either
+	}
+	public boolean reflectMethodsIfNecessary() {
+		if (reflectValuesIfNecessary()) {
+			if (!hasReflectedMethods && !isReflectingMethods) {
+				isReflectingMethods = true;
+				try {
+					hasReflectedMethods = addMethods();
+				} catch (Throwable e) {
+					hasReflectedMethods = false;
+					Logger.getLogger().log(ResourceHandler.getString("Failed_reflecting_values_ERROR_"), Level.WARNING); //$NON-NLS-1$ = "Failed reflecting values!!!"
+					Logger.getLogger().log(e);					
+				} finally {
+					isReflectingMethods = false;
+					if (!hasReflected)
+						flushMethods();	// Something bad happened, so we will do a complete flush to be on safe side.
+				}
+			}
+			return hasReflectedMethods;
+		} else
+			return false;	// Couldn't reflect the base values, so couldn't do fields either
+	}
+	
 	private void registerWithFactory() {
 		getAdapterFactory().registerReflection(getJavaClassTarget().getQualifiedNameForReflection(), this);
 	}
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaFieldJDOMAdaptor.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaFieldJDOMAdaptor.java
index c370558..c68c085 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaFieldJDOMAdaptor.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaFieldJDOMAdaptor.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaFieldJDOMAdaptor.java,v $
- *  $Revision: 1.2 $  $Date: 2004/01/13 16:17:42 $ 
+ *  $Revision: 1.3 $  $Date: 2004/06/16 20:49:23 $ 
  */
 import java.util.Map;
 
@@ -21,9 +21,11 @@
 import org.eclipse.emf.ecore.xmi.XMIResource;
 import org.eclipse.jdt.core.*;
 import org.eclipse.jdt.internal.core.JavaElement;
-import org.eclipse.jem.java.*;
+
 import org.eclipse.jem.internal.java.adapters.ReadAdaptor;
 import org.eclipse.jem.internal.java.adapters.nls.ResourceHandler;
+import org.eclipse.jem.java.*;
+import org.eclipse.jem.java.impl.FieldImpl;
 /**
  * Insert the type's description here.
  * Creation date: (6/6/2000 4:42:50 PM)
@@ -40,6 +42,24 @@
 	protected void clearSource() {
 		sourceField = null;
 	}
+	
+	protected boolean flushReflectedValues(boolean clearCachedModelObject) {
+		if (clearCachedModelObject)
+			clearSource();
+		FieldImpl field = getTargetField();
+		field.setInitializer(null);
+		field.setFinal(false);
+		field.setStatic(false);
+		field.setTransient(false);
+		field.setVolatile(false);
+		field.setJavaVisibility(JavaVisibilityKind.PUBLIC_LITERAL);
+		return true;
+	}
+	
+	protected void postFlushReflectedValuesIfNecessary(boolean isExisting) {
+		getTargetField().setReflected(false);
+		super.postFlushReflectedValuesIfNecessary(isExisting);
+	}
 	/**
 	 * Return a String for the source starting after the field's name to the end of
 	 * the source range.  This will be the source after the name which could include comments.
@@ -149,19 +169,26 @@
 	public Object getReflectionSource() {
 		return getSourceField();
 	}
+	
+	/*
+	 * Used by Java Class JDOM adapter to create and set with a source field
+	 */	
+	public void setSourceField(IField field) {
+		sourceField = field;
+	}	
 	/**
 	 * getSourceField - return the IField which describes our implementing field
 	 */
 	protected IField getSourceField() {
-		if (sourceField == null) {
+		if (sourceField == null || !sourceField.exists()) {
 			IType parent = this.getParentType();
 			if (parent != null)
 				sourceField = parent.getField(((Field) getTarget()).getName());
 		}
 		return sourceField;
 	}
-	public Field getTargetField() {
-		return (Field) getTarget();
+	public FieldImpl getTargetField() {
+		return (FieldImpl) getTarget();
 	}
 	protected IType getType() {
 		return getParentType();
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java
index 038d685..3f8b6ee 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java
@@ -1,4 +1,3 @@
-package org.eclipse.jem.internal.adapters.jdom;
 /*******************************************************************************
  * Copyright (c)  2001, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
@@ -11,9 +10,9 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaMethodJDOMAdaptor.java,v $
- *  $Revision: 1.2 $  $Date: 2004/01/13 16:17:42 $ 
+ *  $Revision: 1.3 $  $Date: 2004/06/16 20:49:23 $ 
  */
-
+package org.eclipse.jem.internal.adapters.jdom;
 
 import java.util.List;
 import java.util.Map;
@@ -23,252 +22,295 @@
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.emf.ecore.xmi.XMIResource;
 import org.eclipse.jdt.core.*;
-import org.eclipse.jem.java.*;
+
 import org.eclipse.jem.internal.java.adapters.ReadAdaptor;
 import org.eclipse.jem.internal.java.adapters.nls.ResourceHandler;
+import org.eclipse.jem.java.*;
 import org.eclipse.jem.java.impl.MethodImpl;
+
 /**
- * Insert the type's description here.
+ * Java Method Reflection Adapter for JDOM (i.e. JDT model)
  * Creation date: (6/6/2000 4:42:50 PM)
  * @author: Administrator
  */
 public class JavaMethodJDOMAdaptor extends JDOMAdaptor {
-	
+
 	protected IMethod sourceMethod = null;
+
 	protected IType parentType = null;
-public JavaMethodJDOMAdaptor(Notifier target, IJavaProject workingProject) {
-	super(target, workingProject);
-}
-/**
- * addExceptions - reflect our exception list
- */
-protected void addExceptions() {
-	try {
-		IMethod sourceMethod = getSourceMethod();
-		String[] exceptionNames = sourceMethod.getExceptionTypes();
-		List exceptions = ((MethodImpl) getTarget()).getJavaExceptionsGen();
-		for (int i = 0; i < exceptionNames.length; i++) {
-			exceptions.add(createJavaClassRef(typeNameFromSignature(exceptionNames[i])));
-		}
-	} catch (JavaModelException npe) {
-		// name stays null and we carry on
+
+	public JavaMethodJDOMAdaptor(Notifier target, IJavaProject workingProject) {
+		super(target, workingProject);
 	}
-}
-/**
- * addParameters - reflect our parms
- */
-protected void addParameters() {
-	String[] parmNames = new String[0], parmTypeNames = getSourceMethod().getParameterTypes();
-	try {
-		parmNames = getSourceMethod().getParameterNames();
-	} catch (JavaModelException npe) {
-		// name stays null and we carry on
-	}
-	// Temp hack to work around a JavaModel bug, above call on a Binary method may return null
-	if (parmNames == null || parmNames.length == 0) {
-		parmNames = new String[parmTypeNames.length];
-		for (int i = 0; i < parmTypeNames.length; i++) {
-			parmNames[i] = "arg" + i;//$NON-NLS-1$
-		}
-	}
-	MethodImpl javaMethodTarget = (MethodImpl) getTarget();
-	List params = javaMethodTarget.getParametersGen();
-	for (int i = 0; i < parmNames.length; i++) {
-		params.add(createJavaParameter(javaMethodTarget, parmNames[i], typeNameFromSignature(parmTypeNames[i])));
-	}
-}
-protected void clearSource() {
-	sourceMethod=null ;
-}
-protected JavaClass getContainingJavaClass() {
-	return ((Method)getTarget()).getContainingJavaClass();
-}
-/**
- * getParentType - return the IType which corresponds to our parent JavaClass
- * we're going to do this a lot, so cache it.
- */
-protected IType getParentType() {
-	if (parentType == null) {
-		Method targetMethod = (Method) getTarget();
-		JavaClass parentJavaClass = targetMethod.getContainingJavaClass();
-		JavaClassJDOMAdaptor pa = (JavaClassJDOMAdaptor) EcoreUtil.getAdapter(parentJavaClass.eAdapters(),ReadAdaptor.TYPE_KEY);
-		if (pa != null)
-			parentType = pa.getSourceType();
-	}
-	return parentType;
-}
-/**
- * getParmTypeSignatures - return an array of Strings (in Signature format) for our parameter types
- * 	For reflection purposes, we can only rely on our UUID, since our parms may
- *  not yet be known.
- * see org.eclipse.jdt.core.SourceMapper.convertTypeNamesToSigs()
- */
-protected String[] getParmTypeSignatures() {
-	Method javaMethodTarget = (Method) getTarget();
-	String[] typeNames = getTypeNamesFromMethodID(((XMIResource)javaMethodTarget.eResource()).getID(javaMethodTarget));
-	if (typeNames == null)
-		return emptyStringArray;
-	int n = typeNames.length;
-	if (n == 0)
-		return emptyStringArray;
-	String[] typeSigs = new String[n];
-	try {
-	for (int i = 0; i < n; ++i) {
-		typeSigs[i] = Signature.createTypeSignature(new String(typeNames[i]), getParentType().isBinary());
-	}
-	} catch (IllegalArgumentException e) {
-		e.printStackTrace();
-	}
-	return typeSigs;
-}
-public Object getReflectionSource() {
-	return getSourceMethod();
-}
-/**
- * getsourceMethod - return the IMethod which describes our implementing method
- */
-public IMethod getSourceMethod() {
-	if ((sourceMethod == null) || (!sourceMethod.exists())) {
-		try {
-			IType parent = this.getParentType();
-			if (parent != null) {
-				String[] parmNames = this.getParmTypeSignatures();
-				sourceMethod = JDOMSearchHelper.searchForMatchingMethod(parent, ((Method) getTarget()).getName(), parmNames);
-			}
-		} catch (JavaModelException e) {
-			//do nothing
-		}
-	}
-	return sourceMethod;
-}
-protected IType getType() {
-	return getParentType();
-}
-protected Map getTypeResolutionCache() {
-	Method method = (Method) getTarget();
-	if (method != null) {
-		JavaClass javaClass = method.getJavaClass();
-		if (javaClass != null) {
-			JDOMAdaptor classAdaptor = (JDOMAdaptor) retrieveAdaptorFrom(javaClass);
-			if (classAdaptor != null)
-				return classAdaptor.getTypeResolutionCache();
-		}
-	}
-	return null;
-}
-/**
- * getValueIn method comment.
- */
-public Object getValueIn(EObject object, EObject attribute) {
-	// At this point, this adapter does not dynamically compute any values,
-	// all values are pushed back into the target on the initial call.
-	return super.getValueIn(object, attribute);
-}
-/**
- * reflectValues - template method, subclasses override to pump values into target.
- * on entry: UUID, name, containing package (and qualified name), and document must be set.
- * Method adaptor:
- *	- set modifiers
- *	- set name
- * 	- set return type
- * 	- add parameters
- * 	- add exceptions
- */
-public boolean reflectValues() {
-	if (getSourceProject() != null && getSourceMethod() != null && sourceMethod.exists()) {
-		setGeneratedFlag();
-		setModifiers();
-		setNaming();
-		setReturnType();
-		addParameters();
-		addExceptions();
+
+	
+	protected boolean flushReflectedValues(boolean clearCachedModelObject) {
+		if (clearCachedModelObject)
+			clearSource();
+		MethodImpl method = (MethodImpl) getTarget();
+		method.setIsGenerated(false);
+		method.setFinal(false);
+		method.setNative(false);
+		method.setStatic(false);
+		method.setSynchronized(false);
+		method.setConstructor(false);
+		method.setAbstract(false);
+		method.setJavaVisibility(JavaVisibilityKind.PUBLIC_LITERAL);
+		method.setEType(null);
+		method.getParametersGen().clear();
+		method.getJavaExceptionsGen().clear();		
+		parentType = null;
 		return true;
 	}
-	return false;
-}
-/**
- * Set the generated flag if @generated is found in the source.
- */
-protected void setGeneratedFlag() {
-	Method methodTarget = (Method) getTarget();
-	try {
-		String source = getSourceMethod().getSource();
-		if (source != null) {
-			int index = source.indexOf(Method.GENERATED_COMMENT_TAG);
-			if (index > 0)
-				methodTarget.setIsGenerated(true);
+	
+	protected void postFlushReflectedValuesIfNecessary(boolean isExisting) {
+		((MethodImpl) getTarget()).setReflected(false);
+		super.postFlushReflectedValuesIfNecessary(isExisting);
+	}	
+	/**
+	 * addExceptions - reflect our exception list
+	 */
+	protected void addExceptions() {
+		try {
+			IMethod sourceMethod = getSourceMethod();
+			String[] exceptionNames = sourceMethod.getExceptionTypes();
+			List exceptions = ((MethodImpl) getTarget()).getJavaExceptionsGen();
+			for (int i = 0; i < exceptionNames.length; i++) {
+				exceptions.add(createJavaClassRef(typeNameFromSignature(exceptionNames[i])));
+			}
+		} catch (JavaModelException npe) {
+			// name stays null and we carry on
 		}
-	} catch (JavaModelException npe) {
-		//System.out.println(ResourceHandler.getString("Error_Setting_GenFlag_ERROR_", new Object[] {((XMIResource)methodTarget.eResource()).getID(methodTarget), npe.getMessage()}));  //$NON-NLS-1$ = "error setting the generated flag on {0}, exception: {1}"
 	}
-}
-/**
- * setModifiers - set the attribute values related to modifiers here
- */
-protected void setModifiers() {
-	Method methodTarget = (Method) getTarget();
-	try {
-		methodTarget.setFinal(Flags.isFinal(getSourceMethod().getFlags()));
-		methodTarget.setNative(Flags.isNative(getSourceMethod().getFlags()));
-		methodTarget.setStatic(Flags.isStatic(getSourceMethod().getFlags()));
-		methodTarget.setSynchronized(Flags.isSynchronized(getSourceMethod().getFlags()));
-		methodTarget.setConstructor(getSourceMethod().isConstructor());
 
-		JavaClass javaClass = getContainingJavaClass();
-		//Set abstract
-		if (javaClass.getKind().getValue() == TypeKind.INTERFACE)
-			methodTarget.setAbstract(true);
-		else
-			methodTarget.setAbstract(Flags.isAbstract(getSourceMethod().getFlags()));
-		// Set visibility
-		if (javaClass.getKind().getValue() == TypeKind.INTERFACE || Flags.isPublic(getSourceMethod().getFlags()))
-			methodTarget.setJavaVisibility(JavaVisibilityKind.PUBLIC_LITERAL);
-		else
-			if (Flags.isPrivate(getSourceMethod().getFlags()))
-				methodTarget.setJavaVisibility(JavaVisibilityKind.PRIVATE_LITERAL);
-			else
-				if (Flags.isProtected(getSourceMethod().getFlags()))
-					methodTarget.setJavaVisibility(JavaVisibilityKind.PROTECTED_LITERAL);
-				else
-					//Visibility must be package
-					methodTarget.setJavaVisibility(JavaVisibilityKind.PACKAGE_LITERAL);
-	} catch (JavaModelException npe) {
-		System.out.println(ResourceHandler.getString("Error_Introspecting_Flags_ERROR_", (new Object[] {((XMIResource)methodTarget.eResource()).getID(methodTarget), npe.getMessage()})));  //$NON-NLS-1$ = "error introspecting flags on {0}, exception: {1}"
+	/**
+	 * addParameters - reflect our parms
+	 */
+	protected void addParameters() {
+		String[] parmNames = new String[0], parmTypeNames = getSourceMethod().getParameterTypes();
+		try {
+			parmNames = getSourceMethod().getParameterNames();
+		} catch (JavaModelException npe) {
+			// name stays null and we carry on
+		}
+		// Temp hack to work around a JavaModel bug, above call on a Binary method may return null
+		if (parmNames == null || parmNames.length == 0) {
+			parmNames = new String[parmTypeNames.length];
+			for (int i = 0; i < parmTypeNames.length; i++) {
+				parmNames[i] = "arg" + i;//$NON-NLS-1$
+			}
+		}
+		MethodImpl javaMethodTarget = (MethodImpl) getTarget();
+		List params = javaMethodTarget.getParametersGen();
+		for (int i = 0; i < parmNames.length; i++) {
+			params.add(createJavaParameter(javaMethodTarget, parmNames[i], typeNameFromSignature(parmTypeNames[i])));
+		}
 	}
-}
-/**
- * setNaming - set the naming values here
- * 	- qualified name must be set first, that is the path to the real Java class
- *	- ID
- * 	- name-based UUID
- */
-protected void setNaming() {
-	//
-	//	naming is currently a no-op since the name and UUID must be set prior to reflection
-	//	...and ID is redundant with UUID.
-	//	javaFieldTarget.setID(parent.getQualifiedName() + "_" + javaFieldTarget.getName());
-}
-/**
- * setType - set our return type here
- */
-protected void setReturnType() {
-	String typeName = null;
-	try {
-		typeName = typeNameFromSignature(getSourceMethod().getReturnType());
-	} catch (JavaModelException npe) {
-		// name stays null and we carry on
+
+	protected void clearSource() {
+		sourceMethod = null;
 	}
-	if (typeName != null) {
+
+	protected JavaClass getContainingJavaClass() {
+		return ((Method) getTarget()).getContainingJavaClass();
+	}
+
+	/**
+	 * getParentType - return the IType which corresponds to our parent JavaClass we're going to do this a lot, so cache it.
+	 */
+	protected IType getParentType() {
+		if (parentType == null) {
+			Method targetMethod = (Method) getTarget();
+			JavaClass parentJavaClass = targetMethod.getContainingJavaClass();
+			JavaClassJDOMAdaptor pa = (JavaClassJDOMAdaptor) EcoreUtil.getAdapter(parentJavaClass.eAdapters(), ReadAdaptor.TYPE_KEY);
+			if (pa != null)
+				parentType = pa.getSourceType();
+		}
+		return parentType;
+	}
+
+	/**
+	 * getParmTypeSignatures - return an array of Strings (in Signature format) for our parameter types For reflection purposes, we can only rely on
+	 * our UUID, since our parms may not yet be known. see org.eclipse.jdt.core.SourceMapper.convertTypeNamesToSigs()
+	 */
+	protected String[] getParmTypeSignatures() {
 		Method javaMethodTarget = (Method) getTarget();
-		javaMethodTarget.setEType(createJavaClassRef(typeName));
+		String[] typeNames = getTypeNamesFromMethodID(((XMIResource) javaMethodTarget.eResource()).getID(javaMethodTarget));
+		if (typeNames == null)
+			return emptyStringArray;
+		int n = typeNames.length;
+		if (n == 0)
+			return emptyStringArray;
+		String[] typeSigs = new String[n];
+		try {
+			for (int i = 0; i < n; ++i) {
+				typeSigs[i] = Signature.createTypeSignature(new String(typeNames[i]), getParentType().isBinary());
+			}
+		} catch (IllegalArgumentException e) {
+			e.printStackTrace();
+		}
+		return typeSigs;
 	}
-}
-/**
- * Insert the method's description here.
- * Creation date: (10/3/2001 10:08:34 AM)
- * @param newSourceMethod org.eclipse.jdt.core.IMethod
- */
-public void setSourceMethod(org.eclipse.jdt.core.IMethod newSourceMethod) {
-	sourceMethod = newSourceMethod;
-}
-}
+
+	public Object getReflectionSource() {
+		return getSourceMethod();
+	}
+
+	/*
+	 * Used by Java Class JDOM adapter to create and set with a source method/
+	 */	
+	public void primSetMethod(IMethod method) {
+		sourceMethod = method;
+	}
+	/**
+	 * getsourceMethod - return the IMethod which describes our implementing method
+	 */
+	public IMethod getSourceMethod() {
+		if ((sourceMethod == null) || (!sourceMethod.exists())) {
+			try {
+				IType parent = this.getParentType();
+				if (parent != null) {
+					String[] parmNames = this.getParmTypeSignatures();
+					sourceMethod = JDOMSearchHelper.searchForMatchingMethod(parent, ((Method) getTarget()).getName(), parmNames);
+				}
+			} catch (JavaModelException e) {
+				//do nothing
+			}
+		}
+		return sourceMethod;
+	}
+
+	protected IType getType() {
+		return getParentType();
+	}
+
+	protected Map getTypeResolutionCache() {
+		Method method = (Method) getTarget();
+		if (method != null) {
+			JavaClass javaClass = method.getJavaClass();
+			if (javaClass != null) {
+				JDOMAdaptor classAdaptor = (JDOMAdaptor) retrieveAdaptorFrom(javaClass);
+				if (classAdaptor != null)
+					return classAdaptor.getTypeResolutionCache();
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * getValueIn method comment.
+	 */
+	public Object getValueIn(EObject object, EObject attribute) {
+		// At this point, this adapter does not dynamically compute any values,
+		// all values are pushed back into the target on the initial call.
+		return super.getValueIn(object, attribute);
+	}
+
+	/**
+	 * reflectValues - template method, subclasses override to pump values into target. on entry: UUID, name, containing package (and qualified name),
+	 * and document must be set. Method adaptor: - set modifiers - set name - set return type - add parameters - add exceptions
+	 */
+	public boolean reflectValues() {
+		if (getSourceProject() != null && getSourceMethod() != null && sourceMethod.exists()) {
+			setGeneratedFlag();
+			setModifiers();
+			setNaming();
+			setReturnType();
+			addParameters();
+			addExceptions();
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Set the generated flag if @generated is found in the source.
+	 */
+	protected void setGeneratedFlag() {
+		Method methodTarget = (Method) getTarget();
+		try {
+			String source = getSourceMethod().getSource();
+			if (source != null) {
+				int index = source.indexOf(Method.GENERATED_COMMENT_TAG);
+				if (index > 0)
+					methodTarget.setIsGenerated(true);
+			}
+		} catch (JavaModelException npe) {
+			//System.out.println(ResourceHandler.getString("Error_Setting_GenFlag_ERROR_", new Object[]
+			// {((XMIResource)methodTarget.eResource()).getID(methodTarget), npe.getMessage()})); //$NON-NLS-1$ = "error setting the generated flag on
+			// {0}, exception: {1}"
+		}
+	}
+
+	/**
+	 * setModifiers - set the attribute values related to modifiers here
+	 */
+	protected void setModifiers() {
+		Method methodTarget = (Method) getTarget();
+		try {
+			methodTarget.setFinal(Flags.isFinal(getSourceMethod().getFlags()));
+			methodTarget.setNative(Flags.isNative(getSourceMethod().getFlags()));
+			methodTarget.setStatic(Flags.isStatic(getSourceMethod().getFlags()));
+			methodTarget.setSynchronized(Flags.isSynchronized(getSourceMethod().getFlags()));
+			methodTarget.setConstructor(getSourceMethod().isConstructor());
+
+			JavaClass javaClass = getContainingJavaClass();
+			//Set abstract
+			if (javaClass.getKind().getValue() == TypeKind.INTERFACE)
+				methodTarget.setAbstract(true);
+			else
+				methodTarget.setAbstract(Flags.isAbstract(getSourceMethod().getFlags()));
+			// Set visibility
+			if (javaClass.getKind().getValue() == TypeKind.INTERFACE || Flags.isPublic(getSourceMethod().getFlags()))
+				methodTarget.setJavaVisibility(JavaVisibilityKind.PUBLIC_LITERAL);
+			else if (Flags.isPrivate(getSourceMethod().getFlags()))
+				methodTarget.setJavaVisibility(JavaVisibilityKind.PRIVATE_LITERAL);
+			else if (Flags.isProtected(getSourceMethod().getFlags()))
+				methodTarget.setJavaVisibility(JavaVisibilityKind.PROTECTED_LITERAL);
+			else
+				//Visibility must be package
+				methodTarget.setJavaVisibility(JavaVisibilityKind.PACKAGE_LITERAL);
+		} catch (JavaModelException npe) {
+			System.out
+					.println(ResourceHandler
+							.getString(
+									"Error_Introspecting_Flags_ERROR_", (new Object[] { ((XMIResource) methodTarget.eResource()).getID(methodTarget), npe.getMessage()}))); //$NON-NLS-1$ = "error introspecting flags on {0}, exception: {1}"
+		}
+	}
+
+	/**
+	 * setNaming - set the naming values here - qualified name must be set first, that is the path to the real Java class - ID - name-based UUID
+	 */
+	protected void setNaming() {
+		//
+		//	naming is currently a no-op since the name and UUID must be set prior to reflection
+		//	...and ID is redundant with UUID.
+		//	javaFieldTarget.setID(parent.getQualifiedName() + "_" + javaFieldTarget.getName());
+	}
+
+	/**
+	 * setType - set our return type here
+	 */
+	protected void setReturnType() {
+		String typeName = null;
+		try {
+			typeName = typeNameFromSignature(getSourceMethod().getReturnType());
+		} catch (JavaModelException npe) {
+			// name stays null and we carry on
+		}
+		if (typeName != null) {
+			Method javaMethodTarget = (Method) getTarget();
+			javaMethodTarget.setEType(createJavaClassRef(typeName));
+		}
+	}
+
+	/**
+	 * Insert the method's description here. Creation date: (10/3/2001 10:08:34 AM)
+	 * 
+	 * @param newSourceMethod
+	 *            org.eclipse.jdt.core.IMethod
+	 */
+	public void setSourceMethod(org.eclipse.jdt.core.IMethod newSourceMethod) {
+		sourceMethod = newSourceMethod;
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaClassAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaClassAdaptor.java
index 23f6985..bb9e235 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaClassAdaptor.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaClassAdaptor.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: IJavaClassAdaptor.java,v $
- *  $Revision: 1.1 $  $Date: 2003/10/27 17:12:30 $ 
+ *  $Revision: 1.2 $  $Date: 2004/06/16 20:49:21 $ 
  */
 /**
  * Insert the type's description here.
@@ -28,6 +28,22 @@
  * Return true if the sourceType can be found.
  */
 boolean sourceTypeExists() ;
+
+/**
+ * Reflect the fields
+ * @return <code>true</code> if reflection occurred.
+ * 
+ * @since 1.0.0
+ */
+boolean reflectFieldsIfNecessary();	
+
+/**
+ * Reflect the methods.
+ * @return <code>true</code> if reflection occurred.
+ * 
+ * @since 1.0.0
+ */
+boolean reflectMethodsIfNecessary();
 }
 
 
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaArrayTypeReflectionAdapter.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaArrayTypeReflectionAdapter.java
index 49e798d..7adf6db 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaArrayTypeReflectionAdapter.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaArrayTypeReflectionAdapter.java
@@ -10,7 +10,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaArrayTypeReflectionAdapter.java,v $
- *  $Revision: 1.1 $  $Date: 2004/05/05 21:03:07 $ 
+ *  $Revision: 1.2 $  $Date: 2004/06/16 20:49:21 $ 
  */
 package org.eclipse.jem.internal.java.adapters;
 
@@ -22,30 +22,30 @@
 import org.eclipse.jem.java.*;
 import org.eclipse.jem.java.impl.ArrayTypeImpl;
 
- 
-
 /**
- * Array type reflection adapter. 
- * Since arrays are very constant we don't need any fancy reflection to the source type (class object).
- * It really doesn't do anything. It is just here so that it exists. Everything is constant or depends on
- * the final component type.
+ * Array type reflection adapter. Since arrays are very constant we don't need any fancy reflection to the source type (class object). It really
+ * doesn't do anything. It is just here so that it exists. Everything is constant or depends on the final component type.
  * 
  * @since 1.0.0
  */
-public class JavaArrayTypeReflectionAdapter extends JavaReflectionAdaptor {
-			
+public class JavaArrayTypeReflectionAdapter extends JavaReflectionAdaptor implements IJavaClassAdaptor {
+
 	public JavaArrayTypeReflectionAdapter(Notifier target) {
 		super(target);
 	}
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#getReflectionSource()
 	 */
 	public Object getReflectionSource() {
-		return null;	// There isn't any for arrays.
+		return null; // There isn't any for arrays.
 	}
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#hasReflectionSource()
 	 */
 	public boolean hasReflectionSource() {
@@ -54,10 +54,10 @@
 		JavaHelpers fc = jh.getFinalComponentType();
 		return (fc.isPrimitive() || ((JavaClass) fc).isExistingType());
 	}
-	
-	
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.eclipse.jem.internal.java.adapters.ReflectionAdaptor#reflectValues()
 	 */
 	public boolean reflectValues() {
@@ -77,7 +77,10 @@
 		list.add(JavaRefFactory.eINSTANCE.createClassRef("java.io.Serializable"));
 		return super.reflectValues();
 	}
-	/* (non-Javadoc)
+
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#flushReflectedValues(boolean)
 	 */
 	protected boolean flushReflectedValues(boolean clearCachedModelObject) {
@@ -85,4 +88,36 @@
 		at.getImplementsInterfacesGen().clear();
 		return true;
 	}
-}
+
+	/*
+	 *  (non-Javadoc)
+	 * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#isSourceTypeFromBinary()
+	 */
+	public boolean isSourceTypeFromBinary() {
+		return false;
+	}
+
+	/*
+	 *  (non-Javadoc)
+	 * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#reflectFieldsIfNecessary()
+	 */
+	public synchronized boolean reflectFieldsIfNecessary() {
+		return reflectValuesIfNecessary();
+	}
+
+	/*
+	 *  (non-Javadoc)
+	 * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#reflectMethodsIfNecessary()
+	 */
+	public synchronized boolean reflectMethodsIfNecessary() {
+		return reflectValuesIfNecessary();
+	}
+
+	/*
+	 *  (non-Javadoc)
+	 * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#sourceTypeExists()
+	 */
+	public boolean sourceTypeExists() {
+		return hasReflectionSource();
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdaptor.java
index 4afb597..1cf0176 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdaptor.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdaptor.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaReflectionAdaptor.java,v $
- *  $Revision: 1.4 $  $Date: 2004/02/24 19:33:42 $ 
+ *  $Revision: 1.5 $  $Date: 2004/06/16 20:49:21 $ 
  */
 import java.util.List;
 
@@ -196,7 +196,7 @@
 	return hasFlushed;
 }
 
-public Notification flushReflectedValuesIfNecessaryNoNotification(boolean clearCachedModelObject) {
+public synchronized Notification flushReflectedValuesIfNecessaryNoNotification(boolean clearCachedModelObject) {
 	if (!hasFlushed && !isFlushing) {
 		boolean isExisting = hasReflectionSource();
 		try {
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReflectionAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReflectionAdaptor.java
index 94e8e63..5cfea90 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReflectionAdaptor.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReflectionAdaptor.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: ReflectionAdaptor.java,v $
- *  $Revision: 1.3 $  $Date: 2004/02/24 19:33:42 $ 
+ *  $Revision: 1.4 $  $Date: 2004/06/16 20:49:21 $ 
  */
 import java.util.logging.Level;
 
@@ -116,11 +116,14 @@
 /**
  * Return a boolean indicating whether reflection had occurred.
  */
-public boolean reflectValuesIfNecessary() {
+public synchronized boolean reflectValuesIfNecessary() {
 	if (!hasReflected && !isReflecting) {
 		try {
 			isReflecting = true;
-			hasReflected = reflectValues();
+			if (!((EObject)getTarget()).eIsProxy())
+				hasReflected = reflectValues();
+			else
+				hasReflected = false;	// AS long we are a proxy, we won't reflect.
 		} catch (Throwable e) {
 			hasReflected = false;
 			Logger.getLogger().log(ResourceHandler.getString("Failed_reflecting_values_ERROR_"), Level.WARNING); //$NON-NLS-1$ = "Failed reflecting values!!!"
@@ -132,8 +135,10 @@
 	}
 	return hasReflected;
 }
-public static ReflectionAdaptor retrieveAdaptorFrom(EObject object) {	
-	return (ReflectionAdaptor)EcoreUtil.getRegisteredAdapter(object, ReadAdaptor.TYPE_KEY);
+public static ReflectionAdaptor retrieveAdaptorFrom(EObject object) {
+	synchronized (object) {
+		return (ReflectionAdaptor)EcoreUtil.getRegisteredAdapter(object, ReadAdaptor.TYPE_KEY);
+	}
 }
 }
 
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaClassJDKAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaClassJDKAdaptor.java
index 8dc84bd..8d53c3e 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaClassJDKAdaptor.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaClassJDKAdaptor.java
@@ -1,4 +1,3 @@
-package org.eclipse.jem.internal.java.adapters.jdk;
 /*******************************************************************************
  * Copyright (c) 2001, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
@@ -11,8 +10,11 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaClassJDKAdaptor.java,v $
- *  $Revision: 1.5 $  $Date: 2004/02/24 19:33:42 $ 
+ *  $Revision: 1.6 $  $Date: 2004/06/16 20:49:21 $ 
  */
+
+package org.eclipse.jem.internal.java.adapters.jdk;
+
 import java.util.List;
 import java.util.logging.Level;
 
@@ -29,280 +31,300 @@
 import org.eclipse.jem.java.impl.JavaClassImpl;
 
 /**
- * Insert the type's description here.
+ * Reflect the class using standard java.reflect methods.
  * Creation date: (6/6/2000 4:42:50 PM)
  * @author: Administrator
  */
 public class JavaClassJDKAdaptor extends JDKAdaptor implements IJavaClassAdaptor {
+
 	protected Class sourceType = null;
-public JavaClassJDKAdaptor(Notifier target, JavaJDKAdapterFactory anAdapterFactory) {
-	super(target, anAdapterFactory);
-}
-/**
- * addFields - reflect our fields
- */
-protected void addFields() {
-	XMIResource resource = (XMIResource) getJavaClassTarget().eResource();
-	List targetFields = getJavaClassTarget().getFieldsGen();
-	targetFields.clear();
-	java.lang.reflect.Field[] fields = {};
-	try { 
-		fields = getSourceType().getDeclaredFields();
-	} catch (NoClassDefFoundError error) {
-		System.out.println(ResourceHandler.getString("Could_Not_Reflect_Fields_ERROR_", new Object[] {getJavaClassTarget().getQualifiedName(), error.getMessage()})); //$NON-NLS-1$
-	}
-	for (int i = 0; i < fields.length; i++) {
-		targetFields.add(createJavaField(fields[i], resource));
-	}
-}
-/**
- * addMethods - reflect our methods
- */
-protected void addMethods() {
-	// We need to first do methods and then do constructors because the JDK treats them as two
-	// different objects, which the Java Model treats them as both Method's.
-	XMIResource resource = (XMIResource) getJavaClassTarget().eResource();
- 	List targetMethods = getJavaClassTarget().getMethodsGen();
-	targetMethods.clear();
-	java.lang.reflect.Method[] methods = {};
-	try {
-		methods = getSourceType().getDeclaredMethods();
-	} catch (NoClassDefFoundError error) {
-		Logger.getLogger().log(ResourceHandler.getString("Could_Not_Reflect_Methods_ERROR_", new Object[] {getJavaClassTarget().getQualifiedName(),  error.toString()}), Level.WARNING);  //$NON-NLS-1$
-	}
-	for (int i = 0; i < methods.length; i++) {
-		targetMethods.add(createJavaMethod(methods[i], resource));
-	}
-	
-	// Now do the constructors
-	java.lang.reflect.Constructor[] ctors = {};
-	try {
-		ctors = getSourceType().getDeclaredConstructors();
-	} catch (NoClassDefFoundError error) {
-		Logger.getLogger().log(ResourceHandler.getString("Could_Not_Reflect_Constructors_ERROR_", new Object[] {getJavaClassTarget().getQualifiedName(), error.getMessage()}), Level.WARNING);  //$NON-NLS-1$
-	}
-	for (int i = 0; i < ctors.length; i++) {
-		targetMethods.add(createJavaMethod(ctors[i], resource));
-	}
-	
-}
-/**
- * Clear the reflected fields list.
- */
-protected boolean flushFields() {
-	getJavaClassTarget().getFieldsGen().clear();
-	return true;
-}
-/**
- * Clear the implements list.
- */
-protected boolean flushImplements() {
-	getJavaClassTarget().getImplementsInterfacesGen().clear();
-	return true;
-}
-/**
- * Clear the reflected methods list.
- */
-protected boolean flushMethods() {
-	getJavaClassTarget().getMethodsGen().clear();
-	return true;
-}
-protected boolean flushInnerClasses() {
-	getJavaClassTarget().getDeclaredClassesGen().clear();
-	return true;
-}
-protected boolean flushModifiers() {
-	JavaClass javaClassTarget = (JavaClass) getTarget();
-	javaClassTarget.setAbstract(false);
-	javaClassTarget.setFinal(false);
-	javaClassTarget.setPublic(false);
-	javaClassTarget.setKind(TypeKind.UNDEFINED_LITERAL);
-	return true;
-}
 
-/**
- * @see org.eclipse.jem.java.adapters.JavaReflectionAdaptor#flushReflectedValues(boolean)
- */
-protected boolean flushReflectedValues(boolean clearCachedModelObject) {
-	boolean result = flushModifiers();
-	result &= flushSuper();
-	result &= flushImplements();
-	result &= flushMethods();
-	result &= flushFields();
-	result &= flushInnerClasses();
-	return result;
-}
-
-/**
- * @see org.eclipse.jem.java.adapters.JavaReflectionAdaptor#postFlushReflectedValuesIfNecessary()
- */
-protected void postFlushReflectedValuesIfNecessary(boolean isExisting) {
-	getJavaClassTarget().setReflected(false);
-	super.postFlushReflectedValuesIfNecessary(isExisting);
-}
-
-/**
- * Set the supertype to be null.
- */
-protected boolean flushSuper() {
-	List targetSupers = getJavaClassTarget().getESuperTypesGen();
-	targetSupers.clear();
-	return true;
-}
-/**
- * Return the target typed to a JavaClass.
- */
-protected JavaClassImpl getJavaClassTarget() {
-	return (JavaClassImpl) getTarget();
-}
-public Object getReflectionSource() {
-	return getSourceType();
-}
-/**
- * getSourceType - return the java.lang.Class which describes our existing Java class
- */
-protected Class getSourceType() {
-	if (sourceType == null) {
-		sourceType = getType((JavaClass) getTarget());
+	public JavaClassJDKAdaptor(Notifier target, JavaJDKAdapterFactory anAdapterFactory) {
+		super(target, anAdapterFactory);
 	}
-	return sourceType;
-}
-/**
- * getValueIn method comment.
- */
-public Object getValueIn(EObject object, EObject attribute) {
-	// At this point, this adapter does not dynamically compute any values,
-	// all values are pushed back into the target on the initial call.
-	return super.getValueIn(object, attribute);
-}
-/**
- * Return true if the sourceType is null or if
- * it is a binary type.
- * Reflection from the JDK is always from binary.
- */
-public boolean isSourceTypeFromBinary() {
-	return true;
-}
-/**
- * reflectValues - template method, subclasses override to pump values into target.
- * on entry: name, containing package (and qualified name), and document must be set.
- * Return true if successful
- * JavaClass adaptor:
- *	- set modifiers
- *	- set name
- * 	- set reference to super
- * 	- create methods
- * 	- create fields
- *	- add imports
- */
-public boolean reflectValues() {
-	super.reflectValues();
-	try {
-		if (getSourceType() != null) {
-			setModifiers();
-			setNaming();
-			try {
-				setSuper();
-			} catch (InheritanceCycleException e) {
-				Logger.getLogger().log(e);
-			}
-			setImplements();
-			addMethods();
-			addFields();
-			reflectInnerClasses();
-			getAdapterFactory().registerReflection(getSourceType().getName(), this);			
-			//	addImports();
-			return true;
+
+	/**
+	 * addFields - reflect our fields
+	 */
+	protected void addFields() {
+		XMIResource resource = (XMIResource) getJavaClassTarget().eResource();
+		List targetFields = getJavaClassTarget().getFieldsGen();
+		targetFields.clear();
+		java.lang.reflect.Field[] fields = {};
+		try {
+			fields = getSourceType().getDeclaredFields();
+		} catch (NoClassDefFoundError error) {
+			System.out.println(ResourceHandler.getString(
+					"Could_Not_Reflect_Fields_ERROR_", new Object[] { getJavaClassTarget().getQualifiedName(), error.getMessage()})); //$NON-NLS-1$
 		}
-		return false;
-	} finally {
-		//Don't cache the class beyond the operation of reflect values; 
-		//this enables dynamic swapping of the alternate class loader
-		//for java reflection, as well as avoids potential memory leakage
-		sourceType = null;
-	}
-}
-/**
- * 
- */
-protected void reflectInnerClasses() {
-	Class[] innerClasses = getSourceType().getClasses();
-	if (innerClasses.length != 0) {
-		List declaredClasses = getJavaClassTarget().getDeclaredClassesGen();
-		JavaClass inner;
-		ResourceSet set = getTargetResource().getResourceSet();
-		for (int i = 0; i < innerClasses.length; i++) {
-			inner = (JavaClass) JavaRefFactory.eINSTANCE.reflectType(innerClasses[i].getName(), set);
-			declaredClasses.add(inner);
+		for (int i = 0; i < fields.length; i++) {
+			targetFields.add(createJavaField(fields[i], resource));
 		}
 	}
-	
-}
-/**
- * setImplements - set our implemented/super interfaces here
- * For an interface, these are superclasses.
- * For a class, these are implemented interfaces.
- */
-protected void setImplements() {
-	Class[] interfaces = getSourceType().getInterfaces();
-	// needs work, the names above will be simple names if we are relfecting from a source file
-	JavaClassImpl javaClassTarget = (JavaClassImpl) getTarget();
-	JavaClass ref;
-	List intList = javaClassTarget.getImplementsInterfacesGen();
-	intList.clear();
-	for (int i = 0; i < interfaces.length; i++) {
-		ref = createJavaClassRef(interfaces[i].getName());
-		intList.add(ref);
+
+	/**
+	 * addMethods - reflect our methods
+	 */
+	protected void addMethods() {
+		// We need to first do methods and then do constructors because the JDK treats them as two
+		// different objects, which the Java Model treats them as both Method's.
+		XMIResource resource = (XMIResource) getJavaClassTarget().eResource();
+		List targetMethods = getJavaClassTarget().getMethodsGen();
+		targetMethods.clear();
+		java.lang.reflect.Method[] methods = {};
+		try {
+			methods = getSourceType().getDeclaredMethods();
+		} catch (NoClassDefFoundError error) {
+			Logger
+					.getLogger()
+					.log(
+							ResourceHandler.getString(
+									"Could_Not_Reflect_Methods_ERROR_", new Object[] { getJavaClassTarget().getQualifiedName(), error.toString()}), Level.WARNING); //$NON-NLS-1$
+		}
+		for (int i = 0; i < methods.length; i++) {
+			targetMethods.add(createJavaMethod(methods[i], resource));
+		}
+
+		// Now do the constructors
+		java.lang.reflect.Constructor[] ctors = {};
+		try {
+			ctors = getSourceType().getDeclaredConstructors();
+		} catch (NoClassDefFoundError error) {
+			Logger
+					.getLogger()
+					.log(
+							ResourceHandler
+									.getString(
+											"Could_Not_Reflect_Constructors_ERROR_", new Object[] { getJavaClassTarget().getQualifiedName(), error.getMessage()}), Level.WARNING); //$NON-NLS-1$
+		}
+		for (int i = 0; i < ctors.length; i++) {
+			targetMethods.add(createJavaMethod(ctors[i], resource));
+		}
+
 	}
-}
-/**
- * setModifiers - set the attribute values related to modifiers here
- */
-protected void setModifiers() {
-	JavaClass javaClassTarget = (JavaClass) getTarget();
-	javaClassTarget.setAbstract(java.lang.reflect.Modifier.isAbstract(getSourceType().getModifiers()));
-	javaClassTarget.setFinal(java.lang.reflect.Modifier.isFinal(getSourceType().getModifiers()));
-	javaClassTarget.setPublic(java.lang.reflect.Modifier.isPublic(getSourceType().getModifiers()));
-	// Set type to class or interface, not yet handling EXCEPTION
-	if (getSourceType().isInterface())
-		javaClassTarget.setKind(TypeKind.INTERFACE_LITERAL);
-	else
-		javaClassTarget.setKind(TypeKind.CLASS_LITERAL);
-}
-/**
- * setNaming - set the naming values here
- * 	- qualified name (package name + name) must be set first, that is the path to the real Java class
- *	- ID - simple name, identity within a package document
- * 	- NO UUID!!!
- */
-protected void setNaming() {
-//	JavaClass javaClassTarget = (JavaClass) getTarget();
-//	javaClassTarget.refSetUUID((String) null);
-//	((XMIResource)javaClassTarget.eResource()).setID(javaClassTarget,getSimpleName(getSourceType().getName()));
-}
-/**
- * setSuper - set our supertype here, implemented interface are handled separately
- */
-protected void setSuper() throws InheritanceCycleException {
-	Class superClass = null;
-	superClass = getSourceType().getSuperclass();
-	if (superClass != null) {
+
+	/**
+	 * Clear the reflected fields list.
+	 */
+	protected boolean flushFields() {
+		getJavaClassTarget().getFieldsGen().clear();
+		return true;
+	}
+
+	/**
+	 * Clear the implements list.
+	 */
+	protected boolean flushImplements() {
+		getJavaClassTarget().getImplementsInterfacesGen().clear();
+		return true;
+	}
+
+	/**
+	 * Clear the reflected methods list.
+	 */
+	protected boolean flushMethods() {
+		getJavaClassTarget().getMethodsGen().clear();
+		return true;
+	}
+
+	protected boolean flushInnerClasses() {
+		getJavaClassTarget().getDeclaredClassesGen().clear();
+		return true;
+	}
+
+	protected boolean flushModifiers() {
 		JavaClass javaClassTarget = (JavaClass) getTarget();
-		javaClassTarget.setSupertype(createJavaClassRef(superClass.getName()));
+		javaClassTarget.setAbstract(false);
+		javaClassTarget.setFinal(false);
+		javaClassTarget.setPublic(false);
+		javaClassTarget.setKind(TypeKind.UNDEFINED_LITERAL);
+		return true;
+	}
+
+	/**
+	 * @see org.eclipse.jem.java.adapters.JavaReflectionAdaptor#flushReflectedValues(boolean)
+	 */
+	protected boolean flushReflectedValues(boolean clearCachedModelObject) {
+		boolean result = flushModifiers();
+		result &= flushSuper();
+		result &= flushImplements();
+		result &= flushMethods();
+		result &= flushFields();
+		result &= flushInnerClasses();
+		return result;
+	}
+
+	/**
+	 * @see org.eclipse.jem.java.adapters.JavaReflectionAdaptor#postFlushReflectedValuesIfNecessary()
+	 */
+	protected void postFlushReflectedValuesIfNecessary(boolean isExisting) {
+		getJavaClassTarget().setReflected(false);
+		super.postFlushReflectedValuesIfNecessary(isExisting);
+	}
+
+	/**
+	 * Set the supertype to be null.
+	 */
+	protected boolean flushSuper() {
+		List targetSupers = getJavaClassTarget().getESuperTypesGen();
+		targetSupers.clear();
+		return true;
+	}
+
+	/**
+	 * Return the target typed to a JavaClass.
+	 */
+	protected JavaClassImpl getJavaClassTarget() {
+		return (JavaClassImpl) getTarget();
+	}
+
+	public Object getReflectionSource() {
+		return getSourceType();
+	}
+
+	/**
+	 * getSourceType - return the java.lang.Class which describes our existing Java class
+	 */
+	protected Class getSourceType() {
+		if (sourceType == null) {
+			sourceType = getType((JavaClass) getTarget());
+		}
+		return sourceType;
+	}
+
+	/**
+	 * getValueIn method comment.
+	 */
+	public Object getValueIn(EObject object, EObject attribute) {
+		// At this point, this adapter does not dynamically compute any values,
+		// all values are pushed back into the target on the initial call.
+		return super.getValueIn(object, attribute);
+	}
+
+	/**
+	 * Return true if the sourceType is null or if it is a binary type. Reflection from the JDK is always from binary.
+	 */
+	public boolean isSourceTypeFromBinary() {
+		return true;
+	}
+
+	/**
+	 * reflectValues - template method, subclasses override to pump values into target. on entry: name, containing package (and qualified name), and
+	 * document must be set. Return true if successful JavaClass adaptor: - set modifiers - set name - set reference to super - create methods -
+	 * create fields - add imports
+	 */
+	public boolean reflectValues() {
+		super.reflectValues();
+		try {
+			if (getSourceType() != null) {
+				setModifiers();
+				setNaming();
+				try {
+					setSuper();
+				} catch (InheritanceCycleException e) {
+					Logger.getLogger().log(e);
+				}
+				setImplements();
+				addMethods();
+				addFields();
+				reflectInnerClasses();
+				getAdapterFactory().registerReflection(getSourceType().getName(), this);
+				//	addImports();
+				return true;
+			}
+			return false;
+		} finally {
+			//Don't cache the class beyond the operation of reflect values;
+			//this enables dynamic swapping of the alternate class loader
+			//for java reflection, as well as avoids potential memory leakage
+			sourceType = null;
+		}
+	}
+
+	/**
+	 *  
+	 */
+	protected void reflectInnerClasses() {
+		Class[] innerClasses = getSourceType().getClasses();
+		if (innerClasses.length != 0) {
+			List declaredClasses = getJavaClassTarget().getDeclaredClassesGen();
+			JavaClass inner;
+			ResourceSet set = getTargetResource().getResourceSet();
+			for (int i = 0; i < innerClasses.length; i++) {
+				inner = (JavaClass) JavaRefFactory.eINSTANCE.reflectType(innerClasses[i].getName(), set);
+				declaredClasses.add(inner);
+			}
+		}
+
+	}
+
+	/**
+	 * setImplements - set our implemented/super interfaces here For an interface, these are superclasses. For a class, these are implemented
+	 * interfaces.
+	 */
+	protected void setImplements() {
+		Class[] interfaces = getSourceType().getInterfaces();
+		// needs work, the names above will be simple names if we are relfecting from a source file
+		JavaClassImpl javaClassTarget = (JavaClassImpl) getTarget();
+		JavaClass ref;
+		List intList = javaClassTarget.getImplementsInterfacesGen();
+		intList.clear();
+		for (int i = 0; i < interfaces.length; i++) {
+			ref = createJavaClassRef(interfaces[i].getName());
+			intList.add(ref);
+		}
+	}
+
+	/**
+	 * setModifiers - set the attribute values related to modifiers here
+	 */
+	protected void setModifiers() {
+		JavaClass javaClassTarget = (JavaClass) getTarget();
+		javaClassTarget.setAbstract(java.lang.reflect.Modifier.isAbstract(getSourceType().getModifiers()));
+		javaClassTarget.setFinal(java.lang.reflect.Modifier.isFinal(getSourceType().getModifiers()));
+		javaClassTarget.setPublic(java.lang.reflect.Modifier.isPublic(getSourceType().getModifiers()));
+		// Set type to class or interface, not yet handling EXCEPTION
+		if (getSourceType().isInterface())
+			javaClassTarget.setKind(TypeKind.INTERFACE_LITERAL);
+		else
+			javaClassTarget.setKind(TypeKind.CLASS_LITERAL);
+	}
+
+	/**
+	 * setNaming - set the naming values here - qualified name (package name + name) must be set first, that is the path to the real Java class - ID -
+	 * simple name, identity within a package document - NO UUID!!!
+	 */
+	protected void setNaming() {
+		//	JavaClass javaClassTarget = (JavaClass) getTarget();
+		//	javaClassTarget.refSetUUID((String) null);
+		//	((XMIResource)javaClassTarget.eResource()).setID(javaClassTarget,getSimpleName(getSourceType().getName()));
+	}
+
+	/**
+	 * setSuper - set our supertype here, implemented interface are handled separately
+	 */
+	protected void setSuper() throws InheritanceCycleException {
+		Class superClass = null;
+		superClass = getSourceType().getSuperclass();
+		if (superClass != null) {
+			JavaClass javaClassTarget = (JavaClass) getTarget();
+			javaClassTarget.setSupertype(createJavaClassRef(superClass.getName()));
+		}
+	}
+
+	/**
+	 * Return true if the sourceType can be found.
+	 */
+	public boolean sourceTypeExists() {
+		return getSourceType() != null;
+	}
+
+	public boolean reflectFieldsIfNecessary() {
+		return reflectValuesIfNecessary();
+	}
+
+	public boolean reflectMethodsIfNecessary() {
+		return reflectValuesIfNecessary();
 	}
 }
-/**
- * Return true if the sourceType can be found.
- */
-public boolean sourceTypeExists() {
-	return getSourceType() != null;
-}
-}
-
-
-
-
-
-
-
 
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/FieldImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/FieldImpl.java
index 0f94128..55b5833 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/FieldImpl.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/FieldImpl.java
@@ -1,4 +1,3 @@
-package org.eclipse.jem.java.impl;
 /*******************************************************************************
  * Copyright (c)  2001, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
@@ -11,8 +10,10 @@
  *******************************************************************************/
 /*
  *  $RCSfile: FieldImpl.java,v $
- *  $Revision: 1.3 $  $Date: 2004/01/14 00:16:44 $ 
+ *  $Revision: 1.4 $  $Date: 2004/06/16 20:49:21 $ 
  */
+package org.eclipse.jem.java.impl;
+
 import java.util.Collection;
 
 import org.eclipse.emf.common.notify.Notification;
@@ -42,7 +43,7 @@
 /**
  * @generated
  */
-public class FieldImpl extends ETypedElementImpl implements Field{
+public class FieldImpl extends ETypedElementImpl implements Field {
 
 	/**
 	 * The default value of the '{@link #isFinal() <em>Final</em>}' attribute.
@@ -94,11 +95,11 @@
 	 */
 	protected static final JavaVisibilityKind JAVA_VISIBILITY_EDEFAULT = JavaVisibilityKind.PUBLIC_LITERAL;
 
-
 	/**
 	 * @generated This field/method will be replaced during code generation.
 	 */
 	protected JavaVisibilityKind javaVisibility = JAVA_VISIBILITY_EDEFAULT;
+
 	/**
 	 * The default value of the '{@link #isTransient() <em>Transient</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -152,6 +153,7 @@
 	protected FieldImpl() {
 		super();
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -162,65 +164,98 @@
 	}
 
 	/**
-	 * createFieldRef - return a JavaURL reference to the named field in the named Java class
-	 * 		in the form "package.class_field"
+	 * createFieldRef - return a JavaURL reference to the named field in the named Java class in the form "package.class_field"
 	 */
-  public static Field createFieldRef(String className, String fieldName) {
-    Field ref = JavaRefFactoryImpl.getActiveFactory().createField();
-    JavaURL javaurl = new JavaURL(className + "/" + fieldName);
-    ((InternalEObject) ref).eSetProxyURI(URI.createURI(javaurl.getFullString()));
-    return ref;    
-  }
+	public static Field createFieldRef(String className, String fieldName) {
+		Field ref = JavaRefFactoryImpl.getActiveFactory().createField();
+		JavaURL javaurl = new JavaURL(className + "/" + fieldName);
+		((InternalEObject) ref).eSetProxyURI(URI.createURI(javaurl.getFullString()));
+		return ref;
+	}
+
 	/**
 	 * Get the class that this field is within.
 	 */
 	public JavaClass getContainingJavaClass() {
 		return (JavaClass) this.getJavaClass();
 	}
+
 	/**
 	 * Overrides to perform lazy initializations/reflection.
 	 */
 	public EClassifier getEType() {
-    if (!hasReflected) reflectValues();
-    return super.getEType();
-  }
-  public Block getInitializer() {
-    if (!hasReflected) reflectValues();
-    return getInitializerGen();
-  }
-  public boolean isFinal() {
-    if (!hasReflected) reflectValues();
-    return isFinalGen();
-  }
-  public boolean isStatic() {
-    if (!hasReflected) reflectValues();
-    return isStaticGen();
-  }
-	public JavaHelpers getJavaType() {
-		return (JavaHelpers)getEType();
+		reflectValues();
+		return super.getEType();
 	}
- public JavaVisibilityKind getJavaVisibility() {
-    if (!hasReflected) reflectValues();
-    return getJavaVisibilityGen();
-  }
-protected ReadAdaptor getReadAdaptor() {
-    return (ReadAdaptor)EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY);
-  }
 
-//FB   protected Object getReadAdaptorValue(EObject attribute) {
-//FB     if (getReadAdaptor() != null)
-//FB       return readAdaptor.getValueIn(this, attribute);
-//FB     return null;
-//FB   }
+	public Block getInitializer() {
+		reflectValues();
+		return getInitializerGen();
+	}
 
-//FB BEGIN
-  protected boolean hasReflected = false;
+	public boolean isFinal() {
+		reflectValues();
+		return isFinalGen();
+	}
 
-  protected void reflectValues()
-  {
-    ReadAdaptor readAdaptor = getReadAdaptor();
-    if (readAdaptor != null) hasReflected = readAdaptor.reflectValuesIfNecessary();
-  }
+	public boolean isStatic() {
+		reflectValues();
+		return isStaticGen();
+	}
+
+	public boolean isTransient() {
+		reflectValues();
+		return isTransientGen();
+	}
+	
+	public boolean isVolatile() {
+		reflectValues();
+		return isVolatileGen();
+	}	
+
+	public JavaHelpers getJavaType() {
+		return (JavaHelpers) getEType();
+	}
+
+	public JavaVisibilityKind getJavaVisibility() {
+		reflectValues();
+		return getJavaVisibilityGen();
+	}
+
+	protected synchronized ReadAdaptor getReadAdapter() {
+		return (ReadAdaptor) EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY);
+	}
+
+	protected boolean hasReflected = false;
+
+	protected void reflectValues() {
+		// We only want the testing of the hasReflected and get readadapter to be sync(this) so that
+		// it is short and no deadlock possibility (this is because the the method reflection adapter may go
+		// back to the containing java class to get its reflection adapter, which would lock on itself. So
+		// we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work
+		// during the sync.
+		ReadAdaptor readAdaptor = null;
+		synchronized (this) {
+			if (!hasReflected) {
+				readAdaptor = getReadAdapter();
+			}
+		}
+		if (readAdaptor != null) {
+			boolean setReflected = readAdaptor.reflectValuesIfNecessary();
+			synchronized (this) {
+				// Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race.
+				if (setReflected)
+					hasReflected = setReflected;
+			}
+		}
+	}
+
+	/*
+	 * Used by reflection adapter to clear the reflection. This not intended to be used by others.
+	 */
+	public synchronized void setReflected(boolean reflected) {
+		hasReflected = reflected;
+	}
 
 	/**
 	 * Is this field an array type.
@@ -232,37 +267,39 @@
 	/**
 	 * Overridden to prevent the reflection of the class.
 	 */
-  public EList eContents() {
-    EList results = new BasicEList();
-//FB  
-//FB    EList containments = eClass().getEAllContainments();
-//FB    if (containments != null) {
-//FB      Iterator i = containments.iterator();
-//FB      while (i.hasNext()) {
-//FB        EStructuralFeature sf = (EStructuralFeature) i.next();
-//FB        //Change from super to primRefValue
-//FB        Object value = primRefValue(sf);
-//FB        //EndChange
-//FB        if (value != null)
-//FB          if (sf.isMany())
-//FB            results.addAll((Collection) value);
-//FB          else
-//FB            results.add(value);
-//FB      }
-//FB    }
-    if (getInitializerGen() != null) results.add(getInitializerGen()); //FB
-    return results;
-  }
+	public EList eContents() {
+		EList results = new BasicEList();
+		//FB
+		//FB EList containments = eClass().getEAllContainments();
+		//FB if (containments != null) {
+		//FB Iterator i = containments.iterator();
+		//FB while (i.hasNext()) {
+		//FB EStructuralFeature sf = (EStructuralFeature) i.next();
+		//FB //Change from super to primRefValue
+		//FB Object value = primRefValue(sf);
+		//FB //EndChange
+		//FB if (value != null)
+		//FB if (sf.isMany())
+		//FB results.addAll((Collection) value);
+		//FB else
+		//FB results.add(value);
+		//FB }
+		//FB }
+		if (getInitializerGen() != null)
+			results.add(getInitializerGen()); //FB
+		return results;
+	}
 
 	public String toString() {
 		return getClass().getName() + " " + "(" + getName() + ")";
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public JavaVisibilityKind getJavaVisibilityGen() {
+	public JavaVisibilityKind getJavaVisibilityGen() {
 		return javaVisibility;
 	}
 
@@ -321,7 +358,7 @@
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public boolean isTransient() {
+	public boolean isTransientGen() {
 		return transient_;
 	}
 
@@ -342,7 +379,7 @@
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public boolean isVolatile() {
+	public boolean isVolatileGen() {
 		return volatile_;
 	}
 
@@ -362,8 +399,9 @@
 	 * @generated This field/method will be replaced during code generation 
 	 */
 	public JavaClass getJavaClass() {
-		if (eContainerFeatureID != JavaRefPackage.FIELD__JAVA_CLASS) return null;
-		return (JavaClass)eContainer;
+		if (eContainerFeatureID != JavaRefPackage.FIELD__JAVA_CLASS)
+			return null;
+		return (JavaClass) eContainer;
 	}
 
 	/**
@@ -379,11 +417,11 @@
 			if (eContainer != null)
 				msgs = eBasicRemoveFromContainer(msgs);
 			if (newJavaClass != null)
-				msgs = ((InternalEObject)newJavaClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__FIELDS, JavaClass.class, msgs);
-			msgs = eBasicSetContainer((InternalEObject)newJavaClass, JavaRefPackage.FIELD__JAVA_CLASS, msgs);
-			if (msgs != null) msgs.dispatch();
-		}
-		else if (eNotificationRequired())
+				msgs = ((InternalEObject) newJavaClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__FIELDS, JavaClass.class, msgs);
+			msgs = eBasicSetContainer((InternalEObject) newJavaClass, JavaRefPackage.FIELD__JAVA_CLASS, msgs);
+			if (msgs != null)
+				msgs.dispatch();
+		} else if (eNotificationRequired())
 			eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__JAVA_CLASS, newJavaClass, newJavaClass));
 	}
 
@@ -435,46 +473,46 @@
 		switch (eDerivedStructuralFeatureID(eFeature)) {
 			case JavaRefPackage.FIELD__EANNOTATIONS:
 				getEAnnotations().clear();
-				getEAnnotations().addAll((Collection)newValue);
+				getEAnnotations().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.FIELD__NAME:
-				setName((String)newValue);
+				setName((String) newValue);
 				return;
 			case JavaRefPackage.FIELD__ORDERED:
-				setOrdered(((Boolean)newValue).booleanValue());
+				setOrdered(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.FIELD__UNIQUE:
-				setUnique(((Boolean)newValue).booleanValue());
+				setUnique(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.FIELD__LOWER_BOUND:
-				setLowerBound(((Integer)newValue).intValue());
+				setLowerBound(((Integer) newValue).intValue());
 				return;
 			case JavaRefPackage.FIELD__UPPER_BOUND:
-				setUpperBound(((Integer)newValue).intValue());
+				setUpperBound(((Integer) newValue).intValue());
 				return;
 			case JavaRefPackage.FIELD__ETYPE:
-				setEType((EClassifier)newValue);
+				setEType((EClassifier) newValue);
 				return;
 			case JavaRefPackage.FIELD__FINAL:
-				setFinal(((Boolean)newValue).booleanValue());
+				setFinal(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.FIELD__STATIC:
-				setStatic(((Boolean)newValue).booleanValue());
+				setStatic(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.FIELD__JAVA_VISIBILITY:
-				setJavaVisibility((JavaVisibilityKind)newValue);
+				setJavaVisibility((JavaVisibilityKind) newValue);
 				return;
 			case JavaRefPackage.FIELD__TRANSIENT:
-				setTransient(((Boolean)newValue).booleanValue());
+				setTransient(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.FIELD__VOLATILE:
-				setVolatile(((Boolean)newValue).booleanValue());
+				setVolatile(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.FIELD__JAVA_CLASS:
-				setJavaClass((JavaClass)newValue);
+				setJavaClass((JavaClass) newValue);
 				return;
 			case JavaRefPackage.FIELD__INITIALIZER:
-				setInitializer((Block)newValue);
+				setInitializer((Block) newValue);
 				return;
 		}
 		eDynamicSet(eFeature, newValue);
@@ -504,7 +542,7 @@
 				setUpperBound(UPPER_BOUND_EDEFAULT);
 				return;
 			case JavaRefPackage.FIELD__ETYPE:
-				setEType((EClassifier)null);
+				setEType((EClassifier) null);
 				return;
 			case JavaRefPackage.FIELD__FINAL:
 				setFinal(FINAL_EDEFAULT);
@@ -522,10 +560,10 @@
 				setVolatile(VOLATILE_EDEFAULT);
 				return;
 			case JavaRefPackage.FIELD__JAVA_CLASS:
-				setJavaClass((JavaClass)null);
+				setJavaClass((JavaClass) null);
 				return;
 			case JavaRefPackage.FIELD__INITIALIZER:
-				setInitializer((Block)null);
+				setInitializer((Block) null);
 				return;
 		}
 		eDynamicUnset(eFeature);
@@ -547,8 +585,12 @@
 		Block oldInitializer = initializer;
 		initializer = newInitializer;
 		if (eNotificationRequired()) {
-			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__INITIALIZER, oldInitializer, newInitializer);
-			if (msgs == null) msgs = notification; else msgs.add(notification);
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__INITIALIZER, oldInitializer,
+					newInitializer);
+			if (msgs == null)
+				msgs = notification;
+			else
+				msgs.add(notification);
 		}
 		return msgs;
 	}
@@ -562,13 +604,13 @@
 		if (newInitializer != initializer) {
 			NotificationChain msgs = null;
 			if (initializer != null)
-				msgs = ((InternalEObject)initializer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaRefPackage.FIELD__INITIALIZER, null, msgs);
+				msgs = ((InternalEObject) initializer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaRefPackage.FIELD__INITIALIZER, null, msgs);
 			if (newInitializer != null)
-				msgs = ((InternalEObject)newInitializer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaRefPackage.FIELD__INITIALIZER, null, msgs);
+				msgs = ((InternalEObject) newInitializer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaRefPackage.FIELD__INITIALIZER, null, msgs);
 			msgs = basicSetInitializer(newInitializer, msgs);
-			if (msgs != null) msgs.dispatch();
-		}
-		else if (eNotificationRequired())
+			if (msgs != null)
+				msgs.dispatch();
+		} else if (eNotificationRequired())
 			eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__INITIALIZER, newInitializer, newInitializer));
 	}
 
@@ -581,7 +623,7 @@
 		if (featureID >= 0) {
 			switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 				case JavaRefPackage.FIELD__EANNOTATIONS:
-					return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getEAnnotations()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.FIELD__JAVA_CLASS:
 					if (eContainer != null)
 						msgs = eBasicRemoveFromContainer(msgs);
@@ -604,7 +646,7 @@
 		if (featureID >= 0) {
 			switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 				case JavaRefPackage.FIELD__EANNOTATIONS:
-					return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getEAnnotations()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.FIELD__JAVA_CLASS:
 					return eBasicSetContainer(null, JavaRefPackage.FIELD__JAVA_CLASS, msgs);
 				case JavaRefPackage.FIELD__INITIALIZER:
@@ -625,12 +667,12 @@
 		if (eContainerFeatureID >= 0) {
 			switch (eContainerFeatureID) {
 				case JavaRefPackage.FIELD__JAVA_CLASS:
-					return ((InternalEObject)eContainer).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__FIELDS, JavaClass.class, msgs);
+					return ((InternalEObject) eContainer).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__FIELDS, JavaClass.class, msgs);
 				default:
 					return eDynamicBasicRemoveFromContainer(msgs);
 			}
 		}
-		return ((InternalEObject)eContainer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
+		return ((InternalEObject) eContainer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
 	}
 
 	/**
@@ -657,7 +699,8 @@
 			case JavaRefPackage.FIELD__REQUIRED:
 				return isRequired() ? Boolean.TRUE : Boolean.FALSE;
 			case JavaRefPackage.FIELD__ETYPE:
-				if (resolve) return getEType();
+				if (resolve)
+					return getEType();
 				return basicGetEType();
 			case JavaRefPackage.FIELD__FINAL:
 				return isFinal() ? Boolean.TRUE : Boolean.FALSE;
@@ -681,7 +724,8 @@
 	 * @generated This field/method will be replaced during code generation.
 	 */
 	public String toStringGen() {
-		if (eIsProxy()) return super.toString();
+		if (eIsProxy())
+			return super.toString();
 
 		StringBuffer result = new StringBuffer(super.toString());
 		result.append(" (final: ");
@@ -700,7 +744,3 @@
 
 }
 
-
-
-
-
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/JavaClassImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/JavaClassImpl.java
index 427d1de..2e843b9 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/JavaClassImpl.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/JavaClassImpl.java
@@ -1,4 +1,3 @@
-package org.eclipse.jem.java.impl;
 /*******************************************************************************
  * Copyright (c)  2001, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
@@ -11,63 +10,30 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaClassImpl.java,v $
- *  $Revision: 1.5 $  $Date: 2004/06/09 22:46:53 $ 
+ *  $Revision: 1.6 $  $Date: 2004/06/16 20:49:21 $ 
  */
+package org.eclipse.jem.java.impl;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.NotificationChain;
 import org.eclipse.emf.common.util.ECollections;
 import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.EClassImpl;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.ESuperAdapter;
+import org.eclipse.emf.ecore.*;
+import org.eclipse.emf.ecore.impl.*;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
-import org.eclipse.emf.ecore.util.EObjectResolvingEList;
-import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.emf.ecore.util.*;
 
-import org.eclipse.jem.java.*;
-import org.eclipse.jem.java.Field;
-import org.eclipse.jem.java.InheritanceCycleException;
-import org.eclipse.jem.java.Initializer;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.java.JavaDataType;
-import org.eclipse.jem.java.JavaEvent;
-import org.eclipse.jem.java.JavaHelpers;
-import org.eclipse.jem.java.JavaPackage;
-import org.eclipse.jem.java.JavaParameter;
-import org.eclipse.jem.java.JavaRefPackage;
-import org.eclipse.jem.java.JavaURL;
-import org.eclipse.jem.java.JavaVisibilityKind;
-import org.eclipse.jem.java.Method;
-import org.eclipse.jem.java.TypeKind;
-import org.eclipse.jem.internal.java.adapters.InternalReadAdaptable;
-import org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor;
-import org.eclipse.jem.internal.java.adapters.ReadAdaptor;
+import org.eclipse.jem.internal.java.adapters.*;
 import org.eclipse.jem.internal.java.beaninfo.IIntrospectionAdapter;
 import org.eclipse.jem.internal.java.instantiation.IInstantiationInstance;
+import org.eclipse.jem.java.*;
+
 /**
  * <!-- begin-user-doc -->
- * @implements InternalReadAdaptable
+ * 
  * <!-- end-user-doc -->
  * <p>
  * The following features are implemented:
@@ -92,15 +58,17 @@
  * @generated
  */
 public class JavaClassImpl extends EClassImpl implements JavaClass, InternalReadAdaptable {
+
 	/**
 	 * The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @see #getKind()
 	 * @generated
 	 * @ordered
 	 */
 	protected static final TypeKind KIND_EDEFAULT = TypeKind.UNDEFINED_LITERAL;
+
 	/**
 	 * @generated This field/method will be replaced during code generation.
 	 */
@@ -108,6 +76,7 @@
 	 * @generated This field/method will be replaced during code generation.
 	 */
 	protected TypeKind kind = KIND_EDEFAULT;
+
 	/**
 	 * The default value of the '{@link #isPublic() <em>Public</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -117,6 +86,7 @@
 	 * @ordered
 	 */
 	protected static final boolean PUBLIC_EDEFAULT = false;
+
 	/**
 	 * The cached value of the '{@link #isPublic() <em>Public</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -126,6 +96,7 @@
 	 * @ordered
 	 */
 	protected boolean public_ = PUBLIC_EDEFAULT;
+
 	/**
 	 * The default value of the '{@link #isFinal() <em>Final</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -135,6 +106,7 @@
 	 * @ordered
 	 */
 	protected static final boolean FINAL_EDEFAULT = false;
+
 	/**
 	 * The cached value of the '{@link #isFinal() <em>Final</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -144,6 +116,7 @@
 	 * @ordered
 	 */
 	protected boolean final_ = FINAL_EDEFAULT;
+
 	/**
 	 * The cached value of the '{@link #getImplementsInterfaces() <em>Implements Interfaces</em>}' reference list.
 	 * <!-- begin-user-doc -->
@@ -237,6 +210,7 @@
 	protected JavaClassImpl() {
 		super();
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -254,8 +228,9 @@
 		Iterator it;
 		it = getExtendedLookupIterator();
 		while (it.hasNext())
-			 ((JavaClassImpl) it.next()).collectFieldsExtended(fields);
+			((JavaClassImpl) it.next()).collectFieldsExtended(fields);
 	}
+
 	protected void collectMethodsExtended(Map methods, boolean onlyPublic, List excludedClasses, List excludedMethods) {
 		Iterator it1, it2;
 		it2 = getExtendedLookupIterator();
@@ -273,10 +248,11 @@
 				methods.put(nextMethod.getMethodElementSignature(), nextMethod);
 		}
 	}
+
 	/**
 	 * createClassRef - return a JavaURL reference to the named Java class
-	 * @deprecated
-	 * @see org.eclipse.jem.java.JavaRefFactory#createClassRef(java.lang.String)
+	 * 
+	 * @deprecated @see org.eclipse.jem.java.JavaRefFactory#createClassRef(java.lang.String)
 	 */
 	public static JavaClass createClassRef(String targetName) {
 		return JavaRefFactory.eINSTANCE.createClassRef(targetName);
@@ -297,6 +273,7 @@
 		}
 		return null;
 	}
+
 	/**
 	 * Get the method of this name and these parameters. It will look up the supertype hierarchy.
 	 */
@@ -316,26 +293,23 @@
 		}
 		return null;
 	}
-	
+
 	public EList getAllSupertypes() {
 		getESuperTypes(); //Force reflection, if needed, before getting all supertypes.
 		return super.getEAllSuperTypes();
 	}
+
 	/**
 	 * Overrides to perform reflection if necessary
 	 */
 	public EList getClassImport() {
-		if (!hasReflected)
-			reflectValues();
+		reflectBase();
 		return getClassImportGen();
 	}
-		
+
 	/**
-	 * MOF41, attribute, reference are changed to volatile
-	 * Because of this we need to re-implement it here to do the
-	 * merge within the introspection adapter instead.
-	 * The merge done in EClassImpl and above doesn't
-	 * necessarily do what we need.
+	 * MOF41, attribute, reference are changed to volatile Because of this we need to re-implement it here to do the merge within the introspection
+	 * adapter instead. The merge done in EClassImpl and above doesn't necessarily do what we need.
 	 */
 	public EList getEAllOperations() {
 		IIntrospectionAdapter ia = getIntrospectionAdapter();
@@ -346,20 +320,19 @@
 			eAllOperations = ia.getEAllOperations();
 		return eAllOperations;
 	}
-		
+
 	public EList getEOperations() {
 		IIntrospectionAdapter adapter = getIntrospectionAdapter();
 		if (adapter != null)
 			return adapter.getEOperations();
 		return super.getEOperations();
 	}
-	
+
 	public EList getEOperationsGen() {
 		// An internal method for returning actual wo fluffing up.
 		return super.getEOperations();
 	}
 
-	
 	public EList getEAnnotations() {
 		IIntrospectionAdapter adapter = getIntrospectionAdapter();
 		if (adapter != null)
@@ -373,15 +346,14 @@
 			return adapter.getEStructuralFeatures();
 		return super.getEStructuralFeatures();
 	}
-	
+
 	public EList getEStructuralFeaturesGen() {
 		// An internal method for returning actual wo fluffing up.
 		return super.getEStructuralFeatures();
 	}
-	
+
 	/**
-	 * Return an Iterator on the implemntsInferface List if this
-	 * is an interface class or on the super List if it is a class.
+	 * Return an Iterator on the implemntsInferface List if this is an interface class or on the super List if it is a class.
 	 */
 	protected Iterator getExtendedLookupIterator() {
 		if (isInterface())
@@ -389,6 +361,7 @@
 		else
 			return getESuperTypes().iterator();
 	}
+
 	/**
 	 * Return an Field with the passed name, or null.
 	 */
@@ -402,8 +375,9 @@
 		}
 		return null;
 	}
+
 	/**
-	 *  Return an Field with the passed name from this JavaClass or any supertypes.
+	 * Return an Field with the passed name from this JavaClass or any supertypes.
 	 * 
 	 * Return null if a Field named fieldName is not found.
 	 */
@@ -419,17 +393,19 @@
 		}
 		return null;
 	}
+
 	/**
 	 * Return an Field with the passed name, or null.
 	 */
 	public Field getFieldNamed(String fieldName) {
 		return getField(fieldName);
 	}
+
 	public EList getFields() {
-		if (!hasReflected)
-			reflectValues();
+		reflectFields();
 		return getFieldsGen();
 	}
+
 	/**
 	 * Return all fields, including those from supertypes.
 	 */
@@ -438,11 +414,12 @@
 		collectFieldsExtended(fields);
 		return fields;
 	}
+
 	public EList getImplementsInterfaces() {
-		if (!hasReflected)
-			reflectValues();
+		reflectBase();
 		return getImplementsInterfacesGen();
 	}
+
 	/**
 	 * Return an IntrospectionAdaptor which can introspect our Java properties
 	 */
@@ -454,20 +431,21 @@
 	public String getJavaName() {
 		return getQualifiedName();
 	}
+
 	/**
-	 * getJavaPackage. This is a derived relationship, so
-	 * we must implement it here to get the EPackage that
-	 * this object is contained in.
+	 * getJavaPackage. This is a derived relationship, so we must implement it here to get the EPackage that this object is contained in.
 	 */
 	public JavaPackage getJavaPackage() {
 		return (JavaPackage) getEPackage();
 	}
+
 	/**
 	 * Get the method of this name and these parameters. It will not look up the supertype hierarchy.
 	 */
 	public Method getMethod(String methodName, List parameterTypes) {
 		return getMethod(methodName, parameterTypes, getMethods());
 	}
+
 	protected Method getMethod(String name, List parameterTypes, List methodList) {
 		boolean found = false;
 		Method method;
@@ -486,13 +464,14 @@
 							break;
 						} // end if params equal
 					} // end compare all params
-					if (found)						//short circuit out of this loop and return the winner
+					if (found) //short circuit out of this loop and return the winner
 						return method;
 				} // end compare lengths
 			} // end compare names
 		} // end loop through all methodList
 		return null;
 	}
+
 	/**
 	 * Return a List of Strings that represent MethodElement signatures from most general to most specific.
 	 */
@@ -518,6 +497,7 @@
 		Collections.sort(signatures);
 		return signatures;
 	}
+
 	/**
 	 * Get the method of this name and these parameters. It will look up the supertype hierarchy.
 	 */
@@ -527,11 +507,12 @@
 		else
 			return findClassMethodExtended(methodName, parameterTypes);
 	}
+
 	public EList getMethods() {
-		if (!hasReflected)
-			reflectValues();
+		reflectMethods();
 		return getMethodsGen();
 	}
+
 	/**
 	 * Return all methods, including those from supertypes.
 	 */
@@ -540,7 +521,7 @@
 		collectMethodsExtended(methods, false, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
 		return new ArrayList(methods.values());
 	}
-	
+
 	/*
 	 * @see getMethodsExtendedWithFilters(List, List) on JavaClass.
 	 */
@@ -549,7 +530,7 @@
 		collectMethodsExtended(methods, false, excludedClasses, excludedMethods);
 		return new ArrayList(methods.values());
 	}
-	
+
 	public String getName() {
 		String result = this.primGetName();
 		if (result == null && eIsProxy()) {
@@ -560,9 +541,10 @@
 		}
 		return result;
 	}
+
 	/**
 	 * Return a List of Methods that begins with @aMethodNamePrefix and is not included in the @excludedNames list. If @aMethodNamePrefix is null, all methods will be returned.
-	
+	 
 	 */
 	public List getOnlySpecificMethods(String aMethodNamePrefix, List excludedNames) {
 		List methods, specific;
@@ -579,11 +561,12 @@
 		}
 		return specific;
 	}
+
 	public EList getPackageImports() {
-		if (!hasReflected)
-			reflectValues();
+		reflectBase();
 		return getPackageImportsGen();
 	}
+
 	/**
 	 * getPrimitive method comment.
 	 */
@@ -595,6 +578,7 @@
 		}
 		return null;
 	}
+
 	/**
 	 * Return the primitive name for this type if one exists.
 	 */
@@ -615,21 +599,26 @@
 		if (myName.equals(DOUBLE_NAME))
 			return PRIM_DOUBLE_NAME;
 		if (myName.equals(CHARACTER_NAME))
-			return PRIM_CHARACTER_NAME;		
+			return PRIM_CHARACTER_NAME;
 		return null;
 	}
+
 	/**
-	 * Return a method matching the name, and non-return parameters with fully qualified types matching all the types in the list, if it exists.  It will not look up the supertype hierarchy.
+	 * Return a method matching the name, and non-return parameters with fully qualified types matching all the types in the list, if it exists. It
+	 * will not look up the supertype hierarchy.
 	 */
 	public Method getPublicMethod(String methodName, List parameterTypes) {
 		return getMethod(methodName, parameterTypes, getPublicMethods());
 	}
+
 	/**
-	 * Return a method matching the name, and non-return parameters with fully qualified types matching all the types in the list, if it exists.  It will not look up the supertype hierarchy.
+	 * Return a method matching the name, and non-return parameters with fully qualified types matching all the types in the list, if it exists. It
+	 * will not look up the supertype hierarchy.
 	 */
 	public Method getPublicMethodExtended(String methodName, List parameterTypes) {
 		return getMethod(methodName, parameterTypes, getPublicMethodsExtended());
 	}
+
 	/**
 	 * Return all methods, it will not go up the supertype hierarchy.
 	 */
@@ -643,6 +632,7 @@
 		}
 		return publicMethods;
 	}
+
 	/**
 	 * Return all public methods, including those from supertypes.
 	 */
@@ -651,6 +641,7 @@
 		collectMethodsExtended(methods, true, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
 		return new ArrayList(methods.values());
 	}
+
 	/**
 	 * Returns a filtered list on the methods of this class, having a name equal to that of the parameter.
 	 */
@@ -664,6 +655,7 @@
 		}
 		return publicMethods;
 	}
+
 	/**
 	 * Returns a filtered list on the methods of this class, having a name equal to that of the parameter.
 	 */
@@ -677,6 +669,7 @@
 		}
 		return publicMethods;
 	}
+
 	public String getQualifiedName() {
 		String result = null;
 		if (eIsProxy()) {
@@ -693,29 +686,94 @@
 			result = result.replace('$', '.');
 		return result;
 	}
+
 	/**
-	 * To be used by people that need to get the qualified name used for reflection.
-	 * Typically bean info would need to use something like this.
+	 * To be used by people that need to get the qualified name used for reflection. Typically bean info would need to use something like this.
 	 */
 	public String getQualifiedNameForReflection() {
 		return primGetQualifiedName();
 	}
+
 	/**
 	 * Return a ReadAdaptor which can reflect our Java properties
 	 */
-	protected synchronized ReadAdaptor getReadAdaptor() {
+	protected synchronized ReadAdaptor getReadAdapter() {
 		// Need to sync because now in a multi-thread env.
 		return (ReadAdaptor) EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY);
 	}
 
-	protected boolean hasReflected = false;
-	
-	protected void reflectValues() {
-		ReadAdaptor readAdaptor = getReadAdaptor();
-		if (readAdaptor != null)
-			hasReflected = readAdaptor.reflectValuesIfNecessary();
+	private static final int NOT_REFLECTED = 0x0, REFLECTED_BASE = 0x1, REFLECTED_METHODS = 0x2, REFLECTED_FIELDS = 0x4;
+
+	protected int reflectionStatus = NOT_REFLECTED;
+
+	protected void reflectBase() {
+		// We only want the testing of the hasReflected and get readadapter to be sync(this) so that
+		// it is short and no deadlock possibility (this is because the the method reflection adapter may go
+		// back to the containing java class to get its reflection adapter, which would lock on itself. So
+		// we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work
+		// during the sync.
+		ReadAdaptor readAdaptor = null;
+		synchronized (this) {
+			if ((reflectionStatus & REFLECTED_BASE) == 0) {
+				readAdaptor = getReadAdapter();
+			}
+		}
+		if (readAdaptor != null) {
+			boolean setReflected = readAdaptor.reflectValuesIfNecessary();
+			synchronized (this) {
+				// Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race.
+				if (setReflected)
+					reflectionStatus |= REFLECTED_BASE;
+			}
+		}
 	}
-	
+
+	protected void reflectFields() {
+		// We only want the testing of the hasReflected and get readadapter to be sync(this) so that
+		// it is short and no deadlock possibility (this is because the the method reflection adapter may go
+		// back to the containing java class to get its reflection adapter, which would lock on itself. So
+		// we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work
+		// during the sync.
+		ReadAdaptor readAdaptor = null;
+		synchronized (this) {
+			if ((reflectionStatus & REFLECTED_FIELDS) == 0) {
+				readAdaptor = getReadAdapter();
+			}
+		}
+		if (readAdaptor != null) {
+			boolean setReflected = ((IJavaClassAdaptor) readAdaptor).reflectFieldsIfNecessary();
+			synchronized (this) {
+				// Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race.
+				if (setReflected)
+					reflectionStatus |= (REFLECTED_FIELDS | REFLECTED_BASE); // We can be certain base will be done by reflect fields if not already
+																			 // done.
+			}
+		}
+	}
+
+	protected void reflectMethods() {
+		// We only want the testing of the hasReflected and get readadapter to be sync(this) so that
+		// it is short and no deadlock possibility (this is because the the method reflection adapter may go
+		// back to the containing java class to get its reflection adapter, which would lock on itself. So
+		// we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work
+		// during the sync.
+		ReadAdaptor readAdaptor = null;
+		synchronized (this) {
+			if ((reflectionStatus & REFLECTED_METHODS) == 0) {
+				readAdaptor = getReadAdapter();
+			}
+		}
+		if (readAdaptor != null) {
+			boolean setReflected = ((IJavaClassAdaptor) readAdaptor).reflectMethodsIfNecessary();
+			synchronized (this) {
+				// Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race.
+				if (setReflected)
+					reflectionStatus |= (REFLECTED_METHODS | REFLECTED_BASE); // We can be certain base will be done by reflect fields if not already
+																			  // done.
+			}
+		}
+	}
+
 	public JavaClass getSupertype() {
 		List list = getESuperTypes();
 		if (!list.isEmpty())
@@ -726,6 +784,7 @@
 	public JavaClass getWrapper() {
 		return this;
 	}
+
 	/**
 	 * Test whether the receiver implements the passed interface (or one of its supertypes).
 	 */
@@ -744,15 +803,15 @@
 		else
 			return false;
 	}
+
 	/**
 	 * Return a string showing our details.
 	 */
 	public String infoString() {
 		StringBuffer out = new StringBuffer();
 		// trip class reflection
-		//FB     this.eGet(JavaRefPackage.eINSTANCE.getJavaClass_Public());
-		if (!hasReflected)
-			reflectValues(); //FB
+		//FB this.eGet(JavaRefPackage.eINSTANCE.getJavaClass_Public());
+		reflectBase(); //FB
 		out.append("Java class: " + getQualifiedName() + "\n");
 		out.append("  superclass: " + this.getSupertype() + "\n");
 		EList fields = getFields();
@@ -782,11 +841,11 @@
 				if (parms.size() > 0) {
 					for (int ii = 0; ii < parms.size(); ii++) {
 						parm = (JavaParameter) parms.get(ii);
-						//FB             if (!parm.isReturn()) {
+						//FB if (!parm.isReturn()) {
 						out.append(((JavaHelpers) parm.getEType()).getJavaName() + " " + parm.getName());
 						if (ii < parms.size() - 1)
 							out.append(", ");
-						//FB             }
+						//FB }
 					}
 				}
 				out.append(")\n");
@@ -794,6 +853,7 @@
 		}
 		return out.toString();
 	}
+
 	/**
 	 * Tests whether this class inherits from the passed in class.
 	 */
@@ -805,14 +865,14 @@
 		else
 			return false;
 	}
+
 	public boolean isArray() {
 		return false;
 	}
+
 	/**
-	 * Can an object of the passed in class be assigned to an
-	 * object of this class. In other words is this class a
-	 * supertype of the passed in class, or is it superinterface
-	 * of it.
+	 * Can an object of the passed in class be assigned to an object of this class. In other words is this class a supertype of the passed in class,
+	 * or is it superinterface of it.
 	 */
 	public boolean isAssignableFrom(EClassifier aClass) {
 		if (aClass instanceof JavaClass) {
@@ -836,36 +896,40 @@
 		}
 		return false;
 	}
+
 	/**
 	 * Does this type exist.
 	 */
 	public boolean isExistingType() {
 		// TODO: Temporary, inefficient implementation
-		return ((JavaReflectionAdaptor) getReadAdaptor()).hasReflectionSource();
+		return ((JavaReflectionAdaptor) getReadAdapter()).hasReflectionSource();
 	}
+
 	/**
 	 * See if this is valid object of this type.
 	 */
 	public boolean isInstance(Object o) {
 		return o instanceof IInstantiationInstance ? isAssignableFrom(((IInstantiationInstance) o).getJavaType()) : false;
 	}
+
 	/**
 	 * Is this an interface.
 	 */
 	public boolean isInterface() {
 		return getKind() == TypeKind.INTERFACE_LITERAL;
 	}
+
 	public boolean isNested() {
 		return getDeclaringClass() != null;
 	}
+
 	public boolean isPrimitive() {
 		return false;
 	}
+
 	/**
-	 * Return an array listing our fields, including inherited fields.
-	 * The field relationship is derived from contents.
-	 * This implementation depends on the assumption that supertypes above JavaClass
-	 * will hold Attributes rather than Fields.
+	 * Return an array listing our fields, including inherited fields. The field relationship is derived from contents. This implementation depends on
+	 * the assumption that supertypes above JavaClass will hold Attributes rather than Fields.
 	 */
 	public Field[] listFieldExtended() {
 		List fields = getFieldsExtended();
@@ -873,11 +937,10 @@
 		fields.toArray(result);
 		return result;
 	}
+
 	/**
-	 * Return an array listing our Methods, including inherited methods.
-	 * The method relationship is derived from contents.
-	 * This implementation depends on the assumption that supertypes above JavaClass
-	 * will hold Operations rather than Methods.
+	 * Return an array listing our Methods, including inherited methods. The method relationship is derived from contents. This implementation depends
+	 * on the assumption that supertypes above JavaClass will hold Operations rather than Methods.
 	 */
 	public Method[] listMethodExtended() {
 		java.util.List methods = getMethodsExtended();
@@ -892,6 +955,7 @@
 	public String primGetName() {
 		return super.getName();
 	}
+
 	/**
 	 * This is required for internal reflection do not use.
 	 */
@@ -904,41 +968,39 @@
 			result = this.getName();
 		return result;
 	}
+
 	/**
-	 * reflect - reflect a JavaClass for a given qualified name.
-	 * If the package or class does not exist, one will be created through
-	 * the reflection mechanism.
-	 * Lookup the JavaClass in the context of the passed object, handling some error cases.
-	 * @deprecated
-	 * @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.EObject)
+	 * reflect - reflect a JavaClass for a given qualified name. If the package or class does not exist, one will be created through the reflection
+	 * mechanism. Lookup the JavaClass in the context of the passed object, handling some error cases.
 	 * 
+	 * @deprecated @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.EObject)
+	 *  
 	 */
 	public static JavaHelpers reflect(String aQualifiedName, EObject relatedObject) {
 		return JavaRefFactory.eINSTANCE.reflectType(aQualifiedName, relatedObject);
 	}
-	
+
 	/**
-	 * reflect - reflect a JavaClass for a given qualified name.
-	 * If the package or class does not exist, one will be created through
-	 * the reflection mechanism.
-	 * @deprecated
-	 * @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet)
+	 * reflect - reflect a JavaClass for a given qualified name. If the package or class does not exist, one will be created through the reflection
+	 * mechanism.
+	 * 
+	 * @deprecated @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet)
 	 */
 	public static JavaHelpers reflect(String aQualifiedName, ResourceSet set) {
 		return JavaRefFactory.eINSTANCE.reflectType(aQualifiedName, set);
 	}
-	
+
 	/**
-	 * reflect - reflect a JavaClass for a given package name or class name.
-	 * If the package or class does not exist, one will be created through
-	 * the reflection mechanism.
-	 * @deprecated
-	 * @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet)
+	 * reflect - reflect a JavaClass for a given package name or class name. If the package or class does not exist, one will be created through the
+	 * reflection mechanism.
+	 * 
+	 * @deprecated @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, java.lang.String,
+	 *             org.eclipse.emf.ecore.resource.ResourceSet)
 	 */
 	public static JavaHelpers reflect(String aPackageName, String aClassName, ResourceSet set) {
 		return JavaRefFactory.eINSTANCE.reflectType(aPackageName, aClassName, set);
 	}
-	
+
 	public void setSupertype(JavaClass aJavaClass) throws InheritanceCycleException {
 		validateSupertype(aJavaClass);
 		List s = super.getESuperTypes();
@@ -946,16 +1008,17 @@
 		if (aJavaClass != null)
 			s.add(aJavaClass);
 	}
+
 	/**
-	 * Check to make sure that the passed JavaClass is a valid super class
-	 * (i.e., it does not create any cycles in the inheritance.
+	 * Check to make sure that the passed JavaClass is a valid super class (i.e., it does not create any cycles in the inheritance.
+	 * 
 	 * @param aJavaClass
 	 */
 	protected void validateSupertype(JavaClass aJavaClass) throws InheritanceCycleException {
 		if (!isValidSupertype(aJavaClass))
 			throw new InheritanceCycleException(this, aJavaClass);
 	}
-	
+
 	public boolean isValidSupertype(JavaClass aJavaClass) {
 		if (aJavaClass != null) {
 			if (this.equals(aJavaClass))
@@ -964,6 +1027,7 @@
 		}
 		return true;
 	}
+
 	/**
 	 * @param subtypes
 	 * @param aJavaClass
@@ -977,8 +1041,9 @@
 			if (!subtype.isValidSupertype(aJavaClass))
 				return false;
 		}
-		return true;		
+		return true;
 	}
+
 	private boolean basicIsValidSupertype(List subtypes, JavaClass aJavaClass) {
 		JavaClass subtype;
 		for (int i = 0; i < subtypes.size(); i++) {
@@ -988,20 +1053,23 @@
 		}
 		return true;
 	}
+
 	protected List getSubtypes() {
 		ESuperAdapter adapter = ESuperAdapter.getESuperAdapter(this);
 		if (adapter != null)
 			return adapter.getSubclasses();
 		return Collections.EMPTY_LIST;
 	}
+
 	public String toString() {
 		return getClass().getName() + "(" + getQualifiedName() + ")";
 	}
+
 	public TypeKind getKind() {
-		if (!hasReflected)
-			reflectValues();
+		reflectBase();
 		return getKindGen();
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1015,10 +1083,10 @@
 	}
 
 	public boolean isPublic() {
-		if (!hasReflected)
-			reflectValues();
+		reflectBase();
 		return isPublicGen();
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1031,11 +1099,9 @@
 			eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__PUBLIC, oldPublic, public_));
 	}
 
-	/**
-	 * @generated This field/method will be replaced during code generation 
-	 */
 	public boolean isFinal() {
-		return final_;
+		reflectBase();
+		return isFinalGen();
 	}
 
 	/**
@@ -1068,15 +1134,23 @@
 		return public_;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
 	public boolean isFinalGen() {
 		return final_;
 	}
+
 	public EList getInitializers() {
 		if (initializers == null) {
-			initializers = new EObjectContainmentWithInverseEList(Initializer.class, this, JavaRefPackage.JAVA_CLASS__INITIALIZERS, JavaRefPackage.INITIALIZER__JAVA_CLASS);
+			initializers = new EObjectContainmentWithInverseEList(Initializer.class, this, JavaRefPackage.JAVA_CLASS__INITIALIZERS,
+					JavaRefPackage.INITIALIZER__JAVA_CLASS);
 		}
 		return initializers;
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1086,13 +1160,13 @@
 		if (newDeclaringClass != declaringClass) {
 			NotificationChain msgs = null;
 			if (declaringClass != null)
-				msgs = ((InternalEObject)declaringClass).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs);
+				msgs = ((InternalEObject) declaringClass).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs);
 			if (newDeclaringClass != null)
-				msgs = ((InternalEObject)newDeclaringClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs);
+				msgs = ((InternalEObject) newDeclaringClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs);
 			msgs = basicSetDeclaringClass(newDeclaringClass, msgs);
-			if (msgs != null) msgs.dispatch();
-		}
-		else if (eNotificationRequired())
+			if (msgs != null)
+				msgs.dispatch();
+		} else if (eNotificationRequired())
 			eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS, newDeclaringClass, newDeclaringClass));
 	}
 
@@ -1104,10 +1178,11 @@
 	public JavaClass getDeclaringClass() {
 		if (declaringClass != null && declaringClass.eIsProxy()) {
 			JavaClass oldDeclaringClass = declaringClass;
-			declaringClass = (JavaClass)eResolveProxy((InternalEObject)declaringClass);
+			declaringClass = (JavaClass) eResolveProxy((InternalEObject) declaringClass);
 			if (declaringClass != oldDeclaringClass) {
 				if (eNotificationRequired())
-					eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS, oldDeclaringClass, declaringClass));
+					eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS, oldDeclaringClass,
+							declaringClass));
 			}
 		}
 		return declaringClass;
@@ -1131,15 +1206,18 @@
 		JavaClass oldDeclaringClass = declaringClass;
 		declaringClass = newDeclaringClass;
 		if (eNotificationRequired()) {
-			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS, oldDeclaringClass, newDeclaringClass);
-			if (msgs == null) msgs = notification; else msgs.add(notification);
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS,
+					oldDeclaringClass, newDeclaringClass);
+			if (msgs == null)
+				msgs = notification;
+			else
+				msgs.add(notification);
 		}
 		return msgs;
 	}
 
 	public EList getDeclaredClasses() {
-		if (!hasReflected)
-			reflectValues();
+		reflectBase();
 		return getDeclaredClassesGen();
 	}
 
@@ -1150,22 +1228,23 @@
 	 */
 	public EList getDeclaredClassesGen() {
 		if (declaredClasses == null) {
-			declaredClasses = new EObjectWithInverseResolvingEList(JavaClass.class, this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS);
+			declaredClasses = new EObjectWithInverseResolvingEList(JavaClass.class, this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES,
+					JavaRefPackage.JAVA_CLASS__DECLARING_CLASS);
 		}
 		return declaredClasses;
 	}
 
 	public EList getProperties() {
-		return getEStructuralFeatures();	// As of EMF 2.0, local properties are the local features. Used to be a merge of eattributes and ereferences.
+		return getEStructuralFeatures(); // As of EMF 2.0, local properties are the local features. Used to be a merge of eattributes and ereferences.
 	}
-	
+
 	public EList getEvents() {
 		IIntrospectionAdapter adapter = getIntrospectionAdapter();
 		if (adapter != null)
 			return adapter.getEvents();
 		return getEventsGen();
 	}
-	
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1179,25 +1258,27 @@
 	}
 
 	private EList allEvents;
+
 	public EList getAllEvents() {
 		IIntrospectionAdapter ia = getIntrospectionAdapter();
 		if (ia == null)
 			return ECollections.EMPTY_ELIST; // No introspection, do normal.
 		return allEvents = ia.getAllEvents();
 	}
-	
+
 	public EList getAllEventsGen() {
 		return allEvents;
 	}
 
 	private EList allProperties;
+
 	public EList getAllProperties() {
 		IIntrospectionAdapter ia = getIntrospectionAdapter();
 		if (ia == null)
 			return ECollections.EMPTY_ELIST; // No introspection, do normal.
 		return allProperties = ia.getAllProperties();
 	}
-	
+
 	public EList getAllPropertiesGen() {
 		return allProperties;
 	}
@@ -1286,79 +1367,79 @@
 		switch (eDerivedStructuralFeatureID(eFeature)) {
 			case JavaRefPackage.JAVA_CLASS__EANNOTATIONS:
 				getEAnnotations().clear();
-				getEAnnotations().addAll((Collection)newValue);
+				getEAnnotations().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__NAME:
-				setName((String)newValue);
+				setName((String) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__INSTANCE_CLASS_NAME:
-				setInstanceClassName((String)newValue);
+				setInstanceClassName((String) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__ABSTRACT:
-				setAbstract(((Boolean)newValue).booleanValue());
+				setAbstract(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.JAVA_CLASS__INTERFACE:
-				setInterface(((Boolean)newValue).booleanValue());
+				setInterface(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.JAVA_CLASS__ESUPER_TYPES:
 				getESuperTypes().clear();
-				getESuperTypes().addAll((Collection)newValue);
+				getESuperTypes().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__EOPERATIONS:
 				getEOperations().clear();
-				getEOperations().addAll((Collection)newValue);
+				getEOperations().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES:
 				getEStructuralFeatures().clear();
-				getEStructuralFeatures().addAll((Collection)newValue);
+				getEStructuralFeatures().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__KIND:
-				setKind((TypeKind)newValue);
+				setKind((TypeKind) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__PUBLIC:
-				setPublic(((Boolean)newValue).booleanValue());
+				setPublic(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.JAVA_CLASS__FINAL:
-				setFinal(((Boolean)newValue).booleanValue());
+				setFinal(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.JAVA_CLASS__IMPLEMENTS_INTERFACES:
 				getImplementsInterfaces().clear();
-				getImplementsInterfaces().addAll((Collection)newValue);
+				getImplementsInterfaces().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__CLASS_IMPORT:
 				getClassImport().clear();
-				getClassImport().addAll((Collection)newValue);
+				getClassImport().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__PACKAGE_IMPORTS:
 				getPackageImports().clear();
-				getPackageImports().addAll((Collection)newValue);
+				getPackageImports().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__FIELDS:
 				getFields().clear();
-				getFields().addAll((Collection)newValue);
+				getFields().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__METHODS:
 				getMethods().clear();
-				getMethods().addAll((Collection)newValue);
+				getMethods().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__INITIALIZERS:
 				getInitializers().clear();
-				getInitializers().addAll((Collection)newValue);
+				getInitializers().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES:
 				getDeclaredClasses().clear();
-				getDeclaredClasses().addAll((Collection)newValue);
+				getDeclaredClasses().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS:
-				setDeclaringClass((JavaClass)newValue);
+				setDeclaringClass((JavaClass) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__EVENTS:
 				getEvents().clear();
-				getEvents().addAll((Collection)newValue);
+				getEvents().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.JAVA_CLASS__ALL_EVENTS:
 				getAllEvents().clear();
-				getAllEvents().addAll((Collection)newValue);
+				getAllEvents().addAll((Collection) newValue);
 				return;
 		}
 		eDynamicSet(eFeature, newValue);
@@ -1424,7 +1505,7 @@
 				getDeclaredClasses().clear();
 				return;
 			case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS:
-				setDeclaringClass((JavaClass)null);
+				setDeclaringClass((JavaClass) null);
 				return;
 			case JavaRefPackage.JAVA_CLASS__EVENTS:
 				getEvents().clear();
@@ -1437,13 +1518,13 @@
 	}
 
 	/**
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * 
+	 * <!-- begin-user-doc --> <!-- end-user-doc -->
+	 *  
 	 */
 	public EList getImplementsInterfacesGen() {
 		if (implementsInterfaces == null) {
 			implementsInterfaces = new EObjectResolvingEList(JavaClass.class, this, JavaRefPackage.JAVA_CLASS__IMPLEMENTS_INTERFACES) {
+
 				public Object get(int index) {
 					if (isInterface())
 						getInterfaceSuperTypes().get(index); //force resolution so the ESuperAdapter will be updated correctly
@@ -1461,7 +1542,7 @@
 					if (isInterface())
 						getInterfaceSuperTypes().remove(index);
 					return result;
-					
+
 				}
 
 				public boolean removeAll(Collection collection) {
@@ -1501,7 +1582,7 @@
 		}
 		return implementsInterfaces;
 	}
-	
+
 	private EList getInterfaceSuperTypes() {
 		return super.getESuperTypes();
 	}
@@ -1518,18 +1599,16 @@
 		return classImport;
 	}
 
-  public EList getEAllSuperTypes() {
-    if (!hasReflected) 
-    	reflectValues();//Force reflection, if needed, before getting all supertypes.
-    return super.getEAllSuperTypes();
-  }	
-  
-  public EList getESuperTypes() {
-	  if (!hasReflected)
-		  reflectValues();
-	  return super.getESuperTypes();
-  }
-  
+	public EList getEAllSuperTypes() {
+		reflectBase();//Force reflection, if needed, before getting all supertypes.
+		return super.getEAllSuperTypes();
+	}
+
+	public EList getESuperTypes() {
+		reflectBase();
+		return super.getESuperTypes();
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1561,7 +1640,8 @@
 	 */
 	public EList getMethodsGen() {
 		if (methods == null) {
-			methods = new EObjectContainmentWithInverseEList(Method.class, this, JavaRefPackage.JAVA_CLASS__METHODS, JavaRefPackage.METHOD__JAVA_CLASS);
+			methods = new EObjectContainmentWithInverseEList(Method.class, this, JavaRefPackage.JAVA_CLASS__METHODS,
+					JavaRefPackage.METHOD__JAVA_CLASS);
 		}
 		return methods;
 	}
@@ -1571,16 +1651,16 @@
 	 */
 	public JavaPackage getJavaPackageGen() {
 		JavaPackage javaPackage = basicGetJavaPackage();
-		return javaPackage == null ? null : (JavaPackage)eResolveProxy((InternalEObject)javaPackage);
+		return javaPackage == null ? null : (JavaPackage) eResolveProxy((InternalEObject) javaPackage);
 	}
 
 	/*
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
+	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 */
 	public JavaPackage basicGetJavaPackage() {
 		return getJavaPackage();
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1590,27 +1670,28 @@
 		if (featureID >= 0) {
 			switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 				case JavaRefPackage.JAVA_CLASS__EANNOTATIONS:
-					return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getEAnnotations()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__EPACKAGE:
 					if (eContainer != null)
 						msgs = eBasicRemoveFromContainer(msgs);
 					return eBasicSetContainer(otherEnd, JavaRefPackage.JAVA_CLASS__EPACKAGE, msgs);
 				case JavaRefPackage.JAVA_CLASS__EOPERATIONS:
-					return ((InternalEList)getEOperations()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getEOperations()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES:
-					return ((InternalEList)getEStructuralFeatures()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getEStructuralFeatures()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__FIELDS:
-					return ((InternalEList)getFields()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getFields()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__METHODS:
-					return ((InternalEList)getMethods()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getMethods()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__INITIALIZERS:
-					return ((InternalEList)getInitializers()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getInitializers()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES:
-					return ((InternalEList)getDeclaredClasses()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getDeclaredClasses()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS:
 					if (declaringClass != null)
-						msgs = ((InternalEObject)declaringClass).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs);
-					return basicSetDeclaringClass((JavaClass)otherEnd, msgs);
+						msgs = ((InternalEObject) declaringClass).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class,
+								msgs);
+					return basicSetDeclaringClass((JavaClass) otherEnd, msgs);
 				default:
 					return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
 			}
@@ -1629,25 +1710,25 @@
 		if (featureID >= 0) {
 			switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 				case JavaRefPackage.JAVA_CLASS__EANNOTATIONS:
-					return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getEAnnotations()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__EPACKAGE:
 					return eBasicSetContainer(null, JavaRefPackage.JAVA_CLASS__EPACKAGE, msgs);
 				case JavaRefPackage.JAVA_CLASS__EOPERATIONS:
-					return ((InternalEList)getEOperations()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getEOperations()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES:
-					return ((InternalEList)getEStructuralFeatures()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getEStructuralFeatures()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__FIELDS:
-					return ((InternalEList)getFields()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getFields()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__METHODS:
-					return ((InternalEList)getMethods()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getMethods()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__INITIALIZERS:
-					return ((InternalEList)getInitializers()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getInitializers()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES:
-					return ((InternalEList)getDeclaredClasses()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getDeclaredClasses()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS:
 					return basicSetDeclaringClass(null, msgs);
 				case JavaRefPackage.JAVA_CLASS__EVENTS:
-					return ((InternalEList)getEvents()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getEvents()).basicRemove(otherEnd, msgs);
 				default:
 					return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
 			}
@@ -1664,12 +1745,12 @@
 		if (eContainerFeatureID >= 0) {
 			switch (eContainerFeatureID) {
 				case JavaRefPackage.JAVA_CLASS__EPACKAGE:
-					return ((InternalEObject)eContainer).eInverseRemove(this, EcorePackage.EPACKAGE__ECLASSIFIERS, EPackage.class, msgs);
+					return ((InternalEObject) eContainer).eInverseRemove(this, EcorePackage.EPACKAGE__ECLASSIFIERS, EPackage.class, msgs);
 				default:
 					return eDynamicBasicRemoveFromContainer(msgs);
 			}
 		}
-		return ((InternalEObject)eContainer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
+		return ((InternalEObject) eContainer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
 	}
 
 	/**
@@ -1740,10 +1821,12 @@
 			case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES:
 				return getDeclaredClasses();
 			case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS:
-				if (resolve) return getDeclaringClass();
+				if (resolve)
+					return getDeclaringClass();
 				return basicGetDeclaringClass();
 			case JavaRefPackage.JAVA_CLASS__JAVA_PACKAGE:
-				if (resolve) return getJavaPackage();
+				if (resolve)
+					return getJavaPackage();
 				return basicGetJavaPackage();
 			case JavaRefPackage.JAVA_CLASS__EVENTS:
 				return getEvents();
@@ -1757,7 +1840,8 @@
 	 * @generated This field/method will be replaced during code generation.
 	 */
 	public String toStringGen() {
-		if (eIsProxy()) return super.toString();
+		if (eIsProxy())
+			return super.toString();
 
 		StringBuffer result = new StringBuffer(super.toString());
 		result.append(" (kind: ");
@@ -1770,10 +1854,15 @@
 		return result.toString();
 	}
 
-	/**
+	/*
+	 * This should never be called with true. It is basically only for reset of reflection, not to set a particular state. But InternalReadAdaptable
+	 * may be used by someone that shouldn't so to be be safe we keep it. TODO Remove InternalReadAdaptable in next version. Need to wait because we
+	 * need time to notify everyone.
+	 * 
 	 * @see org.eclipse.jem.java.adapters.InternalReadAdaptable#setReflected(boolean)
 	 */
-	public void setReflected(boolean aBoolean) {
-		hasReflected = aBoolean;
+	public synchronized void setReflected(boolean aBoolean) {
+		if (!aBoolean)
+			reflectionStatus = NOT_REFLECTED;
 	}
-}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/MethodImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/MethodImpl.java
index d33abc8..0371cfd 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/MethodImpl.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/MethodImpl.java
@@ -1,4 +1,5 @@
 package org.eclipse.jem.java.impl;
+
 /*******************************************************************************
  * Copyright (c)  2001, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
@@ -11,7 +12,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: MethodImpl.java,v $
- *  $Revision: 1.3 $  $Date: 2004/01/14 00:16:44 $ 
+ *  $Revision: 1.4 $  $Date: 2004/06/16 20:49:21 $ 
  */
 
 import java.util.Collection;
@@ -33,7 +34,6 @@
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.emf.ecore.util.InternalEList;
 
-
 import org.eclipse.jem.java.Block;
 import org.eclipse.jem.java.JavaClass;
 import org.eclipse.jem.java.JavaHelpers;
@@ -46,9 +46,10 @@
 /**
  * @generated
  */
-public class MethodImpl extends EOperationImpl implements Method{
+public class MethodImpl extends EOperationImpl implements Method {
+
 	protected String signature;
-	
+
 	/**
 	 * The default value of the '{@link #isAbstract() <em>Abstract</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -179,12 +180,13 @@
 	 */
 	protected static final JavaVisibilityKind JAVA_VISIBILITY_EDEFAULT = JavaVisibilityKind.PUBLIC_LITERAL;
 
-	public static final String copyright = "(c) Copyright IBM Corporation 2001.";
 	private transient boolean isGenerated = false;
+
 	/**
 	 * @generated This field/method will be replaced during code generation.
 	 */
 	protected JavaVisibilityKind javaVisibility = JAVA_VISIBILITY_EDEFAULT;
+
 	/**
 	 * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
 	 * <!-- begin-user-doc -->
@@ -218,6 +220,7 @@
 	protected MethodImpl() {
 		super();
 	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -229,19 +232,19 @@
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public boolean isAbstractGen() {
+	public boolean isAbstractGen() {
 		return abstract_;
 	}
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public void setAbstract(boolean newAbstract) {
+	public void setAbstract(boolean newAbstract) {
 		boolean oldAbstract = abstract_;
 		abstract_ = newAbstract;
 		if (eNotificationRequired())
@@ -250,19 +253,19 @@
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public boolean isNativeGen() {
+	public boolean isNativeGen() {
 		return native_;
 	}
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public void setNative(boolean newNative) {
+	public void setNative(boolean newNative) {
 		boolean oldNative = native_;
 		native_ = newNative;
 		if (eNotificationRequired())
@@ -271,19 +274,19 @@
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public boolean isSynchronizedGen() {
+	public boolean isSynchronizedGen() {
 		return synchronized_;
 	}
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public void setSynchronized(boolean newSynchronized) {
+	public void setSynchronized(boolean newSynchronized) {
 		boolean oldSynchronized = synchronized_;
 		synchronized_ = newSynchronized;
 		if (eNotificationRequired())
@@ -292,19 +295,19 @@
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public boolean isFinalGen() {
+	public boolean isFinalGen() {
 		return final_;
 	}
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public void setFinal(boolean newFinal) {
+	public void setFinal(boolean newFinal) {
 		boolean oldFinal = final_;
 		final_ = newFinal;
 		if (eNotificationRequired())
@@ -313,19 +316,19 @@
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public boolean isConstructorGen() {
+	public boolean isConstructorGen() {
 		return constructor;
 	}
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public void setConstructor(boolean newConstructor) {
+	public void setConstructor(boolean newConstructor) {
 		boolean oldConstructor = constructor;
 		constructor = newConstructor;
 		if (eNotificationRequired())
@@ -334,19 +337,19 @@
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public boolean isStaticGen() {
+	public boolean isStaticGen() {
 		return static_;
 	}
 
 	/**
 	 * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
+	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-  public void setStatic(boolean newStatic) {
+	public void setStatic(boolean newStatic) {
 		boolean oldStatic = static_;
 		static_ = newStatic;
 		if (eNotificationRequired())
@@ -359,62 +362,70 @@
 	public JavaClass getContainingJavaClass() {
 		return this.getJavaClass();
 	}
-	  /**
-   * Overrides to ensure reflection is done.
-   */
-  public boolean isAbstract() {
-    if (!hasReflected) reflectValues();
-    return isAbstractGen();
-  }
-  public boolean isConstructor() {
-    if (!hasReflected) reflectValues();
-    return isConstructorGen();
-  }
-  public boolean isFinal() {
-    if (!hasReflected) reflectValues();
-    return isFinalGen();
-  }
-  public boolean isNative() {
-    if (!hasReflected) reflectValues();
-    return isNativeGen();
-  }
-  public boolean isStatic() {
-    if (!hasReflected) reflectValues();
-    return isStaticGen();
-  }
-  public boolean isSynchronized() {
-    if (!hasReflected) reflectValues();
-    return isSynchronizedGen();
-  }
-  public EList getJavaExceptions() {
-    if (!hasReflected) reflectValues();
-    return getJavaExceptionsGen();
-  }
-  public JavaVisibilityKind getJavaVisibility() {
-    if (!hasReflected) reflectValues();
-    return getJavaVisibilityGen();
-  }
-  public EList getParameters() {
-    if (!hasReflected) reflectValues();
-    return getParametersGen();
-  }
-  
-  /**
-   * @see org.eclipse.emf.ecore.ETypedElement#getEType()
-   */
-   public EClassifier getEType() {
-	  if (!hasReflected) reflectValues();
-      return getETypeGen();
-   }
-   
-   public EClassifier getETypeGen() {
-   	  return super.getEType();
-   }
 
-  
+	/**
+	 * Overrides to ensure reflection is done.
+	 */
+	public boolean isAbstract() {
+		reflectValues();
+		return isAbstractGen();
+	}
+
+	public boolean isConstructor() {
+		reflectValues();
+		return isConstructorGen();
+	}
+
+	public boolean isFinal() {
+		reflectValues();
+		return isFinalGen();
+	}
+
+	public boolean isNative() {
+		reflectValues();
+		return isNativeGen();
+	}
+
+	public boolean isStatic() {
+		reflectValues();
+		return isStaticGen();
+	}
+
+	public boolean isSynchronized() {
+		reflectValues();
+		return isSynchronizedGen();
+	}
+
+	public EList getJavaExceptions() {
+		reflectValues();
+		return getJavaExceptionsGen();
+	}
+
+	public JavaVisibilityKind getJavaVisibility() {
+		reflectValues();
+		return getJavaVisibilityGen();
+	}
+
+	public EList getParameters() {
+		reflectValues();
+		return getParametersGen();
+	}
+
+	/**
+	 * @see org.eclipse.emf.ecore.ETypedElement#getEType()
+	 */
+	public EClassifier getEType() {
+		reflectValues();
+		return getETypeGen();
+	}
+
+	public EClassifier getETypeGen() {
+		return super.getEType();
+	}
+
 	/**
 	 * Return a String with the the method name and its parameters. e.g. <code> setFirstName(java.lang.String) <//code> .
-	 *  
+	 *
 	 */
 	public String getMethodElementSignature() {
 		StringBuffer sb = new StringBuffer(75);
@@ -427,17 +438,18 @@
 		for (int j = 0; j < parmSize; j++) {
 			if (j > commaTest) {
 				sb.append(",");
-			}			
+			}
 			param = (JavaParameter) params.get(j);
-//FB       if (param.isReturn()) {
-//FB         commaTest ++;
-//FB         continue;
-//FB       }
+			//FB if (param.isReturn()) {
+			//FB commaTest ++;
+			//FB continue;
+			//FB }
 			sb.append(((JavaHelpers) param.getEType()).getQualifiedName());
 		}
 		sb.append(")");
 		return sb.toString();
 	}
+
 	/**
 	 * Return a Parameter with the passed name, or null.
 	 */
@@ -453,28 +465,51 @@
 		return null;
 	}
 
-	/**
-	 * Return a ReadAdaptor which can reflect our Java properties
-	 */  
-  protected ReadAdaptor getReadAdaptor() {
-    return (ReadAdaptor)EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY);
-  }
+	protected boolean hasReflected = false;
 
-  protected boolean hasReflected = false;
+	protected void reflectValues() {
+		// We only want the testing of the hasReflected and get readadapter to be sync(this) so that
+		// it is short and no deadlock possibility (this is because the the method reflection adapter may go
+		// back to the containing java class to get its reflection adapter, which would lock on itself. So
+		// we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work
+		// during the sync.
+		ReadAdaptor readAdaptor = null;
+		synchronized (this) {
+			if (!hasReflected) {
+				readAdaptor = getReadAdapter();
+			}
+		}
+		if (readAdaptor != null) {
+			boolean setReflected = readAdaptor.reflectValuesIfNecessary();
+			synchronized (this) {
+				// Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race.
+				if (setReflected)
+					hasReflected = setReflected;
+			}
+		}
+	}
 
-  protected void reflectValues()
-  {
-    ReadAdaptor readAdaptor = getReadAdaptor();
-    if (readAdaptor != null) hasReflected = readAdaptor.reflectValuesIfNecessary();
-  }
+	/*
+	 * This is not meant to be used outside of the reflection adapters.
+	 */
+	public synchronized ReadAdaptor getReadAdapter() {
+		return (ReadAdaptor) EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY);
+	}
+
+	/*
+	 * Used by reflection adapter to clear the reflection. This not intended to be used by others.
+	 */
+	public synchronized void setReflected(boolean reflected) {
+		hasReflected = reflected;
+	}
 
 	/**
 	 * Get the return type.
 	 */
 	public JavaHelpers getReturnType() {
-    	return (JavaHelpers)getEType();
+		return (JavaHelpers) getEType();
 	}
-	
+
 	public String getSignature() {
 		if (signature == null)
 			signature = doGetSignature();
@@ -484,29 +519,32 @@
 	/**
 	 * Replicate the functionality of java.lang.reflect.Method.toString().
 	 * 
-	 * Returns a string describing this Method.  The string is formatted as the method access modifiers, if any, followed by the method return type, followed by a space, followed by the class declaring the method, followed by a period, followed by the method name, followed by a parenthesized, comma-separated list of the method's formal parameter types. If the method throws checked exceptions, the parameter list is followed by a space, followed by the word throws followed by a comma-separated list of the thrown exception types.
+	 * Returns a string describing this Method. The string is formatted as the method access modifiers, if any, followed by the method return type,
+	 * followed by a space, followed by the class declaring the method, followed by a period, followed by the method name, followed by a
+	 * parenthesized, comma-separated list of the method's formal parameter types. If the method throws checked exceptions, the parameter list is
+	 * followed by a space, followed by the word throws followed by a comma-separated list of the thrown exception types.
 	 * 
 	 * For example:
 	 * 
-	 *     public boolean java.lang.Object.equals(java.lang.Object)
+	 * public boolean java.lang.Object.equals(java.lang.Object)
 	 * 
-	 * The access modifiers are placed in canonical order as specified by "The Java Language Specification".  This is public, <tt>protected<//tt> or <tt>private<//tt> first, and then other modifiers in the following order: <tt>abstract<//tt>, <tt>static<//tt>, <tt>final<//tt>, <tt>synchronized<//tt> <tt>native<//tt>.
+	 * The access modifiers are placed in canonical order as specified by "The Java Language Specification". This is public,
+	 * <tt>protected<//tt> or <tt>private<//tt> first, and then other modifiers in the following order: <tt>abstract<//tt>, <tt>static<//tt>, <tt>final<//tt>, <tt>synchronized<//tt> <tt>native<//tt>.
 
 	 */
 	protected String doGetSignature() {
 		StringBuffer sb = new StringBuffer();
-		switch (getJavaVisibility().getValue())
-		{
-		    case JavaVisibilityKind.PUBLIC:
+		switch (getJavaVisibility().getValue()) {
+			case JavaVisibilityKind.PUBLIC:
 				sb.append("Public ");
 				break;
-		    case JavaVisibilityKind.PROTECTED:
+			case JavaVisibilityKind.PROTECTED:
 				sb.append("Protected ");
 				break;
-		    case JavaVisibilityKind.PRIVATE:
+			case JavaVisibilityKind.PRIVATE:
 				sb.append("Private ");
 				break;
-		    case JavaVisibilityKind.PACKAGE:
+			case JavaVisibilityKind.PACKAGE:
 				sb.append("Package ");
 				break;
 		}
@@ -531,8 +569,8 @@
 		int parmSize = params.size();
 		for (int j = 0; j < parmSize; j++) {
 			param = (JavaParameter) params.get(j);
-//FB       if (param.isReturn())
-//FB         continue; //  listParameters() includes return type in array 
+			//FB if (param.isReturn())
+			//FB continue; // listParameters() includes return type in array
 			sb.append(((JavaHelpers) param.getEType()).getQualifiedName());
 			if (j < (params.size() - 1)) {
 				sb.append(",");
@@ -553,21 +591,32 @@
 		}
 		return sb.toString();
 	}
+
 	/**
-	 * Returns true if the method is system generated.
-	 * This is usually determined by the "generated" tag in the comment.
+	 * Returns true if the method is system generated. This is usually determined by the "generated" tag in the comment.
 	 */
-  public boolean isGenerated() {
-	   return isGenerated;
-  }
+	public boolean isGenerated() {
+		reflectValues();
+		return isGeneratedGen();
+	}
+	
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public boolean isGeneratedGen() {
+		return isGenerated;
+	}	
 
 	/**
 	 * Is this a void return type method.
 	 */
 	public boolean isVoid() {
-//FB    return (getReturnParameter() == null || "void".equals(getReturnType().getName()));
-    return (getReturnType() == null || "void".equals(getReturnType().getName()));
-  }
+		//FB return (getReturnParameter() == null || "void".equals(getReturnType().getName()));
+		return (getReturnType() == null || "void".equals(getReturnType().getName()));
+	}
+
 	public JavaParameter[] listParametersWithoutReturn() {
 		Collection v = getParameters();
 		JavaParameter[] result = new JavaParameter[v.size()];
@@ -575,23 +624,26 @@
 		return result;
 	}
 
-  public EList eContents() {
-    EList results = new BasicEList();
-    results.addAll(getParametersGen()); //FB
-    return results;
-  }
+	public EList eContents() {
+		EList results = new BasicEList();
+		results.addAll(getParametersGen()); //FB
+		return results;
+	}
+
 	/**
 	 * Set the isGenerated flag.
 	 */
 	public void setIsGenerated(boolean generated) {
-		isGenerated = generated;		
+		isGenerated = generated;
 	}
+
 	/**
 	 * Set the return type
 	 */
 	public void setReturnType(JavaHelpers type) {
-	    this.setEType(type);
+		this.setEType(type);
 	}
+
 	/**
 	 * @generated This field/method will be replaced during code generation 
 	 */
@@ -615,8 +667,9 @@
 	 * @generated This field/method will be replaced during code generation 
 	 */
 	public JavaClass getJavaClass() {
-		if (eContainerFeatureID != JavaRefPackage.METHOD__JAVA_CLASS) return null;
-		return (JavaClass)eContainer;
+		if (eContainerFeatureID != JavaRefPackage.METHOD__JAVA_CLASS)
+			return null;
+		return (JavaClass) eContainer;
 	}
 
 	/**
@@ -632,11 +685,11 @@
 			if (eContainer != null)
 				msgs = eBasicRemoveFromContainer(msgs);
 			if (newJavaClass != null)
-				msgs = ((InternalEObject)newJavaClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__METHODS, JavaClass.class, msgs);
-			msgs = eBasicSetContainer((InternalEObject)newJavaClass, JavaRefPackage.METHOD__JAVA_CLASS, msgs);
-			if (msgs != null) msgs.dispatch();
-		}
-		else if (eNotificationRequired())
+				msgs = ((InternalEObject) newJavaClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__METHODS, JavaClass.class, msgs);
+			msgs = eBasicSetContainer((InternalEObject) newJavaClass, JavaRefPackage.METHOD__JAVA_CLASS, msgs);
+			if (msgs != null)
+				msgs.dispatch();
+		} else if (eNotificationRequired())
 			eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__JAVA_CLASS, newJavaClass, newJavaClass));
 	}
 
@@ -646,7 +699,7 @@
 	public Block getSource() {
 		if (source != null && source.eIsProxy()) {
 			Block oldSource = source;
-			source = (Block)eResolveProxy((InternalEObject)source);
+			source = (Block) eResolveProxy((InternalEObject) source);
 			if (source != oldSource) {
 				if (eNotificationRequired())
 					eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaRefPackage.METHOD__SOURCE, oldSource, source));
@@ -738,68 +791,68 @@
 		switch (eDerivedStructuralFeatureID(eFeature)) {
 			case JavaRefPackage.METHOD__EANNOTATIONS:
 				getEAnnotations().clear();
-				getEAnnotations().addAll((Collection)newValue);
+				getEAnnotations().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.METHOD__NAME:
-				setName((String)newValue);
+				setName((String) newValue);
 				return;
 			case JavaRefPackage.METHOD__ORDERED:
-				setOrdered(((Boolean)newValue).booleanValue());
+				setOrdered(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__UNIQUE:
-				setUnique(((Boolean)newValue).booleanValue());
+				setUnique(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__LOWER_BOUND:
-				setLowerBound(((Integer)newValue).intValue());
+				setLowerBound(((Integer) newValue).intValue());
 				return;
 			case JavaRefPackage.METHOD__UPPER_BOUND:
-				setUpperBound(((Integer)newValue).intValue());
+				setUpperBound(((Integer) newValue).intValue());
 				return;
 			case JavaRefPackage.METHOD__ETYPE:
-				setEType((EClassifier)newValue);
+				setEType((EClassifier) newValue);
 				return;
 			case JavaRefPackage.METHOD__EPARAMETERS:
 				getEParameters().clear();
-				getEParameters().addAll((Collection)newValue);
+				getEParameters().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.METHOD__EEXCEPTIONS:
 				getEExceptions().clear();
-				getEExceptions().addAll((Collection)newValue);
+				getEExceptions().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.METHOD__ABSTRACT:
-				setAbstract(((Boolean)newValue).booleanValue());
+				setAbstract(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__NATIVE:
-				setNative(((Boolean)newValue).booleanValue());
+				setNative(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__SYNCHRONIZED:
-				setSynchronized(((Boolean)newValue).booleanValue());
+				setSynchronized(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__FINAL:
-				setFinal(((Boolean)newValue).booleanValue());
+				setFinal(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__CONSTRUCTOR:
-				setConstructor(((Boolean)newValue).booleanValue());
+				setConstructor(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__STATIC:
-				setStatic(((Boolean)newValue).booleanValue());
+				setStatic(((Boolean) newValue).booleanValue());
 				return;
 			case JavaRefPackage.METHOD__JAVA_VISIBILITY:
-				setJavaVisibility((JavaVisibilityKind)newValue);
+				setJavaVisibility((JavaVisibilityKind) newValue);
 				return;
 			case JavaRefPackage.METHOD__PARAMETERS:
 				getParameters().clear();
-				getParameters().addAll((Collection)newValue);
+				getParameters().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.METHOD__JAVA_EXCEPTIONS:
 				getJavaExceptions().clear();
-				getJavaExceptions().addAll((Collection)newValue);
+				getJavaExceptions().addAll((Collection) newValue);
 				return;
 			case JavaRefPackage.METHOD__JAVA_CLASS:
-				setJavaClass((JavaClass)newValue);
+				setJavaClass((JavaClass) newValue);
 				return;
 			case JavaRefPackage.METHOD__SOURCE:
-				setSource((Block)newValue);
+				setSource((Block) newValue);
 				return;
 		}
 		eDynamicSet(eFeature, newValue);
@@ -829,7 +882,7 @@
 				setUpperBound(UPPER_BOUND_EDEFAULT);
 				return;
 			case JavaRefPackage.METHOD__ETYPE:
-				setEType((EClassifier)null);
+				setEType((EClassifier) null);
 				return;
 			case JavaRefPackage.METHOD__EPARAMETERS:
 				getEParameters().clear();
@@ -865,10 +918,10 @@
 				getJavaExceptions().clear();
 				return;
 			case JavaRefPackage.METHOD__JAVA_CLASS:
-				setJavaClass((JavaClass)null);
+				setJavaClass((JavaClass) null);
 				return;
 			case JavaRefPackage.METHOD__SOURCE:
-				setSource((Block)null);
+				setSource((Block) null);
 				return;
 		}
 		eDynamicUnset(eFeature);
@@ -878,7 +931,8 @@
 	 * @generated This field/method will be replaced during code generation.
 	 */
 	public String toString() {
-		if (eIsProxy()) return super.toString();
+		if (eIsProxy())
+			return super.toString();
 
 		StringBuffer result = new StringBuffer(super.toString());
 		result.append(" (abstract: ");
@@ -928,13 +982,13 @@
 		if (featureID >= 0) {
 			switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 				case JavaRefPackage.METHOD__EANNOTATIONS:
-					return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getEAnnotations()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.METHOD__ECONTAINING_CLASS:
 					if (eContainer != null)
 						msgs = eBasicRemoveFromContainer(msgs);
 					return eBasicSetContainer(otherEnd, JavaRefPackage.METHOD__ECONTAINING_CLASS, msgs);
 				case JavaRefPackage.METHOD__EPARAMETERS:
-					return ((InternalEList)getEParameters()).basicAdd(otherEnd, msgs);
+					return ((InternalEList) getEParameters()).basicAdd(otherEnd, msgs);
 				case JavaRefPackage.METHOD__JAVA_CLASS:
 					if (eContainer != null)
 						msgs = eBasicRemoveFromContainer(msgs);
@@ -957,13 +1011,13 @@
 		if (featureID >= 0) {
 			switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 				case JavaRefPackage.METHOD__EANNOTATIONS:
-					return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getEAnnotations()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.METHOD__ECONTAINING_CLASS:
 					return eBasicSetContainer(null, JavaRefPackage.METHOD__ECONTAINING_CLASS, msgs);
 				case JavaRefPackage.METHOD__EPARAMETERS:
-					return ((InternalEList)getEParameters()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getEParameters()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.METHOD__PARAMETERS:
-					return ((InternalEList)getParameters()).basicRemove(otherEnd, msgs);
+					return ((InternalEList) getParameters()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.METHOD__JAVA_CLASS:
 					return eBasicSetContainer(null, JavaRefPackage.METHOD__JAVA_CLASS, msgs);
 				default:
@@ -982,14 +1036,14 @@
 		if (eContainerFeatureID >= 0) {
 			switch (eContainerFeatureID) {
 				case JavaRefPackage.METHOD__ECONTAINING_CLASS:
-					return ((InternalEObject)eContainer).eInverseRemove(this, EcorePackage.ECLASS__EOPERATIONS, EClass.class, msgs);
+					return ((InternalEObject) eContainer).eInverseRemove(this, EcorePackage.ECLASS__EOPERATIONS, EClass.class, msgs);
 				case JavaRefPackage.METHOD__JAVA_CLASS:
-					return ((InternalEObject)eContainer).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__METHODS, JavaClass.class, msgs);
+					return ((InternalEObject) eContainer).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__METHODS, JavaClass.class, msgs);
 				default:
 					return eDynamicBasicRemoveFromContainer(msgs);
 			}
 		}
-		return ((InternalEObject)eContainer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
+		return ((InternalEObject) eContainer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
 	}
 
 	/**
@@ -1016,7 +1070,8 @@
 			case JavaRefPackage.METHOD__REQUIRED:
 				return isRequired() ? Boolean.TRUE : Boolean.FALSE;
 			case JavaRefPackage.METHOD__ETYPE:
-				if (resolve) return getEType();
+				if (resolve)
+					return getEType();
 				return basicGetEType();
 			case JavaRefPackage.METHOD__ECONTAINING_CLASS:
 				return getEContainingClass();
@@ -1045,7 +1100,8 @@
 			case JavaRefPackage.METHOD__JAVA_CLASS:
 				return getJavaClass();
 			case JavaRefPackage.METHOD__SOURCE:
-				if (resolve) return getSource();
+				if (resolve)
+					return getSource();
 				return basicGetSource();
 		}
 		return eDynamicGet(eFeature, resolve);
@@ -1053,10 +1109,3 @@
 
 }
 
-
-
-
-
-
-
-