You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ft...@apache.org on 2014/01/27 11:35:22 UTC
[3/4] FLEX-34062: FDB waits up to 20s per SWF before we can start
debugging
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java b/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java
index e2b0b62..37f15f2 100644
--- a/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java
+++ b/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java
@@ -74,14 +74,14 @@ import flash.util.Trace;
public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
{
public static final int MAX_STACK_DEPTH = 256;
- public static final long MAX_TERMINATE_WAIT_MILLIS = 10000;
+ private static final long MAX_TERMINATE_WAIT_MILLIS = 10000;
- private Socket m_socket;
- private DProtocol m_protocol;
- private DManager m_manager;
- private IDebuggerCallbacks m_debuggerCallbacks;
+ private final Socket m_socket;
+ private final DProtocol m_protocol;
+ private final DManager m_manager;
+ private final IDebuggerCallbacks m_debuggerCallbacks;
private Process m_process;
- private Map<String, Object> m_prefs; // WARNING -- accessed from multiple threads
+ private final Map<String, Object> m_prefs; // WARNING -- accessed from multiple threads
private static final String s_newline = System.getProperty("line.separator"); //$NON-NLS-1$
private volatile boolean m_isConnected; // WARNING -- accessed from multiple threads
@@ -105,15 +105,15 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
private AIRLaunchInfo m_airLaunchInfo; // null if this is not an AIR app
static volatile boolean m_debugMsgOn; // debug ONLY; turned on with "set $debug_messages = 1"
- volatile int m_debugMsgSize; // debug ONLY; controlled with "set $debug_message_size = NNN"
+ private volatile int m_debugMsgSize; // debug ONLY; controlled with "set $debug_message_size = NNN"
static volatile boolean m_debugMsgFileOn; // debug ONLY for file dump; turned on with "set $debug_message_file = 1"
- volatile int m_debugMsgFileSize; // debug ONLY for file dump; controlled with "set $debug_message_file_size = NNN"
+ private volatile int m_debugMsgFileSize; // debug ONLY for file dump; controlled with "set $debug_message_file_size = NNN"
/**
* A simple cache of previous "is" and "instanceof" queries, in order to
* avoid having to send redundant messages to the player.
*/
- private Map<String, Boolean> m_evalIsAndInstanceofCache = new HashMap<String, Boolean>();
+ private final Map<String, Boolean> m_evalIsAndInstanceofCache = new HashMap<String, Boolean>();
private static final String DEBUG_MESSAGES = "$debug_messages"; //$NON-NLS-1$
private static final String DEBUG_MESSAGE_SIZE = "$debug_message_size"; //$NON-NLS-1$
@@ -124,7 +124,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
private static final String FLASH_PREFIX = "$flash_"; //$NON-NLS-1$
- PlayerSession(Socket s, DProtocol proto, DManager manager, IDebuggerCallbacks debuggerCallbacks)
+ private PlayerSession(Socket s, DProtocol proto, DManager manager, IDebuggerCallbacks debuggerCallbacks)
{
m_isConnected = false;
m_isHalted = false;
@@ -142,13 +142,11 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
m_debuggerCallbacks = debuggerCallbacks;
}
- private static PlayerSession createFromSocketHelper(Socket s, IDebuggerCallbacks debuggerCallbacks, DProtocol proto) throws IOException
- {
+ private static PlayerSession createFromSocketHelper(Socket s, IDebuggerCallbacks debuggerCallbacks, DProtocol proto) {
// let the manager hear incoming messages
DManager manager = new DManager();
- PlayerSession session = new PlayerSession(s, proto, manager, debuggerCallbacks);
- return session;
+ return new PlayerSession(s, proto, manager, debuggerCallbacks);
}
/**
@@ -184,7 +182,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
/* getter */
public DMessageCounter getMessageCounter() { return m_protocol.getMessageCounter(); }
public String getURI() { return m_manager.getURI(); }
- public boolean playerSupportsGet() { return m_manager.isGetSupported(); }
+ boolean playerSupportsGet() { return m_manager.isGetSupported(); }
public int playerVersion() { return m_manager.getVersion(); }
public SourceLocator getSourceLocator() { return m_manager.getSourceLocator(); }
@@ -217,7 +215,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* Set preference
* If an invalid preference is passed, it will be silently ignored.
*/
- public void setPreferences(Map<String, ? extends Object> map) { m_prefs.putAll(map); mapBack(); }
+ public void setPreferences(Map<String, ?> map) { m_prefs.putAll(map); mapBack(); }
public Set<String> keySet() { return m_prefs.keySet(); }
public Object getPreferenceAsObject(String pref) { return m_prefs.get(pref); }
@@ -226,7 +224,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
*/
public void setPreference(String pref, int value)
{
- m_prefs.put(pref, new Integer(value));
+ m_prefs.put(pref, value);
mapBack();
// change in console messages?
@@ -243,7 +241,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
{
Object prefValue = getPreferenceAsObject(preferenceName);
if (prefValue != null)
- return ((Integer)prefValue).intValue();
+ return (Integer) prefValue;
else
return defaultValue;
}
@@ -253,7 +251,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
{
Object prefValue = getPreferenceAsObject(preferenceName);
if (prefValue != null)
- return ((Integer)prefValue).intValue() != 0 ? true : false;
+ return (Integer) prefValue != 0;
else
return defaultValue;
}
@@ -270,12 +268,12 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
public int getPreference(String pref)
{
- int val = 0;
+ int val;
Integer i = (Integer)m_prefs.get(pref);
if (i == null)
throw new NullPointerException();
else
- val = i.intValue();
+ val = i;
return val;
}
@@ -304,7 +302,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
*/
public boolean bind() throws VersionException
{
- boolean bound = false;
+ boolean bound;
if (m_isConnected)
return false;
@@ -379,7 +377,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
m_protocol.unbind();
// kill the socket
- try { m_socket.close(); } catch(IOException io) {}
+ try { m_socket.close(); } catch(IOException ignored) {}
m_isConnected = false;
m_isHalted = false;
@@ -409,16 +407,14 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
execArgs.add("-"); //$NON-NLS-1$
if (argv != null)
{
- for (int i=0; i<argv.length; ++i)
- execArgs.add(argv[i]);
+ Collections.addAll(execArgs, argv);
}
Process osascript = Runtime.getRuntime().exec(execArgs.toArray(new String[execArgs.size()]));
// feed our AppleScript code to osascript's stdin
OutputStream outputStream = osascript.getOutputStream();
PrintWriter writer = new PrintWriter(outputStream, true);
writer.println("on run argv"); //$NON-NLS-1$ // this gives the name "argv" to the command-line args
- for (int i=0; i<appleScript.length; ++i)
- writer.println(appleScript[i]);
+ for (String anAppleScript : appleScript) writer.println(anAppleScript);
writer.println("end run"); //$NON-NLS-1$
writer.close();
InputStreamReader reader = new InputStreamReader(osascript.getInputStream());
@@ -470,7 +466,6 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* running. You should only call this function if you have already
* checked that you are running on a Mac.
*
- * @param browserName a name, e.g. "Safari", "Firefox", "Camino"
* @return true if currently running
*/
private Set<String> runningApplications()
@@ -486,8 +481,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
);
String[] apps = running.split(", "); //$NON-NLS-1$
Set<String> retval = new HashSet<String>();
- for (int i=0; i<apps.length; ++i)
- retval.add(apps[i]);
+ Collections.addAll(retval, apps);
return retval;
}
@@ -509,7 +503,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
// currently never terminate when you tell it to, but the AIR player will
// terminate.
playerWillTerminateItself = unbind(true);
- } catch(Exception e)
+ } catch(Exception ignored)
{
}
@@ -517,16 +511,13 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
{
if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) //$NON-NLS-1$ //$NON-NLS-2$
{
- if (m_airLaunchInfo != null)
- {
- // nothing we need to do -- Process.destroy() will kill the AIR app
- }
- else if (m_launchUrl != null && m_launchUrl.length() > 0)
+
+ if (m_airLaunchInfo == null && m_launchUrl != null && m_launchUrl.length() > 0)
{
boolean closedAnyWindows = false;
Set<String> runningApps = runningApplications();
- if (!closedAnyWindows && runningApps.contains("Safari")) //$NON-NLS-1$
+ if (runningApps.contains("Safari")) //$NON-NLS-1$
{
try {
String url = m_launchUrl.replaceAll(" ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -589,21 +580,14 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
// if we have a process pop it
if (m_process != null)
{
- try
- {
- m_debuggerCallbacks.terminateDebugTarget(m_process);
- }
- catch (IOException e)
- {
- // ignore
- }
- }
+ m_debuggerCallbacks.terminateDebugTarget(m_process);
+ }
}
else if (m_process != null) {
try {
m_process.waitFor();
}
- catch (Exception e) {
+ catch (Exception ignored) {
}
}
@@ -623,7 +607,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
*/
private Set<String> waitForMacAppQuit(String browser) {
Set<String> runningApps;
- boolean appClosed = true;
+ boolean appClosed;
final long startMillis = System.currentTimeMillis();
final long waitMillis = 100;
do {
@@ -751,8 +735,8 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
// doesn't send it
requestSwfInfo(0);
}
- SwfInfo[] swfs = m_manager.getSwfInfos();
- return swfs;
+
+ return m_manager.getSwfInfos();
}
/**
@@ -778,7 +762,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
*/
public byte[] getActions(int which, int at, int len) throws NoResponseException
{
- byte[] actions = null;
+ byte[] actions;
// send a actions message
DMessage dm = DMessageCache.alloc(12);
@@ -910,7 +894,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
public Location setBreakpoint(int fileId, int lineNum) throws NoResponseException, NotConnectedException
{
/* send the message to the player and await a response */
- Location l = null;
+ Location l;
int bp = DLocation.encodeId(fileId, lineNum);
DMessage dm = DMessageCache.alloc(8);
@@ -964,7 +948,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
return m_manager.getWatchpoints();
}
- private Watch setWatch(long varId, String memberName, int kind) throws NoResponseException, NotConnectedException, NotSupportedException
+ private Watch setWatch(long varId, String memberName, int kind) throws NotSupportedException
{
// we really have two cases here, one where we add a completely new
// watchpoint and the other where we modify an existing one.
@@ -1053,7 +1037,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
// request as many levels as we can get
int i = 0;
- Value v = null;
+ Value v;
do
{
v = getValue(Value.LEVEL_ID-i);
@@ -1126,55 +1110,49 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
// loop through all frame variables, and separate them into two
// groups: activation objects, and all others (locals and arguments)
- for (int i=0; i<frameVars.length; ++i)
- {
- DVariable member = frameVars[i];
- Matcher matcher = activationObjectNamePattern.matcher(member.getName());
- if (matcher.matches())
- activationObjects.add(member);
- else
- varmap.put(member.getName(), member);
- }
+ for (DVariable member : frameVars) {
+ Matcher matcher = activationObjectNamePattern.matcher(member.getName());
+ if (matcher.matches())
+ activationObjects.add(member);
+ else
+ varmap.put(member.getName(), member);
+ }
// If there are no activation objects, then we don't need to do anything
if (activationObjects.size() == 0)
return;
// overwrite existing args and locals with ones pulled from the activation objects
- for (int i=0; i<activationObjects.size(); ++i)
- {
- DVariable activationObject = activationObjects.get(i);
- DVariable[] activationMembers = (DVariable[]) activationObject.getValue().getMembers(this);
- for (int j=0; j<activationMembers.length; ++j)
- {
- DVariable member = activationMembers[j];
- int attributes = member.getAttributes();
-
- // For some odd reason, the activation object often contains a whole bunch of
- // other variables that we shouldn't be displaying. I don't know what they
- // are, but I do know that they are all marked "static".
- if ((attributes & VariableAttribute.IS_STATIC) != 0)
- continue;
-
- // No matter what the activation object member's scope is, we want all locals
- // and arguments to be considered "public"
- attributes &= ~(VariableAttribute.PRIVATE_SCOPE | VariableAttribute.PROTECTED_SCOPE | VariableAttribute.NAMESPACE_SCOPE);
- attributes |= VariableAttribute.PUBLIC_SCOPE;
- member.setAttributes(attributes);
-
- String name = member.getName();
- DVariable oldvar = varmap.get(name);
- int vartype;
- if (oldvar != null)
- vartype = oldvar.getAttributes() & (VariableAttribute.IS_ARGUMENT | VariableAttribute.IS_LOCAL);
- else
- vartype = VariableAttribute.IS_LOCAL;
- member.setAttributes(member.getAttributes() | vartype);
- varmap.put(name, member);
- }
-
- context.convertLocalToActivationObject(activationObject);
- }
+ for (DVariable activationObject : activationObjects) {
+ DVariable[] activationMembers = (DVariable[]) activationObject.getValue().getMembers(this);
+ for (DVariable member : activationMembers) {
+ int attributes = member.getAttributes();
+
+ // For some odd reason, the activation object often contains a whole bunch of
+ // other variables that we shouldn't be displaying. I don't know what they
+ // are, but I do know that they are all marked "static".
+ if ((attributes & VariableAttribute.IS_STATIC) != 0)
+ continue;
+
+ // No matter what the activation object member's scope is, we want all locals
+ // and arguments to be considered "public"
+ attributes &= ~(VariableAttribute.PRIVATE_SCOPE | VariableAttribute.PROTECTED_SCOPE | VariableAttribute.NAMESPACE_SCOPE);
+ attributes |= VariableAttribute.PUBLIC_SCOPE;
+ member.setAttributes(attributes);
+
+ String name = member.getName();
+ DVariable oldvar = varmap.get(name);
+ int vartype;
+ if (oldvar != null)
+ vartype = oldvar.getAttributes() & (VariableAttribute.IS_ARGUMENT | VariableAttribute.IS_LOCAL);
+ else
+ vartype = VariableAttribute.IS_LOCAL;
+ member.setAttributes(member.getAttributes() | vartype);
+ varmap.put(name, member);
+ }
+
+ context.convertLocalToActivationObject(activationObject);
+ }
for (DVariable var: varmap.values())
{
@@ -1198,7 +1176,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
*/
public Value getValue(long valueId) throws NotSuspendedException, NoResponseException, NotConnectedException
{
- DValue val = null;
+ DValue val;
if (!isSuspended())
throw new NotSuspendedException();
@@ -1423,7 +1401,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* $obj(), and if so, handles that directly rather than calling the player. Returns
* null if the function being called is not a pseudofunction.
*/
- private Value callPseudoFunction(Value thisValue, String funcname, Value[] args) throws PlayerDebugException{
+ private Value callPseudoFunction(Value thisValue, String funcname, Value[] args) {
if (thisValue.getType() == VariableType.UNDEFINED || thisValue.getType() == VariableType.NULL) {
if ("$obj".equals(funcname)) { //$NON-NLS-1$
return callObjPseudoFunction(args);
@@ -1437,7 +1415,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* Handles a call to the debugger pseudofunction $obj() -- e.g. $obj(1234) returns
* a pointer to the object with id 1234.
*/
- private Value callObjPseudoFunction(Value[] args) throws PlayerDebugException {
+ private Value callObjPseudoFunction(Value[] args) {
if (args.length != 1) {
return DValue.forPrimitive(DValue.UNDEFINED);
}
@@ -1649,7 +1627,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
// convert type to typeName
String type = DVariable.typeNameFor(t);
DMessage dm = buildOutSetMessage(id, name, type, value);
- FaultEvent faultEvent = null;
+ FaultEvent faultEvent;
// System.out.println("setmsg id="+id+",name="+name+",t="+type+",value="+value);
// make sure any exception during the setter gets held onto
@@ -1734,7 +1712,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* @throws NotSupportedException
* @throws NotSuspendedException
*/
- public boolean addWatch(long varId, String varName, int type, int tag) throws NoResponseException, NotConnectedException, NotSupportedException
+ boolean addWatch(long varId, String varName, int type, int tag) throws NotSupportedException
{
// TODO check for NoResponse, NotConnected
@@ -1750,8 +1728,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
dm.putWord(tag);
int timeout = getPreference(SessionManager.PREF_GETVAR_RESPONSE_TIMEOUT);
- boolean result = simpleRequestResponseMessage(dm, DMessage.InWatch2, timeout);
- return result;
+ return simpleRequestResponseMessage(dm, DMessage.InWatch2, timeout);
}
/**
@@ -1760,8 +1737,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* @throws NoResponseException
* @throws NotSuspendedException
*/
- public boolean removeWatch(long varId, String memberName) throws NoResponseException, NotConnectedException
- {
+ boolean removeWatch(long varId, String memberName) {
memberName = getRawMemberName(varId, memberName);
DMessage dm = DMessageCache.alloc(DMessage.getSizeofPtr()+DMessage.getStringLength(memberName)+1);
dm.setType(DMessage.OutRemoveWatch2);
@@ -1769,8 +1745,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
try { dm.putString(memberName); } catch(UnsupportedEncodingException uee) { dm.putByte((byte)'\0'); }
int timeout = getPreference(SessionManager.PREF_GETVAR_RESPONSE_TIMEOUT);
- boolean result = simpleRequestResponseMessage(dm, DMessage.InWatch2, timeout);
- return result;
+ return simpleRequestResponseMessage(dm, DMessage.InWatch2, timeout);
}
/**
@@ -1914,27 +1889,27 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
public boolean supportsWatchpoints()
{
if (m_playerSupportsWatchpoints == null)
- m_playerSupportsWatchpoints = new Boolean(getOption("can_set_watchpoints", false)); //$NON-NLS-1$
- return m_playerSupportsWatchpoints.booleanValue();
+ m_playerSupportsWatchpoints = getOption("can_set_watchpoints", false); //$NON-NLS-1$
+ return m_playerSupportsWatchpoints;
}
- public boolean playerCanBreakOnAllExceptions()
+ boolean playerCanBreakOnAllExceptions()
{
if (m_playerCanBreakOnAllExceptions == null)
- m_playerCanBreakOnAllExceptions = new Boolean(getOption("can_break_on_all_exceptions", false)); //$NON-NLS-1$
- return m_playerCanBreakOnAllExceptions.booleanValue();
+ m_playerCanBreakOnAllExceptions = getOption("can_break_on_all_exceptions", false); //$NON-NLS-1$
+ return m_playerCanBreakOnAllExceptions;
}
- public boolean playerCanTerminate()
+ boolean playerCanTerminate()
{
return getOption("can_terminate", false); //$NON-NLS-1$
}
- public boolean playerCanCallFunctions()
+ boolean playerCanCallFunctions()
{
if (m_playerCanCallFunctions == null)
- m_playerCanCallFunctions = new Boolean(getOption("can_call_functions", false)); //$NON-NLS-1$
- return m_playerCanCallFunctions.booleanValue();
+ m_playerCanCallFunctions = getOption("can_call_functions", false); //$NON-NLS-1$
+ return m_playerCanCallFunctions;
}
/**
@@ -1945,13 +1920,13 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* the name of the option
* @return its value, or null
*/
- public boolean getOption(String optionName, boolean defaultValue)
+ boolean getOption(String optionName, boolean defaultValue)
{
boolean retval = defaultValue;
String optionValue = getOption(optionName, null);
if (optionValue != null)
- retval = Boolean.valueOf(optionValue).booleanValue();
+ retval = Boolean.valueOf(optionValue);
return retval;
}
@@ -1964,7 +1939,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
* the name of the option
* @return its value, or null
*/
- public String getOption(String optionName, String defaultValue)
+ String getOption(String optionName, String defaultValue)
{
String optionValue = defaultValue;
@@ -2194,7 +2169,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
while(isConnected())
{
// try every 250ms
- try { Thread.sleep(250); } catch(InterruptedException ie) {}
+ try { Thread.sleep(250); } catch(InterruptedException ignored) {}
try
{
@@ -2299,7 +2274,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
{
/* send the message */
int to = getPreference(SessionManager.PREF_SWFSWD_LOAD_TIMEOUT);
- byte[] swf = null;
+ byte[] swf;
// the query
DMessage dm = DMessageCache.alloc(2);
@@ -2318,7 +2293,7 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
{
/* send the message */
int to = getPreference(SessionManager.PREF_SWFSWD_LOAD_TIMEOUT);
- byte[] swd = null;
+ byte[] swd;
// the query
DMessage dm = DMessageCache.alloc(2);
@@ -2351,11 +2326,11 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
m_trace.flush();
}
}
- catch(Exception e) {}
+ catch(Exception ignored) {}
}
// i/o for tracing
- java.io.Writer m_trace;
+ private java.io.Writer m_trace;
java.io.Writer traceFile() throws IOException
{
@@ -2440,11 +2415,11 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
Boolean retval = m_evalIsAndInstanceofCache.get(key);
if (retval == null)
{
- retval = new Boolean(ECMA.toBoolean(evalBinaryOp(op, value, type)));
+ retval = ECMA.toBoolean(evalBinaryOp(op, value, type));
m_evalIsAndInstanceofCache.put(key, retval);
}
- return retval.booleanValue();
+ return retval;
}
private boolean evalIsOrInstanceof(BinaryOp op, Value value, String type) throws PlayerDebugException, PlayerFaultException
@@ -2457,11 +2432,11 @@ public class PlayerSession implements Session, DProtocolNotifierIF, Runnable
if (typeval == null)
retval = Boolean.FALSE;
else
- retval = new Boolean(ECMA.toBoolean(evalBinaryOp(op, value, typeval)));
+ retval = ECMA.toBoolean(evalBinaryOp(op, value, typeval));
m_evalIsAndInstanceofCache.put(key, retval);
}
- return retval.booleanValue();
+ return retval;
}
public boolean evalIn(Value property, Value object) throws PlayerDebugException, PlayerFaultException
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSessionManager.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSessionManager.java b/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSessionManager.java
index a5e48dd..f51f231 100644
--- a/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSessionManager.java
+++ b/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSessionManager.java
@@ -54,9 +54,9 @@ import flash.util.URLHelper;
public class PlayerSessionManager implements SessionManager2
{
private ServerSocket m_serverSocket;
- private HashMap<String, Object> m_prefs;
+ private final HashMap<String, Object> m_prefs;
private IDebuggerCallbacks m_debuggerCallbacks;
- private static LocalizationManager m_localizationManager;
+ private static final LocalizationManager m_localizationManager;
private Socket m_connectSocket;
private boolean m_cancelConnect;
@@ -107,7 +107,7 @@ public class PlayerSessionManager implements SessionManager2
* Set preference
* If an invalid preference is passed, it will be silently ignored.
*/
- public void setPreference(String pref, int value) { m_prefs.put(pref, new Integer(value)); }
+ public void setPreference(String pref, int value) { m_prefs.put(pref, value); }
public void setPreference(String pref, String value){ m_prefs.put(pref, value); }
public Set<String> keySet() { return m_prefs.keySet(); }
public Object getPreferenceAsObject(String pref) { return m_prefs.get(pref); }
@@ -117,11 +117,11 @@ public class PlayerSessionManager implements SessionManager2
*/
public int getPreference(String pref)
{
- int val = 0;
+ int val;
Integer i = (Integer)m_prefs.get(pref);
if (i == null)
throw new NullPointerException();
- val = i.intValue();
+ val = i;
return val;
}
@@ -151,12 +151,12 @@ public class PlayerSessionManager implements SessionManager2
*/
public boolean isListening()
{
- return (m_serverSocket == null) ? false : true;
+ return (m_serverSocket != null);
}
private class LaunchInfo
{
- private String m_uri;
+ private final String m_uri;
public LaunchInfo(String uri)
{
@@ -239,7 +239,7 @@ public class PlayerSessionManager implements SessionManager2
launchCommand = getAIRLaunchArgs(uri, airLaunchInfo);
}
- ProcessListener pl = null;
+ ProcessListener pl;
PlayerSession session = null;
// create the process and attach a thread to watch it during our accept phase
@@ -285,7 +285,7 @@ public class PlayerSessionManager implements SessionManager2
launchCommand = getAIRLaunchArgs(uri, airLaunchInfo);
}
- ProcessListener pl = null;
+ ProcessListener pl;
// create the process and attach a thread to watch it during our accept phase
Process proc = m_debuggerCallbacks.launchDebugTarget(launchCommand);
@@ -307,8 +307,7 @@ public class PlayerSessionManager implements SessionManager2
* Tweaks the launch URI if necessary, e.g. may append "?debug=true"
*/
private String tweakNativeLaunchUri(String uri, boolean forDebugging,
- LaunchInfo launchInfo) throws IOException, FileNotFoundException
- {
+ LaunchInfo launchInfo) throws IOException {
// first let's see if it's an HTTP URL or not
if (launchInfo.isHttpOrAbout())
{
@@ -332,7 +331,7 @@ public class PlayerSessionManager implements SessionManager2
{
// ok, its not an http: type request therefore we should be able to see
// it on the file system, right? If not then it's probably not valid
- File f = null;
+ File f;
if (uri.startsWith("file:")) //$NON-NLS-1$
{
try
@@ -351,7 +350,7 @@ public class PlayerSessionManager implements SessionManager2
f = new File(uri);
}
- if (f != null && f.exists()) {
+ if (f.exists()) {
// Do not use getCanonicalPath() -- see FB-24595
uri = f.getAbsolutePath();
} else {
@@ -396,9 +395,7 @@ public class PlayerSessionManager implements SessionManager2
launchCommand[1] = "-a";
launchCommand[2] = httpExe.toString();
launchCommand[3] = "--args";
- for ( int i = 0; i < customParams.length; i++) {
- launchCommand[i + prependLen] = customParams[i];
- }
+ System.arraycopy(customParams, 0, launchCommand, 4, customParams.length);
}
}
else if (launchInfo.isPlayerNativeLaunch())
@@ -427,9 +424,7 @@ public class PlayerSessionManager implements SessionManager2
final int prependLen = 1;
launchCommand = new String[customParams.length + prependLen];
launchCommand[0] = httpExe.toString();
- for ( int i = 0; i < customParams.length; i++) {
- launchCommand[i + prependLen] = customParams[i];
- }
+ System.arraycopy(customParams, 0, launchCommand, 1, customParams.length);
}
}
else if (launchInfo.isPlayerNativeLaunch())
@@ -477,16 +472,11 @@ public class PlayerSessionManager implements SessionManager2
{
boolean isIE8 = false;
- try
- {
- int[] ieVersion = m_debuggerCallbacks.getAppVersion(httpExe);
- if (ieVersion != null)
- isIE8 = (ieVersion[0] >= 8);
- } catch (IOException e) {
- // ignore
- }
+ int[] ieVersion = m_debuggerCallbacks.getAppVersion(httpExe);
+ if (ieVersion != null)
+ isIE8 = (ieVersion[0] >= 8);
- if (isIE8)
+ if (isIE8)
{
// FB-22107: Tell IE to keep using the new process we are
// launching, rather than merging the new process into the
@@ -567,7 +557,7 @@ public class PlayerSessionManager implements SessionManager2
// If it's a "file:" URL, then pass the actual filename; otherwise, use the URL
// ok, its not an http: type request therefore we should be able to see
// it on the file system, right? If not then it's probably not valid
- File f = null;
+ File f;
if (uri.startsWith("file:")) //$NON-NLS-1$
{
try
@@ -641,8 +631,7 @@ public class PlayerSessionManager implements SessionManager2
// keep looping
i++;
} else if (ch == '"' || (isMacOrUnix && ch == '\'')) {
- char quote = ch;
- int nextQuote = arguments.indexOf(quote, i+1);
+ int nextQuote = arguments.indexOf(ch, i+1);
if (nextQuote == -1) {
retval.add(arguments.substring(i+1));
return retval;
@@ -788,19 +777,15 @@ public class PlayerSessionManager implements SessionManager2
// they don't agree with that -- they want HKEY_LOCAL_MACHINE first.
String[] roots = { "HKEY_LOCAL_MACHINE", "HKEY_CURRENT_USER" }; //$NON-NLS-1$ //$NON-NLS-2$
- for (int i=0; i<roots.length; ++i)
- {
- try
- {
- String path = m_debuggerCallbacks.queryWindowsRegistry(roots[i] + KEY, PATH);
- if (path != null)
- return new File(path);
- }
- catch (IOException e)
- {
- // ignore
- }
- }
+ for (String root : roots) {
+ try {
+ String path = m_debuggerCallbacks.queryWindowsRegistry(root + KEY, PATH);
+ if (path != null)
+ return new File(path);
+ } catch (IOException e) {
+ // ignore
+ }
+ }
return null;
}
@@ -838,7 +823,7 @@ public class PlayerSessionManager implements SessionManager2
int totalTimeout = timeout;
int iterateOn = 100;
- PlayerSession session = null;
+ PlayerSession session;
try
{
m_serverSocket.setSoTimeout(iterateOn);
@@ -1122,7 +1107,7 @@ public class PlayerSessionManager implements SessionManager2
*/
public boolean isConnecting()
{
- return (m_connectSocket == null) ? false : true;
+ return (m_connectSocket != null);
}
/**
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/concrete/ProcessListener.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/concrete/ProcessListener.java b/modules/debugger/src/java/flash/tools/debugger/concrete/ProcessListener.java
index f711a05..3d26786 100644
--- a/modules/debugger/src/java/flash/tools/debugger/concrete/ProcessListener.java
+++ b/modules/debugger/src/java/flash/tools/debugger/concrete/ProcessListener.java
@@ -34,21 +34,21 @@ import flash.tools.debugger.ILaunchNotification;
* When a process exits, the ProcessListener can send out a notification. If
* you want that to happen, call startLaunchNotifier().
*/
-public class ProcessListener
+class ProcessListener
{
- private Process m_process;
- private ILaunchNotification m_launchNotification;
- private boolean m_isDebugging;
- private boolean m_isAIRapp;
+ private final Process m_process;
+ private final ILaunchNotification m_launchNotification;
+ private final boolean m_isDebugging;
+ private final boolean m_isAIRapp;
private final String[] m_launchCommand;
- private StringWriter m_processMessages;
+ private final StringWriter m_processMessages;
private boolean m_isRunLaunch;
/**
* A background thread that will wait until the process terminates, and then
* call the launch listener.
*/
- private Thread m_launchNotifierThread = new Thread("DJAPI ProcessListener") //$NON-NLS-1$
+ private final Thread m_launchNotifierThread = new Thread("DJAPI ProcessListener") //$NON-NLS-1$
{
public void run()
{
@@ -116,7 +116,7 @@ public class ProcessListener
/**
* Returns the command args that were used to launch the process.
*/
- public String[] getLaunchCommand()
+ String[] getLaunchCommand()
{
return m_launchCommand;
}
@@ -137,7 +137,7 @@ public class ProcessListener
}
}
- public int getProcessExitValue() throws IllegalThreadStateException
+ int getProcessExitValue() throws IllegalThreadStateException
{
return m_process.exitValue();
}
@@ -146,7 +146,7 @@ public class ProcessListener
* Returns all messages that were sent to stdout and stderr by the process,
* combined into one string.
*/
- public String getProcessMessages()
+ String getProcessMessages()
{
return m_processMessages.toString();
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/concrete/ScriptText.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/concrete/ScriptText.java b/modules/debugger/src/java/flash/tools/debugger/concrete/ScriptText.java
index 18c9fb7..6016f5b 100644
--- a/modules/debugger/src/java/flash/tools/debugger/concrete/ScriptText.java
+++ b/modules/debugger/src/java/flash/tools/debugger/concrete/ScriptText.java
@@ -46,8 +46,7 @@ public class ScriptText
int start = m_lineMap[2*index];
int end = m_lineMap[(2*index)+1];
- String s = m_text.substring(start, end);
- return s;
+ return m_text.substring(start, end);
}
/* line count in module */
@@ -136,7 +135,7 @@ public class ScriptText
/**
* Count the number of lines within this string.
*/
- public static int lineCountFor(String s)
+ private static int lineCountFor(String s)
{
int i = 0;
int lineNum = 0;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/concrete/StreamListener.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/concrete/StreamListener.java b/modules/debugger/src/java/flash/tools/debugger/concrete/StreamListener.java
index 0579556..f43ea58 100644
--- a/modules/debugger/src/java/flash/tools/debugger/concrete/StreamListener.java
+++ b/modules/debugger/src/java/flash/tools/debugger/concrete/StreamListener.java
@@ -27,9 +27,9 @@ import java.io.Writer;
* Reads a stream, and sends the contents somewhere.
* @author mmoreart
*/
-public class StreamListener extends Thread {
- Reader fIn;
- Writer fOut;
+class StreamListener extends Thread {
+ private final Reader fIn;
+ private final Writer fOut;
/**
* Creates a StreamListener which will copy everything from
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/events/BreakEvent.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/events/BreakEvent.java b/modules/debugger/src/java/flash/tools/debugger/events/BreakEvent.java
index 7436434..360a274 100644
--- a/modules/debugger/src/java/flash/tools/debugger/events/BreakEvent.java
+++ b/modules/debugger/src/java/flash/tools/debugger/events/BreakEvent.java
@@ -25,10 +25,10 @@ package flash.tools.debugger.events;
public class BreakEvent extends DebugEvent
{
/** unique identifier for the source file where the Player has suspened. */
- public int fileId;
+ private final int fileId;
/** line number in the source file where the Player has suspended. */
- public int line;
+ private final int line;
public BreakEvent(int fId, int l)
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/events/ConsoleErrorFault.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/events/ConsoleErrorFault.java b/modules/debugger/src/java/flash/tools/debugger/events/ConsoleErrorFault.java
index ef23021..61fad62 100644
--- a/modules/debugger/src/java/flash/tools/debugger/events/ConsoleErrorFault.java
+++ b/modules/debugger/src/java/flash/tools/debugger/events/ConsoleErrorFault.java
@@ -24,7 +24,7 @@ package flash.tools.debugger.events;
*/
public class ConsoleErrorFault extends FaultEvent
{
- public final static String name = "console_error"; //$NON-NLS-1$
+ private final static String name = "console_error"; //$NON-NLS-1$
public ConsoleErrorFault(String s) { super(s); }
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/events/DebugEvent.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/events/DebugEvent.java b/modules/debugger/src/java/flash/tools/debugger/events/DebugEvent.java
index ef474eb..dedc5ab 100644
--- a/modules/debugger/src/java/flash/tools/debugger/events/DebugEvent.java
+++ b/modules/debugger/src/java/flash/tools/debugger/events/DebugEvent.java
@@ -24,8 +24,8 @@ package flash.tools.debugger.events;
*/
public abstract class DebugEvent
{
- public String information;
+ public final String information;
- public DebugEvent() { information = ""; } //$NON-NLS-1$
- public DebugEvent(String info) { information = info; }
+ DebugEvent() { information = ""; } //$NON-NLS-1$
+ DebugEvent(String info) { information = info; }
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/events/FaultEvent.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/events/FaultEvent.java b/modules/debugger/src/java/flash/tools/debugger/events/FaultEvent.java
index 9c2d5ae..9430761 100644
--- a/modules/debugger/src/java/flash/tools/debugger/events/FaultEvent.java
+++ b/modules/debugger/src/java/flash/tools/debugger/events/FaultEvent.java
@@ -30,7 +30,7 @@ public abstract class FaultEvent extends DebugEvent
{
private String stackTrace = ""; //$NON-NLS-1$
- public FaultEvent(String info)
+ FaultEvent(String info)
{
super(getFirstLine(info));
int newline = info.indexOf('\n');
@@ -38,7 +38,7 @@ public abstract class FaultEvent extends DebugEvent
stackTrace = info.substring(newline+1);
}
- public FaultEvent()
+ FaultEvent()
{
super();
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/events/SwfLoadedEvent.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/events/SwfLoadedEvent.java b/modules/debugger/src/java/flash/tools/debugger/events/SwfLoadedEvent.java
index 32146a7..c8e8628 100644
--- a/modules/debugger/src/java/flash/tools/debugger/events/SwfLoadedEvent.java
+++ b/modules/debugger/src/java/flash/tools/debugger/events/SwfLoadedEvent.java
@@ -26,25 +26,25 @@ package flash.tools.debugger.events;
public class SwfLoadedEvent extends DebugEvent
{
/** unique identifier for the SWF */
- public long id;
+ private final long id;
/** index of swf in Session.getSwfs() array */
- public int index;
+ private final int index;
/** full path name for SWF */
- public String path;
+ public final String path;
/** size of the loaded SWF in bytes */
- public long swfSize;
+ public final long swfSize;
/** URL of the loaded SWF */
- public String url;
+ private final String url;
/** port number related to the URL */
- public long port;
+ private final long port;
/** name of host in which the SWF was loaded */
- public String host;
+ private final String host;
public SwfLoadedEvent(long sId, int sIndex, String sPath, String sUrl, String sHost, long sPort, long sSwfSize)
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/events/SwfUnloadedEvent.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/events/SwfUnloadedEvent.java b/modules/debugger/src/java/flash/tools/debugger/events/SwfUnloadedEvent.java
index beeb361..bad5ee6 100644
--- a/modules/debugger/src/java/flash/tools/debugger/events/SwfUnloadedEvent.java
+++ b/modules/debugger/src/java/flash/tools/debugger/events/SwfUnloadedEvent.java
@@ -25,13 +25,13 @@ package flash.tools.debugger.events;
public class SwfUnloadedEvent extends DebugEvent
{
/** unique identifier for the SWF */
- public long id;
+ private final long id;
/** index of SWF in Session.getSwfs() array */
- public int index;
+ private final int index;
/** full path name for the SWF */
- public String path;
+ public final String path;
public SwfUnloadedEvent(long sId, String sPath, int sIndex)
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/expression/ASTBuilder.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/expression/ASTBuilder.java b/modules/debugger/src/java/flash/tools/debugger/expression/ASTBuilder.java
index 5ef4583..5794ca4 100644
--- a/modules/debugger/src/java/flash/tools/debugger/expression/ASTBuilder.java
+++ b/modules/debugger/src/java/flash/tools/debugger/expression/ASTBuilder.java
@@ -49,7 +49,7 @@ import flash.tools.debugger.DebuggerLocalizer;
*/
public class ASTBuilder implements IASTBuilder
{
- private static LocalizationManager s_localizationManager;
+ private static final LocalizationManager s_localizationManager;
/**
* whether the fdb indirection operators are allowed, e.g. asterisk (*x) or
@@ -78,7 +78,7 @@ public class ASTBuilder implements IASTBuilder
* @return whether the fdb indirection operators are allowed, e.g. asterisk
* (*x) or trailing dot (x.)
*/
- public boolean isIndirectionOperatorAllowed()
+ boolean isIndirectionOperatorAllowed()
{
return m_isIndirectionOperatorAllowed;
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/expression/DebuggerEvaluator.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/expression/DebuggerEvaluator.java b/modules/debugger/src/java/flash/tools/debugger/expression/DebuggerEvaluator.java
index 97302ba..7e97887 100644
--- a/modules/debugger/src/java/flash/tools/debugger/expression/DebuggerEvaluator.java
+++ b/modules/debugger/src/java/flash/tools/debugger/expression/DebuggerEvaluator.java
@@ -56,7 +56,7 @@ class DebuggerEvaluator implements Evaluator
*/
public static class DebuggerValue extends Value
{
- public Object debuggerValue;
+ public final Object debuggerValue;
public DebuggerValue(Object v)
{
@@ -74,7 +74,7 @@ class DebuggerEvaluator implements Evaluator
this.expressionEvaluatorContext = expressionEvaluatorContext;
}
- public Context expressionEvaluatorContext;
+ public final Context expressionEvaluatorContext;
}
private Context eeContext(macromedia.asc.util.Context cx)
@@ -116,16 +116,16 @@ class DebuggerEvaluator implements Evaluator
after = before + 1;
}
- debuggerContext.assign(memberName, debuggerContext.toValue(new Double(after)));
+ debuggerContext.assign(memberName, debuggerContext.toValue(after));
Object result;
if (node.isPostfix)
{
- result = new Double(before);
+ result = before;
}
else
{
- result = new Double(after);
+ result = after;
}
return new DebuggerValue(result);
@@ -189,7 +189,7 @@ class DebuggerEvaluator implements Evaluator
public Value evaluate(macromedia.asc.util.Context cx, LiteralBooleanNode node)
{
- return new DebuggerValue(new Boolean(node.value));
+ return new DebuggerValue(node.value);
}
public Value evaluate(macromedia.asc.util.Context cx, LiteralNumberNode node)
@@ -496,11 +496,8 @@ class DebuggerEvaluator implements Evaluator
} else if (context != null && index != null) {
//Resolve the Value to see if it is a Number
flash.tools.debugger.Value value = context.toValue(index);
- if (value != null && value.getType() == VariableType.NUMBER) {
- return true;
- }
- return false;
- }
+ return value != null && value.getType() == VariableType.NUMBER;
+ }
else {
return false;
}
@@ -558,7 +555,7 @@ class DebuggerEvaluator implements Evaluator
else if (contextValue != null && contextValue.getType() == VariableType.STRING && name.equals("length")) //$NON-NLS-1$
{
String valuestr = contextValue.getValueAsString();
- return new DebuggerValue(new Double(valuestr.length()));
+ return new DebuggerValue((double) valuestr.length());
}
else
{
@@ -580,7 +577,7 @@ class DebuggerEvaluator implements Evaluator
}
}
- public Value getOrSet(macromedia.asc.util.Context cx, SelectorNode node)
+ Value getOrSet(macromedia.asc.util.Context cx, SelectorNode node)
{
assert (node.getMode() == Tokens.LEFTBRACKET_TOKEN || // base[expr]
node.getMode() == Tokens.LEFTPAREN_TOKEN || // base.(expr)
@@ -680,25 +677,25 @@ class DebuggerEvaluator implements Evaluator
case Tokens.PLUS_TOKEN:
{
// ECMA 11.4.6
- return new DebuggerValue(new Double(ECMA.toNumber(eeContext(cx).getSession(), eeContext(cx).toValue(
- arg.debuggerValue))));
+ return new DebuggerValue(ECMA.toNumber(eeContext(cx).getSession(), eeContext(cx).toValue(
+ arg.debuggerValue)));
}
case Tokens.MINUS_TOKEN:
{
// ECMA 11.4.7
- return new DebuggerValue(new Double(-ECMA.toNumber(eeContext(cx).getSession(), eeContext(cx).toValue(
- arg.debuggerValue))));
+ return new DebuggerValue(-ECMA.toNumber(eeContext(cx).getSession(), eeContext(cx).toValue(
+ arg.debuggerValue)));
}
case Tokens.BITWISENOT_TOKEN:
{
// ECMA 11.4.8
- return new DebuggerValue(new Double(~ECMA.toInt32(eeContext(cx).getSession(), eeContext(cx).toValue(
- arg.debuggerValue))));
+ return new DebuggerValue((double) ~ECMA.toInt32(eeContext(cx).getSession(), eeContext(cx).toValue(
+ arg.debuggerValue)));
}
case Tokens.NOT_TOKEN:
{
// ECMA 11.4.9
- return new DebuggerValue(new Boolean(!ECMA.toBoolean(eeContext(cx).toValue(arg.debuggerValue))));
+ return new DebuggerValue(!ECMA.toBoolean(eeContext(cx).toValue(arg.debuggerValue)));
}
default:
cx.internalError(ASTBuilder.getLocalizationManager().getLocalizedTextString("unrecognizedUnaryOperator")); //$NON-NLS-1$
@@ -726,21 +723,21 @@ class DebuggerEvaluator implements Evaluator
// ECMA 11.5
double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
- return new DebuggerValue(new Double(d1 * d2));
+ return new DebuggerValue(d1 * d2);
}
case Tokens.DIV_TOKEN:
{
// ECMA 11.5
double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
- return new DebuggerValue(new Double(d1 / d2));
+ return new DebuggerValue(d1 / d2);
}
case Tokens.MODULUS_TOKEN:
{
// ECMA 11.5
double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
- return new DebuggerValue(new Double(d1 % d2));
+ return new DebuggerValue(d1 % d2);
}
case Tokens.PLUS_TOKEN:
{
@@ -793,7 +790,7 @@ class DebuggerEvaluator implements Evaluator
}
else
{
- return new DebuggerValue(new Double(ECMA.toNumber(session, v1) + ECMA.toNumber(session, v2)));
+ return new DebuggerValue(ECMA.toNumber(session, v1) + ECMA.toNumber(session, v2));
}
}
}
@@ -802,28 +799,28 @@ class DebuggerEvaluator implements Evaluator
// ECMA 11.6.2
double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
- return new DebuggerValue(new Double(d1 - d2));
+ return new DebuggerValue(d1 - d2);
}
case Tokens.LEFTSHIFT_TOKEN:
{
// ECMA 11.7.1
int n1 = ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue));
int n2 = (int) (ECMA.toUint32(session, eeContext.toValue(rhs.debuggerValue)) & 0x1F);
- return new DebuggerValue(new Double(n1 << n2));
+ return new DebuggerValue((double) (n1 << n2));
}
case Tokens.RIGHTSHIFT_TOKEN:
{
// ECMA 11.7.1
int n1 = ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue));
int n2 = (int) (ECMA.toUint32(session, eeContext.toValue(rhs.debuggerValue)) & 0x1F);
- return new DebuggerValue(new Double(n1 >> n2));
+ return new DebuggerValue((double) (n1 >> n2));
}
case Tokens.UNSIGNEDRIGHTSHIFT_TOKEN:
{
// ECMA 11.7.1
long n1 = ECMA.toUint32(session, eeContext.toValue(lhs.debuggerValue));
long n2 = (ECMA.toUint32(session, eeContext.toValue(rhs.debuggerValue)) & 0x1F);
- return new DebuggerValue(new Double(n1 >>> n2));
+ return new DebuggerValue((double) (n1 >>> n2));
}
case Tokens.LESSTHAN_TOKEN:
{
@@ -831,14 +828,7 @@ class DebuggerEvaluator implements Evaluator
flash.tools.debugger.Value lessThan = ECMA.lessThan(session, eeContext.toValue(lhs.debuggerValue), eeContext
.toValue(rhs.debuggerValue));
boolean result;
- if (lessThan.getType() == VariableType.UNDEFINED)
- {
- result = false;
- }
- else
- {
- result = ECMA.toBoolean(lessThan);
- }
+ result = lessThan.getType() != VariableType.UNDEFINED && ECMA.toBoolean(lessThan);
return new DebuggerValue(result);
}
case Tokens.GREATERTHAN_TOKEN:
@@ -847,14 +837,7 @@ class DebuggerEvaluator implements Evaluator
flash.tools.debugger.Value greaterThan = ECMA.lessThan(session, eeContext.toValue(rhs.debuggerValue), eeContext
.toValue(lhs.debuggerValue));
boolean result;
- if (greaterThan.getType() == VariableType.UNDEFINED)
- {
- result = false;
- }
- else
- {
- result = ECMA.toBoolean(greaterThan);
- }
+ result = greaterThan.getType() != VariableType.UNDEFINED && ECMA.toBoolean(greaterThan);
return new DebuggerValue(result);
}
case Tokens.LESSTHANOREQUALS_TOKEN:
@@ -863,14 +846,7 @@ class DebuggerEvaluator implements Evaluator
flash.tools.debugger.Value lessThan = ECMA.lessThan(session, eeContext.toValue(rhs.debuggerValue), eeContext
.toValue(lhs.debuggerValue));
boolean result;
- if (lessThan.getType() == VariableType.UNDEFINED)
- {
- result = false;
- }
- else
- {
- result = !ECMA.toBoolean(lessThan);
- }
+ result = lessThan.getType() != VariableType.UNDEFINED && !ECMA.toBoolean(lessThan);
return new DebuggerValue(result);
}
case Tokens.GREATERTHANOREQUALS_TOKEN:
@@ -879,14 +855,7 @@ class DebuggerEvaluator implements Evaluator
flash.tools.debugger.Value lessThan = ECMA.lessThan(session, eeContext.toValue(lhs.debuggerValue), eeContext
.toValue(rhs.debuggerValue));
boolean result;
- if (lessThan.getType() == VariableType.UNDEFINED)
- {
- result = false;
- }
- else
- {
- result = !ECMA.toBoolean(lessThan);
- }
+ result = lessThan.getType() != VariableType.UNDEFINED && !ECMA.toBoolean(lessThan);
return new DebuggerValue(result);
}
case Tokens.INSTANCEOF_TOKEN:
@@ -932,44 +901,44 @@ class DebuggerEvaluator implements Evaluator
case Tokens.EQUALS_TOKEN:
{
// ECMA 11.9.1
- return new DebuggerValue(new Boolean(ECMA.equals(session, eeContext.toValue(lhs.debuggerValue), eeContext
- .toValue(rhs.debuggerValue))));
+ return new DebuggerValue(ECMA.equals(session, eeContext.toValue(lhs.debuggerValue), eeContext
+ .toValue(rhs.debuggerValue)));
}
case Tokens.NOTEQUALS_TOKEN:
{
// ECMA 11.9.2
- return new DebuggerValue(new Boolean(!ECMA.equals(session, eeContext.toValue(lhs.debuggerValue), eeContext
- .toValue(rhs.debuggerValue))));
+ return new DebuggerValue(!ECMA.equals(session, eeContext.toValue(lhs.debuggerValue), eeContext
+ .toValue(rhs.debuggerValue)));
}
case Tokens.STRICTEQUALS_TOKEN:
{
// ECMA 11.9.4
- return new DebuggerValue(new Boolean(ECMA.strictEquals(eeContext.toValue(lhs.debuggerValue), eeContext
- .toValue(rhs.debuggerValue))));
+ return new DebuggerValue(ECMA.strictEquals(eeContext.toValue(lhs.debuggerValue), eeContext
+ .toValue(rhs.debuggerValue)));
}
case Tokens.STRICTNOTEQUALS_TOKEN:
{
// ECMA 11.9.5
- return new DebuggerValue(new Boolean(!ECMA.strictEquals(eeContext.toValue(lhs.debuggerValue), eeContext
- .toValue(rhs.debuggerValue))));
+ return new DebuggerValue(!ECMA.strictEquals(eeContext.toValue(lhs.debuggerValue), eeContext
+ .toValue(rhs.debuggerValue)));
}
case Tokens.BITWISEAND_TOKEN:
{
// ECMA 11.10
- return new DebuggerValue(new Double(ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue))
- & ECMA.toInt32(session, eeContext.toValue(rhs.debuggerValue))));
+ return new DebuggerValue((double) (ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue))
+ & ECMA.toInt32(session, eeContext.toValue(rhs.debuggerValue))));
}
case Tokens.BITWISEXOR_TOKEN:
{
// ECMA 11.10
- return new DebuggerValue(new Double(ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue))
- ^ ECMA.toInt32(session, eeContext.toValue(rhs.debuggerValue))));
+ return new DebuggerValue((double) (ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue))
+ ^ ECMA.toInt32(session, eeContext.toValue(rhs.debuggerValue))));
}
case Tokens.BITWISEOR_TOKEN:
{
// ECMA 11.10
- return new DebuggerValue(new Double(ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue))
- | ECMA.toInt32(session, eeContext.toValue(rhs.debuggerValue))));
+ return new DebuggerValue((double) (ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue))
+ | ECMA.toInt32(session, eeContext.toValue(rhs.debuggerValue))));
}
case Tokens.LOGICALAND_TOKEN:
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/expression/ECMA.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/expression/ECMA.java b/modules/debugger/src/java/flash/tools/debugger/expression/ECMA.java
index 536aea4..ca04e8d 100644
--- a/modules/debugger/src/java/flash/tools/debugger/expression/ECMA.java
+++ b/modules/debugger/src/java/flash/tools/debugger/expression/ECMA.java
@@ -43,7 +43,7 @@ public class ECMA
/**
* ECMA 4.3.2
*/
- public static boolean isPrimitive(Value v)
+ private static boolean isPrimitive(Value v)
{
v = safeValue(v);
Object o = v.getValueAsObject();
@@ -93,7 +93,7 @@ public class ECMA
* @param optionalPreferredType
* either NUMBER, STRING, or null.
*/
- public static Value defaultValue(Session session, Value v, PreferredType optionalPreferredType)
+ private static Value defaultValue(Session session, Value v, PreferredType optionalPreferredType)
{
v = safeValue(v);
String typename = v.getTypeName();
@@ -171,14 +171,7 @@ public class ECMA
case VariableType.NUMBER:
{
double d = ((Double) v.getValueAsObject()).doubleValue();
- if (d == 0 || Double.isNaN(d))
- {
- return false;
- }
- else
- {
- return true;
- }
+ return !(d == 0 || Double.isNaN(d));
}
case VariableType.STRING:
return ((String) v.getValueAsObject()).length() != 0;
@@ -298,7 +291,7 @@ public class ECMA
{
String sx = px.getValueAsString();
String sy = py.getValueAsString();
- return DValue.forPrimitive(new Boolean(sx.compareTo(sy) < 0));
+ return DValue.forPrimitive(sx.compareTo(sy) < 0);
}
else
{
@@ -306,7 +299,7 @@ public class ECMA
double dy = toNumber(session, py);
if (Double.isNaN(dx) || Double.isNaN(dy))
return DValue.forPrimitive(Value.UNDEFINED);
- return DValue.forPrimitive(new Boolean(dx < dy));
+ return DValue.forPrimitive(dx < dy);
}
}
@@ -335,10 +328,8 @@ public class ECMA
return x.equals(y);
// see if they are the same object
- if (xv.getId() != -1 || yv.getId() != -1)
- return xv.getId() == yv.getId();
- return false;
- }
+ return (xv.getId() != -1 || yv.getId() != -1) && xv.getId() == yv.getId();
+ }
else
{
if (x == null && y == Value.UNDEFINED)
@@ -358,19 +349,15 @@ public class ECMA
return dx == dy;
}
if (x instanceof Boolean)
- return equals(session, DValue.forPrimitive(new Double(toNumber(session, xv))), yv);
+ return equals(session, DValue.forPrimitive(toNumber(session, xv)), yv);
if (y instanceof Boolean)
- return equals(session, xv, DValue.forPrimitive(new Double(toNumber(session, yv))));
+ return equals(session, xv, DValue.forPrimitive(toNumber(session, yv)));
if ((x instanceof String || x instanceof Double) && yv.getType() == VariableType.OBJECT)
{
return equals(session, xv, toPrimitive(session, yv, null));
}
- if (xv.getType() == VariableType.OBJECT && (y instanceof String || y instanceof Double))
- {
- return equals(session, toPrimitive(session, xv, null), yv);
- }
- return false;
- }
+ return xv.getType() == VariableType.OBJECT && (y instanceof String || y instanceof Double) && equals(session, toPrimitive(session, xv, null), yv);
+ }
}
/** ECMA 11.9.6 */
@@ -398,10 +385,8 @@ public class ECMA
return x.equals(y);
// see if they are the same object
- if (xv.getId() != -1 || yv.getId() != -1)
- return xv.getId() == yv.getId();
- return false;
- }
+ return (xv.getId() != -1 || yv.getId() != -1) && xv.getId() == yv.getId();
+ }
else
{
return false;
@@ -417,7 +402,7 @@ public class ECMA
* any Value, possibly null
* @return a non-null Value
*/
- public static Value safeValue(Value v)
+ private static Value safeValue(Value v)
{
if (v == null)
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/expression/PlayerFaultException.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/expression/PlayerFaultException.java b/modules/debugger/src/java/flash/tools/debugger/expression/PlayerFaultException.java
index aaa5c88..1a6aa5f 100644
--- a/modules/debugger/src/java/flash/tools/debugger/expression/PlayerFaultException.java
+++ b/modules/debugger/src/java/flash/tools/debugger/expression/PlayerFaultException.java
@@ -30,7 +30,7 @@ import flash.tools.debugger.events.FaultEvent;
*/
public class PlayerFaultException extends Exception {
private static final long serialVersionUID = 7754580337597815207L;
- private FaultEvent m_event;
+ private final FaultEvent m_event;
public PlayerFaultException(FaultEvent event)
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeASTBuilder.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeASTBuilder.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeASTBuilder.java
index eb9bccf..1588bf2 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeASTBuilder.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeASTBuilder.java
@@ -36,7 +36,7 @@ public class ThreadSafeASTBuilder extends ThreadSafeDebuggerObject implements IA
/**
* @param syncObj
*/
- public ThreadSafeASTBuilder(Object syncObj, IASTBuilder astBuilder)
+ private ThreadSafeASTBuilder(Object syncObj, IASTBuilder astBuilder)
{
super(syncObj);
m_astBuilder = astBuilder;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeBootstrap.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeBootstrap.java
index 6fc9bf2..706cacd 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeBootstrap.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeBootstrap.java
@@ -25,7 +25,7 @@ import flash.tools.debugger.Bootstrap;
* Thread-safe wrapper for flash.tools.debugger.Bootstrap
* @author Mike Morearty
*/
-public class ThreadSafeBootstrap {
+class ThreadSafeBootstrap {
private static ThreadSafeSessionManager fMgr;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeDebuggerObject.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeDebuggerObject.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeDebuggerObject.java
index cfa0b08..43dc4e6 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeDebuggerObject.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeDebuggerObject.java
@@ -26,13 +26,13 @@ package flash.tools.debugger.threadsafe;
*/
class ThreadSafeDebuggerObject {
- private Object fSyncObj;
+ private final Object fSyncObj;
- protected ThreadSafeDebuggerObject(Object syncObj) {
+ ThreadSafeDebuggerObject(Object syncObj) {
fSyncObj = syncObj;
}
- public final Object getSyncObject() {
+ final Object getSyncObject() {
return fSyncObj;
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeFrame.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeFrame.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeFrame.java
index fd75802..8374966 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeFrame.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeFrame.java
@@ -33,7 +33,7 @@ import flash.tools.debugger.Variable;
*/
public class ThreadSafeFrame extends ThreadSafeDebuggerObject implements Frame {
- private Frame fFrame;
+ private final Frame fFrame;
private ThreadSafeFrame(Object syncObj, Frame frame) {
super(syncObj);
@@ -44,7 +44,7 @@ public class ThreadSafeFrame extends ThreadSafeDebuggerObject implements Frame {
* Wraps a Frame inside a ThreadSafeFrame. If the passed-in Frame
* is null, then this function returns null.
*/
- public static ThreadSafeFrame wrap(Object syncObj, Frame frame) {
+ private static ThreadSafeFrame wrap(Object syncObj, Frame frame) {
if (frame != null)
return new ThreadSafeFrame(syncObj, frame);
else
@@ -79,11 +79,8 @@ public class ThreadSafeFrame extends ThreadSafeDebuggerObject implements Frame {
if (other instanceof ThreadSafeFrame) {
return (fFrame.equals(((ThreadSafeFrame)other).fFrame));
}
- if (other instanceof Frame) {
- return (fFrame.equals(other));
- }
- return false;
- }
+ return other instanceof Frame && (fFrame.equals(other));
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeLocation.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeLocation.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeLocation.java
index 9c396cb..4c0659a 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeLocation.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeLocation.java
@@ -28,7 +28,7 @@ import flash.tools.debugger.SourceFile;
*/
public class ThreadSafeLocation extends ThreadSafeDebuggerObject implements Location {
- private Location fLocation;
+ private final Location fLocation;
private ThreadSafeLocation(Object syncObj, Location location) {
super(syncObj);
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafePlayer.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafePlayer.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafePlayer.java
index 44671aa..d0a3398 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafePlayer.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafePlayer.java
@@ -30,7 +30,7 @@ import flash.tools.debugger.Player;
*/
public class ThreadSafePlayer extends ThreadSafeDebuggerObject implements Player {
- private Player fPlayer;
+ private final Player fPlayer;
private ThreadSafePlayer(Object syncObj, Player player) {
super(syncObj);
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSession.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSession.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSession.java
index b802deb..9815fcb 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSession.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSession.java
@@ -43,7 +43,7 @@ import flash.tools.debugger.expression.PlayerFaultException;
*/
public class ThreadSafeSession extends ThreadSafeDebuggerObject implements Session {
- private Session fSession;
+ private final Session fSession;
private ThreadSafeSession(Object syncObj, Session session) {
super(syncObj);
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSessionManager.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSessionManager.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSessionManager.java
index 2a89eb1..c93a83e 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSessionManager.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSessionManager.java
@@ -29,7 +29,6 @@ import flash.tools.debugger.Player;
import flash.tools.debugger.Session;
import flash.tools.debugger.SessionManager;
import flash.tools.debugger.SessionManager2;
-import flash.tools.debugger.VersionException;
/**
* Thread-safe wrapper for flash.tools.debugger.SessionManager
@@ -37,7 +36,7 @@ import flash.tools.debugger.VersionException;
*/
public class ThreadSafeSessionManager extends ThreadSafeDebuggerObject implements SessionManager2 {
- private SessionManager fSessionManager;
+ private final SessionManager fSessionManager;
private ThreadSafeSessionManager(SessionManager sessionManager) {
super(new Object());
@@ -97,10 +96,8 @@ public class ThreadSafeSessionManager extends ThreadSafeDebuggerObject implement
* We just return the process to be consistent with PlayerSessionManager.
*/
assert fSessionManager instanceof SessionManager2;
-
- Process process = ((SessionManager2) fSessionManager).launchForRun(uri, airLaunchInfo, waitReporter, launchNotification);
-
- return process;
+
+ return ((SessionManager2) fSessionManager).launchForRun(uri, airLaunchInfo, waitReporter, launchNotification);
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceFile.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceFile.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceFile.java
index fd56579..786e0a0 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceFile.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceFile.java
@@ -28,7 +28,7 @@ import flash.tools.debugger.SourceFile;
*/
public class ThreadSafeSourceFile extends ThreadSafeDebuggerObject implements SourceFile {
- private SourceFile fSourceFile;
+ private final SourceFile fSourceFile;
private ThreadSafeSourceFile(Object syncObj, SourceFile sourceFile) {
super(syncObj);
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceLocator.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceLocator.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceLocator.java
index ddab0bd..8d15014 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceLocator.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSourceLocator.java
@@ -28,12 +28,12 @@ import flash.tools.debugger.SourceLocator;
*/
public class ThreadSafeSourceLocator extends ThreadSafeDebuggerObject implements SourceLocator
{
- private SourceLocator fSourceLocator;
+ private final SourceLocator fSourceLocator;
/**
* @param syncObj
*/
- public ThreadSafeSourceLocator(Object syncObj, SourceLocator sourceLocator)
+ private ThreadSafeSourceLocator(Object syncObj, SourceLocator sourceLocator)
{
super(syncObj);
fSourceLocator = sourceLocator;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSwfInfo.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSwfInfo.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSwfInfo.java
index 40fa457..39df3a6 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSwfInfo.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeSwfInfo.java
@@ -30,7 +30,7 @@ import flash.tools.debugger.SwfInfo;
*/
public class ThreadSafeSwfInfo extends ThreadSafeDebuggerObject implements SwfInfo {
- private SwfInfo fSwfInfo;
+ private final SwfInfo fSwfInfo;
private ThreadSafeSwfInfo(Object syncObj, SwfInfo swfInfo) {
super(syncObj);
@@ -41,7 +41,7 @@ public class ThreadSafeSwfInfo extends ThreadSafeDebuggerObject implements SwfIn
* Wraps a SwfInfo inside a ThreadSafeSwfInfo. If the passed-in SwfInfo
* is null, then this function returns null.
*/
- public static ThreadSafeSwfInfo wrap(Object syncObj, SwfInfo swfInfo) {
+ private static ThreadSafeSwfInfo wrap(Object syncObj, SwfInfo swfInfo) {
if (swfInfo != null)
return new ThreadSafeSwfInfo(syncObj, swfInfo);
else
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValue.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValue.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValue.java
index cf489ed..50cce16 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValue.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValue.java
@@ -32,7 +32,7 @@ import flash.tools.debugger.Variable;
*/
public class ThreadSafeValue extends ThreadSafeDebuggerObject implements Value {
- private Value fVal;
+ private final Value fVal;
private ThreadSafeValue(Object syncObj, Value val) {
super(syncObj);
@@ -76,10 +76,7 @@ public class ThreadSafeValue extends ThreadSafeDebuggerObject implements Value {
}
public boolean equals(Object other) {
- if (other instanceof Value)
- return fVal.equals(getRaw((Value)other));
- else
- return false;
+ return other instanceof Value && fVal.equals(getRaw((Value) other));
}
public int getAttributes() {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValueExp.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValueExp.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValueExp.java
index 8e6581e..62e80f1 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValueExp.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeValueExp.java
@@ -33,7 +33,7 @@ public class ThreadSafeValueExp extends ThreadSafeDebuggerObject implements Valu
{
private final ValueExp m_valueExp;
- public ThreadSafeValueExp(Object syncObj, ValueExp valueExp)
+ private ThreadSafeValueExp(Object syncObj, ValueExp valueExp)
{
super(syncObj);
m_valueExp = valueExp;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeVariable.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeVariable.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeVariable.java
index 8e6a50f..bf0199f 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeVariable.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeVariable.java
@@ -33,7 +33,7 @@ import flash.tools.debugger.events.FaultEvent;
*/
public class ThreadSafeVariable extends ThreadSafeDebuggerObject implements Variable {
- private Variable fVar;
+ private final Variable fVar;
private ThreadSafeVariable(Object syncObj, Variable var) {
super(syncObj);
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeWatch.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeWatch.java b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeWatch.java
index b88c41e..d51e528 100644
--- a/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeWatch.java
+++ b/modules/debugger/src/java/flash/tools/debugger/threadsafe/ThreadSafeWatch.java
@@ -27,7 +27,7 @@ import flash.tools.debugger.Watch;
*/
public class ThreadSafeWatch extends ThreadSafeDebuggerObject implements Watch {
- private Watch fWatch;
+ private final Watch fWatch;
private ThreadSafeWatch(Object syncObj, Watch watch) {
super(syncObj);
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/util/URLEncoder.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/util/URLEncoder.java b/modules/debugger/src/java/flash/util/URLEncoder.java
index 52afb29..8d0cd34 100644
--- a/modules/debugger/src/java/flash/util/URLEncoder.java
+++ b/modules/debugger/src/java/flash/util/URLEncoder.java
@@ -21,15 +21,15 @@ package flash.util;
import java.io.*;
-public final class URLEncoder
+final class URLEncoder
{
- public static final String charset = "UTF8"; //$NON-NLS-1$
+ private static final String charset = "UTF8"; //$NON-NLS-1$
private URLEncoder()
{
}
- public static final String encode(String s)
+ public static String encode(String s)
{
try
{
@@ -41,7 +41,7 @@ public final class URLEncoder
}
}
- public static final String encode(String s, String enc) throws UnsupportedEncodingException
+ private static String encode(String s, String enc) throws UnsupportedEncodingException
{
if (!needsEncoding(s))
{
@@ -101,7 +101,7 @@ public final class URLEncoder
return out.toString();
}
- private static final void toHex(StringBuilder buffer, byte[] b)
+ private static void toHex(StringBuilder buffer, byte[] b)
{
for (int i = 0; i < b.length; i++)
{
@@ -123,7 +123,7 @@ public final class URLEncoder
}
}
- private static final boolean needsEncoding(String s)
+ private static boolean needsEncoding(String s)
{
if (s == null)
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flash/util/URLHelper.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flash/util/URLHelper.java b/modules/debugger/src/java/flash/util/URLHelper.java
index c0b6556..9f5fb07 100644
--- a/modules/debugger/src/java/flash/util/URLHelper.java
+++ b/modules/debugger/src/java/flash/util/URLHelper.java
@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
public class URLHelper
{
- private static Pattern URL_PATTERN = Pattern.compile("^(.*?)(\\?.*?)?(#.*)?$"); //$NON-NLS-1$
+ private static final Pattern URL_PATTERN = Pattern.compile("^(.*?)(\\?.*?)?(#.*)?$"); //$NON-NLS-1$
/**
* Everything before the "query" part of the URL. E.g. for
@@ -75,7 +75,7 @@ public class URLHelper
* "http://www.example.com/file?firstname=Bob&lastname=Smith#foo"
* this would be "http://www.example.com/file".
*/
- public String getEverythingBeforeQuery()
+ String getEverythingBeforeQuery()
{
return m_everythingBeforeQuery;
}
@@ -91,7 +91,7 @@ public class URLHelper
* "?firstname=Bob&lastname=Smith" part. m_query contains the query
* (including "?"), or "" if the URL has no query. Never null.
*/
- public String getQuery()
+ String getQuery()
{
return m_query;
}
@@ -100,7 +100,7 @@ public class URLHelper
* Sets the "query" portion of the URL. This must be either the
* empty string or a string that begins with "?".
*/
- public void setQuery(String query)
+ void setQuery(String query)
{
// if there is a query, make sure it starts with "?"
if (query.length() > 0 && query.charAt(0) != '?')
@@ -115,7 +115,7 @@ public class URLHelper
* Returns the "fragment" portion of the URL, e.g. the "#foo" part, or
* "" if the URL has no fragment. Never null.
*/
- public String getFragment()
+ String getFragment()
{
return m_fragment;
}
@@ -150,15 +150,11 @@ public class URLHelper
return false;
URLHelper newHelper = new URLHelper(everythingBeforeQuery + query + fragment);
- if (!newHelper.getEverythingBeforeQuery().equals(everythingBeforeQuery) ||
- !newHelper.getQuery().equals(query) ||
- !newHelper.getFragment().equals(fragment))
- {
- return false;
- }
-
- return true;
- }
+ return !(!newHelper.getEverythingBeforeQuery().equals(everythingBeforeQuery) ||
+ !newHelper.getQuery().equals(query) ||
+ !newHelper.getFragment().equals(fragment));
+
+ }
/**
* Returns the entire URL.
@@ -247,7 +243,7 @@ public class URLHelper
* Locates characters 'c' in the scheme specific portion of a URI and
* translates them into 'to'
*/
- public static String escapeCharacter(String uri, char c, String to)
+ private static String escapeCharacter(String uri, char c, String to)
{
StringBuilder sb = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flex/tools/debugger/cli/BreakAction.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flex/tools/debugger/cli/BreakAction.java b/modules/debugger/src/java/flex/tools/debugger/cli/BreakAction.java
index ddf7c08..e8d834c 100644
--- a/modules/debugger/src/java/flex/tools/debugger/cli/BreakAction.java
+++ b/modules/debugger/src/java/flex/tools/debugger/cli/BreakAction.java
@@ -33,7 +33,7 @@ import flash.tools.debugger.expression.ValueExp;
* A breakpoint can be enabled or disabled. It can be set such
* that it disabled or deletes itself after being hit N times.
*/
-public class BreakAction
+class BreakAction
{
// return values for getStatus()
public final static int RESOLVED = 1;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flex/tools/debugger/cli/BreakIdentifier.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flex/tools/debugger/cli/BreakIdentifier.java b/modules/debugger/src/java/flex/tools/debugger/cli/BreakIdentifier.java
index 0516b98..79627b2 100644
--- a/modules/debugger/src/java/flex/tools/debugger/cli/BreakIdentifier.java
+++ b/modules/debugger/src/java/flex/tools/debugger/cli/BreakIdentifier.java
@@ -22,7 +22,7 @@ package flex.tools.debugger.cli;
/**
* An singleton object that doles out unique identifiers to breakpoints and watchpoints
*/
-public class BreakIdentifier
+class BreakIdentifier
{
private static int s_uniqueIdentifier = 1;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dcc40468/modules/debugger/src/java/flex/tools/debugger/cli/CatchAction.java
----------------------------------------------------------------------
diff --git a/modules/debugger/src/java/flex/tools/debugger/cli/CatchAction.java b/modules/debugger/src/java/flex/tools/debugger/cli/CatchAction.java
index afa7d6c..21a1a35 100644
--- a/modules/debugger/src/java/flex/tools/debugger/cli/CatchAction.java
+++ b/modules/debugger/src/java/flex/tools/debugger/cli/CatchAction.java
@@ -26,7 +26,7 @@ package flex.tools.debugger.cli;
*
* @author Mike Morearty
*/
-public class CatchAction
+class CatchAction
{
private final int m_id;
private final String m_typeToCatch;