Bug 511696: [otdre] debugger needs to refresh internal cache after
redefineClasses
- refactoring
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/dynamic/RedefineClassesBPListener.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/dynamic/RedefineClassesBPListener.java
index 7d8f654..63dcc7b 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/dynamic/RedefineClassesBPListener.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/dynamic/RedefineClassesBPListener.java
@@ -42,7 +42,7 @@
 import org.eclipse.jdt.debug.core.IJavaValue;
 import org.eclipse.jdt.debug.core.JDIDebugModel;
 import org.eclipse.objectteams.otdt.core.ext.WeavingScheme;
-import org.eclipse.objectteams.otdt.debug.internal.breakpoints.ClassRedefinitionBreakpoint;
+import org.eclipse.objectteams.otdt.debug.internal.breakpoints.OTBreakpoints;
 import org.eclipse.objectteams.otdt.internal.debug.adaptor.OTDebugAdaptorPlugin;
 
 import com.sun.jdi.VirtualMachine;
@@ -74,7 +74,7 @@
 	    if (!breakpoint.getMarker().exists())
 	    	return DONT_CARE;
 	    try {
-		    if (ClassRedefinitionBreakpoint.isRedefineClassesBreakpoint(breakpoint)) {
+		    if (OTBreakpoints.Descriptor.RedefineClasses.matches(breakpoint)) {
 		    	handleClassRedefinition(thread);
 				return IJavaBreakpointListener.DONT_SUSPEND;
 		    }
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
index 1172980..157200e 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
@@ -33,7 +33,7 @@
 import org.eclipse.objectteams.otdt.core.ext.WeavingScheme;
 import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
 import org.eclipse.objectteams.otdt.debug.OTVMRunnerAdaptor;
-import org.eclipse.objectteams.otdt.debug.TeamBreakpointInstaller;
+import org.eclipse.objectteams.otdt.debug.OTBreakpointInstaller;
 import org.eclipse.objectteams.otdt.internal.debug.adaptor.dynamic.RedefineClassesBPListener;
 import org.eclipse.pde.internal.ui.IPDEUIConstants;
 
@@ -153,7 +153,7 @@
 			this.fAdaptor.setAdaptationArgs(config, mode, launch);
 			// install OT-breakpoints
 			if (ILaunchManager.DEBUG_MODE.equals(mode)) {
-				TeamBreakpointInstaller.installTeamBreakpoints(javaProject,
+				OTBreakpointInstaller.installOTBreakpoints(javaProject,
 						RedefineClassesBPListener.get(this.fAdaptor.getWeavingScheme()));
 			}
 		}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/PDELaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/PDELaunchingAdaptor.java
index 0c35cbd..1912adb 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/PDELaunchingAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/PDELaunchingAdaptor.java
@@ -31,7 +31,7 @@
 import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
 import org.eclipse.objectteams.otdt.core.ext.WeavingScheme;
 import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
-import org.eclipse.objectteams.otdt.debug.TeamBreakpointInstaller;
+import org.eclipse.objectteams.otdt.debug.OTBreakpointInstaller;
 import org.eclipse.objectteams.otdt.internal.debug.adaptor.DebugMessages;
 import org.eclipse.objectteams.otdt.internal.debug.adaptor.OTDebugAdaptorPlugin;
 import org.eclipse.objectteams.otdt.internal.debug.adaptor.dynamic.RedefineClassesBPListener;
@@ -134,7 +134,7 @@
 				// find org.objectteams.Team in any OT/J Project:
 				if (project.getNature(JavaCore.OTJ_NATURE_ID) != null) {
 					IJavaProject javaProject = JavaCore.create(project);
-					TeamBreakpointInstaller.installTeamBreakpoints(javaProject,
+					OTBreakpointInstaller.installOTBreakpoints(javaProject,
 							RedefineClassesBPListener.get(WeavingScheme.valueOf(weavingMode)));
 					return; // good, done.
 				}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/TeamBreakpointInstaller.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTBreakpointInstaller.java
similarity index 66%
rename from plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/TeamBreakpointInstaller.java
rename to plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTBreakpointInstaller.java
index d46b1d4..291e2d3 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/TeamBreakpointInstaller.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTBreakpointInstaller.java
@@ -37,8 +37,7 @@
 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
 import org.eclipse.jdt.debug.core.JDIDebugModel;
 import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
-import org.eclipse.objectteams.otdt.debug.internal.breakpoints.ClassRedefinitionBreakpoint;
-import org.eclipse.objectteams.otdt.debug.internal.breakpoints.OOTBreakpoints;
+import org.eclipse.objectteams.otdt.debug.internal.breakpoints.OTBreakpoints;
 
 /**
  * This class un/installs support for breakpoints in certain well-known methods in class {@link org.objectteams.Team}.
@@ -49,7 +48,7 @@
  * <li>for each detected new java debug target install the actual breakpoints.
  * </ul>
  */

-public class TeamBreakpointInstaller

+public class OTBreakpointInstaller

 {

     private static Hashtable<String, IBreakpoint> OT_BREAKPOINTS = new Hashtable<String, IBreakpoint>(5);
 
@@ -61,12 +60,13 @@
      * @param project used for lookup of org.objectteams.Team, i.e., this class must be in the projects classpath.
      * @throws CoreException various reasons, like could not find class org.objectteams.Team or could not create a breakpoint.
      */

-    public static void installTeamBreakpoints(IJavaProject project, /*Nullable*/IJavaBreakpointListener dynListener)
+    public static void installOTBreakpoints(IJavaProject project, /*Nullable*/IJavaBreakpointListener dynListener)
     		throws CoreException

     {       
-    	TeamBreakpointInstaller.dynListener = dynListener;
+    	OTBreakpointInstaller.dynListener = dynListener;
     	if (dynListener != null)
         	JDIDebugModel.addJavaBreakpointListener(dynListener);
+    
         DebugPlugin.getDefault().addDebugEventListener(new IDebugEventSetListener() {
         	// since we want to avoid using the breakpoint manager (thus hiding synthetic breakpoints from the UI),
         	// we have to track creation of the debug target in order to manually install our breakpoints into the target:
@@ -91,34 +91,19 @@
 					DebugPlugin.getDefault().removeDebugEventListener(this);					
 			}
 		});

-        try

-        {
-        	if (dynListener != null && !OT_BREAKPOINTS.containsKey(ClassRedefinitionBreakpoint.BREAKPOINT_REDEFINE_CLASSES))
-        		OT_BREAKPOINTS.put(ClassRedefinitionBreakpoint.BREAKPOINT_REDEFINE_CLASSES,
-        				ClassRedefinitionBreakpoint.createRedefineClassesBreakpoint(project));

-            IType oot = project.findType(new String(IOTConstants.STR_ORG_OBJECTTEAMS_TEAM));

-            if (oot != null)

-            {            	

-                // Breakpoints in class org.objectteams.Team:

-                // bp on ctor, finalize()-, activate()-, deactivate(), -methods

-            	if(!OT_BREAKPOINTS.containsKey(OOTBreakpoints.ATTR_OT_BREAKPOINT_CTOR))

-            		OT_BREAKPOINTS.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_CTOR, OOTBreakpoints.createOOTConstructorBreakpoint(oot));

-            	

-            	if(!OT_BREAKPOINTS.containsKey(OOTBreakpoints.ATTR_OT_BREAKPOINT_FINALIZE))

-            		OT_BREAKPOINTS.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_FINALIZE, OOTBreakpoints.createOOTFinalizeBreakpoint(oot));

-          		

-            	if(!OT_BREAKPOINTS.containsKey(OOTBreakpoints.ATTR_OT_BREAKPOINT_ACT))

-            		OT_BREAKPOINTS.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_ACT, OOTBreakpoints.createOOTActivateBreakpoint(oot));

-            		

-       			if(!OT_BREAKPOINTS.containsKey(OOTBreakpoints.ATTR_OT_BREAKPOINT_DEACT))

-       				OT_BREAKPOINTS.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_DEACT, OOTBreakpoints.createOOTDeactivateBreakpoint(oot));

-                

-            	if(!OT_BREAKPOINTS.containsKey(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_ACT))

-            		OT_BREAKPOINTS.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_ACT, OOTBreakpoints.createOOTImplicitActivateBreakpoint(oot));

-            		

-       			if(!OT_BREAKPOINTS.containsKey(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_DEACT))

-       				OT_BREAKPOINTS.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_DEACT, OOTBreakpoints.createOOTImplicitDeactivateBreakpoint(oot));

-            }

+        try {
+            IType oot = project.findType(String.valueOf(IOTConstants.STR_ORG_OBJECTTEAMS_TEAM));
+            for (OTBreakpoints.Descriptor bpDescriptor : OTBreakpoints.Descriptor.values()) {
+				if (bpDescriptor.isOOTBreakPoint()) {
+					if (oot != null)
+						bpDescriptor.insertInto(oot, OT_BREAKPOINTS);
+				} else if (dynListener != null) {
+					// other breakpoint only under OTDRE
+		            IType instrumentation = project.findType(bpDescriptor.getTypeName());
+		            if (instrumentation != null)
+						bpDescriptor.insertInto(instrumentation, OT_BREAKPOINTS);
+				}
+			}
         }

         catch (JavaModelException ex)

         {

diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugPlugin.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugPlugin.java
index edde1f9..505aeab 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugPlugin.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTDebugPlugin.java
@@ -360,7 +360,7 @@
 			JDIDebugPlugin.getDefault().removeJavaBreakpointListener(_otRoleBreakpointListener);
 			try
             {
-                TeamBreakpointInstaller.uninstallTeamBreakpoints();
+                OTBreakpointInstaller.uninstallTeamBreakpoints();
             }
             catch (CoreException e)
             {
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/TeamBreakpointListener.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/TeamBreakpointListener.java
index 27dcb7e..1999253 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/TeamBreakpointListener.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/TeamBreakpointListener.java
@@ -38,10 +38,15 @@
 import org.eclipse.objectteams.otdt.debug.OTDebugElementsContainer;
 import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
 import org.eclipse.objectteams.otdt.debug.TeamInstance;
-import org.eclipse.objectteams.otdt.debug.internal.breakpoints.OOTBreakpoints;
+import org.eclipse.objectteams.otdt.debug.internal.breakpoints.OTBreakpoints;
 

 public class TeamBreakpointListener implements IJavaBreakpointListener

-{

+{
+	static final String FIELD_THIS = "this"; //$NON-NLS-1$
+	static final String LOCAL_THREAD_ACT_DEACT = "thread"; //$NON-NLS-1$
+	static final String LOCAL_THREAD_IMPLICIT_ACT_DEACT = "currentThread"; //$NON-NLS-1$
+	static final String FIELD_ALL_THREADS = "ALL_THREADS"; //$NON-NLS-1$
+	

 	private static TeamBreakpointListener _singleton;

 

 	public static TeamBreakpointListener getInstance()

@@ -64,10 +69,10 @@
 

 		try

 		{

-			if (OOTBreakpoints.isOOTConstructorBreakpoint(breakpoint))

+			if (OTBreakpoints.Descriptor.TeamConstructor.matches(breakpoint))

 			{

 			  // A team is being instantiated!

-              JDIThisVariable teamVariable = (JDIThisVariable) thread.findVariable(OOTBreakpoints.FIELD_THIS);

+              JDIThisVariable teamVariable = (JDIThisVariable) thread.findVariable(FIELD_THIS);

               if (otDebugElementsContainer.getTeamInstance(teamVariable) == null) {

 	              TeamInstance newTeam= otDebugElementsContainer.addTeamInstance(teamVariable);

 	              notifyTeamInstantiation(otDebugElementsContainer, newTeam);

@@ -75,27 +80,27 @@
               return IJavaBreakpointListener.DONT_SUSPEND;

 			}

 			

-			if (OOTBreakpoints.isOOTFinalizeBreakpoint(breakpoint))

+			if (OTBreakpoints.Descriptor.TeamFinalize.matches(breakpoint))

 			{

 			  // A team is being disposed!

-              IJavaVariable teamVariable = thread.findVariable(OOTBreakpoints.FIELD_THIS);

+              IJavaVariable teamVariable = thread.findVariable(FIELD_THIS);

               int idx= otDebugElementsContainer.removeTeamInstance(teamVariable);

               if (idx != -1)

             	  notifyTeamFinalize(otDebugElementsContainer, idx);

               return IJavaBreakpointListener.DONT_SUSPEND;

 			}

 			

-			if (OOTBreakpoints.isOOTActiveMethodBreakpoint(breakpoint))

+			if (OTBreakpoints.Descriptor.TeamActivate.matches(breakpoint))

 			{

-				IJavaVariable teamVariable = thread.findVariable(OOTBreakpoints.FIELD_THIS);

+				IJavaVariable teamVariable = thread.findVariable(FIELD_THIS);

 				TeamInstance teamInstance = otDebugElementsContainer.getTeamInstance(teamVariable);

 

-				IJavaVariable teamActiveThread = thread.findVariable(OOTBreakpoints.LOCAL_THREAD_ACT_DEACT);

+				IJavaVariable teamActiveThread = thread.findVariable(LOCAL_THREAD_ACT_DEACT);

 				IValue threadValue = teamActiveThread.getValue();

 				long threadID = ((JDIObjectValue)threadValue).getUniqueId();

 				teamInstance.setActiveForThreadID(threadID);

 				

-				IJavaVariable teamGlobalThread = thread.findVariable(OOTBreakpoints.FIELD_ALL_THREADS);

+				IJavaVariable teamGlobalThread = thread.findVariable(FIELD_ALL_THREADS);

 				IValue globalThreadValue = teamGlobalThread.getValue();

 				long globalThreadID = ((JDIObjectValue)globalThreadValue).getUniqueId();

 				teamInstance.setGlobalThreadID(globalThreadID);

@@ -104,12 +109,12 @@
 				return IJavaBreakpointListener.DONT_SUSPEND;

 			}

 

-			if (OOTBreakpoints.isOOTDeactiveMethodBreakpoint(breakpoint))

+			if (OTBreakpoints.Descriptor.TeamDeactivate.matches(breakpoint))

 			{

-				IJavaVariable teamVariable = thread.findVariable(OOTBreakpoints.FIELD_THIS);

+				IJavaVariable teamVariable = thread.findVariable(FIELD_THIS);

 				TeamInstance teamInstance = otDebugElementsContainer.getTeamInstance(teamVariable);

 				

-				IJavaVariable teamDeactiveThread= thread.findVariable(OOTBreakpoints.LOCAL_THREAD_ACT_DEACT);

+				IJavaVariable teamDeactiveThread= thread.findVariable(LOCAL_THREAD_ACT_DEACT);

 				IValue threadValue = teamDeactiveThread.getValue();

 				long threadID = ((JDIObjectValue)threadValue).getUniqueId();

 				teamInstance.setInactiveForThreadID(new Long(threadID));

@@ -118,9 +123,9 @@
 				return IJavaBreakpointListener.DONT_SUSPEND;

 			}

 			

-			if (OOTBreakpoints.isOOTImplicitActiveMethodBreakpoint(breakpoint))

+			if (OTBreakpoints.Descriptor.TeamImplicitActivate.matches(breakpoint))

 			{

-				IJavaVariable teamVariable = thread.findVariable(OOTBreakpoints.FIELD_THIS);

+				IJavaVariable teamVariable = thread.findVariable(FIELD_THIS);

 				TeamInstance teamInstance = otDebugElementsContainer.getTeamInstance(teamVariable);

 				

 				// don't use fragile access to local variable 

@@ -132,9 +137,9 @@
 				return IJavaBreakpointListener.DONT_SUSPEND;

 			}

 

-			if (OOTBreakpoints.isOOTImplicitDeactiveMethodBreakpoint(breakpoint))

+			if (OTBreakpoints.Descriptor.TeamImplicitDeactivate.matches(breakpoint))

 			{

-				IJavaVariable teamVariable = thread.findVariable(OOTBreakpoints.FIELD_THIS);

+				IJavaVariable teamVariable = thread.findVariable(FIELD_THIS);

 				TeamInstance teamInstance = otDebugElementsContainer.getTeamInstance(teamVariable);

 				

 				// don't use fragile access to local variable 

diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/ClassRedefinitionBreakpoint.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/ClassRedefinitionBreakpoint.java
deleted file mode 100644
index 78dfc60..0000000
--- a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/ClassRedefinitionBreakpoint.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**********************************************************************
- * This file is part of "Object Teams Development Tooling"-Software
- * 
- * Copyright 2017 GK Software AG
- *  
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Please visit http://www.eclipse.org/objectteams for updates and contact.
- * 
- * Contributors:
- * 	Stephan Herrmann - Initial API and implementation
- **********************************************************************/
-package org.eclipse.objectteams.otdt.debug.internal.breakpoints;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.debug.core.IJavaBreakpoint;
-import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
-
-public class ClassRedefinitionBreakpoint {
-	
-	public static final String BREAKPOINT_REDEFINE_CLASSES = OTDebugPlugin.PLUGIN_ID + "InstrumentationBreakpoint.redefineClasses"; //$NON-NLS-1$
-
-	static final String OT_SYNTHETIC_BREAKPOINT = OTDebugPlugin.PLUGIN_ID + "InstrumentationBreakpoint"; //$NON-NLS-1$
-	
-	static final String INSTRUMENTATION_IMPL = "sun.instrument.InstrumentationImpl"; //$NON-NLS-1$
-	static final String REDEFINE_CLASSSES = "redefineClasses"; //$NON-NLS-1$
-	static final String REDEFINE_CLASSSES_SIGNATURE = "([Ljava/lang/instrument/ClassDefinition;)V"; //$NON-NLS-1$
-
-    public static IJavaBreakpoint createRedefineClassesBreakpoint(IJavaProject project) throws CoreException {
-    	
-    	try {
-    		IType instrumentation = project.findType(INSTRUMENTATION_IMPL);
-    		if (instrumentation != null) {
-    			Map<String, Object> attributes = getBreakpointAttributes();
-    			attributes.put(BREAKPOINT_REDEFINE_CLASSES, Boolean.TRUE);
-    			return OOTBreakpoints.createMethodBreakpoint(instrumentation, REDEFINE_CLASSSES, REDEFINE_CLASSSES_SIGNATURE, false, -1, attributes);
-    		}
-    	}
-    	catch (JavaModelException ex) {
-    		throw new CoreException(new Status(IStatus.WARNING, OTDebugPlugin.PLUGIN_ID, IStatus.OK, "Cannot set breakpoints for tracking class redefinition", ex)); //$NON-NLS-1$
-    	}
-    	return null;
-    }
-
-    public static final boolean isRedefineClassesBreakpoint(IBreakpoint breakpoint) throws CoreException {
-        return breakpoint.getMarker().getAttribute(BREAKPOINT_REDEFINE_CLASSES) != null;
-    }
-    
-    private static Map<String, Object> getBreakpointAttributes() {
-        Map<String, Object> attrs = new HashMap<>();
-        attrs.put(OT_SYNTHETIC_BREAKPOINT, Boolean.TRUE);
-        return attrs;
-    }
-}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/OOTBreakpoints.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/OOTBreakpoints.java
deleted file mode 100644
index e867478..0000000
--- a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/OOTBreakpoints.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/**********************************************************************
- * This file is part of "Object Teams Development Tooling"-Software
- * 
- * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
- * for its Fraunhofer Institute for Computer Architecture and Software
- * Technology (FIRST), Berlin, Germany and Technical University Berlin,
- * Germany.
- * 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * $Id: OOTBreakpoints.java 23427 2010-02-03 22:23:59Z stephan $
- * 
- * Please visit http://www.eclipse.org/objectteams for updates and contact.
- * 
- * Contributors:
- * Fraunhofer FIRST - Initial API and implementation
- * Technical University Berlin - Initial API and implementation
- **********************************************************************/
-package org.eclipse.objectteams.otdt.debug.internal.breakpoints;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.debug.core.IJavaBreakpoint;
-import org.eclipse.jdt.debug.core.JDIDebugModel;
-import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
-
-import static org.eclipse.objectteams.otdt.debug.internal.breakpoints.IOOTBreakPoints.*;
-
-/**
- * @author ike
- *
- * This class provides methods to create OOT-specific (org.objectteams.Team) breakpoints
- *
- * $Id: OOTBreakpoints.java 23427 2010-02-03 22:23:59Z stephan $
- */
-@SuppressWarnings("nls")
-public class OOTBreakpoints
-{
-	public static final String FIELD_THIS = "this";
-	public static final String LOCAL_THREAD_ACT_DEACT = "thread";
-	public static final String LOCAL_THREAD_IMPLICIT_ACT_DEACT = "currentThread";
-	public static final String FIELD_ALL_THREADS = "ALL_THREADS";
-	
-	public static final String ATTR_OT_BREAKPOINT = OTDebugPlugin.PLUGIN_ID + ".TeamBreakpoint";
-	public static final String ATTR_OT_BREAKPOINT_CTOR     = OTDebugPlugin.PLUGIN_ID + ".TeamBreakpoint.Constructor";
-	public static final String ATTR_OT_BREAKPOINT_FINALIZE = OTDebugPlugin.PLUGIN_ID + ".TeamBreakpoint.FinalizeMethod";
-	public static final String ATTR_OT_BREAKPOINT_ACT   = OTDebugPlugin.PLUGIN_ID + ".TeamBreakpoint.ActivateMethod";
-	public static final String ATTR_OT_BREAKPOINT_DEACT = OTDebugPlugin.PLUGIN_ID + ".TeamBreakpoint.DeactivateMethod";
-	public static final String ATTR_OT_BREAKPOINT_IMPLICIT_ACT   = OTDebugPlugin.PLUGIN_ID + ".TeamBreakpoint.ImplicitActivateMethod";
-	public static final String ATTR_OT_BREAKPOINT_IMPLICIT_DEACT = OTDebugPlugin.PLUGIN_ID + ".TeamBreakpoint.ImplicitDeactivateMethod";
-
-	private static final String FINALIZE = "finalize";
-	private static final String EMPTY_SIGNATURE = "()V";
-	
-	//associated with "public Team() {}"
-    public static int getTeamConstructorLineNumber()
-    {
-        return LINE_TeamConstructor;
-    }
-
-    //associated with "doRegistration();"
-    public static int getActivateMethodLineNumber()
-    {
-        return LINE_ActivateMethod;
-    }
-    
-    //associated with "_OT$lazyGlobalActiveFlag = false;"
-    public static int getDeactivateMethodLineNumber()
-    {
-        return LINE_DeactivateMethod;
-    }
-    
-    //associated with "implicitActivationsPerThread.set(Integer.valueOf(implActCount + 1 ));"
-    public static int getImplicitActivateMethodLineNumber()
-    {
-        return LINE_ImplicitActivateMethod;
-    }
-
-    //implicitActivationsPerThread.set(Integer.valueOf(implActCount - 1));
-    public static int getImplicitDeactivateMethodLineNumber()
-    {
-        return LINE_ImplicitDeactivateMethod;
-    }
-    
-    // implicit "return;"
-    public static int getFinalizeMethodLineNumber() {
-		return LINE_FinalizeMethod;
-	}
-
-    public static Map<String, Boolean> getBreakpointAttributes()
-    {
-        Map<String, Boolean> attrs = new HashMap<String, Boolean>();
-        attrs.put(OOTBreakpoints.ATTR_OT_BREAKPOINT, Boolean.TRUE);
-        return attrs;
-    }
-
-    public static IBreakpoint createOOTConstructorBreakpoint(IType oot) 
-    		throws CoreException
-    {
-		Map<String, Boolean> constructorAttributes = getBreakpointAttributes();
-		constructorAttributes.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_CTOR, Boolean.TRUE);
-         return createOOTBreakpoint(oot, getTeamConstructorLineNumber(), constructorAttributes);
-    }
-    
-    public static IBreakpoint createOOTFinalizeBreakpoint(IType oot)
-    		throws CoreException
-    {
-    	Map<String, Boolean> finalizeMethodAttributes = getBreakpointAttributes();
-    	finalizeMethodAttributes.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_FINALIZE, Boolean.TRUE);
-    	return createMethodBreakpoint(oot, FINALIZE, EMPTY_SIGNATURE, true,
-    			getFinalizeMethodLineNumber(), finalizeMethodAttributes);    	
-    }
-        
-    public static IBreakpoint createOOTActivateBreakpoint(IType oot)throws CoreException
-    {
-		Map<String, Boolean> activateMethodAttributes = getBreakpointAttributes();
-		activateMethodAttributes.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_ACT, Boolean.TRUE);
-    	return createOOTBreakpoint(oot, getActivateMethodLineNumber(), activateMethodAttributes);
-    }
-
-    public static IBreakpoint createOOTDeactivateBreakpoint(IType oot) throws CoreException
-	{
-		Map<String, Boolean> deactivateMethodAttributes = getBreakpointAttributes();
-		deactivateMethodAttributes.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_DEACT, Boolean.TRUE);
-		return createOOTBreakpoint(oot, getDeactivateMethodLineNumber(), deactivateMethodAttributes);
-	}
-    
-    public static IBreakpoint createOOTImplicitActivateBreakpoint(IType oot)throws CoreException
-    {
-		Map<String, Boolean> implicitActivateMethodAttributes = getBreakpointAttributes();
-		implicitActivateMethodAttributes.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_ACT, Boolean.TRUE);
-    	return createOOTBreakpoint(oot, getImplicitActivateMethodLineNumber(), implicitActivateMethodAttributes);
-    }
-
-    public static IBreakpoint createOOTImplicitDeactivateBreakpoint(IType oot)throws CoreException
-    {
-		Map<String, Boolean> implicitDeactivateMethodAttributes = getBreakpointAttributes();
-		implicitDeactivateMethodAttributes.put(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_DEACT, Boolean.TRUE);
-    	return createOOTBreakpoint(oot, getImplicitDeactivateMethodLineNumber(), implicitDeactivateMethodAttributes);
-    }
-	public static IBreakpoint createOOTBreakpoint(IType oot, int linenumber, Map attributes) 
-			throws CoreException
-	{
-		IResource teamResource = oot.getJavaProject().getResource();
-		IJavaBreakpoint breakpoint = JDIDebugModel.createLineBreakpoint(
-				teamResource,
-				oot.getFullyQualifiedName(),
-				linenumber,
-				-1, -1, 0,
-				false /*register*/,
-				attributes);
-		breakpoint.setPersisted(false);
-		
-		return breakpoint;
-	}
-    
-	public static IJavaBreakpoint createMethodBreakpoint(IType type, String selector, String signature,
-			boolean entry, int linenumber, Map attributes)
-			throws CoreException
-	{
-		IResource resource = type.getJavaProject().getResource();
-		IJavaBreakpoint breakpoint = JDIDebugModel.createMethodBreakpoint(
-				resource, 
-				type.getFullyQualifiedName(), 
-				selector, 
-				signature,
-				entry, !entry, false /*native*/,
-				linenumber, 
-				-1, -1, 0, 
-				false /*register*/, 
-				attributes);
-		breakpoint.setPersisted(false);
-		return breakpoint;
-	}
-	
-	public static final boolean isOOTBreakpoint(IBreakpoint breakpoint) throws CoreException
-    {
-        return breakpoint.getMarker().getAttribute(OOTBreakpoints.ATTR_OT_BREAKPOINT) != null;
-    }
-
-    public static final boolean isOOTConstructorBreakpoint(IBreakpoint breakpoint) throws CoreException
-    {
-        return breakpoint.getMarker().getAttribute(OOTBreakpoints.ATTR_OT_BREAKPOINT_CTOR) != null;
-    }
-    
-    public static final boolean isOOTFinalizeBreakpoint(IBreakpoint breakpoint) throws CoreException
-    {
-    	return breakpoint.getMarker().getAttribute(OOTBreakpoints.ATTR_OT_BREAKPOINT_FINALIZE) != null;
-    }
-    
-    public static final boolean isOOTActiveMethodBreakpoint(IBreakpoint breakpoint) throws CoreException
-    {
-        return breakpoint.getMarker().getAttribute(OOTBreakpoints.ATTR_OT_BREAKPOINT_ACT) != null;
-    }
-    
-    public static final boolean isOOTDeactiveMethodBreakpoint(IBreakpoint breakpoint) throws CoreException
-    {
-        return breakpoint.getMarker().getAttribute(OOTBreakpoints.ATTR_OT_BREAKPOINT_DEACT) != null;
-    }
-    
-    public static final boolean isOOTImplicitActiveMethodBreakpoint(IBreakpoint breakpoint) throws CoreException
-    {
-        return breakpoint.getMarker().getAttribute(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_ACT) != null;
-    }
-    
-    public static final boolean isOOTImplicitDeactiveMethodBreakpoint(IBreakpoint breakpoint) throws CoreException
-    {
-        return breakpoint.getMarker().getAttribute(OOTBreakpoints.ATTR_OT_BREAKPOINT_IMPLICIT_DEACT) != null;
-    }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/OTBreakpoints.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/OTBreakpoints.java
new file mode 100644
index 0000000..d38c48a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/internal/breakpoints/OTBreakpoints.java
@@ -0,0 +1,159 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ * 
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id: OOTBreakpoints.java 23427 2010-02-03 22:23:59Z stephan $
+ * 
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ * 
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.debug.internal.breakpoints;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.debug.core.IJavaBreakpoint;
+import org.eclipse.jdt.debug.core.JDIDebugModel;
+import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
+import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
+
+import static org.eclipse.objectteams.otdt.debug.internal.breakpoints.IOOTBreakPoints.*;
+
+/**
+ * @author ike
+ *
+ * This class provides methods to create OOT-specific (org.objectteams.Team) breakpoints
+ *
+ */
+@SuppressWarnings("nls")
+public class OTBreakpoints {
+
+	private static final String FINALIZE = "finalize";
+	private static final String FINALIZE_SIGNATURE = "()V";
+	
+	private static final String INSTRUMENTATION_IMPL = "sun.instrument.InstrumentationImpl";
+	private static final String REDEFINE_CLASSSES = "redefineClasses";
+	private static final String REDEFINE_CLASSSES_SIGNATURE = "([Ljava/lang/instrument/ClassDefinition;)V";
+	
+	public enum Descriptor {
+		/** associated with "public Team() {}" */
+		TeamConstructor(		".TeamBreakpoint.Constructor", 				LINE_TeamConstructor),
+	    /** associated with "doRegistration();" */
+		TeamActivate(			".TeamBreakpoint.ActivateMethod", 			LINE_ActivateMethod),
+	    /** associated with "_OT$lazyGlobalActiveFlag = false;" */
+		TeamDeactivate(			".TeamBreakpoint.DeactivateMethod", 		LINE_DeactivateMethod),
+	    /** associated with "implicitActivationsPerThread.set(Integer.valueOf(implActCount + 1 ));" */
+		TeamImplicitActivate(	".TeamBreakpoint.ImplicitActivateMethod", 	LINE_ImplicitActivateMethod),
+	    /** associated with "implicitActivationsPerThread.set(Integer.valueOf(implActCount - 1));" */
+		TeamImplicitDeactivate(	".TeamBreakpoint.ImplicitDeactivateMethod", LINE_ImplicitDeactivateMethod),
+		/** associated with implicit "return;" */
+		TeamFinalize(			".TeamBreakpoint.FinalizeMethod",			LINE_FinalizeMethod) {
+			@Override
+			IBreakpoint createBreakpoint(IType oot) throws CoreException {
+		    	Map<String, Boolean> attributes = getBreakpointAttributes();
+		    	attributes.put(BP_ID, Boolean.TRUE);
+		    	return createMethodBreakpoint(oot, FINALIZE, FINALIZE_SIGNATURE, true, this.lineNumber, attributes);
+			}
+		},
+
+		/** on InstrumentationImpl.redefineClasses(). */
+		RedefineClasses(		".InstrumentationBreakpoint.redefineClasses", 	-1) {
+			@Override public boolean isOOTBreakPoint() { return false; }
+			@Override public String getTypeName() { return INSTRUMENTATION_IMPL; }
+			@Override
+			IBreakpoint createBreakpoint(IType type) throws CoreException {
+    			Map<String, Boolean> attributes = getBreakpointAttributes();
+    			attributes.put(BP_ID, Boolean.TRUE);
+    			return createMethodBreakpoint(type, REDEFINE_CLASSSES, REDEFINE_CLASSSES_SIGNATURE, false, -1, attributes);
+			}
+		};
+
+		String BP_ID;
+		int lineNumber;
+		private Descriptor(String id, int lineNumber) {
+			this.BP_ID = OTDebugPlugin.PLUGIN_ID + id;
+			this.lineNumber = lineNumber;
+		}
+
+		/** Is this a descriptor for a breakpoint on org.objectteams.Team? */
+		public boolean isOOTBreakPoint() { return true; }
+
+		/** Does the given breakpoint match this descriptor? */
+		public boolean matches(IBreakpoint breakpoint) throws CoreException {
+			return breakpoint.getMarker().getAttribute(BP_ID) != null;
+		}
+
+		/** Answer the qualified name of the type on which this descriptor installs its breakpoint. */
+		public String getTypeName() {
+			return String.valueOf(IOTConstants.STR_ORG_OBJECTTEAMS_TEAM);
+		}
+
+		/** Check if 'collected' already contains a matching BP, otherwise create and insert a new BP. */
+		public void insertInto(IType type, Map<String,IBreakpoint> collected) throws CoreException {
+			if (!collected.containsKey(this.BP_ID))
+				collected.put(this.BP_ID, createBreakpoint(type));
+		}
+
+		Map<String, Boolean> getBreakpointAttributes() {
+	        Map<String, Boolean> attrs = new HashMap<String, Boolean>();
+	        attrs.put(OTDebugPlugin.PLUGIN_ID + ".SyntheticBreakpoint", Boolean.TRUE);
+	        return attrs;
+	    }
+		/* default impl, individual descriptors may override. */
+		IBreakpoint createBreakpoint(IType oot) throws CoreException {
+			Map<String, Boolean> attributes = getBreakpointAttributes();
+			attributes.put(BP_ID, Boolean.TRUE);
+			return createLineBreakpoint(oot, this.lineNumber, attributes);
+	    }
+	
+		private IBreakpoint createLineBreakpoint(IType oot, int linenumber, Map attributes) 
+				throws CoreException
+		{
+			IResource teamResource = oot.getJavaProject().getResource();
+			IJavaBreakpoint breakpoint = JDIDebugModel.createLineBreakpoint(
+					teamResource,
+					oot.getFullyQualifiedName(),
+					linenumber,
+					-1, -1, 0,
+					false /*register*/,
+					attributes);
+			breakpoint.setPersisted(false);
+			
+			return breakpoint;
+		}
+    
+		IJavaBreakpoint createMethodBreakpoint(IType type, String selector, String signature,
+				boolean entry, int linenumber, Map attributes)
+						throws CoreException
+		{
+			IResource resource = type.getJavaProject().getResource();
+			IJavaBreakpoint breakpoint = JDIDebugModel.createMethodBreakpoint(
+					resource, 
+					type.getFullyQualifiedName(), 
+					selector, 
+					signature,
+					entry, !entry, false /*native*/,
+					linenumber, 
+					-1, -1, 0, 
+					false /*register*/, 
+					attributes);
+			breakpoint.setPersisted(false);
+			return breakpoint;
+		}
+	}
+}
\ No newline at end of file