2012/11/2 bob <[email protected]>

> You're right.
>
>
> It only triggers if you put it on the second line.  Do you think this is
> correct behavior?
>

Whether it's correct or not is a loaded question, I'm not gonna discuss
this without a lawyer :)

Putting it another way: I remember debuggers for all languages, on all
platforms that I've ever used acting a little weird for complex and/or
multiline statements.



>
> I guess I just always thought whitespace never mattered at all.
>

What whitespace? The newline character splits your statement in two lines,
and -- AFAIK -- debug info typically ties code fragments to source lines...
So the whole thing depends on how the compiler breaks down the declaration
/ call / assignment and ties it back to source lines.

The origin of this behavior, in this case, most likely lies in the Java
compiler.

-- K

>
>
> On Friday, November 2, 2012 12:19:23 PM UTC-5, Kostya Vasilyev wrote:
>
>> Hold on a second.
>>
>> Calling start() on a thread surely keeps a reference somewhere that would
>> prevent the thread from being GC'd while it's still running.
>>
>> As for the breakpoint, quoting Bob's original message:
>>
>> >>
>> Now put a breakpoint on this line in the thread:
>>
>>  BluetoothAdapter bluetoothAdapter = BluetoothAdapter
>>  .getDefaultAdapter();
>> <<
>>
>> Is not a very specific description, because there are two lines here
>> forming a single statement, if the original formatting is preserved.
>>
>> Single-stepping and breakpoints sometimes act a little weird with
>> multi-line statements.
>>
>> And -- at least in my environment, Eclipse 3.7.2, latest Android stuff --
>> a breakpoint set on the second of those two lines triggers, but a
>> breakpoint set on the first of the two does not.
>>
>> To make the line-to-code matching more visual, one can add a statement
>> above the two lines in question, set a breakpoint there, then single-step.
>>
>> The "currently executing line" highlight will never hit the first of
>> those two lines, but will hit the second one.
>>
>> -- K
>>
>> 2012/11/2 Latimerius <[email protected]>
>>
>>> On Fri, Nov 2, 2012 at 4:25 PM, bob <[email protected]> wrote:
>>> > I changed it to this:
>>> >
>>> > Listener_Thread listener_Thread = new Listener_Thread(this);
>>> > listener_Thread.start();
>>>
>>> Well what is the lifespan of listener_Thread?  If it's local in
>>> onCreate() as seems to be implied then you haven't changed much as
>>> listener_Thread will go out of scope just moments later, leaving your
>>> Listener_Thread instance with no references again.  Try making
>>> listener_Thread a member variable of your Activity to make it longer
>>> lived (if just for the sake of test).
>>>
>>> If your problem is 100% reliably reproducible then this might not be
>>> the root cause.  However, it could be one of the causes.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-d...@**googlegroups.com
>>>
>>> To unsubscribe from this group, send email to
>>> android-developers+**[email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to