SdkManagers buglet?

  4 posts   Feedicon  
Replies: 3 - Last Post: January 10, 2011 20:09
by: Jacob Nordfalk
showing 1 - 4 of 4
 
Posted: January 05, 2011 04:48 by Tim Boudreau
I'm attempting to get these modules (built from source) up and running; it's possibly complicated by the fact that I'm running Gentoo Linux and built the Android SDK myself (and since then, updated it, which must be done as root <sigh/>).

Anyway, so far it recognizes the SDK but the Next / Finish buttons are never enabled in the wizard - I'm downloading still more SDK pieces so that may be why.

In the meantime I took a look at what the platform install wizard was doing.

SdkManagers looks like it can't possibly do what it's intended to do. It looks up an Android SDK object SdkManager, and stores it mapped to a file path in a static WeakHashMap<String, SdkManager>.

The keys, not the values are what is weak in a WeakHashMap. So one of two things will happen:
- They are not interned, and the values put in the map are garbage collected within a couple of seconds, or worse
- They *are* interned, and the values put in the map live forever, even if the path they map to has become invalid

Conceivably someone is trying to very cleverly exploit the lifecycle of Strings in the JVM, is assuming that a File will strongly reference the string, and be referenced from the file chooser, etc. But somehow I doubt this, and if so, it's depending on way too many implementation details to ever be reliable.

Probably the pattern you want here (if a cache is needed at all) is
private static Map<Object, Map<String, SdkManager>> managers = ...
public static SdkTarget findSdkAndTargetForPlatform(Object caller, JavaPlatform platform, final boolean errorReportOn) { ...

(i.e. tie the lifetime of the cache to the lifetime of the caller, whatever it is) but the whole thing looks pretty fishy.

If the cache contents is ending up strongly held, that may be the source of my inability to install a platform - once recognized as semi-valid, it would take a restart of NetBeans to fix it.

-Tim
 
Posted: January 05, 2011 06:10 by Tim Boudreau
Nevermind, I found the NBANDROID-65 branch
 
Posted: January 05, 2011 16:10 by radim
Yup, NBANDROID-65 is the only active branch. At least some basic stuff should be working there. Feel free to post your feedback on it. I'd like to post its build as an alpha prototype soon. It would be great to get some input what are critical pieces.
 
Posted: January 10, 2011 20:09 by Jacob Nordfalk
Hi Radim,

I am starting up new Android classes by end of January.

Do you think you could get something working by then?

Jacob
Replies: 3 - Last Post: January 10, 2011 20:09
by: Jacob Nordfalk
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close