Merge
authorasaha
Mon, 06 Jul 2009 11:42:37 -0700
changeset 3465 96252ea98a6a
parent 3464 4ef40ee318ef (current diff)
parent 3217 07b65d4b6227 (diff)
child 3466 2200fa4b79ff
child 3467 b9f3a2f34102
Merge
jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
jdk/src/share/native/sun/font/bidi/cmemory.h
jdk/src/share/native/sun/font/bidi/jbidi.c
jdk/src/share/native/sun/font/bidi/jbidi.h
jdk/src/share/native/sun/font/bidi/ubidi.c
jdk/src/share/native/sun/font/bidi/ubidi.h
jdk/src/share/native/sun/font/bidi/ubidiimp.h
jdk/src/share/native/sun/font/bidi/ubidiln.c
jdk/src/share/native/sun/font/bidi/uchardir.c
jdk/src/share/native/sun/font/bidi/uchardir.h
jdk/src/share/native/sun/font/bidi/utypes.h
langtools/src/share/classes/sun/tools/javap/AttrData.java
langtools/src/share/classes/sun/tools/javap/CPX.java
langtools/src/share/classes/sun/tools/javap/CPX2.java
langtools/src/share/classes/sun/tools/javap/ClassData.java
langtools/src/share/classes/sun/tools/javap/Constants.java
langtools/src/share/classes/sun/tools/javap/FieldData.java
langtools/src/share/classes/sun/tools/javap/InnerClassData.java
langtools/src/share/classes/sun/tools/javap/JavapEnvironment.java
langtools/src/share/classes/sun/tools/javap/JavapPrinter.java
langtools/src/share/classes/sun/tools/javap/LineNumData.java
langtools/src/share/classes/sun/tools/javap/LocVarData.java
langtools/src/share/classes/sun/tools/javap/Main.java
langtools/src/share/classes/sun/tools/javap/MethodData.java
langtools/src/share/classes/sun/tools/javap/RuntimeConstants.java
langtools/src/share/classes/sun/tools/javap/StackMapData.java
langtools/src/share/classes/sun/tools/javap/StackMapTableData.java
langtools/src/share/classes/sun/tools/javap/Tables.java
langtools/src/share/classes/sun/tools/javap/TrapData.java
langtools/src/share/classes/sun/tools/javap/TypeSignature.java
langtools/test/tools/javac/code/ArrayClone.sh
langtools/test/tools/javap/ListTest.java
langtools/test/tools/javap/OptionTest.java
--- a/.hgtags	Wed Jul 01 09:59:16 2009 -0700
+++ b/.hgtags	Mon Jul 06 11:42:37 2009 -0700
@@ -35,3 +35,5 @@
 d60a9ce3c3eabf28f5d50ae839d18be04a551bc2 jdk7-b58
 c33e7d38c9210741dbc285507403a4b20bd802a0 jdk7-b59
 5a10e4d0b14d7beac53a7b2213ae6864afe1fd3e jdk7-b60
+dbb955b1ee59b876dd1f133952b557b48b1d7732 jdk7-b61
+6107cbff3130c747d243c25a7874cd59db5744a8 jdk7-b62
--- a/.hgtags-top-repo	Wed Jul 01 09:59:16 2009 -0700
+++ b/.hgtags-top-repo	Mon Jul 06 11:42:37 2009 -0700
@@ -35,3 +35,5 @@
 59b497130f82ec809c245ffb5e521e3a5fabf8af jdk7-b58
 030142474602b4a067662fffc0c8e541de5a78df jdk7-b59
 39565502682c7085369bd09e51640919dc741097 jdk7-b60
+472c21584cfd7e9c0229ad6a100366a5c03d2976 jdk7-b61
+c7ed15ab92ce36a09d264a5e34025884b2d7607f jdk7-b62
--- a/README-builds.html	Wed Jul 01 09:59:16 2009 -0700
+++ b/README-builds.html	Mon Jul 06 11:42:37 2009 -0700
@@ -72,6 +72,7 @@
                             <li>Linux and Solaris:
                                 <ul>
                                     <li><a href="#cups">CUPS Include files</a> </li>
+                                    <li><a href="#xrender">XRender Include files</a></li>
                                 </ul>
                             </li>
                             <li>Linux only:
@@ -657,6 +658,9 @@
                     <tt><a href="#ALT_CUPS_HEADERS_PATH">ALT_CUPS_HEADERS_PATH</a></tt>.
                 </li>
                 <li>
+                    Install the <a href="#xrender">XRender Include files</a>.
+                </li>
+                <li>
                     Install the
                     <a href="#jibx">JIBX Libraries</a>, set
                     <tt><a href="#ALT_JIBX_LIBS_PATH">ALT_JIBX_LIBS_PATH</a></tt>.
@@ -1032,6 +1036,27 @@
                 CUPS Header files.
             </blockquote>
             <!-- ------------------------------------------------------ -->
+            <h4><a name="xrender">XRender Extension Headers (Solaris &amp; Linux)</a></h4>
+            <blockquote>
+                <p>
+                <strong>Solaris:</strong>
+                XRender header files are required for building the 
+                OpenJDK on Solaris.
+                The XRender header file is included with the other X11 header files
+                in the package <strong>SFWxwinc</strong> on new enough versions of
+                Solaris and will be installed in
+	        <tt>/usr/X11/include/X11/extensions/Xrender.h</tt>
+                </p><p>
+                <strong>Linux:</strong>
+                XRender header files are required for building the 
+                OpenJDK on Linux.
+                The Linux header files are usually available from a "Xrender"
+                development package, it's recommended that you try and use
+                the package provided by the particular distribution of Linux that
+                you are using.
+	        </p>
+            </blockquote>
+            <!-- ------------------------------------------------------ -->
             <h4><a name="freetype">FreeType 2</a></h4>
             <blockquote>
                 Version 2.3 or newer of FreeType is required for building the OpenJDK.
--- a/corba/.hgtags	Wed Jul 01 09:59:16 2009 -0700
+++ b/corba/.hgtags	Mon Jul 06 11:42:37 2009 -0700
@@ -35,3 +35,5 @@
 2e3b8edab3ef55406494d3dd562e06882e6fc15e jdk7-b58
 7e6b2b55c00cc523b468272353ada3979adbbf16 jdk7-b59
 f1e1cccbd13aa96d2d8bd872782ff764010bc22c jdk7-b60
+e906b16a12a9a63b615898afa5d9673cbd1c5ab8 jdk7-b61
+65b66117dbd70a493e9644aeb4033cf95a4e3c99 jdk7-b62
--- a/corba/make/Makefile	Wed Jul 01 09:59:16 2009 -0700
+++ b/corba/make/Makefile	Mon Jul 06 11:42:37 2009 -0700
@@ -106,7 +106,12 @@
 
 SOURCE_LEVEL = 5
 BOOTSTRAP_TARGET_LEVEL = 5
-TARGET_LEVEL = 6
+
+ifdef TARGET_CLASS_VERSION
+    TARGET_LEVEL = $(TARGET_CLASS_VERSION)
+else
+    TARGET_LEVEL = 6
+endif
 
 ifndef TARGET_JAVA
   TARGET_JAVA = java
--- a/hotspot/.hgtags	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/.hgtags	Mon Jul 06 11:42:37 2009 -0700
@@ -35,3 +35,5 @@
 53d9bf689e80fcc76b221bbe6c5d58e08b80cbc6 jdk7-b58
 c55be0c7bd32c016c52218eb4c8b5da8a75450b5 jdk7-b59
 a77eddcd510c3972717c025cfcef9a60bfa4ecac jdk7-b60
+27b728fd1281ab62e9d7e4424f8bbb6ca438d803 jdk7-b61
+a88386380bdaaa5ab4ffbedf22c57bac5dbec034 jdk7-b62
--- a/hotspot/make/hotspot_version	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/make/hotspot_version	Mon Jul 06 11:42:37 2009 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=16
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=04
+HS_BUILD_NUMBER=05
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -1157,6 +1157,13 @@
   } else {
     // We're done with marking.
     JavaThread::satb_mark_queue_set().set_active_all_threads(false);
+
+    if (VerifyDuringGC) {
+      g1h->prepare_for_verify();
+      g1h->verify(/* allow_dirty */      true,
+                  /* silent */           false,
+                  /* use_prev_marking */ false);
+    }
   }
 
 #if VERIFY_OBJS_PROCESSED
@@ -1747,12 +1754,12 @@
   // races with it goes around and waits for completeCleanup to finish.
   g1h->increment_total_collections();
 
-#ifndef PRODUCT
   if (VerifyDuringGC) {
-    G1CollectedHeap::heap()->prepare_for_verify();
-    G1CollectedHeap::heap()->verify(true,false);
+    g1h->prepare_for_verify();
+    g1h->verify(/* allow_dirty */      true,
+                /* silent */           false,
+                /* use_prev_marking */ true);
   }
-#endif
 }
 
 void ConcurrentMark::completeCleanup() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -1535,6 +1535,15 @@
   guarantee(_hrs != NULL, "Couldn't allocate HeapRegionSeq");
   guarantee(_cur_alloc_region == NULL, "from constructor");
 
+  // 6843694 - ensure that the maximum region index can fit
+  // in the remembered set structures.
+  const size_t max_region_idx = ((size_t)1 << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1;
+  guarantee((max_regions() - 1) <= max_region_idx, "too many regions");
+
+  const size_t cards_per_region = HeapRegion::GrainBytes >> CardTableModRefBS::card_shift;
+  size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1;
+  guarantee(cards_per_region < max_cards_per_region, "too many cards per region");
+
   _bot_shared = new G1BlockOffsetSharedArray(_reserved,
                                              heap_word_size(init_byte_size));
 
@@ -2127,17 +2136,22 @@
 };
 
 class VerifyObjsInRegionClosure: public ObjectClosure {
+private:
   G1CollectedHeap* _g1h;
   size_t _live_bytes;
   HeapRegion *_hr;
+  bool _use_prev_marking;
 public:
-  VerifyObjsInRegionClosure(HeapRegion *hr) : _live_bytes(0), _hr(hr) {
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  VerifyObjsInRegionClosure(HeapRegion *hr, bool use_prev_marking)
+    : _live_bytes(0), _hr(hr), _use_prev_marking(use_prev_marking) {
     _g1h = G1CollectedHeap::heap();
   }
   void do_object(oop o) {
     VerifyLivenessOopClosure isLive(_g1h);
     assert(o != NULL, "Huh?");
-    if (!_g1h->is_obj_dead(o)) {
+    if (!_g1h->is_obj_dead_cond(o, _use_prev_marking)) {
       o->oop_iterate(&isLive);
       if (!_hr->obj_allocated_since_prev_marking(o))
         _live_bytes += (o->size() * HeapWordSize);
@@ -2176,17 +2190,22 @@
 };
 
 class VerifyRegionClosure: public HeapRegionClosure {
-public:
+private:
   bool _allow_dirty;
   bool _par;
-  VerifyRegionClosure(bool allow_dirty, bool par = false)
-    : _allow_dirty(allow_dirty), _par(par) {}
+  bool _use_prev_marking;
+public:
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  VerifyRegionClosure(bool allow_dirty, bool par, bool use_prev_marking)
+    : _allow_dirty(allow_dirty), _par(par),
+      _use_prev_marking(use_prev_marking) {}
   bool doHeapRegion(HeapRegion* r) {
     guarantee(_par || r->claim_value() == HeapRegion::InitialClaimValue,
               "Should be unclaimed at verify points.");
     if (!r->continuesHumongous()) {
-      VerifyObjsInRegionClosure not_dead_yet_cl(r);
-      r->verify(_allow_dirty);
+      VerifyObjsInRegionClosure not_dead_yet_cl(r, _use_prev_marking);
+      r->verify(_allow_dirty, _use_prev_marking);
       r->object_iterate(&not_dead_yet_cl);
       guarantee(r->max_live_bytes() >= not_dead_yet_cl.live_bytes(),
                 "More live objects than counted in last complete marking.");
@@ -2199,10 +2218,13 @@
 private:
   G1CollectedHeap* _g1h;
   bool             _failures;
-
+  bool             _use_prev_marking;
 public:
-  VerifyRootsClosure() :
-    _g1h(G1CollectedHeap::heap()), _failures(false) { }
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  VerifyRootsClosure(bool use_prev_marking) :
+    _g1h(G1CollectedHeap::heap()), _failures(false),
+    _use_prev_marking(use_prev_marking) { }
 
   bool failures() { return _failures; }
 
@@ -2213,7 +2235,7 @@
   void do_oop(oop* p) {
     oop obj = *p;
     if (obj != NULL) {
-      if (_g1h->is_obj_dead(obj)) {
+      if (_g1h->is_obj_dead_cond(obj, _use_prev_marking)) {
         gclog_or_tty->print_cr("Root location "PTR_FORMAT" "
                                "points to dead obj "PTR_FORMAT, p, (void*) obj);
         obj->print_on(gclog_or_tty);
@@ -2229,24 +2251,35 @@
 private:
   G1CollectedHeap* _g1h;
   bool _allow_dirty;
+  bool _use_prev_marking;
 
 public:
-  G1ParVerifyTask(G1CollectedHeap* g1h, bool allow_dirty) :
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  G1ParVerifyTask(G1CollectedHeap* g1h, bool allow_dirty,
+                  bool use_prev_marking) :
     AbstractGangTask("Parallel verify task"),
-    _g1h(g1h), _allow_dirty(allow_dirty) { }
+    _g1h(g1h), _allow_dirty(allow_dirty),
+    _use_prev_marking(use_prev_marking) { }
 
   void work(int worker_i) {
     HandleMark hm;
-    VerifyRegionClosure blk(_allow_dirty, true);
+    VerifyRegionClosure blk(_allow_dirty, true, _use_prev_marking);
     _g1h->heap_region_par_iterate_chunked(&blk, worker_i,
                                           HeapRegion::ParVerifyClaimValue);
   }
 };
 
 void G1CollectedHeap::verify(bool allow_dirty, bool silent) {
+  verify(allow_dirty, silent, /* use_prev_marking */ true);
+}
+
+void G1CollectedHeap::verify(bool allow_dirty,
+                             bool silent,
+                             bool use_prev_marking) {
   if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) {
     if (!silent) { gclog_or_tty->print("roots "); }
-    VerifyRootsClosure rootsCl;
+    VerifyRootsClosure rootsCl(use_prev_marking);
     process_strong_roots(false,
                          SharedHeap::SO_AllClasses,
                          &rootsCl,
@@ -2257,7 +2290,7 @@
       assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue),
              "sanity check");
 
-      G1ParVerifyTask task(this, allow_dirty);
+      G1ParVerifyTask task(this, allow_dirty, use_prev_marking);
       int n_workers = workers()->total_workers();
       set_par_threads(n_workers);
       workers()->run_task(&task);
@@ -2271,7 +2304,7 @@
       assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue),
              "sanity check");
     } else {
-      VerifyRegionClosure blk(allow_dirty);
+      VerifyRegionClosure blk(allow_dirty, false, use_prev_marking);
       _hrs->iterate(&blk);
     }
     if (!silent) gclog_or_tty->print("remset ");
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -59,6 +59,9 @@
 typedef GenericTaskQueue<oop*>    RefToScanQueue;
 typedef GenericTaskQueueSet<oop*> RefToScanQueueSet;
 
+typedef int RegionIdx_t;   // needs to hold [ 0..max_regions() )
+typedef int CardIdx_t;     // needs to hold [ 0..CardsPerRegion )
+
 enum G1GCThreadGroups {
   G1CRGroup = 0,
   G1ZFGroup = 1,
@@ -1046,6 +1049,17 @@
   virtual void prepare_for_verify();
 
   // Perform verification.
+
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  // NOTE: Only the "prev" marking information is guaranteed to be
+  // consistent most of the time, so most calls to this should use
+  // use_prev_marking == true. Currently, there is only one case where
+  // this is called with use_prev_marking == false, which is to verify
+  // the "next" marking information at the end of remark.
+  void verify(bool allow_dirty, bool silent, bool use_prev_marking);
+
+  // Override; it uses the "prev" marking information
   virtual void verify(bool allow_dirty, bool silent);
   virtual void print() const;
   virtual void print_on(outputStream* st) const;
@@ -1122,6 +1136,18 @@
   bool isMarkedPrev(oop obj) const;
   bool isMarkedNext(oop obj) const;
 
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  bool is_obj_dead_cond(const oop obj,
+                        const HeapRegion* hr,
+                        const bool use_prev_marking) const {
+    if (use_prev_marking) {
+      return is_obj_dead(obj, hr);
+    } else {
+      return is_obj_ill(obj, hr);
+    }
+  }
+
   // Determine if an object is dead, given the object and also
   // the region to which the object belongs. An object is dead
   // iff a) it was not allocated since the last mark and b) it
@@ -1159,8 +1185,19 @@
   // Added if it is in permanent gen it isn't dead.
   // Added if it is NULL it isn't dead.
 
-  bool is_obj_dead(oop obj) {
-    HeapRegion* hr = heap_region_containing(obj);
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  bool is_obj_dead_cond(const oop obj,
+                        const bool use_prev_marking) {
+    if (use_prev_marking) {
+      return is_obj_dead(obj);
+    } else {
+      return is_obj_ill(obj);
+    }
+  }
+
+  bool is_obj_dead(const oop obj) {
+    const HeapRegion* hr = heap_region_containing(obj);
     if (hr == NULL) {
       if (Universe::heap()->is_in_permanent(obj))
         return false;
@@ -1170,8 +1207,8 @@
     else return is_obj_dead(obj, hr);
   }
 
-  bool is_obj_ill(oop obj) {
-    HeapRegion* hr = heap_region_containing(obj);
+  bool is_obj_ill(const oop obj) {
+    const HeapRegion* hr = heap_region_containing(obj);
     if (hr == NULL) {
       if (Universe::heap()->is_in_permanent(obj))
         return false;
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -40,15 +40,19 @@
 {}
 
 class VerifyLiveClosure: public OopClosure {
+private:
   G1CollectedHeap* _g1h;
   CardTableModRefBS* _bs;
   oop _containing_obj;
   bool _failures;
   int _n_failures;
+  bool _use_prev_marking;
 public:
-  VerifyLiveClosure(G1CollectedHeap* g1h) :
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  VerifyLiveClosure(G1CollectedHeap* g1h, bool use_prev_marking) :
     _g1h(g1h), _bs(NULL), _containing_obj(NULL),
-    _failures(false), _n_failures(0)
+    _failures(false), _n_failures(0), _use_prev_marking(use_prev_marking)
   {
     BarrierSet* bs = _g1h->barrier_set();
     if (bs->is_a(BarrierSet::CardTableModRef))
@@ -68,11 +72,13 @@
 
   void do_oop(oop* p) {
     assert(_containing_obj != NULL, "Precondition");
-    assert(!_g1h->is_obj_dead(_containing_obj), "Precondition");
+    assert(!_g1h->is_obj_dead_cond(_containing_obj, _use_prev_marking),
+           "Precondition");
     oop obj = *p;
     if (obj != NULL) {
       bool failed = false;
-      if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead(obj)) {
+      if (!_g1h->is_in_closed_subset(obj) ||
+          _g1h->is_obj_dead_cond(obj, _use_prev_marking)) {
         if (!_failures) {
           gclog_or_tty->print_cr("");
           gclog_or_tty->print_cr("----------");
@@ -647,19 +653,23 @@
   G1OffsetTableContigSpace::print_on(st);
 }
 
+void HeapRegion::verify(bool allow_dirty) const {
+  verify(allow_dirty, /* use_prev_marking */ true);
+}
+
 #define OBJ_SAMPLE_INTERVAL 0
 #define BLOCK_SAMPLE_INTERVAL 100
 
 // This really ought to be commoned up into OffsetTableContigSpace somehow.
 // We would need a mechanism to make that code skip dead objects.
 
-void HeapRegion::verify(bool allow_dirty) const {
+void HeapRegion::verify(bool allow_dirty, bool use_prev_marking) const {
   G1CollectedHeap* g1 = G1CollectedHeap::heap();
   HeapWord* p = bottom();
   HeapWord* prev_p = NULL;
   int objs = 0;
   int blocks = 0;
-  VerifyLiveClosure vl_cl(g1);
+  VerifyLiveClosure vl_cl(g1, use_prev_marking);
   while (p < top()) {
     size_t size = oop(p)->size();
     if (blocks == BLOCK_SAMPLE_INTERVAL) {
@@ -671,7 +681,7 @@
     }
     if (objs == OBJ_SAMPLE_INTERVAL) {
       oop obj = oop(p);
-      if (!g1->is_obj_dead(obj, this)) {
+      if (!g1->is_obj_dead_cond(obj, this, use_prev_marking)) {
         obj->verify();
         vl_cl.set_containing_obj(obj);
         obj->oop_iterate(&vl_cl);
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -782,7 +782,16 @@
   void print() const;
   void print_on(outputStream* st) const;
 
-  // Override
+  // use_prev_marking == true  -> use "prev" marking information,
+  // use_prev_marking == false -> use "next" marking information
+  // NOTE: Only the "prev" marking information is guaranteed to be
+  // consistent most of the time, so most calls to this should use
+  // use_prev_marking == true. Currently, there is only one case where
+  // this is called with use_prev_marking == false, which is to verify
+  // the "next" marking information at the end of remark.
+  void verify(bool allow_dirty, bool use_prev_marking) const;
+
+  // Override; it uses the "prev" marking information
   virtual void verify(bool allow_dirty) const;
 
 #ifdef DEBUG
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -109,7 +109,7 @@
     return new PerRegionTable(hr);
   }
 
-  void add_card_work(short from_card, bool par) {
+  void add_card_work(CardIdx_t from_card, bool par) {
     if (!_bm.at(from_card)) {
       if (par) {
         if (_bm.par_at_put(from_card, 1)) {
@@ -141,11 +141,11 @@
     // and adding a bit to the new table is never incorrect.
     if (loc_hr->is_in_reserved(from)) {
       size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom());
-      size_t from_card =
-        hw_offset >>
-        (CardTableModRefBS::card_shift - LogHeapWordSize);
+      CardIdx_t from_card = (CardIdx_t)
+          hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize);
 
-      add_card_work((short) from_card, par);
+      assert(0 <= from_card && from_card < CardsPerRegion, "Must be in range.");
+      add_card_work(from_card, par);
     }
   }
 
@@ -190,11 +190,11 @@
 #endif
   }
 
-  void add_card(short from_card_index) {
+  void add_card(CardIdx_t from_card_index) {
     add_card_work(from_card_index, /*parallel*/ true);
   }
 
-  void seq_add_card(short from_card_index) {
+  void seq_add_card(CardIdx_t from_card_index) {
     add_card_work(from_card_index, /*parallel*/ false);
   }
 
@@ -604,7 +604,7 @@
 
   // Note that this may be a continued H region.
   HeapRegion* from_hr = _g1h->heap_region_containing_raw(from);
-  size_t from_hrs_ind = (size_t)from_hr->hrs_index();
+  RegionIdx_t from_hrs_ind = (RegionIdx_t) from_hr->hrs_index();
 
   // If the region is already coarsened, return.
   if (_coarse_map.at(from_hrs_ind)) {
@@ -627,11 +627,11 @@
       uintptr_t from_hr_bot_card_index =
         uintptr_t(from_hr->bottom())
           >> CardTableModRefBS::card_shift;
-      int card_index = from_card - from_hr_bot_card_index;
+      CardIdx_t card_index = from_card - from_hr_bot_card_index;
       assert(0 <= card_index && card_index < PosParPRT::CardsPerRegion,
              "Must be in range.");
       if (G1HRRSUseSparseTable &&
-          _sparse_table.add_card((short) from_hrs_ind, card_index)) {
+          _sparse_table.add_card(from_hrs_ind, card_index)) {
         if (G1RecordHRRSOops) {
           HeapRegionRemSet::record(hr(), from);
 #if HRRS_VERBOSE
@@ -656,9 +656,9 @@
       }
 
       // Otherwise, transfer from sparse to fine-grain.
-      short cards[SparsePRTEntry::CardsPerEntry];
+      CardIdx_t cards[SparsePRTEntry::CardsPerEntry];
       if (G1HRRSUseSparseTable) {
-        bool res = _sparse_table.get_cards((short) from_hrs_ind, &cards[0]);
+        bool res = _sparse_table.get_cards(from_hrs_ind, &cards[0]);
         assert(res, "There should have been an entry");
       }
 
@@ -679,13 +679,13 @@
       // Add in the cards from the sparse table.
       if (G1HRRSUseSparseTable) {
         for (int i = 0; i < SparsePRTEntry::CardsPerEntry; i++) {
-          short c = cards[i];
+          CardIdx_t c = cards[i];
           if (c != SparsePRTEntry::NullEntry) {
             prt->add_card(c);
           }
         }
         // Now we can delete the sparse entry.
-        bool res = _sparse_table.delete_entry((short) from_hrs_ind);
+        bool res = _sparse_table.delete_entry(from_hrs_ind);
         assert(res, "It should have been there.");
       }
     }
@@ -1030,7 +1030,7 @@
 bool OtherRegionsTable::contains_reference_locked(oop* from) const {
   HeapRegion* hr = _g1h->heap_region_containing_raw(from);
   if (hr == NULL) return false;
-  size_t hr_ind = hr->hrs_index();
+  RegionIdx_t hr_ind = (RegionIdx_t) hr->hrs_index();
   // Is this region in the coarse map?
   if (_coarse_map.at(hr_ind)) return true;
 
@@ -1045,8 +1045,9 @@
     uintptr_t hr_bot_card_index =
       uintptr_t(hr->bottom()) >> CardTableModRefBS::card_shift;
     assert(from_card >= hr_bot_card_index, "Inv");
-    int card_index = from_card - hr_bot_card_index;
-    return _sparse_table.contains_card((short)hr_ind, card_index);
+    CardIdx_t card_index = from_card - hr_bot_card_index;
+    assert(0 <= card_index && card_index < PosParPRT::CardsPerRegion, "Must be in range.");
+    return _sparse_table.contains_card(hr_ind, card_index);
   }
 
 
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -33,7 +33,7 @@
     sprt_iter->init(this);
 }
 
-void SparsePRTEntry::init(short region_ind) {
+void SparsePRTEntry::init(RegionIdx_t region_ind) {
   _region_ind = region_ind;
   _next_index = NullEntry;
 #if UNROLL_CARD_LOOPS
@@ -43,11 +43,12 @@
   _cards[2] = NullEntry;
   _cards[3] = NullEntry;
 #else
-  for (int i = 0; i < CardsPerEntry; i++) _cards[i] = NullEntry;
+  for (int i = 0; i < CardsPerEntry; i++)
+    _cards[i] = NullEntry;
 #endif
 }
 
-bool SparsePRTEntry::contains_card(short card_index) const {
+bool SparsePRTEntry::contains_card(CardIdx_t card_index) const {
 #if UNROLL_CARD_LOOPS
   assert(CardsPerEntry == 4, "Assumption.  If changes, un-unroll.");
   if (_cards[0] == card_index) return true;
@@ -80,10 +81,10 @@
   return sum;
 }
 
-SparsePRTEntry::AddCardResult SparsePRTEntry::add_card(short card_index) {
+SparsePRTEntry::AddCardResult SparsePRTEntry::add_card(CardIdx_t card_index) {
 #if UNROLL_CARD_LOOPS
   assert(CardsPerEntry == 4, "Assumption.  If changes, un-unroll.");
-  short c = _cards[0];
+  CardIdx_t c = _cards[0];
   if (c == card_index) return found;
   if (c == NullEntry) { _cards[0] = card_index; return added; }
   c = _cards[1];
@@ -97,16 +98,19 @@
   if (c == NullEntry) { _cards[3] = card_index; return added; }
 #else
   for (int i = 0; i < CardsPerEntry; i++) {
-    short c = _cards[i];
+    CardIdx_t c = _cards[i];
     if (c == card_index) return found;
-    if (c == NullEntry) { _cards[i] = card_index; return added; }
+    if (c == NullEntry) {
+      _cards[i] = card_index;
+      return added;
+    }
   }
 #endif
   // Otherwise, we're full.
   return overflow;
 }
 
-void SparsePRTEntry::copy_cards(short* cards) const {
+void SparsePRTEntry::copy_cards(CardIdx_t* cards) const {
 #if UNROLL_CARD_LOOPS
   assert(CardsPerEntry == 4, "Assumption.  If changes, un-unroll.");
   cards[0] = _cards[0];
@@ -130,7 +134,7 @@
   _capacity(capacity), _capacity_mask(capacity-1),
   _occupied_entries(0), _occupied_cards(0),
   _entries(NEW_C_HEAP_ARRAY(SparsePRTEntry, capacity)),
-  _buckets(NEW_C_HEAP_ARRAY(short, capacity)),
+  _buckets(NEW_C_HEAP_ARRAY(int, capacity)),
   _next_deleted(NULL), _deleted(false),
   _free_list(NullEntry), _free_region(0)
 {
@@ -143,7 +147,7 @@
     _entries = NULL;
   }
   if (_buckets != NULL) {
-    FREE_C_HEAP_ARRAY(short, _buckets);
+    FREE_C_HEAP_ARRAY(int, _buckets);
     _buckets = NULL;
   }
 }
@@ -153,14 +157,18 @@
   _occupied_cards = 0;
   guarantee(_entries != NULL, "INV");
   guarantee(_buckets != NULL, "INV");
+
+  guarantee(_capacity <= ((size_t)1 << (sizeof(int)*BitsPerByte-1)) - 1,
+                "_capacity too large");
+
   // This will put -1 == NullEntry in the key field of all entries.
   memset(_entries, -1, _capacity * sizeof(SparsePRTEntry));
-  memset(_buckets, -1, _capacity * sizeof(short));
+  memset(_buckets, -1, _capacity * sizeof(int));
   _free_list = NullEntry;
   _free_region = 0;
 }
 
-bool RSHashTable::add_card(short region_ind, short card_index) {
+bool RSHashTable::add_card(RegionIdx_t region_ind, CardIdx_t card_index) {
   SparsePRTEntry* e = entry_for_region_ind_create(region_ind);
   assert(e != NULL && e->r_ind() == region_ind,
          "Postcondition of call above.");
@@ -175,9 +183,9 @@
   return res != SparsePRTEntry::overflow;
 }
 
-bool RSHashTable::get_cards(short region_ind, short* cards) {
-  short ind = (short) (region_ind & capacity_mask());
-  short cur_ind = _buckets[ind];
+bool RSHashTable::get_cards(RegionIdx_t region_ind, CardIdx_t* cards) {
+  int ind = (int) (region_ind & capacity_mask());
+  int cur_ind = _buckets[ind];
   SparsePRTEntry* cur;
   while (cur_ind != NullEntry &&
          (cur = entry(cur_ind))->r_ind() != region_ind) {
@@ -192,10 +200,10 @@
   return true;
 }
 
-bool RSHashTable::delete_entry(short region_ind) {
-  short ind = (short) (region_ind & capacity_mask());
-  short* prev_loc = &_buckets[ind];
-  short cur_ind = *prev_loc;
+bool RSHashTable::delete_entry(RegionIdx_t region_ind) {
+  int ind = (int) (region_ind & capacity_mask());
+  int* prev_loc = &_buckets[ind];
+  int cur_ind = *prev_loc;
   SparsePRTEntry* cur;
   while (cur_ind != NullEntry &&
          (cur = entry(cur_ind))->r_ind() != region_ind) {
@@ -212,10 +220,11 @@
   return true;
 }
 
-SparsePRTEntry* RSHashTable::entry_for_region_ind(short region_ind) const {
+SparsePRTEntry*
+RSHashTable::entry_for_region_ind(RegionIdx_t region_ind) const {
   assert(occupied_entries() < capacity(), "Precondition");
-  short ind = (short) (region_ind & capacity_mask());
-  short cur_ind = _buckets[ind];
+  int ind = (int) (region_ind & capacity_mask());
+  int cur_ind = _buckets[ind];
   SparsePRTEntry* cur;
   // XXX
   // int k = 0;
@@ -242,15 +251,16 @@
   }
 }
 
-SparsePRTEntry* RSHashTable::entry_for_region_ind_create(short region_ind) {
+SparsePRTEntry*
+RSHashTable::entry_for_region_ind_create(RegionIdx_t region_ind) {
   SparsePRTEntry* res = entry_for_region_ind(region_ind);
   if (res == NULL) {
-    short new_ind = alloc_entry();
+    int new_ind = alloc_entry();
     assert(0 <= new_ind && (size_t)new_ind < capacity(), "There should be room.");
     res = entry(new_ind);
     res->init(region_ind);
     // Insert at front.
-    short ind = (short) (region_ind & capacity_mask());
+    int ind = (int) (region_ind & capacity_mask());
     res->set_next_index(_buckets[ind]);
     _buckets[ind] = new_ind;
     _occupied_entries++;
@@ -258,8 +268,8 @@
   return res;
 }
 
-short RSHashTable::alloc_entry() {
-  short res;
+int RSHashTable::alloc_entry() {
+  int res;
   if (_free_list != NullEntry) {
     res = _free_list;
     _free_list = entry(res)->next_index();
@@ -273,13 +283,11 @@
   }
 }
 
-
-void RSHashTable::free_entry(short fi) {
+void RSHashTable::free_entry(int fi) {
   entry(fi)->set_next_index(_free_list);
   _free_list = fi;
 }
 
-
 void RSHashTable::add_entry(SparsePRTEntry* e) {
   assert(e->num_valid_cards() > 0, "Precondition.");
   SparsePRTEntry* e2 = entry_for_region_ind_create(e->r_ind());
@@ -322,8 +330,8 @@
   return NULL;
 }
 
-short /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() {
-  short res;
+CardIdx_t /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() {
+  CardIdx_t res;
   while (_bl_ind != RSHashTable::NullEntry) {
     res = _rsht->entry(_bl_ind)->card(0);
     if (res != SparsePRTEntry::NullEntry) {
@@ -336,7 +344,7 @@
   return SparsePRTEntry::NullEntry;
 }
 
-size_t /* RSHashTable:: */ RSHashTableIter::compute_card_ind(short ci) {
+size_t /* RSHashTable:: */ RSHashTableIter::compute_card_ind(CardIdx_t ci) {
   return
     _heap_bot_card_ind
     + (_rsht->entry(_bl_ind)->r_ind() * CardsPerRegion)
@@ -345,7 +353,7 @@
 
 bool /* RSHashTable:: */ RSHashTableIter::has_next(size_t& card_index) {
   _card_ind++;
-  short ci;
+  CardIdx_t ci;
   if (_card_ind < SparsePRTEntry::CardsPerEntry &&
       ((ci = _rsht->entry(_bl_ind)->card(_card_ind)) !=
        SparsePRTEntry::NullEntry)) {
@@ -379,16 +387,16 @@
   return false;
 }
 
-bool RSHashTable::contains_card(short region_index, short card_index) const {
+bool RSHashTable::contains_card(RegionIdx_t region_index, CardIdx_t card_index) const {
   SparsePRTEntry* e = entry_for_region_ind(region_index);
   return (e != NULL && e->contains_card(card_index));
 }
 
 size_t RSHashTable::mem_size() const {
-  return sizeof(this) + capacity() * (sizeof(SparsePRTEntry) + sizeof(short));
+  return sizeof(this) +
+    capacity() * (sizeof(SparsePRTEntry) + sizeof(int));
 }
 
-
 // ----------------------------------------------------------------------
 
 SparsePRT* SparsePRT::_head_expanded_list = NULL;
@@ -408,6 +416,7 @@
   }
 }
 
+
 SparsePRT* SparsePRT::get_from_expanded_list() {
   SparsePRT* hd = _head_expanded_list;
   while (hd != NULL) {
@@ -452,6 +461,7 @@
   _next = _cur;
 }
 
+
 SparsePRT::~SparsePRT() {
   assert(_next != NULL && _cur != NULL, "Inv");
   if (_cur != _next) { delete _cur; }
@@ -465,7 +475,7 @@
   return sizeof(this) + _next->mem_size();
 }
 
-bool SparsePRT::add_card(short region_id, short card_index) {
+bool SparsePRT::add_card(RegionIdx_t region_id, CardIdx_t card_index) {
 #if SPARSE_PRT_VERBOSE
   gclog_or_tty->print_cr("  Adding card %d from region %d to region %d sparse.",
                 card_index, region_id, _hr->hrs_index());
@@ -476,11 +486,11 @@
   return _next->add_card(region_id, card_index);
 }
 
-bool SparsePRT::get_cards(short region_id, short* cards) {
+bool SparsePRT::get_cards(RegionIdx_t region_id, CardIdx_t* cards) {
   return _next->get_cards(region_id, cards);
 }
 
-bool SparsePRT::delete_entry(short region_id) {
+bool SparsePRT::delete_entry(RegionIdx_t region_id) {
   return _next->delete_entry(region_id);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -35,32 +35,32 @@
 
 class SparsePRTEntry: public CHeapObj {
 public:
+
   enum SomePublicConstants {
-    CardsPerEntry = (short)4,
-    NullEntry = (short)-1,
-    DeletedEntry = (short)-2
+    CardsPerEntry =  4,
+    NullEntry     = -1
   };
 
 private:
-  short _region_ind;
-  short _next_index;
-  short _cards[CardsPerEntry];
+  RegionIdx_t _region_ind;
+  int         _next_index;
+  CardIdx_t   _cards[CardsPerEntry];
 
 public:
 
   // Set the region_ind to the given value, and delete all cards.
-  inline void init(short region_ind);
+  inline void init(RegionIdx_t region_ind);
 
-  short r_ind() const { return _region_ind; }
+  RegionIdx_t r_ind() const { return _region_ind; }
   bool valid_entry() const { return r_ind() >= 0; }
-  void set_r_ind(short rind) { _region_ind = rind; }
+  void set_r_ind(RegionIdx_t rind) { _region_ind = rind; }
 
-  short next_index() const { return _next_index; }
-  short* next_index_addr() { return &_next_index; }
-  void set_next_index(short ni) { _next_index = ni; }
+  int next_index() const { return _next_index; }
+  int* next_index_addr() { return &_next_index; }
+  void set_next_index(int ni) { _next_index = ni; }
 
   // Returns "true" iff the entry contains the given card index.
-  inline bool contains_card(short card_index) const;
+  inline bool contains_card(CardIdx_t card_index) const;
 
   // Returns the number of non-NULL card entries.
   inline int num_valid_cards() const;
@@ -73,14 +73,14 @@
     found,
     added
   };
-  inline AddCardResult add_card(short card_index);
+  inline AddCardResult add_card(CardIdx_t card_index);
 
   // Copy the current entry's cards into "cards".
-  inline void copy_cards(short* cards) const;
+  inline void copy_cards(CardIdx_t* cards) const;
   // Copy the current entry's cards into the "_card" array of "e."
   inline void copy_cards(SparsePRTEntry* e) const;
 
-  inline short card(int i) const { return _cards[i]; }
+  inline CardIdx_t card(int i) const { return _cards[i]; }
 };
 
 
@@ -98,9 +98,9 @@
   size_t _occupied_cards;
 
   SparsePRTEntry* _entries;
-  short* _buckets;
-  short  _free_region;
-  short  _free_list;
+  int* _buckets;
+  int  _free_region;
+  int  _free_list;
 
   static RSHashTable* _head_deleted_list;
   RSHashTable* _next_deleted;
@@ -113,20 +113,20 @@
   // operations, and that the the table be less than completely full.  If
   // an entry for "region_ind" is already in the table, finds it and
   // returns its address; otherwise returns "NULL."
-  SparsePRTEntry* entry_for_region_ind(short region_ind) const;
+  SparsePRTEntry* entry_for_region_ind(RegionIdx_t region_ind) const;
 
   // Requires that the caller hold a lock preventing parallel modifying
   // operations, and that the the table be less than completely full.  If
   // an entry for "region_ind" is already in the table, finds it and
   // returns its address; otherwise allocates, initializes, inserts and
   // returns a new entry for "region_ind".
-  SparsePRTEntry* entry_for_region_ind_create(short region_ind);
+  SparsePRTEntry* entry_for_region_ind_create(RegionIdx_t region_ind);
 
   // Returns the index of the next free entry in "_entries".
-  short alloc_entry();
+  int alloc_entry();
   // Declares the entry "fi" to be free.  (It must have already been
   // deleted from any bucket lists.
-  void free_entry(short fi);
+  void free_entry(int fi);
 
 public:
   RSHashTable(size_t capacity);
@@ -138,12 +138,12 @@
   // Otherwise, returns "false" to indicate that the addition would
   // overflow the entry for the region.  The caller must transfer these
   // entries to a larger-capacity representation.
-  bool add_card(short region_id, short card_index);
+  bool add_card(RegionIdx_t region_id, CardIdx_t card_index);
 
-  bool get_cards(short region_id, short* cards);
-  bool delete_entry(short region_id);
+  bool get_cards(RegionIdx_t region_id, CardIdx_t* cards);
+  bool delete_entry(RegionIdx_t region_id);
 
-  bool contains_card(short region_id, short card_index) const;
+  bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const;
 
   void add_entry(SparsePRTEntry* e);
 
@@ -162,51 +162,49 @@
 
   static void add_to_deleted_list(RSHashTable* rsht);
   static RSHashTable* get_from_deleted_list();
-
-
 };
 
-  // ValueObj because will be embedded in HRRS iterator.
+// ValueObj because will be embedded in HRRS iterator.
 class RSHashTableIter VALUE_OBJ_CLASS_SPEC {
-    short _tbl_ind;
-    short _bl_ind;
-    short _card_ind;
-    RSHashTable* _rsht;
-    size_t _heap_bot_card_ind;
+  int _tbl_ind;         // [-1, 0.._rsht->_capacity)
+  int _bl_ind;          // [-1, 0.._rsht->_capacity)
+  short _card_ind;      // [0..CardsPerEntry)
+  RSHashTable* _rsht;
+  size_t _heap_bot_card_ind;
 
-    enum SomePrivateConstants {
-      CardsPerRegion = HeapRegion::GrainBytes >> CardTableModRefBS::card_shift
-    };
+  enum SomePrivateConstants {
+    CardsPerRegion = HeapRegion::GrainBytes >> CardTableModRefBS::card_shift
+  };
+
+  // If the bucket list pointed to by _bl_ind contains a card, sets
+  // _bl_ind to the index of that entry, and returns the card.
+  // Otherwise, returns SparseEntry::NullEntry.
+  CardIdx_t find_first_card_in_list();
 
-    // If the bucket list pointed to by _bl_ind contains a card, sets
-    // _bl_ind to the index of that entry, and returns the card.
-    // Otherwise, returns SparseEntry::NullEnty.
-    short find_first_card_in_list();
-    // Computes the proper card index for the card whose offset in the
-    // current region (as indicated by _bl_ind) is "ci".
-    // This is subject to errors when there is iteration concurrent with
-    // modification, but these errors should be benign.
-    size_t compute_card_ind(short ci);
+  // Computes the proper card index for the card whose offset in the
+  // current region (as indicated by _bl_ind) is "ci".
+  // This is subject to errors when there is iteration concurrent with
+  // modification, but these errors should be benign.
+  size_t compute_card_ind(CardIdx_t ci);
 
-  public:
-    RSHashTableIter(size_t heap_bot_card_ind) :
-      _tbl_ind(RSHashTable::NullEntry),
-      _bl_ind(RSHashTable::NullEntry),
-      _card_ind((SparsePRTEntry::CardsPerEntry-1)),
-      _rsht(NULL),
-      _heap_bot_card_ind(heap_bot_card_ind)
-    {}
+public:
+  RSHashTableIter(size_t heap_bot_card_ind) :
+    _tbl_ind(RSHashTable::NullEntry),
+    _bl_ind(RSHashTable::NullEntry),
+    _card_ind((SparsePRTEntry::CardsPerEntry-1)),
+    _rsht(NULL),
+    _heap_bot_card_ind(heap_bot_card_ind)
+  {}
 
-    void init(RSHashTable* rsht) {
-      _rsht = rsht;
-      _tbl_ind = -1; // So that first increment gets to 0.
-      _bl_ind = RSHashTable::NullEntry;
-      _card_ind = (SparsePRTEntry::CardsPerEntry-1);
-    }
+  void init(RSHashTable* rsht) {
+    _rsht = rsht;
+    _tbl_ind = -1; // So that first increment gets to 0.
+    _bl_ind = RSHashTable::NullEntry;
+    _card_ind = (SparsePRTEntry::CardsPerEntry-1);
+  }
 
-    bool has_next(size_t& card_index);
-
-  };
+  bool has_next(size_t& card_index);
+};
 
 // Concurrent accesss to a SparsePRT must be serialized by some external
 // mutex.
@@ -238,7 +236,6 @@
   SparsePRT* next_expanded() { return _next_expanded; }
   void set_next_expanded(SparsePRT* nxt) { _next_expanded = nxt; }
 
-
   static SparsePRT* _head_expanded_list;
 
 public:
@@ -255,16 +252,16 @@
   // Otherwise, returns "false" to indicate that the addition would
   // overflow the entry for the region.  The caller must transfer these
   // entries to a larger-capacity representation.
-  bool add_card(short region_id, short card_index);
+  bool add_card(RegionIdx_t region_id, CardIdx_t card_index);
 
   // If the table hold an entry for "region_ind",  Copies its
   // cards into "cards", which must be an array of length at least
   // "CardsPerEntry", and returns "true"; otherwise, returns "false".
-  bool get_cards(short region_ind, short* cards);
+  bool get_cards(RegionIdx_t region_ind, CardIdx_t* cards);
 
   // If there is an entry for "region_ind", removes it and return "true";
   // otherwise returns "false."
-  bool delete_entry(short region_ind);
+  bool delete_entry(RegionIdx_t region_ind);
 
   // Clear the table, and reinitialize to initial capacity.
   void clear();
@@ -276,13 +273,12 @@
   static void cleanup_all();
   RSHashTable* cur() const { return _cur; }
 
-
   void init_iterator(SparsePRTIter* sprt_iter);
 
   static void add_to_expanded_list(SparsePRT* sprt);
   static SparsePRT* get_from_expanded_list();
 
-  bool contains_card(short region_id, short card_index) const {
+  bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const {
     return _next->contains_card(region_id, card_index);
   }
 
--- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1	Mon Jul 06 11:42:37 2009 -0700
@@ -51,7 +51,6 @@
 concurrentG1Refine.hpp			allocation.hpp
 concurrentG1Refine.hpp			thread.hpp
 
-
 concurrentG1RefineThread.cpp		concurrentG1Refine.hpp
 concurrentG1RefineThread.cpp		concurrentG1RefineThread.hpp
 concurrentG1RefineThread.cpp		g1CollectedHeap.inline.hpp
@@ -334,6 +333,7 @@
 sparsePRT.hpp				allocation.hpp
 sparsePRT.hpp				cardTableModRefBS.hpp
 sparsePRT.hpp				globalDefinitions.hpp
+sparsePRT.hpp                           g1CollectedHeap.inline.hpp
 sparsePRT.hpp				heapRegion.hpp
 sparsePRT.hpp				mutex.hpp
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -177,6 +177,7 @@
   // are double-word aligned in 32-bit VMs, but not in 64-bit VMs, so the 32-bit
   // granularity is 2, 64-bit is 1.
   static inline size_t obj_granularity() { return size_t(MinObjAlignment); }
+  static inline int obj_granularity_shift() { return LogMinObjAlignment; }
 
   HeapWord*       _region_start;
   size_t          _region_size;
@@ -299,13 +300,13 @@
 inline size_t
 ParMarkBitMap::bits_to_words(idx_t bits)
 {
-  return bits * obj_granularity();
+  return bits << obj_granularity_shift();
 }
 
 inline ParMarkBitMap::idx_t
 ParMarkBitMap::words_to_bits(size_t words)
 {
-  return words / obj_granularity();
+  return words >> obj_granularity_shift();
 }
 
 inline size_t ParMarkBitMap::obj_size(idx_t beg_bit, idx_t end_bit) const
--- a/hotspot/src/share/vm/includeDB_compiler1	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/includeDB_compiler1	Mon Jul 06 11:42:37 2009 -0700
@@ -387,7 +387,7 @@
 c1_ValueSet.cpp                         c1_ValueSet.hpp
 
 c1_ValueSet.hpp                         allocation.hpp
-c1_ValueSet.hpp                         bitMap.hpp
+c1_ValueSet.hpp                         bitMap.inline.hpp
 c1_ValueSet.hpp                         c1_Instruction.hpp
 
 c1_ValueStack.cpp                       c1_IR.hpp
--- a/hotspot/src/share/vm/memory/gcLocker.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/memory/gcLocker.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -242,6 +242,31 @@
 #endif
 };
 
+// A SkipGCALot object is used to elide the usual effect of gc-a-lot
+// over a section of execution by a thread. Currently, it's used only to
+// prevent re-entrant calls to GC.
+class SkipGCALot : public StackObj {
+  private:
+   bool _saved;
+   Thread* _t;
+
+  public:
+#ifdef ASSERT
+    SkipGCALot(Thread* t) : _t(t) {
+      _saved = _t->skip_gcalot();
+      _t->set_skip_gcalot(true);
+    }
+
+    ~SkipGCALot() {
+      assert(_t->skip_gcalot(), "Save-restore protocol invariant");
+      _t->set_skip_gcalot(_saved);
+    }
+#else
+    SkipGCALot(Thread* t) { }
+    ~SkipGCALot() { }
+#endif
+};
+
 // JRT_LEAF currently can be called from either _thread_in_Java or
 // _thread_in_native mode. In _thread_in_native, it is ok
 // for another thread to trigger GC. The rest of the JRT_LEAF
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -66,11 +66,14 @@
 
 void InterfaceSupport::gc_alot() {
   Thread *thread = Thread::current();
-  if (thread->is_VM_thread()) return; // Avoid concurrent calls
+  if (!thread->is_Java_thread()) return; // Avoid concurrent calls
   // Check for new, not quite initialized thread. A thread in new mode cannot initiate a GC.
   JavaThread *current_thread = (JavaThread *)thread;
   if (current_thread->active_handles() == NULL) return;
 
+  // Short-circuit any possible re-entrant gc-a-lot attempt
+  if (thread->skip_gcalot()) return;
+
   if (is_init_completed()) {
 
     if (++_fullgc_alot_invocation < FullGCALotStart) {
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -127,6 +127,7 @@
   debug_only(_owned_locks = NULL;)
   debug_only(_allow_allocation_count = 0;)
   NOT_PRODUCT(_allow_safepoint_count = 0;)
+  NOT_PRODUCT(_skip_gcalot = false;)
   CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;)
   _jvmti_env_iteration_count = 0;
   _vm_operation_started_count = 0;
@@ -784,7 +785,6 @@
       // We could enter a safepoint here and thus have a gc
       InterfaceSupport::check_gc_alot();
     }
-
 #endif
 }
 #endif
--- a/hotspot/src/share/vm/runtime/thread.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -191,6 +191,9 @@
   NOT_PRODUCT(int _allow_safepoint_count;)       // If 0, thread allow a safepoint to happen
   debug_only (int _allow_allocation_count;)      // If 0, the thread is allowed to allocate oops.
 
+  // Used by SkipGCALot class.
+  NOT_PRODUCT(bool _skip_gcalot;)                // Should we elide gc-a-lot?
+
   // Record when GC is locked out via the GC_locker mechanism
   CHECK_UNHANDLED_OOPS_ONLY(int _gc_locked_out_count;)
 
@@ -308,6 +311,11 @@
   bool is_gc_locked_out() { return _gc_locked_out_count > 0; }
 #endif // CHECK_UNHANDLED_OOPS
 
+#ifndef PRODUCT
+  bool skip_gcalot()           { return _skip_gcalot; }
+  void set_skip_gcalot(bool v) { _skip_gcalot = v;    }
+#endif
+
  public:
   // Installs a pending exception to be inserted later
   static void send_async_exception(oop thread_oop, oop java_throwable);
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -531,6 +531,7 @@
   Thread* t = Thread::current();
 
   if (!t->is_VM_thread()) {
+    SkipGCALot sgcalot(t);    // avoid re-entrant attempts to gc-a-lot
     // JavaThread or WatcherThread
     t->check_for_valid_safepoint_state(true);
 
--- a/hotspot/src/share/vm/utilities/bitMap.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -41,19 +41,6 @@
   resize(size_in_bits, in_resource_area);
 }
 
-
-void BitMap::verify_index(idx_t index) const {
-    assert(index < _size, "BitMap index out of bounds");
-}
-
-void BitMap::verify_range(idx_t beg_index, idx_t end_index) const {
-#ifdef ASSERT
-    assert(beg_index <= end_index, "BitMap range error");
-    // Note that [0,0) and [size,size) are both valid ranges.
-    if (end_index != _size)  verify_index(end_index);
-#endif
-}
-
 void BitMap::resize(idx_t size_in_bits, bool in_resource_area) {
   assert(size_in_bits >= 0, "just checking");
   idx_t old_size_in_words = size_in_words();
--- a/hotspot/src/share/vm/utilities/bitMap.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/utilities/bitMap.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -93,10 +93,12 @@
   // The index of the first full word in a range.
   idx_t word_index_round_up(idx_t bit) const;
 
-  // Verification, statistics.
-  void verify_index(idx_t index) const;
-  void verify_range(idx_t beg_index, idx_t end_index) const;
+  // Verification.
+  inline void verify_index(idx_t index) const NOT_DEBUG_RETURN;
+  inline void verify_range(idx_t beg_index, idx_t end_index) const
+    NOT_DEBUG_RETURN;
 
+  // Statistics.
   static idx_t* _pop_count_table;
   static void init_pop_count_table();
   static idx_t num_set_bits(bm_word_t w);
@@ -287,7 +289,6 @@
 #endif
 };
 
-
 // Convenience class wrapping BitMap which provides multiple bits per slot.
 class BitMap2D VALUE_OBJ_CLASS_SPEC {
  public:
--- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -22,6 +22,17 @@
  *
  */
 
+#ifdef ASSERT
+inline void BitMap::verify_index(idx_t index) const {
+  assert(index < _size, "BitMap index out of bounds");
+}
+
+inline void BitMap::verify_range(idx_t beg_index, idx_t end_index) const {
+  assert(beg_index <= end_index, "BitMap range error");
+  // Note that [0,0) and [size,size) are both valid ranges.
+  if (end_index != _size) verify_index(end_index);
+}
+#endif // #ifdef ASSERT
 
 inline void BitMap::set_bit(idx_t bit) {
   verify_index(bit);
--- a/hotspot/src/share/vm/utilities/macros.hpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/hotspot/src/share/vm/utilities/macros.hpp	Mon Jul 06 11:42:37 2009 -0700
@@ -106,11 +106,13 @@
 #ifdef ASSERT
 #define DEBUG_ONLY(code) code
 #define NOT_DEBUG(code)
+#define NOT_DEBUG_RETURN  /*next token must be ;*/
 // Historical.
 #define debug_only(code) code
 #else // ASSERT
 #define DEBUG_ONLY(code)
 #define NOT_DEBUG(code) code
+#define NOT_DEBUG_RETURN {}
 #define debug_only(code)
 #endif // ASSERT
 
--- a/jaxp/.hgtags	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxp/.hgtags	Mon Jul 06 11:42:37 2009 -0700
@@ -35,3 +35,5 @@
 13bf67d8c6341b841d268985cabaf747f2652bc8 jdk7-b58
 75113d7ce083048e7576b9d0d60a4e80db6b181f jdk7-b59
 259aef5045a155eb6a2f8dd0e2429c6dbe0f652f jdk7-b60
+f1ac756616eaaad795f77f7f5e7f7c7bfdc9c1de jdk7-b61
+a97dd57a62604c35c79bc2fa77a612ed547f6135 jdk7-b62
--- a/jaxp/make/Makefile	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxp/make/Makefile	Mon Jul 06 11:42:37 2009 -0700
@@ -81,7 +81,15 @@
   ifdef JAVAC_TARGET_ARG
     ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
   endif
-endif
+endif 
+
+ifdef SOURCE_LANGUAGE_VERSION
+  ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
+else
+  ifdef JAVAC_SOURCE_ARG 
+    ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
+  endif
+endif 
 
 ifdef ALT_BOOTDIR
   ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
--- a/jaxp/make/build.properties	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxp/make/build.properties	Mon Jul 06 11:42:37 2009 -0700
@@ -30,6 +30,7 @@
 # one of the standard user build.properties files (see build.xml)
 
 # options for the <javac> tasks used to compile the tools
+javac.source = 5
 javac.target = 5
 javac.debug = true
 javac.no.jdk.warnings = -XDignore.symbol.file=true
--- a/jaxp/make/build.xml	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxp/make/build.xml	Mon Jul 06 11:42:37 2009 -0700
@@ -85,6 +85,7 @@
              destdir="${build.classes.dir}"
              memoryInitialSize="${javac.memoryInitialSize}"
              memoryMaximumSize="${javac.memoryMaximumSize}"
+	     source="${javac.source}"
 	     debug="${javac.debug}"
              target="${javac.target}">
          <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
--- a/jaxws/.hgtags	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxws/.hgtags	Mon Jul 06 11:42:37 2009 -0700
@@ -35,3 +35,5 @@
 5fb4fbea81c3609916da00417fdd15dbd9e39e97 jdk7-b58
 f64566bf4c2bc92e65ab2b9fab51b119f0d493d1 jdk7-b59
 3b054db3e277ca224fe6576c59ed6f4ab5ed0bb5 jdk7-b60
+aeabf802f2a1ca72b87d7397c5ece58058e000a9 jdk7-b61
+75c801c13ea1ddebc58b1a8c8da9318d72750e62 jdk7-b62
--- a/jaxws/make/Makefile	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxws/make/Makefile	Mon Jul 06 11:42:37 2009 -0700
@@ -83,6 +83,14 @@
   endif
 endif
 
+ifdef SOURCE_LANGUAGE_VERSION
+  ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
+else
+  ifdef JAVAC_SOURCE_ARG 
+    ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
+  endif
+endif 
+
 ifdef ALT_BOOTDIR
   ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
 endif
--- a/jaxws/make/build.properties	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxws/make/build.properties	Mon Jul 06 11:42:37 2009 -0700
@@ -30,6 +30,7 @@
 # one of the standard user build.properties files (see build.xml)
 
 # options for the <javac> tasks used to compile the tools
+javac.source = 5
 javac.target = 5
 javac.debug = true
 javac.no.jdk.warnings = -XDignore.symbol.file=true
--- a/jaxws/make/build.xml	Wed Jul 01 09:59:16 2009 -0700
+++ b/jaxws/make/build.xml	Mon Jul 06 11:42:37 2009 -0700
@@ -107,6 +107,7 @@
              destdir="${build.classes.dir}"
              memoryInitialSize="${javac.memoryInitialSize}"
              memoryMaximumSize="${javac.memoryMaximumSize}"
+             source="${javac.source}"
 	     debug="${javac.debug}"
              target="${javac.target}"
              excludes="com/sun/tools/internal/txw2/**">
--- a/jdk/.hgtags	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/.hgtags	Mon Jul 06 11:42:37 2009 -0700
@@ -36,3 +36,5 @@
 2a5a1b269e89f27ebe419ef4cf6e66a3face0df1 jdk7-b59
 0c3ef2d612a47667829eb17a192decef23f1c536 jdk7-b60
 f72c0dc047b9b2e797beee68ae0b50decb1f020d jdk7-b61
+12e11fab9a839a9666a996a8f9a02fd8fa03aab6 jdk7-b62
+2ed6ed6b5bfc7dd724925b90dbb31223df59c25d jdk7-b63
--- a/jdk/make/java/text/FILES_java.gmk	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/make/java/text/FILES_java.gmk	Mon Jul 06 11:42:37 2009 -0700
@@ -76,6 +76,10 @@
         sun/text/Normalizer.java \
         sun/text/SupplementaryCharacterData.java \
         sun/text/UCompactIntArray.java \
+            sun/text/bidi/BidiBase.java \
+            sun/text/bidi/BidiLine.java \
+            sun/text/bidi/BidiRun.java \
+            \
             sun/text/normalizer/CharTrie.java \
             sun/text/normalizer/CharacterIteratorWrapper.java \
             sun/text/normalizer/ICUBinary.java \
--- a/jdk/make/sun/font/FILES_c.gmk	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/make/sun/font/FILES_c.gmk	Mon Jul 06 11:42:37 2009 -0700
@@ -24,10 +24,6 @@
 #
 
 FILES_c_shared = \
-        jbidi.c \
-        ubidi.c \
-        ubidiln.c \
-        uchardir.c \
         DrawGlyphList.c \
         sunFont.c
 
--- a/jdk/make/sun/font/Makefile	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/make/sun/font/Makefile	Mon Jul 06 11:42:37 2009 -0700
@@ -145,7 +145,6 @@
 # Add to the ambient vpath to pick up files in subdirectories
 #
 vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)
-vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/bidi
 vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)/layout
 vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)
 
@@ -187,7 +186,6 @@
 
 CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR) \
             -I$(SHARE_SRC)/native/$(PKGDIR)/layout \
-            -I$(SHARE_SRC)/native/$(PKGDIR)/bidi \
 	    -I$(SHARE_SRC)/native/sun/awt/image/cvutils \
 	    -I$(PLATFORM_SRC)/native/sun/awt \
 	    -I$(SHARE_SRC)/native/sun/awt/debug \
--- a/jdk/make/sun/font/mapfile-vers	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/make/sun/font/mapfile-vers	Mon Jul 06 11:42:37 2009 -0700
@@ -31,8 +31,6 @@
                 newLayoutTableCache; 
                 freeLayoutTableCache;
                 isNullScalerContext;
-		Java_java_text_Bidi_nativeBidiChars;
-		Java_java_text_Bidi_nativeGetDirectionCode;
                 Java_sun_font_NullFontScaler_getNullScalerContext;
                 Java_sun_font_NullFontScaler_getGlyphImage;
                 Java_sun_font_FontManager_getPlatformFontVar;
--- a/jdk/make/sun/font/mapfile-vers.openjdk	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/make/sun/font/mapfile-vers.openjdk	Mon Jul 06 11:42:37 2009 -0700
@@ -33,8 +33,6 @@
                 newLayoutTableCache; 
                 freeLayoutTableCache;
                 isNullScalerContext;
-		Java_java_text_Bidi_nativeBidiChars;
-		Java_java_text_Bidi_nativeGetDirectionCode;
                 Java_sun_font_NullFontScaler_getNullScalerContext;
                 Java_sun_font_NullFontScaler_getGlyphImage;
                 Java_sun_font_FontManager_getPlatformFontVar;
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -506,6 +506,19 @@
 
         writeFileHeader(fileSize, offset);
 
+        /* According to MSDN description, the top-down image layout
+         * is allowed only if compression type is BI_RGB or BI_BITFIELDS.
+         * Images with any other compression type must be wrote in the
+         * bottom-up layout.
+         */
+        if (compressionType == BMPConstants.BI_RGB ||
+            compressionType == BMPConstants.BI_BITFIELDS)
+        {
+            isTopDown = bmpParam.isTopDown();
+        } else {
+            isTopDown = false;
+        }
+
         writeInfoHeader(headerSize, bitsPerPixel);
 
         // compression
@@ -588,8 +601,6 @@
             return;
         }
 
-        isTopDown = bmpParam.isTopDown();
-
         int maxBandOffset = bandOffsets[0];
         for (int i = 1; i < bandOffsets.length; i++)
             if (bandOffsets[i] > maxBandOffset)
@@ -1299,7 +1310,7 @@
         stream.writeInt(w);
 
         // height
-        stream.writeInt(h);
+        stream.writeInt(isTopDown ? -h : h);
 
         // number of planes
         stream.writeShort(1);
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/ReaderUtil.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/ReaderUtil.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,6 +27,8 @@
 
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
 
 /**
  * This class contains utility methods that may be useful to ImageReader
@@ -198,4 +200,17 @@
                              vals, 1);
         return vals;
     }
+
+    public static int readMultiByteInteger(ImageInputStream iis)
+        throws IOException
+    {
+        int value = iis.readByte();
+        int result = value & 0x7f;
+        while((value & 0x80) == 0x80) {
+            result <<= 7;
+            value = iis.readByte();
+            result |= (value & 0x7f);
+        }
+        return result;
+    }
 }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java	Mon Jul 06 11:42:37 2009 -0700
@@ -215,17 +215,21 @@
     public static class JCS {
         public static final ColorSpace sRGB =
             ColorSpace.getInstance(ColorSpace.CS_sRGB);
-        public static final ColorSpace YCC;
+
+        private static ColorSpace YCC = null;
+        private static boolean yccInited = false;
 
-        static {
-            ColorSpace cs = null;
-            try {
-                cs = ColorSpace.getInstance(ColorSpace.CS_PYCC);
-            } catch (IllegalArgumentException e) {
-                // PYCC.pf may not always be installed
-            } finally {
-                YCC = cs;
+        public static ColorSpace getYCC() {
+            if (!yccInited) {
+                try {
+                    YCC = ColorSpace.getInstance(ColorSpace.CS_PYCC);
+                } catch (IllegalArgumentException e) {
+                    // PYCC.pf may not always be installed
+                } finally {
+                    yccInited = true;
+                }
             }
+            return YCC;
         }
     }
 
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Mon Jul 06 11:42:37 2009 -0700
@@ -41,6 +41,7 @@
 import java.awt.color.ColorSpace;
 import java.awt.color.ICC_Profile;
 import java.awt.color.ICC_ColorSpace;
+import java.awt.color.CMMException;
 import java.awt.image.BufferedImage;
 import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
@@ -53,6 +54,7 @@
 import java.util.List;
 import java.util.Iterator;
 import java.util.ArrayList;
+import java.util.NoSuchElementException;
 
 import sun.java2d.Disposer;
 import sun.java2d.DisposerRecord;
@@ -215,51 +217,6 @@
     /** The DisposerRecord that handles the actual disposal of this reader. */
     private DisposerRecord disposerRecord;
 
-    /**
-     * Maintain an array of the default image types corresponding to the
-     * various supported IJG colorspace codes.
-     */
-    private static final ImageTypeSpecifier [] defaultTypes =
-        new ImageTypeSpecifier [JPEG.NUM_JCS_CODES];
-
-    static {
-        defaultTypes[JPEG.JCS_GRAYSCALE] =
-            ImageTypeSpecifier.createFromBufferedImageType
-            (BufferedImage.TYPE_BYTE_GRAY);
-        defaultTypes[JPEG.JCS_RGB] =
-            ImageTypeSpecifier.createInterleaved
-            (JPEG.JCS.sRGB,
-             JPEG.bOffsRGB,
-             DataBuffer.TYPE_BYTE,
-             false,
-             false);
-        defaultTypes[JPEG.JCS_RGBA] =
-            ImageTypeSpecifier.createPacked
-            (JPEG.JCS.sRGB,
-             0xff000000,
-             0x00ff0000,
-             0x0000ff00,
-             0x000000ff,
-             DataBuffer.TYPE_INT,
-             false);
-        if (JPEG.JCS.YCC != null) {
-            defaultTypes[JPEG.JCS_YCC] =
-                ImageTypeSpecifier.createInterleaved
-                (JPEG.JCS.YCC,
-                 JPEG.bandOffsets[2],
-                 DataBuffer.TYPE_BYTE,
-                 false,
-                 false);
-            defaultTypes[JPEG.JCS_YCCA] =
-                ImageTypeSpecifier.createInterleaved
-                (JPEG.JCS.YCC,
-                 JPEG.bandOffsets[3],
-                 DataBuffer.TYPE_BYTE,
-                 true,
-                 false);
-        }
-    }
-
     /** Sets up static C structures. */
     private static native void initReaderIDs(Class iisClass,
                                              Class qTableClass,
@@ -673,6 +630,17 @@
             !java.util.Arrays.equals(oldData, newData))
         {
             iccCS = new ICC_ColorSpace(newProfile);
+            // verify new color space
+            try {
+                float[] colors = iccCS.fromRGB(new float[] {1f, 0f, 0f});
+            } catch (CMMException e) {
+                /*
+                 * Embedded profile seems to be corrupted.
+                 * Ignore this profile.
+                 */
+                iccCS = null;
+                warningOccurred(WARNING_IGNORE_INVALID_ICC);
+            }
         }
     }
 
@@ -706,11 +674,11 @@
      * Return an ImageTypeSpecifier corresponding to the given
      * color space code, or null if the color space is unsupported.
      */
-    private ImageTypeSpecifier getImageType(int code) {
-        ImageTypeSpecifier ret = null;
+    private ImageTypeProducer getImageType(int code) {
+        ImageTypeProducer ret = null;
 
         if ((code > 0) && (code < JPEG.NUM_JCS_CODES)) {
-            ret = defaultTypes[code];
+            ret = ImageTypeProducer.getTypeProducer(code);
         }
         return ret;
     }
@@ -724,7 +692,7 @@
             }
 
             // Returns null if it can't be represented
-            return getImageType(colorSpaceCode);
+            return getImageType(colorSpaceCode).getType();
         } finally {
             clearThreadLock();
         }
@@ -758,13 +726,13 @@
 
         // Get the raw ITS, if there is one.  Note that this
         // won't always be the same as the default.
-        ImageTypeSpecifier raw = getImageType(colorSpaceCode);
+        ImageTypeProducer raw = getImageType(colorSpaceCode);
 
         // Given the encoded colorspace, build a list of ITS's
         // representing outputs you could handle starting
         // with the default.
 
-        ArrayList list = new ArrayList(1);
+        ArrayList<ImageTypeProducer> list = new ArrayList<ImageTypeProducer>(1);
 
         switch (colorSpaceCode) {
         case JPEG.JCS_GRAYSCALE:
@@ -774,9 +742,7 @@
         case JPEG.JCS_RGB:
             list.add(raw);
             list.add(getImageType(JPEG.JCS_GRAYSCALE));
-            if (JPEG.JCS.YCC != null) {
-                list.add(getImageType(JPEG.JCS_YCC));
-            }
+            list.add(getImageType(JPEG.JCS_YCC));
             break;
         case JPEG.JCS_RGBA:
             list.add(raw);
@@ -801,19 +767,21 @@
             list.add(getImageType(JPEG.JCS_RGB));
 
             if (iccCS != null) {
-                list.add(ImageTypeSpecifier.createInterleaved
+                list.add(new ImageTypeProducer() {
+                    protected ImageTypeSpecifier produce() {
+                        return ImageTypeSpecifier.createInterleaved
                          (iccCS,
                           JPEG.bOffsRGB,  // Assume it's for RGB
                           DataBuffer.TYPE_BYTE,
                           false,
-                          false));
+                          false);
+                    }
+                });
 
             }
 
             list.add(getImageType(JPEG.JCS_GRAYSCALE));
-            if (JPEG.JCS.YCC != null) { // Might be null if PYCC.pf not installed
-                list.add(getImageType(JPEG.JCS_YCC));
-            }
+            list.add(getImageType(JPEG.JCS_YCC));
             break;
         case JPEG.JCS_YCbCrA:  // Default is to convert to RGBA
             // As there is no YCbCr ColorSpace, we can't support
@@ -822,7 +790,7 @@
             break;
         }
 
-        return list.iterator();
+        return new ImageTypeIterator(list.iterator());
     }
 
     /**
@@ -872,6 +840,10 @@
             if  (csType == ColorSpace.TYPE_RGB) { // We want RGB
                 // IJG can do this for us more efficiently
                 setOutColorSpace(structPointer, JPEG.JCS_RGB);
+                // Update java state according to changes
+                // in the native part of decoder.
+                outColorSpaceCode = JPEG.JCS_RGB;
+                numComponents = 3;
             } else if (csType != ColorSpace.TYPE_GRAY) {
                 throw new IIOException("Incompatible color conversion");
             }
@@ -881,6 +853,10 @@
                 if (colorSpaceCode == JPEG.JCS_YCbCr) {
                     // If the jpeg space is YCbCr, IJG can do it
                     setOutColorSpace(structPointer, JPEG.JCS_GRAYSCALE);
+                    // Update java state according to changes
+                    // in the native part of decoder.
+                    outColorSpaceCode = JPEG.JCS_GRAYSCALE;
+                    numComponents = 1;
                 }
             } else if ((iccCS != null) &&
                        (cm.getNumComponents() == numComponents) &&
@@ -906,20 +882,26 @@
             }
             break;
         case JPEG.JCS_YCC:
-            if (JPEG.JCS.YCC == null) { // We can't do YCC at all
-                throw new IIOException("Incompatible color conversion");
-            }
-            if ((cs != JPEG.JCS.YCC) &&
-                (cm.getNumComponents() == numComponents)) {
-                convert = new ColorConvertOp(JPEG.JCS.YCC, cs, null);
+            {
+                ColorSpace YCC = JPEG.JCS.getYCC();
+                if (YCC == null) { // We can't do YCC at all
+                    throw new IIOException("Incompatible color conversion");
+                }
+                if ((cs != YCC) &&
+                    (cm.getNumComponents() == numComponents)) {
+                    convert = new ColorConvertOp(YCC, cs, null);
+                }
             }
             break;
         case JPEG.JCS_YCCA:
-            // No conversions available; image must be YCCA
-            if ((JPEG.JCS.YCC == null) || // We can't do YCC at all
-                (cs != JPEG.JCS.YCC) ||
-                (cm.getNumComponents() != numComponents)) {
-                throw new IIOException("Incompatible color conversion");
+            {
+                ColorSpace YCC = JPEG.JCS.getYCC();
+                // No conversions available; image must be YCCA
+                if ((YCC == null) || // We can't do YCC at all
+                    (cs != YCC) ||
+                    (cm.getNumComponents() != numComponents)) {
+                    throw new IIOException("Incompatible color conversion");
+                }
             }
             break;
         default:
@@ -1554,3 +1536,140 @@
         }
     }
 }
+
+/**
+ * An internal helper class that wraps producer's iterator
+ * and extracts specifier instances on demand.
+ */
+class ImageTypeIterator implements Iterator<ImageTypeSpecifier> {
+     private Iterator<ImageTypeProducer> producers;
+     private ImageTypeSpecifier theNext = null;
+
+     public ImageTypeIterator(Iterator<ImageTypeProducer> producers) {
+         this.producers = producers;
+     }
+
+     public boolean hasNext() {
+         if (theNext != null) {
+             return true;
+         }
+         if (!producers.hasNext()) {
+             return false;
+         }
+         do {
+             theNext = producers.next().getType();
+         } while (theNext == null && producers.hasNext());
+
+         return (theNext != null);
+     }
+
+     public ImageTypeSpecifier next() {
+         if (theNext != null || hasNext()) {
+             ImageTypeSpecifier t = theNext;
+             theNext = null;
+             return t;
+         } else {
+             throw new NoSuchElementException();
+         }
+     }
+
+     public void remove() {
+         producers.remove();
+     }
+}
+
+/**
+ * An internal helper class that provides means for deferred creation
+ * of ImageTypeSpecifier instance required to describe available
+ * destination types.
+ *
+ * This implementation only supports standard
+ * jpeg color spaces (defined by corresponding JCS color space code).
+ *
+ * To support other color spaces one can override produce() method to
+ * return custom instance of ImageTypeSpecifier.
+ */
+class ImageTypeProducer {
+
+    private ImageTypeSpecifier type = null;
+    boolean failed = false;
+    private int csCode;
+
+    public ImageTypeProducer(int csCode) {
+        this.csCode = csCode;
+    }
+
+    public ImageTypeProducer() {
+        csCode = -1; // undefined
+    }
+
+    public synchronized ImageTypeSpecifier getType() {
+        if (!failed && type == null) {
+            try {
+                type = produce();
+            } catch (Throwable e) {
+                failed = true;
+            }
+        }
+        return type;
+    }
+
+    private static final ImageTypeProducer [] defaultTypes =
+            new ImageTypeProducer [JPEG.NUM_JCS_CODES];
+
+    public synchronized static ImageTypeProducer getTypeProducer(int csCode) {
+        if (csCode < 0 || csCode >= JPEG.NUM_JCS_CODES) {
+            return null;
+        }
+        if (defaultTypes[csCode] == null) {
+            defaultTypes[csCode] = new ImageTypeProducer(csCode);
+        }
+        return defaultTypes[csCode];
+    }
+
+    protected ImageTypeSpecifier produce() {
+        switch (csCode) {
+            case JPEG.JCS_GRAYSCALE:
+                return ImageTypeSpecifier.createFromBufferedImageType
+                        (BufferedImage.TYPE_BYTE_GRAY);
+            case JPEG.JCS_RGB:
+                return ImageTypeSpecifier.createInterleaved(JPEG.JCS.sRGB,
+                        JPEG.bOffsRGB,
+                        DataBuffer.TYPE_BYTE,
+                        false,
+                        false);
+            case JPEG.JCS_RGBA:
+                return ImageTypeSpecifier.createPacked(JPEG.JCS.sRGB,
+                        0xff000000,
+                        0x00ff0000,
+                        0x0000ff00,
+                        0x000000ff,
+                        DataBuffer.TYPE_INT,
+                        false);
+            case JPEG.JCS_YCC:
+                if (JPEG.JCS.getYCC() != null) {
+                    return ImageTypeSpecifier.createInterleaved(
+                            JPEG.JCS.getYCC(),
+                        JPEG.bandOffsets[2],
+                        DataBuffer.TYPE_BYTE,
+                        false,
+                        false);
+                } else {
+                    return null;
+                }
+            case JPEG.JCS_YCCA:
+                if (JPEG.JCS.getYCC() != null) {
+                    return ImageTypeSpecifier.createInterleaved(
+                            JPEG.JCS.getYCC(),
+                        JPEG.bandOffsets[3],
+                        DataBuffer.TYPE_BYTE,
+                        true,
+                        false);
+                } else {
+                    return null;
+                }
+            default:
+                return null;
+        }
+    }
+}
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -812,7 +812,7 @@
                             }
                             break;
                         case ColorSpace.TYPE_3CLR:
-                            if (cs == JPEG.JCS.YCC) {
+                            if (cs == JPEG.JCS.getYCC()) {
                                 if (!alpha) {
                                     if (jfif != null) {
                                         convertTosRGB = true;
@@ -1494,7 +1494,7 @@
                 }
                 break;
             case ColorSpace.TYPE_3CLR:
-                if (cs == JPEG.JCS.YCC) {
+                if (cs == JPEG.JCS.getYCC()) {
                     if (alpha) {
                         retval = JPEG.JCS_YCCA;
                     } else {
@@ -1533,7 +1533,7 @@
                 }
                 break;
             case ColorSpace.TYPE_3CLR:
-                if (cs == JPEG.JCS.YCC) {
+                if (cs == JPEG.JCS.getYCC()) {
                     if (alpha) {
                         retval = JPEG.JCS_YCCA;
                     } else {
@@ -1579,7 +1579,7 @@
                 }
                 break;
             case ColorSpace.TYPE_3CLR:
-                if (cs == JPEG.JCS.YCC) {
+                if (cs == JPEG.JCS.getYCC()) {
                     if (alpha) {
                         retval = JPEG.JCS_YCCA;
                     } else {
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Mon Jul 06 11:42:37 2009 -0700
@@ -490,7 +490,7 @@
                 }
                 break;
             case ColorSpace.TYPE_3CLR:
-                if (cs == JPEG.JCS.YCC) {
+                if (cs == JPEG.JCS.getYCC()) {
                     wantJFIF = false;
                     componentIDs[0] = (byte) 'Y';
                     componentIDs[1] = (byte) 'C';
--- a/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Mon Jul 06 11:42:37 2009 -0700
@@ -45,6 +45,7 @@
 import java.util.Iterator;
 
 import com.sun.imageio.plugins.common.I18N;
+import com.sun.imageio.plugins.common.ReaderUtil;
 
 /** This class is the Java Image IO plugin reader for WBMP images.
  *  It may subsample the image, clip the image,
@@ -141,11 +142,11 @@
         metadata.wbmpType = wbmpType;
 
         // Read image width
-        width = readMultiByteInteger();
+        width = ReaderUtil.readMultiByteInteger(iis);
         metadata.width = width;
 
         // Read image height
-        height = readMultiByteInteger();
+        height = ReaderUtil.readMultiByteInteger(iis);
         metadata.height = height;
 
         gotHeader = true;
@@ -311,17 +312,6 @@
         gotHeader = false;
     }
 
-    private int readMultiByteInteger() throws IOException {
-        int value = iis.readByte();
-        int result = value & 0x7f;
-        while((value & 0x80) == 0x80) {
-            result <<= 7;
-            value = iis.readByte();
-            result |= (value & 0x7f);
-        }
-        return result;
-    }
-
     /*
      * This method verifies that given byte is valid wbmp type marker.
      * At the moment only 0x0 marker is described by wbmp spec.
--- a/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Mon Jul 06 11:42:37 2009 -0700
@@ -33,9 +33,13 @@
 import java.io.IOException;
 import javax.imageio.ImageReader;
 import javax.imageio.IIOException;
+import com.sun.imageio.plugins.common.ReaderUtil;
 
 public class WBMPImageReaderSpi extends ImageReaderSpi {
 
+    private static final int MAX_WBMP_WIDTH = 1024;
+    private static final int MAX_WBMP_HEIGHT = 768;
+
     private static String [] writerSpiNames =
         {"com.sun.imageio.plugins.wbmp.WBMPImageWriterSpi"};
     private static String[] formatNames = {"wbmp", "WBMP"};
@@ -79,16 +83,44 @@
         }
 
         ImageInputStream stream = (ImageInputStream)source;
-        byte[] b = new byte[3];
 
         stream.mark();
-        stream.readFully(b);
+        int type = stream.readByte();   // TypeField
+        int fixHeaderField = stream.readByte();
+        // check WBMP "header"
+        if (type != 0 || fixHeaderField != 0) {
+            // while WBMP reader does not support ext WBMP headers
+            stream.reset();
+            return false;
+        }
+
+        int width = ReaderUtil.readMultiByteInteger(stream);
+        int height = ReaderUtil.readMultiByteInteger(stream);
+        // check image dimension
+        if (width <= 0 || height <= 0) {
+            stream.reset();
+            return false;
+        }
+
+        long dataLength = stream.length();
+        if (dataLength == -1) {
+            // We can't verify that amount of data in the stream
+            // corresponds to image dimension because we do not know
+            // the length of the data stream.
+            // Assuming that wbmp image are used for mobile devices,
+            // let's introduce an upper limit for image dimension.
+            // In case if exact amount of raster data is unknown,
+            // let's reject images with dimension above the limit.
+            stream.reset();
+            return (width < MAX_WBMP_WIDTH) && (height < MAX_WBMP_HEIGHT);
+        }
+
+        dataLength -= stream.getStreamPosition();
         stream.reset();
 
-        return ((b[0] == (byte)0) &&  // TypeField == 0
-                b[1] == 0 && // FixHeaderField == 0xxx00000; not support ext header
-                ((b[2] & 0x8f) != 0 || (b[2] & 0x7f) != 0));  // First width byte
-                //XXX: b[2] & 0x8f) != 0 for the bug in Sony Ericsson encoder.
+        long scanSize = (width / 8) + ((width % 8) == 0 ? 0 : 1);
+
+        return (dataLength == scanSize * height);
     }
 
     public ImageReader createReaderInstance(Object extension)
--- a/jdk/src/share/classes/java/awt/Font.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/awt/Font.java	Mon Jul 06 11:42:37 2009 -0700
@@ -445,18 +445,19 @@
      */
     private AttributeValues getAttributeValues() {
         if (values == null) {
-            values = new AttributeValues();
-            values.setFamily(name);
-            values.setSize(pointSize); // expects the float value.
+            AttributeValues valuesTmp = new AttributeValues();
+            valuesTmp.setFamily(name);
+            valuesTmp.setSize(pointSize); // expects the float value.
 
             if ((style & BOLD) != 0) {
-                values.setWeight(2); // WEIGHT_BOLD
+                valuesTmp.setWeight(2); // WEIGHT_BOLD
             }
 
             if ((style & ITALIC) != 0) {
-                values.setPosture(.2f); // POSTURE_OBLIQUE
+                valuesTmp.setPosture(.2f); // POSTURE_OBLIQUE
             }
-            values.defineAll(PRIMARY_MASK); // for streaming compatibility
+            valuesTmp.defineAll(PRIMARY_MASK); // for streaming compatibility
+            values = valuesTmp;
         }
 
         return values;
--- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Mon Jul 06 11:42:37 2009 -0700
@@ -79,8 +79,9 @@
 
             try {
 //                      long t0 = System.currentTimeMillis();
-                localEnv =
-                    (GraphicsEnvironment) Class.forName(nm).newInstance();
+                ClassLoader cl = ClassLoader.getSystemClassLoader();
+                Class geCls = Class.forName(nm, true, cl);
+                localEnv = (GraphicsEnvironment)geCls.newInstance();
 //              long t1 = System.currentTimeMillis();
 //              System.out.println("GE creation took " + (t1-t0)+ "ms.");
                 if (isHeadless()) {
--- a/jdk/src/share/classes/java/awt/color/ICC_Profile.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/awt/color/ICC_Profile.java	Mon Jul 06 11:42:37 2009 -0700
@@ -863,11 +863,16 @@
         case ColorSpace.CS_PYCC:
             synchronized(ICC_Profile.class) {
                 if (PYCCprofile == null) {
-                    ProfileDeferralInfo pInfo =
-                        new ProfileDeferralInfo("PYCC.pf",
-                                                ColorSpace.TYPE_3CLR, 3,
-                                                CLASS_DISPLAY);
-                    PYCCprofile = getDeferredInstance(pInfo);
+                    if (getProfileFile("PYCC.pf") != null) {
+                        ProfileDeferralInfo pInfo =
+                            new ProfileDeferralInfo("PYCC.pf",
+                                                    ColorSpace.TYPE_3CLR, 3,
+                                                    CLASS_DISPLAY);
+                        PYCCprofile = getDeferredInstance(pInfo);
+                    } else {
+                        throw new IllegalArgumentException(
+                                "Can't load standard profile: PYCC.pf");
+                    }
                 }
                 thisProfile = PYCCprofile;
             }
@@ -1783,17 +1788,33 @@
         return (FileInputStream)java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction() {
             public Object run() {
-                return privilegedOpenProfile(fileName);
+                File f = privilegedGetProfileFile(fileName);
+                if (f != null) {
+                    try {
+                        return new FileInputStream(f);
+                    } catch (FileNotFoundException e) {
+                    }
+                }
+                return null;
+            }
+        });
+    }
+
+    private static File getProfileFile(final String fileName) {
+        return (File)java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction() {
+            public Object run() {
+                return privilegedGetProfileFile(fileName);
             }
         });
     }
 
     /*
-     * this version is called from doPrivileged in privilegedOpenProfile.
-     * the whole method is privileged!
+     * this version is called from doPrivileged in openProfile
+     * or getProfileFile, so the whole method is privileged!
      */
-    private static FileInputStream privilegedOpenProfile(String fileName) {
-        FileInputStream fis = null;
+
+    private static File privilegedGetProfileFile(String fileName) {
         String path, dir, fullPath;
 
         File f = new File(fileName); /* try absolute file name */
@@ -1830,12 +1851,9 @@
             }
 
         if (f.isFile()) {
-            try {
-                fis = new FileInputStream(f);
-            } catch (FileNotFoundException e) {
-            }
+            return f;
         }
-        return fis;
+        return null;
     }
 
 
--- a/jdk/src/share/classes/java/nio/file/LinkPermission.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/nio/file/LinkPermission.java	Mon Jul 06 11:42:37 2009 -0700
@@ -46,7 +46,7 @@
  *   known as creating a link, or hard link. </td>
  *   <td> Extreme care should be taken when granting this permission. It allows
  *   linking to any file or directory in the file system thus allowing the
- *   attacker to access to all files. </td>
+ *   attacker access to all files. </td>
  * </tr>
  * <tr>
  *   <td>symbolic</td>
--- a/jdk/src/share/classes/java/nio/file/NotLinkException.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/nio/file/NotLinkException.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
 
 /**
  * Checked exception thrown when a file system operation fails because a file
- * is not a link.
+ * is not a symbolic link.
  *
  * @since 1.7
  */
--- a/jdk/src/share/classes/java/nio/file/Path.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/nio/file/Path.java	Mon Jul 06 11:42:37 2009 -0700
@@ -91,8 +91,8 @@
  *      iterate over the entries in the directory. </p></li>
  *   <li><p> Files can be {@link #copyTo(Path,CopyOption[]) copied} or
  *     {@link #moveTo(Path,CopyOption[]) moved}. </p></li>
- *   <li><p> Symbolic-links may be {@link #createSymbolicLink created}, or the
- *     target of a link may be {@link #readSymbolicLink read}. </p></li>
+ *   <li><p> Symbolic links may be {@link #createSymbolicLink created}, or the
+ *     target of a symbolic link may be {@link #readSymbolicLink read}. </p></li>
  *   <li><p> The {@link #toRealPath real} path of an existing file may be
  *     obtained. </li></p>
  * </ul>
@@ -403,12 +403,12 @@
      *   <i>p</i><tt>.relativize(</tt><i>p</i><tt>.resolve(</tt><i>q</i><tt>)).equals(</tt><i>q</i><tt>)</tt>
      * </blockquote>
      *
-     * <p> When symbolic-links are supported, then whether the resulting path,
+     * <p> When symbolic links are supported, then whether the resulting path,
      * when resolved against this path, yields a path that can be used to locate
      * the {@link #isSameFile same} file as {@code other} is implementation
      * dependent. For example, if this path is  {@code "/a/b"} and the given
      * path is {@code "/a/x"} then the resulting relative path may be {@code
-     * "../x"}. If {@code "b"} is a symbolic-link then is implementation
+     * "../x"}. If {@code "b"} is a symbolic link then is implementation
      * dependent if {@code "a/b/../x"} would locate the same file as {@code "/a/x"}.
      *
      * @param   other
@@ -430,8 +430,8 @@
      *
      * <p> An implementation may require to examine the file to determine if the
      * file is a directory. Consequently this method may not be atomic with respect
-     * to other file system operations.  If the file is a symbolic-link then the
-     * link is deleted and not the final target of the link.
+     * to other file system operations.  If the file is a symbolic link then the
+     * symbolic link itself, not the final target of the link, is deleted.
      *
      * <p> If the file is a directory then the directory must be empty. In some
      * implementations a directory has entries for special files or links that
@@ -459,11 +459,11 @@
     /**
      * Deletes the file located by this path, if it exists.
      *
-     * <p> As with the {@link #delete delete()} method, an implementation
-     * may require to examine the file to determine if the file is a directory.
+     * <p> As with the {@link #delete delete()} method, an implementation may
+     * need to examine the file to determine if the file is a directory.
      * Consequently this method may not be atomic with respect to other file
-     * system operations.  If the file is a symbolic-link then the link is
-     * deleted and not the final target of the link.
+     * system operations.  If the file is a symbolic link, then the symbolic
+     * link itself, not the final target of the link, is deleted.
      *
      * <p> If the file is a directory then the directory must be empty. In some
      * implementations a directory has entries for special files or links that
@@ -507,7 +507,7 @@
      * create symbolic links, in which case this method may throw {@code IOException}.
      *
      * @param   target
-     *          the target of the link
+     *          the target of the symbolic link
      * @param   attrs
      *          the array of attributes to set atomically when creating the
      *          symbolic link
@@ -573,9 +573,9 @@
      * Reads the target of a symbolic link <i>(optional operation)</i>.
      *
      * <p> If the file system supports <a href="package-summary.html#links">symbolic
-     * links</a> then this method is used read the target of the link, failing
-     * if the file is not a link. The target of the link need not exist. The
-     * returned {@code Path} object will be associated with the same file
+     * links</a> then this method is used to read the target of the link, failing
+     * if the file is not a symbolic link. The target of the link need not exist.
+     * The returned {@code Path} object will be associated with the same file
      * system as this {@code Path}.
      *
      * @return  a {@code Path} object representing the target of the link
@@ -584,7 +584,7 @@
      *          if the implementation does not support symbolic links
      * @throws  NotLinkException
      *          if the target could otherwise not be read because the file
-     *          is not a link <i>(optional specific exception)</i>
+     *          is not a symbolic link <i>(optional specific exception)</i>
      * @throws  IOException
      *          if an I/O error occurs
      * @throws  SecurityException
@@ -724,8 +724,8 @@
      * exists, except if the source and target are the {@link #isSameFile same}
      * file, in which case this method has no effect. File attributes are not
      * required to be copied to the target file. If symbolic links are supported,
-     * and the file is a link, then the final target of the link is copied. If
-     * the file is a directory then it creates an empty directory in the target
+     * and the file is a symbolic link, then the final target of the link is copied.
+     * If the file is a directory then it creates an empty directory in the target
      * location (entries in the directory are not copied). This method can be
      * used with the {@link Files#walkFileTree Files.walkFileTree} utility
      * method to copy a directory and all entries in the directory, or an entire
@@ -740,8 +740,8 @@
      *   <td> {@link StandardCopyOption#REPLACE_EXISTING REPLACE_EXISTING} </td>
      *   <td> If the target file exists, then the target file is replaced if it
      *     is not a non-empty directory. If the target file exists and is a
-     *     symbolic-link then the symbolic-link is replaced (not the target of
-     *     the link. </td>
+     *     symbolic link, then the symbolic link itself, not the target of
+     *     the link, is replaced. </td>
      * </tr>
      * <tr>
      *   <td> {@link StandardCopyOption#COPY_ATTRIBUTES COPY_ATTRIBUTES} </td>
@@ -755,11 +755,11 @@
      * </tr>
      * <tr>
      *   <td> {@link LinkOption#NOFOLLOW_LINKS NOFOLLOW_LINKS} </td>
-     *   <td> Symbolic-links are not followed. If the file, located by this path,
-     *     is a symbolic-link then the link is copied rather than the target of
-     *     the link. It is implementation specific if file attributes can be
-     *     copied to the new link. In other words, the {@code COPY_ATTRIBUTES}
-     *     option may be ignored when copying a link. </td>
+     *   <td> Symbolic links are not followed. If the file, located by this path,
+     *     is a symbolic link, then the symbolic link itself, not the target of
+     *     the link, is copied. It is implementation specific if file attributes
+     *     can be copied to the new link. In other words, the {@code
+     *     COPY_ATTRIBUTES} option may be ignored when copying a symbolic link. </td>
      * </tr>
      * </table>
      *
@@ -807,18 +807,19 @@
      * <p> By default, this method attempts to move the file to the target
      * location, failing if the target file exists except if the source and
      * target are the {@link #isSameFile same} file, in which case this method
-     * has no effect. If the file is a symbolic link then the link is moved and
-     * not the target of the link. This method may be invoked to move an empty
-     * directory. In some implementations a directory has entries for special
-     * files or links that are created when the directory is created. In such
-     * implementations a directory is considered empty when only the special
-     * entries exist. When invoked to move a directory that is not empty then the
-     * directory is moved if it does not require moving the entries in the directory.
-     * For example, renaming a directory on the same {@link FileStore} will usually
-     * not require moving the entries in the directory. When moving a directory
-     * requires that its entries be moved then this method fails (by throwing
-     * an {@code IOException}). To move a <i>file tree</i> may involve copying
-     * rather than moving directories and this can be done using the {@link
+     * has no effect. If the file is a symbolic link then the symbolic link
+     * itself, not the target of the link, is moved. This method may be
+     * invoked to move an empty directory. In some implementations a directory
+     * has entries for special files or links that are created when the
+     * directory is created. In such implementations a directory is considered
+     * empty when only the special entries exist. When invoked to move a
+     * directory that is not empty then the directory is moved if it does not
+     * require moving the entries in the directory.  For example, renaming a
+     * directory on the same {@link FileStore} will usually not require moving
+     * the entries in the directory. When moving a directory requires that its
+     * entries be moved then this method fails (by throwing an {@code
+     * IOException}). To move a <i>file tree</i> may involve copying rather
+     * than moving directories and this can be done using the {@link
      * #copyTo copyTo} method in conjunction with the {@link
      * Files#walkFileTree Files.walkFileTree} utility method.
      *
@@ -831,8 +832,8 @@
      *   <td> {@link StandardCopyOption#REPLACE_EXISTING REPLACE_EXISTING} </td>
      *   <td> If the target file exists, then the target file is replaced if it
      *     is not a non-empty directory. If the target file exists and is a
-     *     symbolic-link then the symbolic-link is replaced and not the target of
-     *     the link. </td>
+     *     symbolic link, then the symbolic link itself, not the target of
+     *     the link, is replaced. </td>
      * </tr>
      * <tr>
      *   <td> {@link StandardCopyOption#ATOMIC_MOVE ATOMIC_MOVE} </td>
@@ -1495,7 +1496,7 @@
      *
      * <p> Where a file is registered with a watch service by means of a symbolic
      * link then it is implementation specific if the watch continues to depend
-     * on the existence of the link after it is registered.
+     * on the existence of the symbolic link after it is registered.
      *
      * @param   watcher
      *          the watch service to which this object is to be registered
--- a/jdk/src/share/classes/java/nio/file/SecureDirectoryStream.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/nio/file/SecureDirectoryStream.java	Mon Jul 06 11:42:37 2009 -0700
@@ -166,12 +166,13 @@
     /**
      * Deletes a file.
      *
-     * <p> Unlike the {@link Path#delete delete()} method, this method
-     * does not first examine the file to determine if the file is a directory.
+     * <p> Unlike the {@link Path#delete delete()} method, this method does
+     * not first examine the file to determine if the file is a directory.
      * Whether a directory is deleted by this method is system dependent and
-     * therefore not specified. If the file is a symbolic-link then the link is
-     * deleted (not the final target of the link). When the parameter is a
-     * relative path then the file to delete is relative to this open directory.
+     * therefore not specified. If the file is a symbolic link, then the link
+     * itself, not the final target of the link, is deleted. When the
+     * parameter is a relative path then the file to delete is relative to
+     * this open directory.
      *
      * @param   path
      *          the path of the file to delete
--- a/jdk/src/share/classes/java/nio/file/attribute/Attributes.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/Attributes.java	Mon Jul 06 11:42:37 2009 -0700
@@ -48,9 +48,9 @@
      * symbolic links are followed and the file attributes of the final target
      * of the link are read. If the option {@link LinkOption#NOFOLLOW_LINKS
      * NOFOLLOW_LINKS} is present then symbolic links are not followed and so
-     * the method returns the file attributes of the symbolic link. This option
-     * should be used where there is a need to determine if a file is a
-     * symbolic link:
+     * the method returns the file attributes of the symbolic link itself.
+     * This option should be used where there is a need to determine if a
+     * file is a symbolic link:
      * <pre>
      *    boolean isSymbolicLink = Attributes.readBasicFileAttributes(file, NOFOLLOW_LINKS).isSymbolicLink();
      * </pre>
@@ -98,7 +98,7 @@
      * symbolic links are followed and the file attributes of the final target
      * of the link are read. If the option {@link LinkOption#NOFOLLOW_LINKS
      * NOFOLLOW_LINKS} is present then symbolic links are not followed and so
-     * the method returns the file attributes of the symbolic link.
+     * the method returns the file attributes of the symbolic link itself.
      *
      * @param   file
      *          A file reference that locates the file
@@ -145,7 +145,7 @@
      * symbolic links are followed and the file attributes of the final target
      * of the link are read. If the option {@link LinkOption#NOFOLLOW_LINKS
      * NOFOLLOW_LINKS} is present then symbolic links are not followed and so
-     * the method returns the file attributes of the symbolic link.
+     * the method returns the file attributes of the symbolic link itself.
      *
      * @param   file
      *          A file reference that locates the file
--- a/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java	Mon Jul 06 11:42:37 2009 -0700
@@ -81,13 +81,13 @@
     boolean isDirectory();
 
     /**
-     * Tells whether the file is a symbolic-link.
+     * Tells whether the file is a symbolic link.
      */
     boolean isSymbolicLink();
 
     /**
      * Tells whether the file is something other than a regular file, directory,
-     * or link.
+     * or symbolic link.
      */
     boolean isOther();
 
--- a/jdk/src/share/classes/java/text/Bidi.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/java/text/Bidi.java	Mon Jul 06 11:42:37 2009 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,7 @@
 
 package java.text;
 
-import java.awt.Toolkit;
-import java.awt.font.TextAttribute;
-import java.awt.font.NumericShaper;
-import sun.text.CodePointIterator;
+import sun.text.bidi.BidiBase;
 
 /**
  * This class implements the Unicode Bidirectional Algorithm.
@@ -62,15 +59,6 @@
  * @since 1.4
  */
 public final class Bidi {
-    byte dir;
-    byte baselevel;
-    int length;
-    int[] runs;
-    int[] cws;
-
-    static {
-         sun.font.FontManagerNativeLibrary.load();
-    }
 
     /** Constant indicating base direction is left-to-right. */
     public static final int DIRECTION_LEFT_TO_RIGHT = 0;
@@ -94,7 +82,7 @@
      */
     public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT = -1;
 
-    private static final int DIR_MIXED = 2;
+    private BidiBase bidiBase;
 
     /**
      * Create Bidi from the given paragraph of text and base direction.
@@ -109,7 +97,7 @@
             throw new IllegalArgumentException("paragraph is null");
         }
 
-        nativeBidiChars(this, paragraph.toCharArray(), 0, null, 0, paragraph.length(), flags);
+        bidiBase = new BidiBase(paragraph.toCharArray(), 0, null, 0, paragraph.length(), flags);
     }
 
     /**
@@ -142,67 +130,8 @@
             throw new IllegalArgumentException("paragraph is null");
         }
 
-        int flags = DIRECTION_DEFAULT_LEFT_TO_RIGHT;
-        byte[] embeddings = null;
-
-        int start = paragraph.getBeginIndex();
-        int limit = paragraph.getEndIndex();
-        int length = limit - start;
-        int n = 0;
-        char[] text = new char[length];
-        for (char c = paragraph.first(); c != paragraph.DONE; c = paragraph.next()) {
-            text[n++] = c;
-        }
-
-        paragraph.first();
-        try {
-            Boolean runDirection = (Boolean)paragraph.getAttribute(TextAttribute.RUN_DIRECTION);
-            if (runDirection != null) {
-                if (TextAttribute.RUN_DIRECTION_LTR.equals(runDirection)) {
-                    flags = DIRECTION_LEFT_TO_RIGHT; // clears default setting
-                } else {
-                    flags = DIRECTION_RIGHT_TO_LEFT;
-                }
-            }
-        }
-        catch (ClassCastException e) {
-        }
-
-        try {
-            NumericShaper shaper = (NumericShaper)paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING);
-            if (shaper != null) {
-                shaper.shape(text, 0, text.length);
-            }
-        }
-        catch (ClassCastException e) {
-        }
-
-        int pos = start;
-        do {
-            paragraph.setIndex(pos);
-            Object embeddingLevel = paragraph.getAttribute(TextAttribute.BIDI_EMBEDDING);
-            int newpos = paragraph.getRunLimit(TextAttribute.BIDI_EMBEDDING);
-
-            if (embeddingLevel != null) {
-                try {
-                    int intLevel = ((Integer)embeddingLevel).intValue();
-                    if (intLevel >= -61 && intLevel < 61) {
-                        byte level = (byte)(intLevel < 0 ? (-intLevel | 0x80) : intLevel);
-                        if (embeddings == null) {
-                            embeddings = new byte[length];
-                        }
-                        for (int i = pos - start; i < newpos - start; ++i) {
-                            embeddings[i] = level;
-                        }
-                    }
-                }
-                catch (ClassCastException e) {
-                }
-            }
-            pos = newpos;
-        } while (pos < limit);
-
-        nativeBidiChars(this, text, 0, embeddings, 0, text.length, flags);
+        bidiBase = new BidiBase(0, 0);
+        bidiBase.setPara(paragraph);
     }
 
     /**
@@ -240,46 +169,7 @@
                                                " for embeddings of length: " + text.length);
         }
 
-        if (embeddings != null) {
-            // native uses high bit to indicate override, not negative value, sigh
-
-            for (int i = embStart, embLimit = embStart + paragraphLength; i < embLimit; ++i) {
-                if (embeddings[i] < 0) {
-                    byte[] temp = new byte[paragraphLength];
-                    System.arraycopy(embeddings, embStart, temp, 0, paragraphLength);
-
-                    for (i -= embStart; i < paragraphLength; ++i) {
-                        if (temp[i] < 0) {
-                            temp[i] = (byte)(-temp[i] | 0x80);
-                        }
-                    }
-
-                    embeddings = temp;
-                    embStart = 0;
-                    break;
-                }
-            }
-        }
-
-        nativeBidiChars(this, text, textStart, embeddings, embStart, paragraphLength, flags);
-    }
-
-    /**
-     * Private constructor used by line bidi.
-     */
-    private Bidi(int dir, int baseLevel, int length, int[] data, int[] cws) {
-        reset(dir, baseLevel, length, data, cws);
-    }
-
-    /**
-     * Private mutator used by native code.
-     */
-    private void reset(int dir, int baselevel, int length, int[] data, int[] cws) {
-        this.dir = (byte)dir;
-        this.baselevel = (byte)baselevel;
-        this.length = length;
-        this.runs = data;
-        this.cws = cws;
+        bidiBase = new BidiBase(text, textStart, embeddings, embStart, paragraphLength, flags);
     }
 
     /**
@@ -290,96 +180,10 @@
      * @param lineLimit the offset from the start of the paragraph to the limit of the line.
      */
     public Bidi createLineBidi(int lineStart, int lineLimit) {
-        if (lineStart == 0 && lineLimit == length) {
-            return this;
-        }
-
-        int lineLength = lineLimit - lineStart;
-        if (lineStart < 0 ||
-            lineLimit < lineStart ||
-            lineLimit > length) {
-            throw new IllegalArgumentException("range " + lineStart +
-                                               " to " + lineLimit +
-                                               " is invalid for paragraph of length " + length);
-        }
-
-        if (runs == null) {
-            return new Bidi(dir, baselevel, lineLength, null, null);
-        } else {
-            int cwspos = -1;
-            int[] ncws = null;
-            if (cws != null) {
-                int cwss = 0;
-                int cwsl = cws.length;
-                while (cwss < cwsl) {
-                    if (cws[cwss] >= lineStart) {
-                        cwsl = cwss;
-                        while (cwsl < cws.length && cws[cwsl] < lineLimit) {
-                            cwsl++;
-                        }
-                        int ll = lineLimit-1;
-                        while (cwsl > cwss && cws[cwsl-1] == ll) {
-                            cwspos = ll; // record start of counter-directional whitespace
-                            --cwsl;
-                            --ll;
-                        }
-
-                        if (cwspos == lineStart) { // entire line is cws, so ignore
-                            return new Bidi(dir, baselevel, lineLength, null, null);
-                        }
+        AttributedString astr = new AttributedString("");
+        Bidi newBidi = new Bidi(astr.getIterator());
 
-                        int ncwslen = cwsl - cwss;
-                        if (ncwslen > 0) {
-                            ncws = new int[ncwslen];
-                            for (int i = 0; i < ncwslen; ++i) {
-                                ncws[i] = cws[cwss+i] - lineStart;
-                            }
-                        }
-                        break;
-                    }
-                    ++cwss;
-                }
-            }
-
-            int[] nruns = null;
-            int nlevel = baselevel;
-            int limit = cwspos == -1 ? lineLimit : cwspos;
-            int rs = 0;
-            int rl = runs.length;
-            int ndir = dir;
-            for (; rs < runs.length; rs += 2) {
-                if (runs[rs] > lineStart) {
-                    rl = rs;
-                    while (rl < runs.length && runs[rl] < limit) {
-                        rl += 2;
-                    }
-                    if ((rl > rs) || (runs[rs+1] != baselevel)) {
-                        rl += 2;
-
-                        if (cwspos != -1 && rl > rs && runs[rl-1] != baselevel) { // add level for cws
-                            nruns = new int[rl - rs + 2];
-                            nruns[rl - rs] = lineLength;
-                            nruns[rl - rs + 1] = baselevel;
-                        } else {
-                            limit = lineLimit;
-                            nruns = new int[rl - rs];
-                        }
-
-                        int n = 0;
-                        for (int i = rs; i < rl; i += 2) {
-                            nruns[n++] = runs[i] - lineStart;
-                            nruns[n++] = runs[i+1];
-                        }
-                        nruns[n-2] = limit - lineStart;
-                    } else {
-                        ndir = (runs[rs+1] & 0x1) == 0 ? DIRECTION_LEFT_TO_RIGHT : DIRECTION_RIGHT_TO_LEFT;
-                    }
-                    break;
-                }
-            }
-
-            return new Bidi(ndir, baselevel, lineLength, nruns, ncws);
-        }
+        return bidiBase.setLine(this, bidiBase, newBidi, newBidi.bidiBase,lineStart, lineLimit);
     }
 
     /**
@@ -388,7 +192,7 @@
      * @return true if the line is not left-to-right or right-to-left.
      */
     public boolean isMixed() {
-        return dir == DIR_MIXED;
+        return bidiBase.isMixed();
     }
 
     /**
@@ -396,7 +200,7 @@
      * @return true if the line is all left-to-right text and the base direction is left-to-right
      */
     public boolean isLeftToRight() {
-        return dir == DIRECTION_LEFT_TO_RIGHT;
+        return bidiBase.isLeftToRight();
     }
 
     /**
@@ -404,7 +208,7 @@
      * @return true if the line is all right-to-left text, and the base direction is right-to-left
      */
     public boolean isRightToLeft() {
-        return dir == DIRECTION_RIGHT_TO_LEFT;
+        return bidiBase.isRightToLeft();
     }
 
     /**
@@ -412,7 +216,7 @@
      * @return the length of text in the line
      */
     public int getLength() {
-        return length;
+        return bidiBase.getLength();
     }
 
     /**
@@ -420,7 +224,7 @@
      * @return true if the base direction is left-to-right
      */
     public boolean baseIsLeftToRight() {
-        return (baselevel & 0x1) == 0;
+        return bidiBase.baseIsLeftToRight();
     }
 
     /**
@@ -428,7 +232,7 @@
      * @return the base level
      */
     public int getBaseLevel() {
-      return baselevel;
+        return bidiBase.getParaLevel();
     }
 
     /**
@@ -438,17 +242,7 @@
      * @return the resolved level of the character at offset
      */
     public int getLevelAt(int offset) {
-        if (runs == null || offset < 0 || offset >= length) {
-            return baselevel;
-        } else {
-            int i = 0;
-            do {
-                if (offset < runs[i]) {
-                    return runs[i+1];
-                }
-                i += 2;
-            } while (true);
-        }
+        return bidiBase.getLevelAt(offset);
     }
 
     /**
@@ -456,7 +250,7 @@
      * @return the number of level runs
      */
     public int getRunCount() {
-        return runs == null ? 1 : runs.length / 2;
+        return bidiBase.countRuns();
     }
 
     /**
@@ -465,7 +259,7 @@
      * @return the level of the run
      */
     public int getRunLevel(int run) {
-        return runs == null ? baselevel : runs[run * 2 + 1];
+        return bidiBase.getRunLevel(run);
     }
 
     /**
@@ -475,7 +269,7 @@
      * @return the start of the run
      */
     public int getRunStart(int run) {
-        return (runs == null || run == 0) ? 0 : runs[run * 2 - 2];
+        return bidiBase.getRunStart(run);
     }
 
     /**
@@ -486,7 +280,7 @@
      * @return limit the limit of the run
      */
     public int getRunLimit(int run) {
-        return runs == null ? length : runs[run * 2];
+        return bidiBase.getRunLimit(run);
     }
 
     /**
@@ -501,16 +295,7 @@
      * @return true if the range of characters requires bidi analysis
      */
     public static boolean requiresBidi(char[] text, int start, int limit) {
-        CodePointIterator cpi = CodePointIterator.create(text, start, limit);
-        for (int cp = cpi.next(); cp != CodePointIterator.DONE; cp = cpi.next()) {
-            if (cp > 0x0590) {
-                int dc = nativeGetDirectionCode(cp);
-                if ((RMASK & (1 << dc)) != 0) {
-                    return true;
-                }
-            }
-        }
-        return false;
+        return BidiBase.requiresBidi(text, start, limit);
     }
 
     /**
@@ -530,124 +315,14 @@
      * @param count the number of objects to reorder
      */
     public static void reorderVisually(byte[] levels, int levelStart, Object[] objects, int objectStart, int count) {
-
-        if (count < 0) {
-            throw new IllegalArgumentException("count " + count + " must be >= 0");
-        }
-        if (levelStart < 0 || levelStart + count > levels.length) {
-            throw new IllegalArgumentException("levelStart " + levelStart + " and count " + count +
-                                               " out of range [0, " + levels.length + "]");
-        }
-        if (objectStart < 0 || objectStart + count > objects.length) {
-            throw new IllegalArgumentException("objectStart " + objectStart + " and count " + count +
-                                               " out of range [0, " + objects.length + "]");
-        }
-
-        byte lowestOddLevel = (byte)(NUMLEVELS + 1);
-        byte highestLevel = 0;
-
-        // initialize mapping and levels
-
-        int levelLimit = levelStart + count;
-        for (int i = levelStart; i < levelLimit; i++) {
-            byte level = levels[i];
-            if (level > highestLevel) {
-                highestLevel = level;
-            }
-
-            if ((level & 0x01) != 0 && level < lowestOddLevel) {
-                lowestOddLevel = level;
-            }
-        }
-
-        int delta = objectStart - levelStart;
-
-        while (highestLevel >= lowestOddLevel) {
-            int i = levelStart;
-
-            for (;;) {
-                while (i < levelLimit && levels[i] < highestLevel) {
-                    i++;
-                }
-                int begin = i++;
-
-                if (begin == levelLimit) {
-                    break; // no more runs at this level
-                }
-
-                while (i < levelLimit && levels[i] >= highestLevel) {
-                    i++;
-                }
-                int end = i - 1;
-
-                begin += delta;
-                end += delta;
-                while (begin < end) {
-                    Object temp = objects[begin];
-                    objects[begin] = objects[end];
-                    objects[end] = temp;
-                    ++begin;
-                    --end;
-                }
-            }
-
-            --highestLevel;
-        }
+        BidiBase.reorderVisually(levels, levelStart, objects, objectStart, count);
     }
 
-    private static final char NUMLEVELS = 62;
-
-    private static final int RMASK =
-        (1 << 1 /* U_RIGHT_TO_LEFT */) |
-        (1 << 5 /* U_ARABIC_NUMBER */) |
-        (1 << 13 /* U_RIGHT_TO_LEFT_ARABIC */) |
-        (1 << 14 /* U_RIGHT_TO_LEFT_EMBEDDING */) |
-        (1 << 15 /* U_RIGHT_TO_LEFT_OVERRIDE */);
-
-    /** Access native bidi implementation. */
-    private static native int nativeGetDirectionCode(int cp);
-
-    /** Access native bidi implementation. */
-    private static synchronized native void nativeBidiChars(Bidi bidi, char[] text, int textStart,
-                                                            byte[] embeddings, int embeddingStart,
-                                                            int length, int flags);
-
     /**
      * Display the bidi internal state, used in debugging.
      */
     public String toString() {
-        StringBuffer buf = new StringBuffer(super.toString());
-        buf.append("[dir: " + dir);
-        buf.append(" baselevel: " + baselevel);
-        buf.append(" length: " + length);
-        if (runs == null) {
-            buf.append(" runs: null");
-        } else {
-            buf.append(" runs: [");
-            for (int i = 0; i < runs.length; i += 2) {
-                if (i != 0) {
-                    buf.append(' ');
-                }
-                buf.append(runs[i]); // limit
-                buf.append('/');
-                buf.append(runs[i+1]); // level
-            }
-            buf.append(']');
-        }
-        if (cws == null) {
-            buf.append(" cws: null");
-        } else {
-            buf.append(" cws: [");
-            for (int i = 0; i < cws.length; ++i) {
-                if (i != 0) {
-                    buf.append(' ');
-                }
-                buf.append(Integer.toHexString(cws[i]));
-            }
-            buf.append(']');
-        }
-        buf.append(']');
+        return bidiBase.toString();
+    }
 
-        return buf.toString();
-    }
 }
--- a/jdk/src/share/classes/javax/imageio/ImageIO.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/javax/imageio/ImageIO.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,6 +28,7 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.RenderedImage;
 import java.io.File;
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -195,13 +196,22 @@
                     } else {
                         cachepath = getTempDir();
 
-                        if (cachepath == null) {
+                        if (cachepath == null || cachepath.isEmpty()) {
                             getCacheInfo().setHasPermission(Boolean.FALSE);
                             return false;
                         }
                     }
 
-                    security.checkWrite(cachepath);
+                    // we have to check whether we can read, write,
+                    // and delete cache files.
+                    // So, compose cache file path and check it.
+                    String filepath = cachepath;
+                    if (!filepath.endsWith(File.separator)) {
+                        filepath += File.separator;
+                    }
+                    filepath += "*";
+
+                    security.checkPermission(new FilePermission(filepath, "read, write, delete"));
                 }
             } catch (SecurityException e) {
                 getCacheInfo().setHasPermission(Boolean.FALSE);
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java	Mon Jul 06 11:42:37 2009 -0700
@@ -160,6 +160,13 @@
     private boolean supportsJA;
     private boolean supportsCJK;
 
+    /* These are for faster access to the name of the font as
+     * typically exposed via API to applications.
+     */
+    private Locale nameLocale;
+    private String localeFamilyName;
+    private String localeFullName;
+
     /**
      * - does basic verification of the file
      * - reads the header table for this font (within a collection)
@@ -1092,6 +1099,10 @@
              * greater than 32767, so read and store those as ints
              */
             int stringPtr = sbuffer.get() & 0xffff;
+
+            nameLocale = sun.awt.SunToolkit.getStartupLocale();
+            short nameLocaleID = FontManager.getLCIDFromLocale(nameLocale);
+
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
                 if (platformID != MS_PLATFORM_ID) {
@@ -1103,15 +1114,24 @@
                 short nameID     = sbuffer.get();
                 int nameLen    = ((int) sbuffer.get()) & 0xffff;
                 int namePtr    = (((int) sbuffer.get()) & 0xffff) + stringPtr;
-
+                String tmpName = null;
                 switch (nameID) {
 
                 case FAMILY_NAME_ID:
 
-                    if (familyName == null || langID == ENGLISH_LOCALE_ID) {
+                    if (familyName == null || langID == ENGLISH_LOCALE_ID ||
+                        langID == nameLocaleID)
+                    {
                         buffer.position(namePtr);
                         buffer.get(name, 0, nameLen);
-                        familyName = makeString(name, nameLen, encodingID);
+                        tmpName = makeString(name, nameLen, encodingID);
+
+                        if (familyName == null || langID == ENGLISH_LOCALE_ID){
+                            familyName = tmpName;
+                        }
+                        if (langID == nameLocaleID) {
+                            localeFamilyName = tmpName;
+                        }
                     }
 /*
                     for (int ii=0;ii<nameLen;ii++) {
@@ -1129,15 +1149,29 @@
 
                 case FULL_NAME_ID:
 
-                    if (fullName == null || langID == ENGLISH_LOCALE_ID) {
+                    if (fullName == null || langID == ENGLISH_LOCALE_ID ||
+                        langID == nameLocaleID)
+                    {
                         buffer.position(namePtr);
                         buffer.get(name, 0, nameLen);
-                        fullName = makeString(name, nameLen, encodingID);
+                        tmpName = makeString(name, nameLen, encodingID);
+
+                        if (fullName == null || langID == ENGLISH_LOCALE_ID) {
+                            fullName = tmpName;
+                        }
+                        if (langID == nameLocaleID) {
+                            localeFullName = tmpName;
+                        }
                     }
                     break;
-
                 }
             }
+            if (localeFamilyName == null) {
+                localeFamilyName = familyName;
+            }
+            if (localeFullName == null) {
+                localeFullName = fullName;
+            }
         }
     }
 
@@ -1220,6 +1254,8 @@
     public String getFontName(Locale locale) {
         if (locale == null) {
             return fullName;
+        } else if (locale.equals(nameLocale) && localeFullName != null) {
+            return localeFullName;
         } else {
             short localeID = FontManager.getLCIDFromLocale(locale);
             String name = lookupName(localeID, FULL_NAME_ID);
@@ -1234,11 +1270,13 @@
     public String getFamilyName(Locale locale) {
         if (locale == null) {
             return familyName;
+        } else if (locale.equals(nameLocale) && localeFamilyName != null) {
+            return localeFamilyName;
         } else {
             short localeID = FontManager.getLCIDFromLocale(locale);
             String name = lookupName(localeID, FAMILY_NAME_ID);
             if (name == null) {
-                return familyName;
+               return familyName;
             } else {
                 return name;
             }
--- a/jdk/src/share/classes/sun/java2d/pisces/PiscesCache.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/PiscesCache.java	Mon Jul 06 11:42:37 2009 -0700
@@ -96,7 +96,7 @@
             bboxX1 = x1+1;
         } else {
             if (bboxX0 > x0) bboxX0 = x0;
-            if (bboxX1 < x1) bboxX1 = x1;
+            if (bboxX1 < x1 + 1) bboxX1 = x1 + 1;
             while (bboxY1++ < y) {
                 reallocRowInfo(alphaRows+1);
                 minTouched[alphaRows] = 0;
--- a/jdk/src/share/classes/sun/net/www/http/HttpCapture.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/net/www/http/HttpCapture.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,6 +25,8 @@
 
 package sun.net.www.http;
 import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -60,6 +62,76 @@
     private static boolean initialized = false;
     private static volatile ArrayList<Pattern> patterns = null;
     private static volatile ArrayList<String> capFiles = null;
+    /* Logging is done in an ugly way so that it does not require the presence
+     * the java.util.logging package. If the Logger class is not available, then
+     * logging is turned off. This is for helping the modularization effort.
+     */
+    private static Object logger = null;
+    private static boolean logging = false;
+
+    static {
+        Class cl;
+        try {
+            cl = Class.forName("java.util.logging.Logger");
+        } catch (ClassNotFoundException ex) {
+            cl = null;
+        }
+        if (cl != null) {
+            try {
+                Method m = cl.getMethod("getLogger", String.class);
+                logger = m.invoke(null, "sun.net.www.protocol.http.HttpURLConnection");
+                logging = true;
+            } catch (NoSuchMethodException noSuchMethodException) {
+            } catch (SecurityException securityException) {
+            } catch (IllegalAccessException illegalAccessException) {
+            } catch (IllegalArgumentException illegalArgumentException) {
+            } catch (InvocationTargetException invocationTargetException) {
+            }
+        }
+    }
+
+    public static void fine(String s) {
+        if (logging) {
+            ((Logger)logger).fine(s);
+        }
+    }
+
+    public static void finer(String s) {
+        if (logging) {
+            ((Logger)logger).finer(s);
+        }
+    }
+
+    public static void finest(String s) {
+        if (logging) {
+            ((Logger)logger).finest(s);
+        }
+    }
+
+    public static void severe(String s) {
+        if (logging) {
+            ((Logger)logger).finest(s);
+        }
+    }
+
+    public static void info(String s) {
+        if (logging) {
+            ((Logger)logger).info(s);
+        }
+    }
+
+    public static void warning(String s) {
+        if (logging) {
+            ((Logger)logger).warning(s);
+        }
+    }
+
+    public static boolean isLoggable(String level) {
+        if (!logging) {
+            return false;
+        }
+        return ((Logger)logger).isLoggable(Level.parse(level));
+    }
 
     private static synchronized void init() {
         initialized = true;
--- a/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,8 +28,6 @@
 import java.io.*;
 import java.net.*;
 import java.util.Locale;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import sun.net.NetworkClient;
 import sun.net.ProgressSource;
 import sun.net.www.MessageHeader;
@@ -66,10 +64,6 @@
     /** Default port number for http daemons. REMIND: make these private */
     static final int    httpPortNumber = 80;
 
-    // Use same logger as HttpURLConnection since we want to combine both event
-    // streams into one single HTTP log
-    private static Logger logger = Logger.getLogger("sun.net.www.protocol.http.HttpURLConnection");
-
     /** return default port number (subclasses may override) */
     protected int getDefaultPort () { return httpPortNumber; }
 
@@ -810,8 +804,8 @@
 
             if (isKeepingAlive())   {
                 // Wrap KeepAliveStream if keep alive is enabled.
-                if (logger.isLoggable(Level.FINEST)) {
-                    logger.finest("KeepAlive stream used: " + url);
+                if (HttpCapture.isLoggable("FINEST")) {
+                    HttpCapture.finest("KeepAlive stream used: " + url);
                 }
                 serverInput = new KeepAliveStream(serverInput, pi, cl, this);
                 failedOnce = false;
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpLogFormatter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpLogFormatter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -49,8 +49,7 @@
 
     @Override
     public String format(LogRecord record) {
-        if (!"sun.net.www.protocol.http.HttpURLConnection".equalsIgnoreCase(record.getSourceClassName())
-                && !"sun.net.www.http.HttpClient".equalsIgnoreCase(record.getSourceClassName())) {
+        if (!"sun.net.www.http.HttpCapture".equalsIgnoreCase(record.getSourceClassName())) {
             // Don't change format for stuff that doesn't concern us
             return super.format(record);
         }
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Mon Jul 06 11:42:37 2009 -0700
@@ -51,14 +51,13 @@
 import java.util.Locale;
 import java.util.StringTokenizer;
 import java.util.Iterator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import sun.net.*;
 import sun.net.www.*;
 import sun.net.www.http.HttpClient;
 import sun.net.www.http.PosterOutputStream;
 import sun.net.www.http.ChunkedInputStream;
 import sun.net.www.http.ChunkedOutputStream;
+import sun.net.www.http.HttpCapture;
 import java.text.SimpleDateFormat;
 import java.util.TimeZone;
 import java.net.MalformedURLException;
@@ -71,8 +70,6 @@
 
 public class HttpURLConnection extends java.net.HttpURLConnection {
 
-    private static Logger logger = Logger.getLogger("sun.net.www.protocol.http.HttpURLConnection");
-
     static String HTTP_CONNECT = "CONNECT";
 
     static final String version;
@@ -304,14 +301,14 @@
         return java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction<PasswordAuthentication>() {
                 public PasswordAuthentication run() {
-                    if (logger.isLoggable(Level.FINEST)) {
-                        logger.finest("Requesting Authentication: host =" + host + " url = " + url);
+                    if (HttpCapture.isLoggable("FINEST")) {
+                        HttpCapture.finest("Requesting Authentication: host =" + host + " url = " + url);
                     }
                     PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                         host, addr, port, protocol,
                         prompt, scheme, url, authType);
-                    if (pass != null && logger.isLoggable(Level.FINEST)) {
-                        logger.finest("Authentication returned: " + pass.toString());
+                    if (HttpCapture.isLoggable("FINEST")) {
+                        HttpCapture.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                     }
                     return pass;
                 }
@@ -466,8 +463,8 @@
 
             setRequests=true;
         }
-        if (logger.isLoggable(Level.FINE)) {
-            logger.fine(requests.toString());
+        if (HttpCapture.isLoggable("FINE")) {
+            HttpCapture.fine(requests.toString());
         }
         http.writeRequests(requests, poster);
         if (ps.checkError()) {
@@ -731,11 +728,9 @@
                         && !(cachedResponse instanceof SecureCacheResponse)) {
                         cachedResponse = null;
                     }
-                    if (logger.isLoggable(Level.FINEST)) {
-                        logger.finest("Cache Request for " + uri + " / " + getRequestMethod());
-                        if (cachedResponse != null) {
-                            logger.finest("From cache: "+cachedResponse.toString());
-                        }
+                    if (HttpCapture.isLoggable("FINEST")) {
+                        HttpCapture.finest("Cache Request for " + uri + " / " + getRequestMethod());
+                        HttpCapture.finest("From cache: " + (cachedResponse != null ? cachedResponse.toString() : "null"));
                     }
                     if (cachedResponse != null) {
                         cachedHeaders = mapToMessageHeader(cachedResponse.getHeaders());
@@ -774,8 +769,8 @@
                              });
                 if (sel != null) {
                     URI uri = sun.net.www.ParseUtil.toURI(url);
-                    if (logger.isLoggable(Level.FINEST)) {
-                        logger.finest("ProxySelector Request for " + uri);
+                    if (HttpCapture.isLoggable("FINEST")) {
+                        HttpCapture.finest("ProxySelector Request for " + uri);
                     }
                     Iterator<Proxy> it = sel.select(uri).iterator();
                     Proxy p;
@@ -791,9 +786,9 @@
                                 http = getNewHttpClient(url, p, connectTimeout, false);
                                 http.setReadTimeout(readTimeout);
                             }
-                            if (logger.isLoggable(Level.FINEST)) {
+                            if (HttpCapture.isLoggable("FINEST")) {
                                 if (p != null) {
-                                    logger.finest("Proxy used: " + p.toString());
+                                    HttpCapture.finest("Proxy used: " + p.toString());
                                 }
                             }
                             break;
@@ -1023,15 +1018,15 @@
 
             URI uri = ParseUtil.toURI(url);
             if (uri != null) {
-                if (logger.isLoggable(Level.FINEST)) {
-                    logger.finest("CookieHandler request for " + uri);
+                if (HttpCapture.isLoggable("FINEST")) {
+                    HttpCapture.finest("CookieHandler request for " + uri);
                 }
                 Map<String, List<String>> cookies
                     = cookieHandler.get(
                         uri, requests.getHeaders(EXCLUDE_HEADERS));
                 if (!cookies.isEmpty()) {
-                    if (logger.isLoggable(Level.FINEST)) {
-                        logger.finest("Cookies retrieved: " + cookies.toString());
+                    if (HttpCapture.isLoggable("FINEST")) {
+                        HttpCapture.finest("Cookies retrieved: " + cookies.toString());
                     }
                     for (Map.Entry<String, List<String>> entry :
                              cookies.entrySet()) {
@@ -1162,8 +1157,8 @@
                     writeRequests();
                 }
                 http.parseHTTP(responses, pi, this);
-                if (logger.isLoggable(Level.FINE)) {
-                    logger.fine(responses.toString());
+                if (HttpCapture.isLoggable("FINE")) {
+                    HttpCapture.fine(responses.toString());
                 }
                 inputStream = http.getInputStream();
 
@@ -1607,8 +1602,8 @@
                 http.parseHTTP(responses, null, this);
 
                 /* Log the response to the CONNECT */
-                if (logger.isLoggable(Level.FINE)) {
-                    logger.fine(responses.toString());
+                if (HttpCapture.isLoggable("FINE")) {
+                    HttpCapture.fine(responses.toString());
                 }
 
                 statusLine = responses.getValue(0);
@@ -1735,8 +1730,8 @@
         setPreemptiveProxyAuthentication(requests);
 
          /* Log the CONNECT request */
-        if (logger.isLoggable(Level.FINE)) {
-            logger.fine(requests.toString());
+        if (HttpCapture.isLoggable("FINE")) {
+            HttpCapture.fine(requests.toString());
         }
 
         http.writeRequests(requests, null);
@@ -1880,8 +1875,8 @@
                 }
             }
         }
-        if (logger.isLoggable(Level.FINER)) {
-            logger.finer("Proxy Authentication for " + authhdr.toString() +" returned " + ret.toString());
+        if (HttpCapture.isLoggable("FINER")) {
+            HttpCapture.finer("Proxy Authentication for " + authhdr.toString() +" returned " + (ret != null ? ret.toString() : "null"));
         }
         return ret;
     }
@@ -2010,8 +2005,8 @@
                 }
             }
         }
-        if (logger.isLoggable(Level.FINER)) {
-            logger.finer("Server Authentication for " + authhdr.toString() +" returned " + ret.toString());
+        if (HttpCapture.isLoggable("FINER")) {
+            HttpCapture.finer("Server Authentication for " + authhdr.toString() +" returned " + (ret != null ? ret.toString() : "null"));
         }
         return ret;
     }
@@ -2086,8 +2081,8 @@
         if (streaming()) {
             throw new HttpRetryException (RETRY_MSG3, stat, loc);
         }
-        if (logger.isLoggable(Level.FINE)) {
-            logger.fine("Redirected from " + url + " to " + locUrl);
+        if (HttpCapture.isLoggable("FINE")) {
+            HttpCapture.fine("Redirected from " + url + " to " + locUrl);
         }
 
         // clear out old response headers!!!!
--- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java	Mon Jul 06 11:42:37 2009 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -351,18 +351,27 @@
             }
             in = con.getInputStream();
 
+            byte[] response = null;
+            int total = 0;
             int contentLength = con.getContentLength();
-            if (contentLength == -1) {
+            if (contentLength != -1) {
+                response = new byte[contentLength];
+            } else {
+                response = new byte[2048];
                 contentLength = Integer.MAX_VALUE;
             }
 
-            byte[] response = new byte[contentLength];
-            int total = 0;
-            int count = 0;
-            while (count != -1 && total < contentLength) {
-                count = in.read(response, total, response.length - total);
+            while (total < contentLength) {
+                int count = in.read(response, total, response.length - total);
+                if (count < 0)
+                    break;
+
                 total += count;
+                if (total >= response.length && total < contentLength) {
+                    response = Arrays.copyOf(response, total * 2);
+                }
             }
+            response = Arrays.copyOf(response, total);
 
             OCSPResponse ocspResponse = new OCSPResponse(response, pkixParams,
                 responderCert);
--- a/jdk/src/share/classes/sun/security/timestamp/HttpTimestamper.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/security/timestamp/HttpTimestamper.java	Mon Jul 06 11:42:37 2009 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 import java.net.HttpURLConnection;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.Arrays;
 
 import sun.security.pkcs.*;
 
@@ -137,23 +138,33 @@
                 }
                 System.out.println();
             }
-            int contentLength = connection.getContentLength();
-            if (contentLength == -1) {
-                contentLength = Integer.MAX_VALUE;
-            }
             verifyMimeType(connection.getContentType());
 
-            replyBuffer = new byte[contentLength];
             int total = 0;
-            int count = 0;
-            while (count != -1 && total < contentLength) {
-                count = input.read(replyBuffer, total,
+            int contentLength = connection.getContentLength();
+            if (contentLength != -1) {
+                replyBuffer = new byte[contentLength];
+            } else {
+                replyBuffer = new byte[2048];
+                contentLength = Integer.MAX_VALUE;
+            }
+
+            while (total < contentLength) {
+                int count = input.read(replyBuffer, total,
                                         replyBuffer.length - total);
+                if (count < 0)
+                    break;
+
                 total += count;
+                if (total >= replyBuffer.length && total < contentLength) {
+                    replyBuffer = Arrays.copyOf(replyBuffer, total * 2);
+                }
             }
+            replyBuffer = Arrays.copyOf(replyBuffer, total);
+
             if (DEBUG) {
                 System.out.println("received timestamp response (length=" +
-                        replyBuffer.length + ")");
+                        total + ")");
             }
         } finally {
             if (input != null) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,3444 @@
+/*
+ * Portions Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+/*
+ *******************************************************************************
+ * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved         *
+ *                                                                             *
+ * The original version of this source code and documentation is copyrighted   *
+ * and owned by IBM, These materials are provided under terms of a License     *
+ * Agreement between IBM and Sun. This technology is protected by multiple     *
+ * US and International patents. This notice and attribution to IBM may not    *
+ * to removed.                                                                 *
+ *******************************************************************************
+ */
+
+/* FOOD FOR THOUGHT: currently the reordering modes are a mixture of
+ * algorithm for direct BiDi, algorithm for inverse Bidi and the bizarre
+ * concept of RUNS_ONLY which is a double operation.
+ * It could be advantageous to divide this into 3 concepts:
+ * a) Operation: direct / inverse / RUNS_ONLY
+ * b) Direct algorithm: default / NUMBERS_SPECIAL / GROUP_NUMBERS_WITH_L
+ * c) Inverse algorithm: default / INVERSE_LIKE_DIRECT / NUMBERS_SPECIAL
+ * This would allow combinations not possible today like RUNS_ONLY with
+ * NUMBERS_SPECIAL.
+ * Also allow to set INSERT_MARKS for the direct step of RUNS_ONLY and
+ * REMOVE_CONTROLS for the inverse step.
+ * Not all combinations would be supported, and probably not all do make sense.
+ * This would need to document which ones are supported and what are the
+ * fallbacks for unsupported combinations.
+ */
+
+package sun.text.bidi;
+
+import java.awt.font.TextAttribute;
+import java.awt.font.NumericShaper;
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.text.AttributedCharacterIterator;
+import java.text.Bidi;
+import java.util.Arrays;
+import java.util.MissingResourceException;
+import sun.text.normalizer.UBiDiProps;
+import sun.text.normalizer.UCharacter;
+import sun.text.normalizer.UTF16;
+
+/**
+ *
+ * <h2>Bidi algorithm for ICU</h2>
+ *
+ * This is an implementation of the Unicode Bidirectional algorithm. The
+ * algorithm is defined in the <a
+ * href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,
+ * version 13, also described in The Unicode Standard, Version 4.0 .
+ * <p>
+ *
+ * Note: Libraries that perform a bidirectional algorithm and reorder strings
+ * accordingly are sometimes called "Storage Layout Engines". ICU's Bidi and
+ * shaping (ArabicShaping) classes can be used at the core of such "Storage
+ * Layout Engines".
+ *
+ * <h3>General remarks about the API:</h3>
+ *
+ * The &quot;limit&quot; of a sequence of characters is the position just after
+ * their last character, i.e., one more than that position.
+ * <p>
+ *
+ * Some of the API methods provide access to &quot;runs&quot;. Such a
+ * &quot;run&quot; is defined as a sequence of characters that are at the same
+ * embedding level after performing the Bidi algorithm.
+ * <p>
+ *
+ * <h3>Basic concept: paragraph</h3>
+ * A piece of text can be divided into several paragraphs by characters
+ * with the Bidi class <code>Block Separator</code>. For handling of
+ * paragraphs, see:
+ * <ul>
+ * <li>{@link #countParagraphs}
+ * <li>{@link #getParaLevel}
+ * <li>{@link #getParagraph}
+ * <li>{@link #getParagraphByIndex}
+ * </ul>
+ *
+ * <h3>Basic concept: text direction</h3>
+ * The direction of a piece of text may be:
+ * <ul>
+ * <li>{@link #LTR}
+ * <li>{@link #RTL}
+ * <li>{@link #MIXED}
+ * </ul>
+ *
+ * <h3>Basic concept: levels</h3>
+ *
+ * Levels in this API represent embedding levels according to the Unicode
+ * Bidirectional Algorithm.
+ * Their low-order bit (even/odd value) indicates the visual direction.<p>
+ *
+ * Levels can be abstract values when used for the
+ * <code>paraLevel</code> and <code>embeddingLevels</code>
+ * arguments of <code>setPara()</code>; there:
+ * <ul>
+ * <li>the high-order bit of an <code>embeddingLevels[]</code>
+ * value indicates whether the using application is
+ * specifying the level of a character to <i>override</i> whatever the
+ * Bidi implementation would resolve it to.</li>
+ * <li><code>paraLevel</code> can be set to the
+ * pseudo-level values <code>LEVEL_DEFAULT_LTR</code>
+ * and <code>LEVEL_DEFAULT_RTL</code>.</li>
+ * </ul>
+ *
+ * <p>The related constants are not real, valid level values.
+ * <code>DEFAULT_XXX</code> can be used to specify
+ * a default for the paragraph level for
+ * when the <code>setPara()</code> method
+ * shall determine it but there is no
+ * strongly typed character in the input.<p>
+ *
+ * Note that the value for <code>LEVEL_DEFAULT_LTR</code> is even
+ * and the one for <code>LEVEL_DEFAULT_RTL</code> is odd,
+ * just like with normal LTR and RTL level values -
+ * these special values are designed that way. Also, the implementation
+ * assumes that MAX_EXPLICIT_LEVEL is odd.
+ *
+ * <ul><b>See Also:</b>
+ * <li>{@link #LEVEL_DEFAULT_LTR}
+ * <li>{@link #LEVEL_DEFAULT_RTL}
+ * <li>{@link #LEVEL_OVERRIDE}
+ * <li>{@link #MAX_EXPLICIT_LEVEL}
+ * <li>{@link #setPara}
+ * </ul>
+ *
+ * <h3>Basic concept: Reordering Mode</h3>
+ * Reordering mode values indicate which variant of the Bidi algorithm to
+ * use.
+ *
+ * <ul><b>See Also:</b>
+ * <li>{@link #setReorderingMode}
+ * <li>{@link #REORDER_DEFAULT}
+ * <li>{@link #REORDER_NUMBERS_SPECIAL}
+ * <li>{@link #REORDER_GROUP_NUMBERS_WITH_R}
+ * <li>{@link #REORDER_RUNS_ONLY}
+ * <li>{@link #REORDER_INVERSE_NUMBERS_AS_L}
+ * <li>{@link #REORDER_INVERSE_LIKE_DIRECT}
+ * <li>{@link #REORDER_INVERSE_FOR_NUMBERS_SPECIAL}
+ * </ul>
+ *
+ * <h3>Basic concept: Reordering Options</h3>
+ * Reordering options can be applied during Bidi text transformations.
+ * <ul><b>See Also:</b>
+ * <li>{@link #setReorderingOptions}
+ * <li>{@link #OPTION_DEFAULT}
+ * <li>{@link #OPTION_INSERT_MARKS}
+ * <li>{@link #OPTION_REMOVE_CONTROLS}
+ * <li>{@link #OPTION_STREAMING}
+ * </ul>
+ *
+ *
+ * @author Simon Montagu, Matitiahu Allouche (ported from C code written by Markus W. Scherer)
+ * @stable ICU 3.8
+ *
+ *
+ * <h4> Sample code for the ICU Bidi API </h4>
+ *
+ * <h5>Rendering a paragraph with the ICU Bidi API</h5>
+ *
+ * This is (hypothetical) sample code that illustrates how the ICU Bidi API
+ * could be used to render a paragraph of text. Rendering code depends highly on
+ * the graphics system, therefore this sample code must make a lot of
+ * assumptions, which may or may not match any existing graphics system's
+ * properties.
+ *
+ * <p>
+ * The basic assumptions are:
+ * </p>
+ * <ul>
+ * <li>Rendering is done from left to right on a horizontal line.</li>
+ * <li>A run of single-style, unidirectional text can be rendered at once.
+ * </li>
+ * <li>Such a run of text is passed to the graphics system with characters
+ * (code units) in logical order.</li>
+ * <li>The line-breaking algorithm is very complicated and Locale-dependent -
+ * and therefore its implementation omitted from this sample code.</li>
+ * </ul>
+ *
+ * <pre>
+ *
+ *  package com.ibm.icu.dev.test.bidi;
+ *
+ *  import com.ibm.icu.text.Bidi;
+ *  import com.ibm.icu.text.BidiRun;
+ *
+ *  public class Sample {
+ *
+ *      static final int styleNormal = 0;
+ *      static final int styleSelected = 1;
+ *      static final int styleBold = 2;
+ *      static final int styleItalics = 4;
+ *      static final int styleSuper=8;
+ *      static final int styleSub = 16;
+ *
+ *      static class StyleRun {
+ *          int limit;
+ *          int style;
+ *
+ *          public StyleRun(int limit, int style) {
+ *              this.limit = limit;
+ *              this.style = style;
+ *          }
+ *      }
+ *
+ *      static class Bounds {
+ *          int start;
+ *          int limit;
+ *
+ *          public Bounds(int start, int limit) {
+ *              this.start = start;
+ *              this.limit = limit;
+ *          }
+ *      }
+ *
+ *      static int getTextWidth(String text, int start, int limit,
+ *                              StyleRun[] styleRuns, int styleRunCount) {
+ *          // simplistic way to compute the width
+ *          return limit - start;
+ *      }
+ *
+ *      // set limit and StyleRun limit for a line
+ *      // from text[start] and from styleRuns[styleRunStart]
+ *      // using Bidi.getLogicalRun(...)
+ *      // returns line width
+ *      static int getLineBreak(String text, Bounds line, Bidi para,
+ *                              StyleRun styleRuns[], Bounds styleRun) {
+ *          // dummy return
+ *          return 0;
+ *      }
+ *
+ *      // render runs on a line sequentially, always from left to right
+ *
+ *      // prepare rendering a new line
+ *      static void startLine(byte textDirection, int lineWidth) {
+ *          System.out.println();
+ *      }
+ *
+ *      // render a run of text and advance to the right by the run width
+ *      // the text[start..limit-1] is always in logical order
+ *      static void renderRun(String text, int start, int limit,
+ *                            byte textDirection, int style) {
+ *      }
+ *
+ *      // We could compute a cross-product
+ *      // from the style runs with the directional runs
+ *      // and then reorder it.
+ *      // Instead, here we iterate over each run type
+ *      // and render the intersections -
+ *      // with shortcuts in simple (and common) cases.
+ *      // renderParagraph() is the main function.
+ *
+ *      // render a directional run with
+ *      // (possibly) multiple style runs intersecting with it
+ *      static void renderDirectionalRun(String text, int start, int limit,
+ *                                       byte direction, StyleRun styleRuns[],
+ *                                       int styleRunCount) {
+ *          int i;
+ *
+ *          // iterate over style runs
+ *          if (direction == Bidi.LTR) {
+ *              int styleLimit;
+ *              for (i = 0; i < styleRunCount; ++i) {
+ *                  styleLimit = styleRuns[i].limit;
+ *                  if (start < styleLimit) {
+ *                      if (styleLimit > limit) {
+ *                          styleLimit = limit;
+ *                      }
+ *                      renderRun(text, start, styleLimit,
+ *                                direction, styleRuns[i].style);
+ *                      if (styleLimit == limit) {
+ *                          break;
+ *                      }
+ *                      start = styleLimit;
+ *                  }
+ *              }
+ *          } else {
+ *              int styleStart;
+ *
+ *              for (i = styleRunCount-1; i >= 0; --i) {
+ *                  if (i > 0) {
+ *                      styleStart = styleRuns[i-1].limit;
+ *                  } else {
+ *                      styleStart = 0;
+ *                  }
+ *                  if (limit >= styleStart) {
+ *                      if (styleStart < start) {
+ *                          styleStart = start;
+ *                      }
+ *                      renderRun(text, styleStart, limit, direction,
+ *                                styleRuns[i].style);
+ *                      if (styleStart == start) {
+ *                          break;
+ *                      }
+ *                      limit = styleStart;
+ *                  }
+ *              }
+ *          }
+ *      }
+ *
+ *      // the line object represents text[start..limit-1]
+ *      static void renderLine(Bidi line, String text, int start, int limit,
+ *                             StyleRun styleRuns[], int styleRunCount) {
+ *          byte direction = line.getDirection();
+ *          if (direction != Bidi.MIXED) {
+ *              // unidirectional
+ *              if (styleRunCount <= 1) {
+ *                  renderRun(text, start, limit, direction, styleRuns[0].style);
+ *              } else {
+ *                  renderDirectionalRun(text, start, limit, direction,
+ *                                       styleRuns, styleRunCount);
+ *              }
+ *          } else {
+ *              // mixed-directional
+ *              int count, i;
+ *              BidiRun run;
+ *
+ *              try {
+ *                  count = line.countRuns();
+ *              } catch (IllegalStateException e) {
+ *                  e.printStackTrace();
+ *                  return;
+ *              }
+ *              if (styleRunCount <= 1) {
+ *                  int style = styleRuns[0].style;
+ *
+ *                  // iterate over directional runs
+ *                  for (i = 0; i < count; ++i) {
+ *                      run = line.getVisualRun(i);
+ *                      renderRun(text, run.getStart(), run.getLimit(),
+ *                                run.getDirection(), style);
+ *                  }
+ *              } else {
+ *                  // iterate over both directional and style runs
+ *                  for (i = 0; i < count; ++i) {
+ *                      run = line.getVisualRun(i);
+ *                      renderDirectionalRun(text, run.getStart(),
+ *                                           run.getLimit(), run.getDirection(),
+ *                                           styleRuns, styleRunCount);
+ *                  }
+ *              }
+ *          }
+ *      }
+ *
+ *      static void renderParagraph(String text, byte textDirection,
+ *                                  StyleRun styleRuns[], int styleRunCount,
+ *                                  int lineWidth) {
+ *          int length = text.length();
+ *          Bidi para = new Bidi();
+ *          try {
+ *              para.setPara(text,
+ *                           textDirection != 0 ? Bidi.LEVEL_DEFAULT_RTL
+ *                                              : Bidi.LEVEL_DEFAULT_LTR,
+ *                           null);
+ *          } catch (Exception e) {
+ *              e.printStackTrace();
+ *              return;
+ *          }
+ *          byte paraLevel = (byte)(1 & para.getParaLevel());
+ *          StyleRun styleRun = new StyleRun(length, styleNormal);
+ *
+ *          if (styleRuns == null || styleRunCount <= 0) {
+ *              styleRuns = new StyleRun[1];
+ *              styleRunCount = 1;
+ *              styleRuns[0] = styleRun;
+ *          }
+ *          // assume styleRuns[styleRunCount-1].limit>=length
+ *
+ *          int width = getTextWidth(text, 0, length, styleRuns, styleRunCount);
+ *          if (width <= lineWidth) {
+ *              // everything fits onto one line
+ *
+ *              // prepare rendering a new line from either left or right
+ *              startLine(paraLevel, width);
+ *
+ *              renderLine(para, text, 0, length, styleRuns, styleRunCount);
+ *          } else {
+ *              // we need to render several lines
+ *              Bidi line = new Bidi(length, 0);
+ *              int start = 0, limit;
+ *              int styleRunStart = 0, styleRunLimit;
+ *
+ *              for (;;) {
+ *                  limit = length;
+ *                  styleRunLimit = styleRunCount;
+ *                  width = getLineBreak(text, new Bounds(start, limit),
+ *                                       para, styleRuns,
+ *                                       new Bounds(styleRunStart, styleRunLimit));
+ *                  try {
+ *                      line = para.setLine(start, limit);
+ *                  } catch (Exception e) {
+ *                      e.printStackTrace();
+ *                      return;
+ *                  }
+ *                  // prepare rendering a new line
+ *                  // from either left or right
+ *                  startLine(paraLevel, width);
+ *
+ *                  if (styleRunStart > 0) {
+ *                      int newRunCount = styleRuns.length - styleRunStart;
+ *                      StyleRun[] newRuns = new StyleRun[newRunCount];
+ *                      System.arraycopy(styleRuns, styleRunStart, newRuns, 0,
+ *                                       newRunCount);
+ *                      renderLine(line, text, start, limit, newRuns,
+ *                                 styleRunLimit - styleRunStart);
+ *                  } else {
+ *                      renderLine(line, text, start, limit, styleRuns,
+ *                                 styleRunLimit - styleRunStart);
+ *                  }
+ *                  if (limit == length) {
+ *                      break;
+ *                  }
+ *                  start = limit;
+ *                  styleRunStart = styleRunLimit - 1;
+ *                  if (start >= styleRuns[styleRunStart].limit) {
+ *                      ++styleRunStart;
+ *                  }
+ *              }
+ *          }
+ *      }
+ *
+ *      public static void main(String[] args)
+ *      {
+ *          renderParagraph("Some Latin text...", Bidi.LTR, null, 0, 80);
+ *          renderParagraph("Some Hebrew text...", Bidi.RTL, null, 0, 60);
+ *      }
+ *  }
+ *
+ * </pre>
+ */
+
+public class BidiBase {
+
+    class Point {
+        int pos;    /* position in text */
+        int flag;   /* flag for LRM/RLM, before/after */
+    }
+
+    class InsertPoints {
+        int size;
+        int confirmed;
+        Point[] points = new Point[0];
+    }
+
+    /** Paragraph level setting<p>
+     *
+     * Constant indicating that the base direction depends on the first strong
+     * directional character in the text according to the Unicode Bidirectional
+     * Algorithm. If no strong directional character is present,
+     * then set the paragraph level to 0 (left-to-right).<p>
+     *
+     * If this value is used in conjunction with reordering modes
+     * <code>REORDER_INVERSE_LIKE_DIRECT</code> or
+     * <code>REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code>, the text to reorder
+     * is assumed to be visual LTR, and the text after reordering is required
+     * to be the corresponding logical string with appropriate contextual
+     * direction. The direction of the result string will be RTL if either
+     * the righmost or leftmost strong character of the source text is RTL
+     * or Arabic Letter, the direction will be LTR otherwise.<p>
+     *
+     * If reordering option <code>OPTION_INSERT_MARKS</code> is set, an RLM may
+     * be added at the beginning of the result string to ensure round trip
+     * (that the result string, when reordered back to visual, will produce
+     * the original source text).
+     * @see #REORDER_INVERSE_LIKE_DIRECT
+     * @see #REORDER_INVERSE_FOR_NUMBERS_SPECIAL
+     * @stable ICU 3.8
+     */
+    public static final byte INTERNAL_LEVEL_DEFAULT_LTR = (byte)0x7e;
+
+    /** Paragraph level setting<p>
+     *
+     * Constant indicating that the base direction depends on the first strong
+     * directional character in the text according to the Unicode Bidirectional
+     * Algorithm. If no strong directional character is present,
+     * then set the paragraph level to 1 (right-to-left).<p>
+     *
+     * If this value is used in conjunction with reordering modes
+     * <code>REORDER_INVERSE_LIKE_DIRECT</code> or
+     * <code>REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code>, the text to reorder
+     * is assumed to be visual LTR, and the text after reordering is required
+     * to be the corresponding logical string with appropriate contextual
+     * direction. The direction of the result string will be RTL if either
+     * the righmost or leftmost strong character of the source text is RTL
+     * or Arabic Letter, or if the text contains no strong character;
+     * the direction will be LTR otherwise.<p>
+     *
+     * If reordering option <code>OPTION_INSERT_MARKS</code> is set, an RLM may
+     * be added at the beginning of the result string to ensure round trip
+     * (that the result string, when reordered back to visual, will produce
+     * the original source text).
+     * @see #REORDER_INVERSE_LIKE_DIRECT
+     * @see #REORDER_INVERSE_FOR_NUMBERS_SPECIAL
+     * @stable ICU 3.8
+     */
+    public static final byte INTERNAL_LEVEL_DEFAULT_RTL = (byte)0x7f;
+
+    /**
+     * Maximum explicit embedding level.
+     * (The maximum resolved level can be up to <code>MAX_EXPLICIT_LEVEL+1</code>).
+     * @stable ICU 3.8
+     */
+    public static final byte MAX_EXPLICIT_LEVEL = 61;
+
+    /**
+     * Bit flag for level input.
+     * Overrides directional properties.
+     * @stable ICU 3.8
+     */
+    public static final byte INTERNAL_LEVEL_OVERRIDE = (byte)0x80;
+
+    /**
+     * Special value which can be returned by the mapping methods when a
+     * logical index has no corresponding visual index or vice-versa. This may
+     * happen for the logical-to-visual mapping of a Bidi control when option
+     * <code>OPTION_REMOVE_CONTROLS</code> is
+     * specified. This can also happen for the visual-to-logical mapping of a
+     * Bidi mark (LRM or RLM) inserted by option
+     * <code>OPTION_INSERT_MARKS</code>.
+     * @see #getVisualIndex
+     * @see #getVisualMap
+     * @see #getLogicalIndex
+     * @see #getLogicalMap
+     * @see #OPTION_INSERT_MARKS
+     * @see #OPTION_REMOVE_CONTROLS
+     * @stable ICU 3.8
+     */
+    public static final int MAP_NOWHERE = -1;
+
+    /**
+     * Mixed-directional text.
+     * @stable ICU 3.8
+     */
+    public static final byte MIXED = 2;
+
+    /**
+     * option bit for writeReordered():
+     * replace characters with the "mirrored" property in RTL runs
+     * by their mirror-image mappings
+     *
+     * @see #writeReordered
+     * @stable ICU 3.8
+     */
+    public static final short DO_MIRRORING = 2;
+
+    /** Reordering mode: Regular Logical to Visual Bidi algorithm according to Unicode.
+     * @see #setReorderingMode
+     * @stable ICU 3.8
+     */
+    private static final short REORDER_DEFAULT = 0;
+
+    /** Reordering mode: Logical to Visual algorithm which handles numbers in
+     * a way which mimicks the behavior of Windows XP.
+     * @see #setReorderingMode
+     * @stable ICU 3.8
+     */
+    private static final short REORDER_NUMBERS_SPECIAL = 1;
+
+    /** Reordering mode: Logical to Visual algorithm grouping numbers with
+     * adjacent R characters (reversible algorithm).
+     * @see #setReorderingMode
+     * @stable ICU 3.8
+     */
+    private static final short REORDER_GROUP_NUMBERS_WITH_R = 2;
+
+    /** Reordering mode: Reorder runs only to transform a Logical LTR string
+     * to the logical RTL string with the same display, or vice-versa.<br>
+     * If this mode is set together with option
+     * <code>OPTION_INSERT_MARKS</code>, some Bidi controls in the source
+     * text may be removed and other controls may be added to produce the
+     * minimum combination which has the required display.
+     * @see #OPTION_INSERT_MARKS
+     * @see #setReorderingMode
+     * @stable ICU 3.8
+     */
+    private static final short REORDER_RUNS_ONLY = 3;
+
+    /** Reordering mode: Visual to Logical algorithm which handles numbers
+     * like L (same algorithm as selected by <code>setInverse(true)</code>.
+     * @see #setInverse
+     * @see #setReorderingMode
+     * @stable ICU 3.8
+     */
+    private static final short REORDER_INVERSE_NUMBERS_AS_L = 4;
+
+    /** Reordering mode: Visual to Logical algorithm equivalent to the regular
+     * Logical to Visual algorithm.
+     * @see #setReorderingMode
+     * @stable ICU 3.8
+     */
+    private static final short REORDER_INVERSE_LIKE_DIRECT = 5;
+
+    /** Reordering mode: Inverse Bidi (Visual to Logical) algorithm for the
+     * <code>REORDER_NUMBERS_SPECIAL</code> Bidi algorithm.
+     * @see #setReorderingMode
+     * @stable ICU 3.8
+     */
+    private static final short REORDER_INVERSE_FOR_NUMBERS_SPECIAL = 6;
+
+    /* Reordering mode values must be ordered so that all the regular logical to
+     * visual modes come first, and all inverse Bidi modes come last.
+     */
+    private static final short REORDER_LAST_LOGICAL_TO_VISUAL =
+            REORDER_NUMBERS_SPECIAL;
+
+    /**
+     * Option bit for <code>setReorderingOptions</code>:
+     * insert Bidi marks (LRM or RLM) when needed to ensure correct result of
+     * a reordering to a Logical order
+     *
+     * <p>This option must be set or reset before calling
+     * <code>setPara</code>.</p>
+     *
+     * <p>This option is significant only with reordering modes which generate
+     * a result with Logical order, specifically.</p>
+     * <ul>
+     *   <li><code>REORDER_RUNS_ONLY</code></li>
+     *   <li><code>REORDER_INVERSE_NUMBERS_AS_L</code></li>
+     *   <li><code>REORDER_INVERSE_LIKE_DIRECT</code></li>
+     *   <li><code>REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code></li>
+     * </ul>
+     *
+     * <p>If this option is set in conjunction with reordering mode
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code> or with calling
+     * <code>setInverse(true)</code>, it implies option
+     * <code>INSERT_LRM_FOR_NUMERIC</code> in calls to method
+     * <code>writeReordered()</code>.</p>
+     *
+     * <p>For other reordering modes, a minimum number of LRM or RLM characters
+     * will be added to the source text after reordering it so as to ensure
+     * round trip, i.e. when applying the inverse reordering mode on the
+     * resulting logical text with removal of Bidi marks
+     * (option <code>OPTION_REMOVE_CONTROLS</code> set before calling
+     * <code>setPara()</code> or option
+     * <code>REMOVE_BIDI_CONTROLS</code> in
+     * <code>writeReordered</code>), the result will be identical to the
+     * source text in the first transformation.
+     *
+     * <p>This option will be ignored if specified together with option
+     * <code>OPTION_REMOVE_CONTROLS</code>. It inhibits option
+     * <code>REMOVE_BIDI_CONTROLS</code> in calls to method
+     * <code>writeReordered()</code> and it implies option
+     * <code>INSERT_LRM_FOR_NUMERIC</code> in calls to method
+     * <code>writeReordered()</code> if the reordering mode is
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code>.</p>
+     *
+     * @see #setReorderingMode
+     * @see #setReorderingOptions
+     * @see #INSERT_LRM_FOR_NUMERIC
+     * @see #REMOVE_BIDI_CONTROLS
+     * @see #OPTION_REMOVE_CONTROLS
+     * @see #REORDER_RUNS_ONLY
+     * @see #REORDER_INVERSE_NUMBERS_AS_L
+     * @see #REORDER_INVERSE_LIKE_DIRECT
+     * @see #REORDER_INVERSE_FOR_NUMBERS_SPECIAL
+     * @stable ICU 3.8
+     */
+    private static final int OPTION_INSERT_MARKS = 1;
+
+    /**
+     * Option bit for <code>setReorderingOptions</code>:
+     * remove Bidi control characters
+     *
+     * <p>This option must be set or reset before calling
+     * <code>setPara</code>.</p>
+     *
+     * <p>This option nullifies option
+     * <code>OPTION_INSERT_MARKS</code>. It inhibits option
+     * <code>INSERT_LRM_FOR_NUMERIC</code> in calls to method
+     * <code>writeReordered()</code> and it implies option
+     * <code>REMOVE_BIDI_CONTROLS</code> in calls to that method.</p>
+     *
+     * @see #setReorderingMode
+     * @see #setReorderingOptions
+     * @see #OPTION_INSERT_MARKS
+     * @see #INSERT_LRM_FOR_NUMERIC
+     * @see #REMOVE_BIDI_CONTROLS
+     * @stable ICU 3.8
+     */
+    private static final int OPTION_REMOVE_CONTROLS = 2;
+
+    /**
+     * Option bit for <code>setReorderingOptions</code>:
+     * process the output as part of a stream to be continued
+     *
+     * <p>This option must be set or reset before calling
+     * <code>setPara</code>.</p>
+     *
+     * <p>This option specifies that the caller is interested in processing
+     * large text object in parts. The results of the successive calls are
+     * expected to be concatenated by the caller. Only the call for the last
+     * part will have this option bit off.</p>
+     *
+     * <p>When this option bit is on, <code>setPara()</code> may process
+     * less than the full source text in order to truncate the text at a
+     * meaningful boundary. The caller should call
+     * <code>getProcessedLength()</code> immediately after calling
+     * <code>setPara()</code> in order to determine how much of the source
+     * text has been processed. Source text beyond that length should be
+     * resubmitted in following calls to <code>setPara</code>. The
+     * processed length may be less than the length of the source text if a
+     * character preceding the last character of the source text constitutes a
+     * reasonable boundary (like a block separator) for text to be continued.<br>
+     * If the last character of the source text constitutes a reasonable
+     * boundary, the whole text will be processed at once.<br>
+     * If nowhere in the source text there exists
+     * such a reasonable boundary, the processed length will be zero.<br>
+     * The caller should check for such an occurrence and do one of the following:
+     * <ul><li>submit a larger amount of text with a better chance to include
+     *         a reasonable boundary.</li>
+     *     <li>resubmit the same text after turning off option
+     *         <code>OPTION_STREAMING</code>.</li></ul>
+     * In all cases, this option should be turned off before processing the last
+     * part of the text.</p>
+     *
+     * <p>When the <code>OPTION_STREAMING</code> option is used, it is
+     * recommended to call <code>orderParagraphsLTR()</code> with argument
+     * <code>orderParagraphsLTR</code> set to <code>true</code> before calling
+     * <code>setPara()</code> so that later paragraphs may be concatenated to
+     * previous paragraphs on the right.
+     * </p>
+     *
+     * @see #setReorderingMode
+     * @see #setReorderingOptions
+     * @see #getProcessedLength
+     * @see #orderParagraphsLTR
+     * @stable ICU 3.8
+     */
+    private static final int OPTION_STREAMING = 4;
+
+    /*
+     *   Comparing the description of the Bidi algorithm with this implementation
+     *   is easier with the same names for the Bidi types in the code as there.
+     *   See UCharacterDirection
+     */
+    private static final byte L   = 0;
+    private static final byte R   = 1;
+    private static final byte EN  = 2;
+    private static final byte ES  = 3;
+    private static final byte ET  = 4;
+    private static final byte AN  = 5;
+    private static final byte CS  = 6;
+    static final byte B   = 7;
+    private static final byte S   = 8;
+    private static final byte WS  = 9;
+    private static final byte ON  = 10;
+    private static final byte LRE = 11;
+    private static final byte LRO = 12;
+    private static final byte AL  = 13;
+    private static final byte RLE = 14;
+    private static final byte RLO = 15;
+    private static final byte PDF = 16;
+    private static final byte NSM = 17;
+    private static final byte BN  = 18;
+
+    private static final int MASK_R_AL = (1 << R | 1 << AL);
+
+    private static final char CR = '\r';
+    private static final char LF = '\n';
+
+    static final int LRM_BEFORE = 1;
+    static final int LRM_AFTER = 2;
+    static final int RLM_BEFORE = 4;
+    static final int RLM_AFTER = 8;
+
+    /*
+     * reference to parent paragraph object (reference to self if this object is
+     * a paragraph object); set to null in a newly opened object; set to a
+     * real value after a successful execution of setPara or setLine
+     */
+    BidiBase                paraBidi;
+
+    final UBiDiProps    bdp;
+
+    /* character array representing the current text */
+    char[]              text;
+
+    /* length of the current text */
+    int                 originalLength;
+
+    /* if the option OPTION_STREAMING is set, this is the length of
+     * text actually processed by <code>setPara</code>, which may be shorter
+     * than the original length. Otherwise, it is identical to the original
+     * length.
+     */
+    public int                 length;
+
+    /* if option OPTION_REMOVE_CONTROLS is set, and/or Bidi
+     * marks are allowed to be inserted in one of the reordering modes, the
+     * length of the result string may be different from the processed length.
+     */
+    int                 resultLength;
+
+    /* indicators for whether memory may be allocated after construction */
+    boolean             mayAllocateText;
+    boolean             mayAllocateRuns;
+
+    /* arrays with one value per text-character */
+    byte[]              dirPropsMemory = new byte[1];
+    byte[]              levelsMemory = new byte[1];
+    byte[]              dirProps;
+    byte[]              levels;
+
+    /* must block separators receive level 0? */
+    boolean             orderParagraphsLTR;
+
+    /* the paragraph level */
+    byte                paraLevel;
+
+    /* original paraLevel when contextual */
+    /* must be one of DEFAULT_xxx or 0 if not contextual */
+    byte                defaultParaLevel;
+
+    /* the following is set in setPara, used in processPropertySeq */
+
+    ImpTabPair          impTabPair;  /* reference to levels state table pair */
+
+    /* the overall paragraph or line directionality*/
+    byte                direction;
+
+    /* flags is a bit set for which directional properties are in the text */
+    int                 flags;
+
+    /* lastArabicPos is index to the last AL in the text, -1 if none */
+    int                 lastArabicPos;
+
+    /* characters after trailingWSStart are WS and are */
+    /* implicitly at the paraLevel (rule (L1)) - levels may not reflect that */
+    int                 trailingWSStart;
+
+    /* fields for paragraph handling */
+    int                 paraCount;       /* set in getDirProps() */
+    int[]               parasMemory = new int[1];
+    int[]               paras;           /* limits of paragraphs, filled in
+                                          ResolveExplicitLevels() or CheckExplicitLevels() */
+
+    /* for single paragraph text, we only need a tiny array of paras (no allocation) */
+    int[]               simpleParas = {0};
+
+    /* fields for line reordering */
+    int                 runCount;     /* ==-1: runs not set up yet */
+    BidiRun[]           runsMemory = new BidiRun[0];
+    BidiRun[]           runs;
+
+    /* for non-mixed text, we only need a tiny array of runs (no allocation) */
+    BidiRun[]           simpleRuns = {new BidiRun()};
+
+    /* mapping of runs in logical order to visual order */
+    int[]               logicalToVisualRunsMap;
+
+    /* flag to indicate that the map has been updated */
+    boolean             isGoodLogicalToVisualRunsMap;
+
+    /* for inverse Bidi with insertion of directional marks */
+    InsertPoints        insertPoints = new InsertPoints();
+
+    /* for option OPTION_REMOVE_CONTROLS */
+    int                 controlCount;
+
+    /*
+     * Sometimes, bit values are more appropriate
+     * to deal with directionality properties.
+     * Abbreviations in these method names refer to names
+     * used in the Bidi algorithm.
+     */
+    static int DirPropFlag(byte dir) {
+        return (1 << dir);
+    }
+
+    /*
+     * The following bit is ORed to the property of characters in paragraphs
+     * with contextual RTL direction when paraLevel is contextual.
+     */
+    static final byte CONTEXT_RTL_SHIFT = 6;
+    static final byte CONTEXT_RTL = (byte)(1<<CONTEXT_RTL_SHIFT);   // 0x40
+    static byte NoContextRTL(byte dir)
+    {
+        return (byte)(dir & ~CONTEXT_RTL);
+    }
+
+    /*
+     * The following is a variant of DirProp.DirPropFlag() which ignores the
+     * CONTEXT_RTL bit.
+     */
+    static int DirPropFlagNC(byte dir) {
+        return (1<<(dir & ~CONTEXT_RTL));
+    }
+
+    static final int DirPropFlagMultiRuns = DirPropFlag((byte)31);
+
+    /* to avoid some conditional statements, use tiny constant arrays */
+    static final int DirPropFlagLR[] = { DirPropFlag(L), DirPropFlag(R) };
+    static final int DirPropFlagE[] = { DirPropFlag(LRE), DirPropFlag(RLE) };
+    static final int DirPropFlagO[] = { DirPropFlag(LRO), DirPropFlag(RLO) };
+
+    static final int DirPropFlagLR(byte level) { return DirPropFlagLR[level & 1]; }
+    static final int DirPropFlagE(byte level)  { return DirPropFlagE[level & 1]; }
+    static final int DirPropFlagO(byte level)  { return DirPropFlagO[level & 1]; }
+
+    /*
+     *  are there any characters that are LTR?
+     */
+    static final int MASK_LTR =
+        DirPropFlag(L)|DirPropFlag(EN)|DirPropFlag(AN)|DirPropFlag(LRE)|DirPropFlag(LRO);
+
+    /*
+     *  are there any characters that are RTL?
+     */
+    static final int MASK_RTL = DirPropFlag(R)|DirPropFlag(AL)|DirPropFlag(RLE)|DirPropFlag(RLO);
+
+    /* explicit embedding codes */
+    private static final int MASK_LRX = DirPropFlag(LRE)|DirPropFlag(LRO);
+    private static final int MASK_RLX = DirPropFlag(RLE)|DirPropFlag(RLO);
+    private static final int MASK_EXPLICIT = MASK_LRX|MASK_RLX|DirPropFlag(PDF);
+    private static final int MASK_BN_EXPLICIT = DirPropFlag(BN)|MASK_EXPLICIT;
+
+    /* paragraph and segment separators */
+    private static final int MASK_B_S = DirPropFlag(B)|DirPropFlag(S);
+
+    /* all types that are counted as White Space or Neutral in some steps */
+    static final int MASK_WS = MASK_B_S|DirPropFlag(WS)|MASK_BN_EXPLICIT;
+    private static final int MASK_N = DirPropFlag(ON)|MASK_WS;
+
+    /* types that are neutrals or could becomes neutrals in (Wn) */
+    private static final int MASK_POSSIBLE_N = DirPropFlag(CS)|DirPropFlag(ES)|DirPropFlag(ET)|MASK_N;
+
+    /*
+     * These types may be changed to "e",
+     * the embedding type (L or R) of the run,
+     * in the Bidi algorithm (N2)
+     */
+    static final int MASK_EMBEDDING = DirPropFlag(NSM)|MASK_POSSIBLE_N;
+
+    /*
+     *  the dirProp's L and R are defined to 0 and 1 values in UCharacterDirection.java
+     */
+    private static byte GetLRFromLevel(byte level)
+    {
+        return (byte)(level & 1);
+    }
+
+    private static boolean IsDefaultLevel(byte level)
+    {
+        return ((level & INTERNAL_LEVEL_DEFAULT_LTR) == INTERNAL_LEVEL_DEFAULT_LTR);
+    }
+
+    byte GetParaLevelAt(int index)
+    {
+        return (defaultParaLevel != 0) ?
+                (byte)(dirProps[index]>>CONTEXT_RTL_SHIFT) : paraLevel;
+    }
+
+    static boolean IsBidiControlChar(int c)
+    {
+        /* check for range 0x200c to 0x200f (ZWNJ, ZWJ, LRM, RLM) or
+                           0x202a to 0x202e (LRE, RLE, PDF, LRO, RLO) */
+        return (((c & 0xfffffffc) == 0x200c) || ((c >= 0x202a) && (c <= 0x202e)));
+    }
+
+    public void verifyValidPara()
+    {
+        if (this != this.paraBidi) {
+            throw new IllegalStateException("");
+        }
+    }
+
+    public void verifyValidParaOrLine()
+    {
+        BidiBase para = this.paraBidi;
+        /* verify Para */
+        if (this == para) {
+            return;
+        }
+        /* verify Line */
+        if ((para == null) || (para != para.paraBidi)) {
+            throw new IllegalStateException();
+        }
+    }
+
+    public void verifyRange(int index, int start, int limit)
+    {
+        if (index < start || index >= limit) {
+            throw new IllegalArgumentException("Value " + index +
+                      " is out of range " + start + " to " + limit);
+        }
+    }
+
+    public void verifyIndex(int index, int start, int limit)
+    {
+        if (index < start || index >= limit) {
+            throw new ArrayIndexOutOfBoundsException("Index " + index +
+                      " is out of range " + start + " to " + limit);
+        }
+    }
+
+    /**
+     * Allocate a <code>Bidi</code> object with preallocated memory
+     * for internal structures.
+     * This method provides a <code>Bidi</code> object like the default constructor
+     * but it also preallocates memory for internal structures
+     * according to the sizings supplied by the caller.<p>
+     * The preallocation can be limited to some of the internal memory
+     * by setting some values to 0 here. That means that if, e.g.,
+     * <code>maxRunCount</code> cannot be reasonably predetermined and should not
+     * be set to <code>maxLength</code> (the only failproof value) to avoid
+     * wasting  memory, then <code>maxRunCount</code> could be set to 0 here
+     * and the internal structures that are associated with it will be allocated
+     * on demand, just like with the default constructor.
+     *
+     * @param maxLength is the maximum text or line length that internal memory
+     *        will be preallocated for. An attempt to associate this object with a
+     *        longer text will fail, unless this value is 0, which leaves the allocation
+     *        up to the implementation.
+     *
+     * @param maxRunCount is the maximum anticipated number of same-level runs
+     *        that internal memory will be preallocated for. An attempt to access
+     *        visual runs on an object that was not preallocated for as many runs
+     *        as the text was actually resolved to will fail,
+     *        unless this value is 0, which leaves the allocation up to the implementation.<br><br>
+     *        The number of runs depends on the actual text and maybe anywhere between
+     *        1 and <code>maxLength</code>. It is typically small.
+     *
+     * @throws IllegalArgumentException if maxLength or maxRunCount is less than 0
+     * @stable ICU 3.8
+     */
+    public BidiBase(int maxLength, int maxRunCount)
+     {
+        /* check the argument values */
+        if (maxLength < 0 || maxRunCount < 0) {
+            throw new IllegalArgumentException();
+        }
+
+        /* reset the object, all reference variables null, all flags false,
+           all sizes 0.
+           In fact, we don't need to do anything, since class members are
+           initialized as zero when an instance is created.
+         */
+        /*
+        mayAllocateText = false;
+        mayAllocateRuns = false;
+        orderParagraphsLTR = false;
+        paraCount = 0;
+        runCount = 0;
+        trailingWSStart = 0;
+        flags = 0;
+        paraLevel = 0;
+        defaultParaLevel = 0;
+        direction = 0;
+        */
+        /* get Bidi properties */
+        try {
+            bdp = UBiDiProps.getSingleton();
+        }
+        catch (IOException e) {
+            throw new MissingResourceException(e.getMessage(), "(BidiProps)", "");
+        }
+
+        /* allocate memory for arrays as requested */
+        if (maxLength > 0) {
+            getInitialDirPropsMemory(maxLength);
+            getInitialLevelsMemory(maxLength);
+        } else {
+            mayAllocateText = true;
+        }
+
+        if (maxRunCount > 0) {
+            // if maxRunCount == 1, use simpleRuns[]
+            if (maxRunCount > 1) {
+                getInitialRunsMemory(maxRunCount);
+            }
+        } else {
+            mayAllocateRuns = true;
+        }
+    }
+
+    /*
+     * We are allowed to allocate memory if object==null or
+     * mayAllocate==true for each array that we need.
+     *
+     * Assume sizeNeeded>0.
+     * If object != null, then assume size > 0.
+     */
+    private Object getMemory(String label, Object array, Class arrayClass,
+            boolean mayAllocate, int sizeNeeded)
+    {
+        int len = Array.getLength(array);
+
+        /* we have at least enough memory and must not allocate */
+        if (sizeNeeded == len) {
+            return array;
+        }
+        if (!mayAllocate) {
+            /* we must not allocate */
+            if (sizeNeeded <= len) {
+                return array;
+            }
+            throw new OutOfMemoryError("Failed to allocate memory for "
+                                       + label);
+        }
+        /* we may try to grow or shrink */
+        /* FOOD FOR THOUGHT: when shrinking it should be possible to avoid
+           the allocation altogether and rely on this.length */
+        try {
+            return Array.newInstance(arrayClass, sizeNeeded);
+        } catch (Exception e) {
+            throw new OutOfMemoryError("Failed to allocate memory for "
+                                       + label);
+        }
+    }
+
+    /* helper methods for each allocated array */
+    private void getDirPropsMemory(boolean mayAllocate, int len)
+    {
+        Object array = getMemory("DirProps", dirPropsMemory, Byte.TYPE, mayAllocate, len);
+        dirPropsMemory = (byte[]) array;
+    }
+
+    void getDirPropsMemory(int len)
+    {
+        getDirPropsMemory(mayAllocateText, len);
+    }
+
+    private void getLevelsMemory(boolean mayAllocate, int len)
+    {
+        Object array = getMemory("Levels", levelsMemory, Byte.TYPE, mayAllocate, len);
+        levelsMemory = (byte[]) array;
+    }
+
+    void getLevelsMemory(int len)
+    {
+        getLevelsMemory(mayAllocateText, len);
+    }
+
+    private void getRunsMemory(boolean mayAllocate, int len)
+    {
+        Object array = getMemory("Runs", runsMemory, BidiRun.class, mayAllocate, len);
+        runsMemory = (BidiRun[]) array;
+    }
+
+    void getRunsMemory(int len)
+    {
+        getRunsMemory(mayAllocateRuns, len);
+    }
+
+    /* additional methods used by constructor - always allow allocation */
+    private void getInitialDirPropsMemory(int len)
+    {
+        getDirPropsMemory(true, len);
+    }
+
+    private void getInitialLevelsMemory(int len)
+    {
+        getLevelsMemory(true, len);
+    }
+
+    private void getInitialParasMemory(int len)
+    {
+        Object array = getMemory("Paras", parasMemory, Integer.TYPE, true, len);
+        parasMemory = (int[]) array;
+    }
+
+    private void getInitialRunsMemory(int len)
+    {
+        getRunsMemory(true, len);
+    }
+
+/* perform (P2)..(P3) ------------------------------------------------------- */
+
+    private void getDirProps()
+    {
+        int i = 0, i0, i1;
+        flags = 0;          /* collect all directionalities in the text */
+        int uchar;
+        byte dirProp;
+        byte paraDirDefault = 0;   /* initialize to avoid compiler warnings */
+        boolean isDefaultLevel = IsDefaultLevel(paraLevel);
+        /* for inverse Bidi, the default para level is set to RTL if there is a
+           strong R or AL character at either end of the text                */
+        lastArabicPos = -1;
+        controlCount = 0;
+
+        final int NOT_CONTEXTUAL = 0;         /* 0: not contextual paraLevel */
+        final int LOOKING_FOR_STRONG = 1;     /* 1: looking for first strong char */
+        final int FOUND_STRONG_CHAR = 2;      /* 2: found first strong char       */
+
+        int state;
+        int paraStart = 0;                    /* index of first char in paragraph */
+        byte paraDir;                         /* == CONTEXT_RTL within paragraphs
+                                                 starting with strong R char      */
+        byte lastStrongDir=0;                 /* for default level & inverse Bidi */
+        int lastStrongLTR=0;                  /* for STREAMING option             */
+
+        if (isDefaultLevel) {
+            paraDirDefault = ((paraLevel & 1) != 0) ? CONTEXT_RTL : 0;
+            paraDir = paraDirDefault;
+            lastStrongDir = paraDirDefault;
+            state = LOOKING_FOR_STRONG;
+        } else {
+            state = NOT_CONTEXTUAL;
+            paraDir = 0;
+        }
+        /* count paragraphs and determine the paragraph level (P2..P3) */
+        /*
+         * see comment on constant fields:
+         * the LEVEL_DEFAULT_XXX values are designed so that
+         * their low-order bit alone yields the intended default
+         */
+
+        for (i = 0; i < originalLength; /* i is incremented in the loop */) {
+            i0 = i;                     /* index of first code unit */
+            uchar = UTF16.charAt(text, 0, originalLength, i);
+            i += Character.charCount(uchar);
+            i1 = i - 1; /* index of last code unit, gets the directional property */
+
+            dirProp = (byte)bdp.getClass(uchar);
+
+            flags |= DirPropFlag(dirProp);
+            dirProps[i1] = (byte)(dirProp | paraDir);
+            if (i1 > i0) {     /* set previous code units' properties to BN */
+                flags |= DirPropFlag(BN);
+                do {
+                    dirProps[--i1] = (byte)(BN | paraDir);
+                } while (i1 > i0);
+            }
+            if (state == LOOKING_FOR_STRONG) {
+                if (dirProp == L) {
+                    state = FOUND_STRONG_CHAR;
+                    if (paraDir != 0) {
+                        paraDir = 0;
+                        for (i1 = paraStart; i1 < i; i1++) {
+                            dirProps[i1] &= ~CONTEXT_RTL;
+                        }
+                    }
+                    continue;
+                }
+                if (dirProp == R || dirProp == AL) {
+                    state = FOUND_STRONG_CHAR;
+                    if (paraDir == 0) {
+                        paraDir = CONTEXT_RTL;
+                        for (i1 = paraStart; i1 < i; i1++) {
+                            dirProps[i1] |= CONTEXT_RTL;
+                        }
+                    }
+                    continue;
+                }
+            }
+            if (dirProp == L) {
+                lastStrongDir = 0;
+                lastStrongLTR = i;      /* i is index to next character */
+            }
+            else if (dirProp == R) {
+                lastStrongDir = CONTEXT_RTL;
+            }
+            else if (dirProp == AL) {
+                lastStrongDir = CONTEXT_RTL;
+                lastArabicPos = i-1;
+            }
+            else if (dirProp == B) {
+                if (i < originalLength) {   /* B not last char in text */
+                    if (!((uchar == (int)CR) && (text[i] == (int)LF))) {
+                        paraCount++;
+                    }
+                    if (isDefaultLevel) {
+                        state=LOOKING_FOR_STRONG;
+                        paraStart = i;        /* i is index to next character */
+                        paraDir = paraDirDefault;
+                        lastStrongDir = paraDirDefault;
+                    }
+                }
+            }
+        }
+        if (isDefaultLevel) {
+            paraLevel = GetParaLevelAt(0);
+        }
+
+        /* The following line does nothing new for contextual paraLevel, but is
+           needed for absolute paraLevel.                               */
+        flags |= DirPropFlagLR(paraLevel);
+
+        if (orderParagraphsLTR && (flags & DirPropFlag(B)) != 0) {
+            flags |= DirPropFlag(L);
+        }
+    }
+
+    /* perform (X1)..(X9) ------------------------------------------------------- */
+
+    /* determine if the text is mixed-directional or single-directional */
+    private byte directionFromFlags() {
+        /* if the text contains AN and neutrals, then some neutrals may become RTL */
+        if (!((flags & MASK_RTL) != 0 ||
+              ((flags & DirPropFlag(AN)) != 0 &&
+               (flags & MASK_POSSIBLE_N) != 0))) {
+            return Bidi.DIRECTION_LEFT_TO_RIGHT;
+        } else if ((flags & MASK_LTR) == 0) {
+            return Bidi.DIRECTION_RIGHT_TO_LEFT;
+        } else {
+            return MIXED;
+        }
+    }
+
+    /*
+     * Resolve the explicit levels as specified by explicit embedding codes.
+     * Recalculate the flags to have them reflect the real properties
+     * after taking the explicit embeddings into account.
+     *
+     * The Bidi algorithm is designed to result in the same behavior whether embedding
+     * levels are externally specified (from "styled text", supposedly the preferred
+     * method) or set by explicit embedding codes (LRx, RLx, PDF) in the plain text.
+     * That is why (X9) instructs to remove all explicit codes (and BN).
+     * However, in a real implementation, this removal of these codes and their index
+     * positions in the plain text is undesirable since it would result in
+     * reallocated, reindexed text.
+     * Instead, this implementation leaves the codes in there and just ignores them
+     * in the subsequent processing.
+     * In order to get the same reordering behavior, positions with a BN or an
+     * explicit embedding code just get the same level assigned as the last "real"
+     * character.
+     *
+     * Some implementations, not this one, then overwrite some of these
+     * directionality properties at "real" same-level-run boundaries by
+     * L or R codes so that the resolution of weak types can be performed on the
+     * entire paragraph at once instead of having to parse it once more and
+     * perform that resolution on same-level-runs.
+     * This limits the scope of the implicit rules in effectively
+     * the same way as the run limits.
+     *
+     * Instead, this implementation does not modify these codes.
+     * On one hand, the paragraph has to be scanned for same-level-runs, but
+     * on the other hand, this saves another loop to reset these codes,
+     * or saves making and modifying a copy of dirProps[].
+     *
+     *
+     * Note that (Pn) and (Xn) changed significantly from version 4 of the Bidi algorithm.
+     *
+     *
+     * Handling the stack of explicit levels (Xn):
+     *
+     * With the Bidi stack of explicit levels,
+     * as pushed with each LRE, RLE, LRO, and RLO and popped with each PDF,
+     * the explicit level must never exceed MAX_EXPLICIT_LEVEL==61.
+     *
+     * In order to have a correct push-pop semantics even in the case of overflows,
+     * there are two overflow counters:
+     * - countOver60 is incremented with each LRx at level 60
+     * - from level 60, one RLx increases the level to 61
+     * - countOver61 is incremented with each LRx and RLx at level 61
+     *
+     * Popping levels with PDF must work in the opposite order so that level 61
+     * is correct at the correct point. Underflows (too many PDFs) must be checked.
+     *
+     * This implementation assumes that MAX_EXPLICIT_LEVEL is odd.
+     */
+    private byte resolveExplicitLevels() {
+        int i = 0;
+        byte dirProp;
+        byte level = GetParaLevelAt(0);
+
+        byte dirct;
+        int paraIndex = 0;
+
+        /* determine if the text is mixed-directional or single-directional */
+        dirct = directionFromFlags();
+
+        /* we may not need to resolve any explicit levels, but for multiple
+           paragraphs we want to loop on all chars to set the para boundaries */
+        if ((dirct != MIXED) && (paraCount == 1)) {
+            /* not mixed directionality: levels don't matter - trailingWSStart will be 0 */
+        } else if ((paraCount == 1) &&
+                   ((flags & MASK_EXPLICIT) == 0)) {
+            /* mixed, but all characters are at the same embedding level */
+            /* or we are in "inverse Bidi" */
+            /* and we don't have contextual multiple paragraphs with some B char */
+            /* set all levels to the paragraph level */
+            for (i = 0; i < length; ++i) {
+                levels[i] = level;
+            }
+        } else {
+            /* continue to perform (Xn) */
+
+            /* (X1) level is set for all codes, embeddingLevel keeps track of the push/pop operations */
+            /* both variables may carry the LEVEL_OVERRIDE flag to indicate the override status */
+            byte embeddingLevel = level;
+            byte newLevel;
+            byte stackTop = 0;
+
+            byte[] stack = new byte[MAX_EXPLICIT_LEVEL];    /* we never push anything >=MAX_EXPLICIT_LEVEL */
+            int countOver60 = 0;
+            int countOver61 = 0;  /* count overflows of explicit levels */
+
+            /* recalculate the flags */
+            flags = 0;
+
+            for (i = 0; i < length; ++i) {
+                dirProp = NoContextRTL(dirProps[i]);
+                switch(dirProp) {
+                case LRE:
+                case LRO:
+                    /* (X3, X5) */
+                    newLevel = (byte)((embeddingLevel+2) & ~(INTERNAL_LEVEL_OVERRIDE | 1)); /* least greater even level */
+                    if (newLevel <= MAX_EXPLICIT_LEVEL) {
+                        stack[stackTop] = embeddingLevel;
+                        ++stackTop;
+                        embeddingLevel = newLevel;
+                        if (dirProp == LRO) {
+                            embeddingLevel |= INTERNAL_LEVEL_OVERRIDE;
+                        }
+                        /* we don't need to set LEVEL_OVERRIDE off for LRE
+                           since this has already been done for newLevel which is
+                           the source for embeddingLevel.
+                         */
+                    } else if ((embeddingLevel & ~INTERNAL_LEVEL_OVERRIDE) == MAX_EXPLICIT_LEVEL) {
+                        ++countOver61;
+                    } else /* (embeddingLevel & ~INTERNAL_LEVEL_OVERRIDE) == MAX_EXPLICIT_LEVEL-1 */ {
+                        ++countOver60;
+                    }
+                    flags |= DirPropFlag(BN);
+                    break;
+                case RLE:
+                case RLO:
+                    /* (X2, X4) */
+                    newLevel=(byte)(((embeddingLevel & ~INTERNAL_LEVEL_OVERRIDE) + 1) | 1); /* least greater odd level */
+                    if (newLevel<=MAX_EXPLICIT_LEVEL) {
+                        stack[stackTop] = embeddingLevel;
+                        ++stackTop;
+                        embeddingLevel = newLevel;
+                        if (dirProp == RLO) {
+                            embeddingLevel |= INTERNAL_LEVEL_OVERRIDE;
+                        }
+                        /* we don't need to set LEVEL_OVERRIDE off for RLE
+                           since this has already been done for newLevel which is
+                           the source for embeddingLevel.
+                         */
+                    } else {
+                        ++countOver61;
+                    }
+                    flags |= DirPropFlag(BN);
+                    break;
+                case PDF:
+                    /* (X7) */
+                    /* handle all the overflow cases first */
+                    if (countOver61 > 0) {
+                        --countOver61;
+                    } else if (countOver60 > 0 && (embeddingLevel & ~INTERNAL_LEVEL_OVERRIDE) != MAX_EXPLICIT_LEVEL) {
+                        /* handle LRx overflows from level 60 */
+                        --countOver60;
+                    } else if (stackTop > 0) {
+                        /* this is the pop operation; it also pops level 61 while countOver60>0 */
+                        --stackTop;
+                        embeddingLevel = stack[stackTop];
+                    /* } else { (underflow) */
+                    }
+                    flags |= DirPropFlag(BN);
+                    break;
+                case B:
+                    stackTop = 0;
+                    countOver60 = 0;
+                    countOver61 = 0;
+                    level = GetParaLevelAt(i);
+                    if ((i + 1) < length) {
+                        embeddingLevel = GetParaLevelAt(i+1);
+                        if (!((text[i] == CR) && (text[i + 1] == LF))) {
+                            paras[paraIndex++] = i+1;
+                        }
+                    }
+                    flags |= DirPropFlag(B);
+                    break;
+                case BN:
+                    /* BN, LRE, RLE, and PDF are supposed to be removed (X9) */
+                    /* they will get their levels set correctly in adjustWSLevels() */
+                    flags |= DirPropFlag(BN);
+                    break;
+                default:
+                    /* all other types get the "real" level */
+                    if (level != embeddingLevel) {
+                        level = embeddingLevel;
+                        if ((level & INTERNAL_LEVEL_OVERRIDE) != 0) {
+                            flags |= DirPropFlagO(level) | DirPropFlagMultiRuns;
+                        } else {
+                            flags |= DirPropFlagE(level) | DirPropFlagMultiRuns;
+                        }
+                    }
+                    if ((level & INTERNAL_LEVEL_OVERRIDE) == 0) {
+                        flags |= DirPropFlag(dirProp);
+                    }
+                    break;
+                }
+
+                /*
+                 * We need to set reasonable levels even on BN codes and
+                 * explicit codes because we will later look at same-level runs (X10).
+                 */
+                levels[i] = level;
+            }
+            if ((flags & MASK_EMBEDDING) != 0) {
+                flags |= DirPropFlagLR(paraLevel);
+            }
+            if (orderParagraphsLTR && (flags & DirPropFlag(B)) != 0) {
+                flags |= DirPropFlag(L);
+            }
+
+            /* subsequently, ignore the explicit codes and BN (X9) */
+
+            /* again, determine if the text is mixed-directional or single-directional */
+            dirct = directionFromFlags();
+        }
+
+        return dirct;
+    }
+
+    /*
+     * Use a pre-specified embedding levels array:
+     *
+     * Adjust the directional properties for overrides (->LEVEL_OVERRIDE),
+     * ignore all explicit codes (X9),
+     * and check all the preset levels.
+     *
+     * Recalculate the flags to have them reflect the real properties
+     * after taking the explicit embeddings into account.
+     */
+    private byte checkExplicitLevels() {
+        byte dirProp;
+        int i;
+        this.flags = 0;     /* collect all directionalities in the text */
+        byte level;
+        int paraIndex = 0;
+
+        for (i = 0; i < length; ++i) {
+            if (levels[i] == 0) {
+                levels[i] = paraLevel;
+            }
+            if (MAX_EXPLICIT_LEVEL < (levels[i]&0x7f)) {
+                if ((levels[i] & INTERNAL_LEVEL_OVERRIDE) != 0) {
+                    levels[i] =  (byte)(paraLevel|INTERNAL_LEVEL_OVERRIDE);
+                } else {
+                    levels[i] = paraLevel;
+                }
+            }
+            level = levels[i];
+            dirProp = NoContextRTL(dirProps[i]);
+            if ((level & INTERNAL_LEVEL_OVERRIDE) != 0) {
+                /* keep the override flag in levels[i] but adjust the flags */
+                level &= ~INTERNAL_LEVEL_OVERRIDE;     /* make the range check below simpler */
+                flags |= DirPropFlagO(level);
+            } else {
+                /* set the flags */
+                flags |= DirPropFlagE(level) | DirPropFlag(dirProp);
+            }
+
+            if ((level < GetParaLevelAt(i) &&
+                    !((0 == level) && (dirProp == B))) ||
+                    (MAX_EXPLICIT_LEVEL <level)) {
+                /* level out of bounds */
+                throw new IllegalArgumentException("level " + level +
+                                                   " out of bounds at index " + i);
+            }
+            if ((dirProp == B) && ((i + 1) < length)) {
+                if (!((text[i] == CR) && (text[i + 1] == LF))) {
+                    paras[paraIndex++] = i + 1;
+                }
+            }
+        }
+        if ((flags&MASK_EMBEDDING) != 0) {
+            flags |= DirPropFlagLR(paraLevel);
+        }
+
+        /* determine if the text is mixed-directional or single-directional */
+        return directionFromFlags();
+    }
+
+    /*********************************************************************/
+    /* The Properties state machine table                                */
+    /*********************************************************************/
+    /*                                                                   */
+    /* All table cells are 8 bits:                                       */
+    /*      bits 0..4:  next state                                       */
+    /*      bits 5..7:  action to perform (if > 0)                       */
+    /*                                                                   */
+    /* Cells may be of format "n" where n represents the next state      */
+    /* (except for the rightmost column).                                */
+    /* Cells may also be of format "_(x,y)" where x represents an action */
+    /* to perform and y represents the next state.                       */
+    /*                                                                   */
+    /*********************************************************************/
+    /* Definitions and type for properties state tables                  */
+    /*********************************************************************/
+    private static final int IMPTABPROPS_COLUMNS = 14;
+    private static final int IMPTABPROPS_RES = IMPTABPROPS_COLUMNS - 1;
+    private static short GetStateProps(short cell) {
+        return (short)(cell & 0x1f);
+    }
+    private static short GetActionProps(short cell) {
+        return (short)(cell >> 5);
+    }
+
+    private static final short groupProp[] =          /* dirProp regrouped */
+    {
+        /*  L   R   EN  ES  ET  AN  CS  B   S   WS  ON  LRE LRO AL  RLE RLO PDF NSM BN  */
+        0,  1,  2,  7,  8,  3,  9,  6,  5,  4,  4,  10, 10, 12, 10, 10, 10, 11, 10
+    };
+    private static final short _L  = 0;
+    private static final short _R  = 1;
+    private static final short _EN = 2;
+    private static final short _AN = 3;
+    private static final short _ON = 4;
+    private static final short _S  = 5;
+    private static final short _B  = 6; /* reduced dirProp */
+
+    /*********************************************************************/
+    /*                                                                   */
+    /*      PROPERTIES  STATE  TABLE                                     */
+    /*                                                                   */
+    /* In table impTabProps,                                             */
+    /*      - the ON column regroups ON and WS                           */
+    /*      - the BN column regroups BN, LRE, RLE, LRO, RLO, PDF         */
+    /*      - the Res column is the reduced property assigned to a run   */
+    /*                                                                   */
+    /* Action 1: process current run1, init new run1                     */
+    /*        2: init new run2                                           */
+    /*        3: process run1, process run2, init new run1               */
+    /*        4: process run1, set run1=run2, init new run2              */
+    /*                                                                   */
+    /* Notes:                                                            */
+    /*  1) This table is used in resolveImplicitLevels().                */
+    /*  2) This table triggers actions when there is a change in the Bidi*/
+    /*     property of incoming characters (action 1).                   */
+    /*  3) Most such property sequences are processed immediately (in    */
+    /*     fact, passed to processPropertySeq().                         */
+    /*  4) However, numbers are assembled as one sequence. This means    */
+    /*     that undefined situations (like CS following digits, until    */
+    /*     it is known if the next char will be a digit) are held until  */
+    /*     following chars define them.                                  */
+    /*     Example: digits followed by CS, then comes another CS or ON;  */
+    /*              the digits will be processed, then the CS assigned   */
+    /*              as the start of an ON sequence (action 3).           */
+    /*  5) There are cases where more than one sequence must be          */
+    /*     processed, for instance digits followed by CS followed by L:  */
+    /*     the digits must be processed as one sequence, and the CS      */
+    /*     must be processed as an ON sequence, all this before starting */
+    /*     assembling chars for the opening L sequence.                  */
+    /*                                                                   */
+    /*                                                                   */
+    private static final short impTabProps[][] =
+    {
+/*                        L,     R,    EN,    AN,    ON,     S,     B,    ES,    ET,    CS,    BN,   NSM,    AL,  Res */
+/* 0 Init        */ {     1,     2,     4,     5,     7,    15,    17,     7,     9,     7,     0,     7,     3,  _ON },
+/* 1 L           */ {     1,  32+2,  32+4,  32+5,  32+7, 32+15, 32+17,  32+7,  32+9,  32+7,     1,     1,  32+3,   _L },
+/* 2 R           */ {  32+1,     2,  32+4,  32+5,  32+7, 32+15, 32+17,  32+7,  32+9,  32+7,     2,     2,  32+3,   _R },
+/* 3 AL          */ {  32+1,  32+2,  32+6,  32+6,  32+8, 32+16, 32+17,  32+8,  32+8,  32+8,     3,     3,     3,   _R },
+/* 4 EN          */ {  32+1,  32+2,     4,  32+5,  32+7, 32+15, 32+17, 64+10,    11, 64+10,     4,     4,  32+3,  _EN },
+/* 5 AN          */ {  32+1,  32+2,  32+4,     5,  32+7, 32+15, 32+17,  32+7,  32+9, 64+12,     5,     5,  32+3,  _AN },
+/* 6 AL:EN/AN    */ {  32+1,  32+2,     6,     6,  32+8, 32+16, 32+17,  32+8,  32+8, 64+13,     6,     6,  32+3,  _AN },
+/* 7 ON          */ {  32+1,  32+2,  32+4,  32+5,     7, 32+15, 32+17,     7, 64+14,     7,     7,     7,  32+3,  _ON },
+/* 8 AL:ON       */ {  32+1,  32+2,  32+6,  32+6,     8, 32+16, 32+17,     8,     8,     8,     8,     8,  32+3,  _ON },
+/* 9 ET          */ {  32+1,  32+2,     4,  32+5,     7, 32+15, 32+17,     7,     9,     7,     9,     9,  32+3,  _ON },
+/*10 EN+ES/CS    */ {  96+1,  96+2,     4,  96+5, 128+7, 96+15, 96+17, 128+7,128+14, 128+7,    10, 128+7,  96+3,  _EN },
+/*11 EN+ET       */ {  32+1,  32+2,     4,  32+5,  32+7, 32+15, 32+17,  32+7,    11,  32+7,    11,    11,  32+3,  _EN },
+/*12 AN+CS       */ {  96+1,  96+2,  96+4,     5, 128+7, 96+15, 96+17, 128+7,128+14, 128+7,    12, 128+7,  96+3,  _AN },
+/*13 AL:EN/AN+CS */ {  96+1,  96+2,     6,     6, 128+8, 96+16, 96+17, 128+8, 128+8, 128+8,    13, 128+8,  96+3,  _AN },
+/*14 ON+ET       */ {  32+1,  32+2, 128+4,  32+5,     7, 32+15, 32+17,     7,    14,     7,    14,    14,  32+3,  _ON },
+/*15 S           */ {  32+1,  32+2,  32+4,  32+5,  32+7,    15, 32+17,  32+7,  32+9,  32+7,    15,  32+7,  32+3,   _S },
+/*16 AL:S        */ {  32+1,  32+2,  32+6,  32+6,  32+8,    16, 32+17,  32+8,  32+8,  32+8,    16,  32+8,  32+3,   _S },
+/*17 B           */ {  32+1,  32+2,  32+4,  32+5,  32+7, 32+15,    17,  32+7,  32+9,  32+7,    17,  32+7,  32+3,   _B }
+    };
+
+    /*********************************************************************/
+    /* The levels state machine tables                                   */
+    /*********************************************************************/
+    /*                                                                   */
+    /* All table cells are 8 bits:                                       */
+    /*      bits 0..3:  next state                                       */
+    /*      bits 4..7:  action to perform (if > 0)                       */
+    /*                                                                   */
+    /* Cells may be of format "n" where n represents the next state      */
+    /* (except for the rightmost column).                                */
+    /* Cells may also be of format "_(x,y)" where x represents an action */
+    /* to perform and y represents the next state.                       */
+    /*                                                                   */
+    /* This format limits each table to 16 states each and to 15 actions.*/
+    /*                                                                   */
+    /*********************************************************************/
+    /* Definitions and type for levels state tables                      */
+    /*********************************************************************/
+    private static final int IMPTABLEVELS_COLUMNS = _B + 2;
+    private static final int IMPTABLEVELS_RES = IMPTABLEVELS_COLUMNS - 1;
+    private static short GetState(byte cell) { return (short)(cell & 0x0f); }
+    private static short GetAction(byte cell) { return (short)(cell >> 4); }
+
+    private static class ImpTabPair {
+        byte[][][] imptab;
+        short[][] impact;
+
+        ImpTabPair(byte[][] table1, byte[][] table2,
+                   short[] act1, short[] act2) {
+            imptab = new byte[][][] {table1, table2};
+            impact = new short[][] {act1, act2};
+        }
+    }
+
+    /*********************************************************************/
+    /*                                                                   */
+    /*      LEVELS  STATE  TABLES                                        */
+    /*                                                                   */
+    /* In all levels state tables,                                       */
+    /*      - state 0 is the initial state                               */
+    /*      - the Res column is the increment to add to the text level   */
+    /*        for this property sequence.                                */
+    /*                                                                   */
+    /* The impact arrays for each table of a pair map the local action   */
+    /* numbers of the table to the total list of actions. For instance,  */
+    /* action 2 in a given table corresponds to the action number which  */
+    /* appears in entry [2] of the impact array for that table.          */
+    /* The first entry of all impact arrays must be 0.                   */
+    /*                                                                   */
+    /* Action 1: init conditional sequence                               */
+    /*        2: prepend conditional sequence to current sequence        */
+    /*        3: set ON sequence to new level - 1                        */
+    /*        4: init EN/AN/ON sequence                                  */
+    /*        5: fix EN/AN/ON sequence followed by R                     */
+    /*        6: set previous level sequence to level 2                  */
+    /*                                                                   */
+    /* Notes:                                                            */
+    /*  1) These tables are used in processPropertySeq(). The input      */
+    /*     is property sequences as determined by resolveImplicitLevels. */
+    /*  2) Most such property sequences are processed immediately        */
+    /*     (levels are assigned).                                        */
+    /*  3) However, some sequences cannot be assigned a final level till */
+    /*     one or more following sequences are received. For instance,   */
+    /*     ON following an R sequence within an even-level paragraph.    */
+    /*     If the following sequence is R, the ON sequence will be       */
+    /*     assigned basic run level+1, and so will the R sequence.       */
+    /*  4) S is generally handled like ON, since its level will be fixed */
+    /*     to paragraph level in adjustWSLevels().                       */
+    /*                                                                   */
+
+    private static final byte impTabL_DEFAULT[][] = /* Even paragraph level */
+        /*  In this table, conditional sequences receive the higher possible level
+            until proven otherwise.
+        */
+    {
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     0,     1,     0,     2,     0,     0,     0,  0 },
+        /* 1 : R          */ {     0,     1,     3,     3,  0x14,  0x14,     0,  1 },
+        /* 2 : AN         */ {     0,     1,     0,     2,  0x15,  0x15,     0,  2 },
+        /* 3 : R+EN/AN    */ {     0,     1,     3,     3,  0x14,  0x14,     0,  2 },
+        /* 4 : R+ON       */ {  0x20,     1,     3,     3,     4,     4,  0x20,  1 },
+        /* 5 : AN+ON      */ {  0x20,     1,  0x20,     2,     5,     5,  0x20,  1 }
+    };
+
+    private static final byte impTabR_DEFAULT[][] = /* Odd  paragraph level */
+        /*  In this table, conditional sequences receive the lower possible level
+            until proven otherwise.
+        */
+    {
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     1,     0,     2,     2,     0,     0,     0,  0 },
+        /* 1 : L          */ {     1,     0,     1,     3,  0x14,  0x14,     0,  1 },
+        /* 2 : EN/AN      */ {     1,     0,     2,     2,     0,     0,     0,  1 },
+        /* 3 : L+AN       */ {     1,     0,     1,     3,     5,     5,     0,  1 },
+        /* 4 : L+ON       */ {  0x21,     0,  0x21,     3,     4,     4,     0,  0 },
+        /* 5 : L+AN+ON    */ {     1,     0,     1,     3,     5,     5,     0,  0 }
+    };
+
+    private static final short[] impAct0 = {0,1,2,3,4,5,6};
+
+    private static final ImpTabPair impTab_DEFAULT = new ImpTabPair(
+            impTabL_DEFAULT, impTabR_DEFAULT, impAct0, impAct0);
+
+    private static final byte impTabL_NUMBERS_SPECIAL[][] = { /* Even paragraph level */
+        /* In this table, conditional sequences receive the higher possible
+           level until proven otherwise.
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     0,     2,     1,     1,     0,     0,     0,  0 },
+        /* 1 : L+EN/AN    */ {     0,     2,     1,     1,     0,     0,     0,  2 },
+        /* 2 : R          */ {     0,     2,     4,     4,  0x13,     0,     0,  1 },
+        /* 3 : R+ON       */ {  0x20,     2,     4,     4,     3,     3,  0x20,  1 },
+        /* 4 : R+EN/AN    */ {     0,     2,     4,     4,  0x13,  0x13,     0,  2 }
+    };
+    private static final ImpTabPair impTab_NUMBERS_SPECIAL = new ImpTabPair(
+            impTabL_NUMBERS_SPECIAL, impTabR_DEFAULT, impAct0, impAct0);
+
+    private static final byte impTabL_GROUP_NUMBERS_WITH_R[][] = {
+        /* In this table, EN/AN+ON sequences receive levels as if associated with R
+           until proven that there is L or sor/eor on both sides. AN is handled like EN.
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 init         */ {     0,     3,  0x11,  0x11,     0,     0,     0,  0 },
+        /* 1 EN/AN        */ {  0x20,     3,     1,     1,     2,  0x20,  0x20,  2 },
+        /* 2 EN/AN+ON     */ {  0x20,     3,     1,     1,     2,  0x20,  0x20,  1 },
+        /* 3 R            */ {     0,     3,     5,     5,  0x14,     0,     0,  1 },
+        /* 4 R+ON         */ {  0x20,     3,     5,     5,     4,  0x20,  0x20,  1 },
+        /* 5 R+EN/AN      */ {     0,     3,     5,     5,  0x14,     0,     0,  2 }
+    };
+    private static final byte impTabR_GROUP_NUMBERS_WITH_R[][] = {
+        /*  In this table, EN/AN+ON sequences receive levels as if associated with R
+            until proven that there is L on both sides. AN is handled like EN.
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 init         */ {     2,     0,     1,     1,     0,     0,     0,  0 },
+        /* 1 EN/AN        */ {     2,     0,     1,     1,     0,     0,     0,  1 },
+        /* 2 L            */ {     2,     0,  0x14,  0x14,  0x13,     0,     0,  1 },
+        /* 3 L+ON         */ {  0x22,     0,     4,     4,     3,     0,     0,  0 },
+        /* 4 L+EN/AN      */ {  0x22,     0,     4,     4,     3,     0,     0,  1 }
+    };
+    private static final ImpTabPair impTab_GROUP_NUMBERS_WITH_R = new
+            ImpTabPair(impTabL_GROUP_NUMBERS_WITH_R,
+                       impTabR_GROUP_NUMBERS_WITH_R, impAct0, impAct0);
+
+    private static final byte impTabL_INVERSE_NUMBERS_AS_L[][] = {
+        /* This table is identical to the Default LTR table except that EN and AN
+           are handled like L.
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     0,     1,     0,     0,     0,     0,     0,  0 },
+        /* 1 : R          */ {     0,     1,     0,     0,  0x14,  0x14,     0,  1 },
+        /* 2 : AN         */ {     0,     1,     0,     0,  0x15,  0x15,     0,  2 },
+        /* 3 : R+EN/AN    */ {     0,     1,     0,     0,  0x14,  0x14,     0,  2 },
+        /* 4 : R+ON       */ {  0x20,     1,  0x20,  0x20,     4,     4,  0x20,  1 },
+        /* 5 : AN+ON      */ {  0x20,     1,  0x20,  0x20,     5,     5,  0x20,  1 }
+    };
+    private static final byte impTabR_INVERSE_NUMBERS_AS_L[][] = {
+        /* This table is identical to the Default RTL table except that EN and AN
+           are handled like L.
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     1,     0,     1,     1,     0,     0,     0,  0 },
+        /* 1 : L          */ {     1,     0,     1,     1,  0x14,  0x14,     0,  1 },
+        /* 2 : EN/AN      */ {     1,     0,     1,     1,     0,     0,     0,  1 },
+        /* 3 : L+AN       */ {     1,     0,     1,     1,     5,     5,     0,  1 },
+        /* 4 : L+ON       */ {  0x21,     0,  0x21,  0x21,     4,     4,     0,  0 },
+        /* 5 : L+AN+ON    */ {     1,     0,     1,     1,     5,     5,     0,  0 }
+    };
+    private static final ImpTabPair impTab_INVERSE_NUMBERS_AS_L = new ImpTabPair
+            (impTabL_INVERSE_NUMBERS_AS_L, impTabR_INVERSE_NUMBERS_AS_L,
+             impAct0, impAct0);
+
+    private static final byte impTabR_INVERSE_LIKE_DIRECT[][] = {  /* Odd  paragraph level */
+        /*  In this table, conditional sequences receive the lower possible level
+            until proven otherwise.
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     1,     0,     2,     2,     0,     0,     0,  0 },
+        /* 1 : L          */ {     1,     0,     1,     2,  0x13,  0x13,     0,  1 },
+        /* 2 : EN/AN      */ {     1,     0,     2,     2,     0,     0,     0,  1 },
+        /* 3 : L+ON       */ {  0x21,  0x30,     6,     4,     3,     3,  0x30,  0 },
+        /* 4 : L+ON+AN    */ {  0x21,  0x30,     6,     4,     5,     5,  0x30,  3 },
+        /* 5 : L+AN+ON    */ {  0x21,  0x30,     6,     4,     5,     5,  0x30,  2 },
+        /* 6 : L+ON+EN    */ {  0x21,  0x30,     6,     4,     3,     3,  0x30,  1 }
+    };
+    private static final short[] impAct1 = {0,1,11,12};
+    private static final ImpTabPair impTab_INVERSE_LIKE_DIRECT = new ImpTabPair(
+            impTabL_DEFAULT, impTabR_INVERSE_LIKE_DIRECT, impAct0, impAct1);
+
+    private static final byte impTabL_INVERSE_LIKE_DIRECT_WITH_MARKS[][] = {
+        /* The case handled in this table is (visually):  R EN L
+         */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     0,  0x63,     0,     1,     0,     0,     0,  0 },
+        /* 1 : L+AN       */ {     0,  0x63,     0,     1,  0x12,  0x30,     0,  4 },
+        /* 2 : L+AN+ON    */ {  0x20,  0x63,  0x20,     1,     2,  0x30,  0x20,  3 },
+        /* 3 : R          */ {     0,  0x63,  0x55,  0x56,  0x14,  0x30,     0,  3 },
+        /* 4 : R+ON       */ {  0x30,  0x43,  0x55,  0x56,     4,  0x30,  0x30,  3 },
+        /* 5 : R+EN       */ {  0x30,  0x43,     5,  0x56,  0x14,  0x30,  0x30,  4 },
+        /* 6 : R+AN       */ {  0x30,  0x43,  0x55,     6,  0x14,  0x30,  0x30,  4 }
+    };
+    private static final byte impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS[][] = {
+        /* The cases handled in this table are (visually):  R EN L
+                                                            R L AN L
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {  0x13,     0,     1,     1,     0,     0,     0,  0 },
+        /* 1 : R+EN/AN    */ {  0x23,     0,     1,     1,     2,  0x40,     0,  1 },
+        /* 2 : R+EN/AN+ON */ {  0x23,     0,     1,     1,     2,  0x40,     0,  0 },
+        /* 3 : L          */ {    3 ,     0,     3,  0x36,  0x14,  0x40,     0,  1 },
+        /* 4 : L+ON       */ {  0x53,  0x40,     5,  0x36,     4,  0x40,  0x40,  0 },
+        /* 5 : L+ON+EN    */ {  0x53,  0x40,     5,  0x36,     4,  0x40,  0x40,  1 },
+        /* 6 : L+AN       */ {  0x53,  0x40,     6,     6,     4,  0x40,  0x40,  3 }
+    };
+    private static final short impAct2[] = {0,1,7,8,9,10};
+    private static final ImpTabPair impTab_INVERSE_LIKE_DIRECT_WITH_MARKS =
+            new ImpTabPair(impTabL_INVERSE_LIKE_DIRECT_WITH_MARKS,
+                           impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS, impAct0, impAct2);
+
+    private static final ImpTabPair impTab_INVERSE_FOR_NUMBERS_SPECIAL = new ImpTabPair(
+            impTabL_NUMBERS_SPECIAL, impTabR_INVERSE_LIKE_DIRECT, impAct0, impAct1);
+
+    private static final byte impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS[][] = {
+        /*  The case handled in this table is (visually):  R EN L
+        */
+        /*                         L,     R,    EN,    AN,    ON,     S,     B, Res */
+        /* 0 : init       */ {     0,  0x62,     1,     1,     0,     0,     0,  0 },
+        /* 1 : L+EN/AN    */ {     0,  0x62,     1,     1,     0,  0x30,     0,  4 },
+        /* 2 : R          */ {     0,  0x62,  0x54,  0x54,  0x13,  0x30,     0,  3 },
+        /* 3 : R+ON       */ {  0x30,  0x42,  0x54,  0x54,     3,  0x30,  0x30,  3 },
+        /* 4 : R+EN/AN    */ {  0x30,  0x42,     4,     4,  0x13,  0x30,  0x30,  4 }
+    };
+    private static final ImpTabPair impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS = new
+            ImpTabPair(impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS,
+                       impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS, impAct0, impAct2);
+
+    private class LevState {
+        byte[][] impTab;                /* level table pointer          */
+        short[] impAct;                 /* action map array             */
+        int startON;                    /* start of ON sequence         */
+        int startL2EN;                  /* start of level 2 sequence    */
+        int lastStrongRTL;              /* index of last found R or AL  */
+        short state;                    /* current state                */
+        byte runLevel;                  /* run level before implicit solving */
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    static final int FIRSTALLOC = 10;
+    /*
+     *  param pos:     position where to insert
+     *  param flag:    one of LRM_BEFORE, LRM_AFTER, RLM_BEFORE, RLM_AFTER
+     */
+    private void addPoint(int pos, int flag)
+    {
+        Point point = new Point();
+
+        int len = insertPoints.points.length;
+        if (len == 0) {
+            insertPoints.points = new Point[FIRSTALLOC];
+            len = FIRSTALLOC;
+        }
+        if (insertPoints.size >= len) { /* no room for new point */
+            Point[] savePoints = insertPoints.points;
+            insertPoints.points = new Point[len * 2];
+            System.arraycopy(savePoints, 0, insertPoints.points, 0, len);
+        }
+        point.pos = pos;
+        point.flag = flag;
+        insertPoints.points[insertPoints.size] = point;
+        insertPoints.size++;
+    }
+
+    /* perform rules (Wn), (Nn), and (In) on a run of the text ------------------ */
+
+    /*
+     * This implementation of the (Wn) rules applies all rules in one pass.
+     * In order to do so, it needs a look-ahead of typically 1 character
+     * (except for W5: sequences of ET) and keeps track of changes
+     * in a rule Wp that affect a later Wq (p<q).
+     *
+     * The (Nn) and (In) rules are also performed in that same single loop,
+     * but effectively one iteration behind for white space.
+     *
+     * Since all implicit rules are performed in one step, it is not necessary
+     * to actually store the intermediate directional properties in dirProps[].
+     */
+
+    private void processPropertySeq(LevState levState, short _prop,
+            int start, int limit) {
+        byte cell;
+        byte[][] impTab = levState.impTab;
+        short[] impAct = levState.impAct;
+        short oldStateSeq,actionSeq;
+        byte level, addLevel;
+        int start0, k;
+
+        start0 = start;                 /* save original start position */
+        oldStateSeq = levState.state;
+        cell = impTab[oldStateSeq][_prop];
+        levState.state = GetState(cell);        /* isolate the new state */
+        actionSeq = impAct[GetAction(cell)];    /* isolate the action */
+        addLevel = (byte)impTab[levState.state][IMPTABLEVELS_RES];
+
+        if (actionSeq != 0) {
+            switch (actionSeq) {
+            case 1:                     /* init ON seq */
+                levState.startON = start0;
+                break;
+
+            case 2:                     /* prepend ON seq to current seq */
+                start = levState.startON;
+                break;
+
+            case 3:                     /* L or S after possible relevant EN/AN */
+                /* check if we had EN after R/AL */
+                if (levState.startL2EN >= 0) {
+                    addPoint(levState.startL2EN, LRM_BEFORE);
+                }
+                levState.startL2EN = -1;  /* not within previous if since could also be -2 */
+                /* check if we had any relevant EN/AN after R/AL */
+                if ((insertPoints.points.length == 0) ||
+                        (insertPoints.size <= insertPoints.confirmed)) {
+                    /* nothing, just clean up */
+                    levState.lastStrongRTL = -1;
+                    /* check if we have a pending conditional segment */
+                    level = (byte)impTab[oldStateSeq][IMPTABLEVELS_RES];
+                    if ((level & 1) != 0 && levState.startON > 0) { /* after ON */
+                        start = levState.startON;   /* reset to basic run level */
+                    }
+                    if (_prop == _S) {              /* add LRM before S */
+                        addPoint(start0, LRM_BEFORE);
+                        insertPoints.confirmed = insertPoints.size;
+                    }
+                    break;
+                }
+                /* reset previous RTL cont to level for LTR text */
+                for (k = levState.lastStrongRTL + 1; k < start0; k++) {
+                    /* reset odd level, leave runLevel+2 as is */
+                    levels[k] = (byte)((levels[k] - 2) & ~1);
+                }
+                /* mark insert points as confirmed */
+                insertPoints.confirmed = insertPoints.size;
+                levState.lastStrongRTL = -1;
+                if (_prop == _S) {           /* add LRM before S */
+                    addPoint(start0, LRM_BEFORE);
+                    insertPoints.confirmed = insertPoints.size;
+                }
+                break;
+
+            case 4:                     /* R/AL after possible relevant EN/AN */
+                /* just clean up */
+                if (insertPoints.points.length > 0)
+                    /* remove all non confirmed insert points */
+                    insertPoints.size = insertPoints.confirmed;
+                levState.startON = -1;
+                levState.startL2EN = -1;
+                levState.lastStrongRTL = limit - 1;
+                break;
+
+            case 5:                     /* EN/AN after R/AL + possible cont */
+                /* check for real AN */
+                if ((_prop == _AN) && (NoContextRTL(dirProps[start0]) == AN)) {
+                    /* real AN */
+                    if (levState.startL2EN == -1) { /* if no relevant EN already found */
+                        /* just note the righmost digit as a strong RTL */
+                        levState.lastStrongRTL = limit - 1;
+                        break;
+                    }
+                    if (levState.startL2EN >= 0)  { /* after EN, no AN */
+                        addPoint(levState.startL2EN, LRM_BEFORE);
+                        levState.startL2EN = -2;
+                    }
+                    /* note AN */
+                    addPoint(start0, LRM_BEFORE);
+                    break;
+                }
+                /* if first EN/AN after R/AL */
+                if (levState.startL2EN == -1) {
+                    levState.startL2EN = start0;
+                }
+                break;
+
+            case 6:                     /* note location of latest R/AL */
+                levState.lastStrongRTL = limit - 1;
+                levState.startON = -1;
+                break;
+
+            case 7:                     /* L after R+ON/EN/AN */
+                /* include possible adjacent number on the left */
+                for (k = start0-1; k >= 0 && ((levels[k] & 1) == 0); k--) {
+                }
+                if (k >= 0) {
+                    addPoint(k, RLM_BEFORE);    /* add RLM before */
+                    insertPoints.confirmed = insertPoints.size; /* confirm it */
+                }
+                levState.startON = start0;
+                break;
+
+            case 8:                     /* AN after L */
+                /* AN numbers between L text on both sides may be trouble. */
+                /* tentatively bracket with LRMs; will be confirmed if followed by L */
+                addPoint(start0, LRM_BEFORE);   /* add LRM before */
+                addPoint(start0, LRM_AFTER);    /* add LRM after  */
+                break;
+
+            case 9:                     /* R after L+ON/EN/AN */
+                /* false alert, infirm LRMs around previous AN */
+                insertPoints.size=insertPoints.confirmed;
+                if (_prop == _S) {          /* add RLM before S */
+                    addPoint(start0, RLM_BEFORE);
+                    insertPoints.confirmed = insertPoints.size;
+                }
+                break;
+
+            case 10:                    /* L after L+ON/AN */
+                level = (byte)(levState.runLevel + addLevel);
+                for (k=levState.startON; k < start0; k++) {
+                    if (levels[k] < level) {
+                        levels[k] = level;
+                    }
+                }
+                insertPoints.confirmed = insertPoints.size;   /* confirm inserts */
+                levState.startON = start0;
+                break;
+
+            case 11:                    /* L after L+ON+EN/AN/ON */
+                level = (byte)levState.runLevel;
+                for (k = start0-1; k >= levState.startON; k--) {
+                    if (levels[k] == level+3) {
+                        while (levels[k] == level+3) {
+                            levels[k--] -= 2;
+                        }
+                        while (levels[k] == level) {
+                            k--;
+                        }
+                    }
+                    if (levels[k] == level+2) {
+                        levels[k] = level;
+                        continue;
+                    }
+                    levels[k] = (byte)(level+1);
+                }
+                break;
+
+            case 12:                    /* R after L+ON+EN/AN/ON */
+                level = (byte)(levState.runLevel+1);
+                for (k = start0-1; k >= levState.startON; k--) {
+                    if (levels[k] > level) {
+                        levels[k] -= 2;
+                    }
+                }
+                break;
+
+            default:                        /* we should never get here */
+                throw new IllegalStateException("Internal ICU error in processPropertySeq");
+            }
+        }
+        if ((addLevel) != 0 || (start < start0)) {
+            level = (byte)(levState.runLevel + addLevel);
+            for (k = start; k < limit; k++) {
+                levels[k] = level;
+            }
+        }
+    }
+
+    private void resolveImplicitLevels(int start, int limit, short sor, short eor)
+    {
+        LevState levState = new LevState();
+        int i, start1, start2;
+        short oldStateImp, stateImp, actionImp;
+        short gprop, resProp, cell;
+        short nextStrongProp = R;
+        int nextStrongPos = -1;
+
+
+        /* check for RTL inverse Bidi mode */
+        /* FOOD FOR THOUGHT: in case of RTL inverse Bidi, it would make sense to
+         * loop on the text characters from end to start.
+         * This would need a different properties state table (at least different
+         * actions) and different levels state tables (maybe very similar to the
+         * LTR corresponding ones.
+         */
+        /* initialize for levels state table */
+        levState.startL2EN = -1;        /* used for INVERSE_LIKE_DIRECT_WITH_MARKS */
+        levState.lastStrongRTL = -1;    /* used for INVERSE_LIKE_DIRECT_WITH_MARKS */
+        levState.state = 0;
+        levState.runLevel = levels[start];
+        levState.impTab = impTabPair.imptab[levState.runLevel & 1];
+        levState.impAct = impTabPair.impact[levState.runLevel & 1];
+        processPropertySeq(levState, (short)sor, start, start);
+        /* initialize for property state table */
+        if (dirProps[start] == NSM) {
+            stateImp = (short)(1 + sor);
+        } else {
+            stateImp = 0;
+        }
+        start1 = start;
+        start2 = 0;
+
+        for (i = start; i <= limit; i++) {
+            if (i >= limit) {
+                gprop = eor;
+            } else {
+                short prop, prop1;
+                prop = NoContextRTL(dirProps[i]);
+                gprop = groupProp[prop];
+            }
+            oldStateImp = stateImp;
+            cell = impTabProps[oldStateImp][gprop];
+            stateImp = GetStateProps(cell);     /* isolate the new state */
+            actionImp = GetActionProps(cell);   /* isolate the action */
+            if ((i == limit) && (actionImp == 0)) {
+                /* there is an unprocessed sequence if its property == eor   */
+                actionImp = 1;                  /* process the last sequence */
+            }
+            if (actionImp != 0) {
+                resProp = impTabProps[oldStateImp][IMPTABPROPS_RES];
+                switch (actionImp) {
+                case 1:             /* process current seq1, init new seq1 */
+                    processPropertySeq(levState, resProp, start1, i);
+                    start1 = i;
+                    break;
+                case 2:             /* init new seq2 */
+                    start2 = i;
+                    break;
+                case 3:             /* process seq1, process seq2, init new seq1 */
+                    processPropertySeq(levState, resProp, start1, start2);
+                    processPropertySeq(levState, _ON, start2, i);
+                    start1 = i;
+                    break;
+                case 4:             /* process seq1, set seq1=seq2, init new seq2 */
+                    processPropertySeq(levState, resProp, start1, start2);
+                    start1 = start2;
+                    start2 = i;
+                    break;
+                default:            /* we should never get here */
+                    throw new IllegalStateException("Internal ICU error in resolveImplicitLevels");
+                }
+            }
+        }
+        /* flush possible pending sequence, e.g. ON */
+        processPropertySeq(levState, (short)eor, limit, limit);
+    }
+
+    /* perform (L1) and (X9) ---------------------------------------------------- */
+
+    /*
+     * Reset the embedding levels for some non-graphic characters (L1).
+     * This method also sets appropriate levels for BN, and
+     * explicit embedding types that are supposed to have been removed
+     * from the paragraph in (X9).
+     */
+    private void adjustWSLevels() {
+        int i;
+
+        if ((flags & MASK_WS) != 0) {
+            int flag;
+            i = trailingWSStart;
+            while (i > 0) {
+                /* reset a sequence of WS/BN before eop and B/S to the paragraph paraLevel */
+                while (i > 0 && ((flag = DirPropFlagNC(dirProps[--i])) & MASK_WS) != 0) {
+                    if (orderParagraphsLTR && (flag & DirPropFlag(B)) != 0) {
+                        levels[i] = 0;
+                    } else {
+                        levels[i] = GetParaLevelAt(i);
+                    }
+                }
+
+                /* reset BN to the next character's paraLevel until B/S, which restarts above loop */
+                /* here, i+1 is guaranteed to be <length */
+                while (i > 0) {
+                    flag = DirPropFlagNC(dirProps[--i]);
+                    if ((flag & MASK_BN_EXPLICIT) != 0) {
+                        levels[i] = levels[i + 1];
+                    } else if (orderParagraphsLTR && (flag & DirPropFlag(B)) != 0) {
+                        levels[i] = 0;
+                        break;
+                    } else if ((flag & MASK_B_S) != 0){
+                        levels[i] = GetParaLevelAt(i);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    private int Bidi_Min(int x, int y) {
+        return x < y ? x : y;
+    }
+
+    private int Bidi_Abs(int x) {
+        return x >= 0 ? x : -x;
+    }
+
+    /**
+     * Perform the Unicode Bidi algorithm. It is defined in the
+     * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,
+     * version 13,
+     * also described in The Unicode Standard, Version 4.0 .<p>
+     *
+     * This method takes a piece of plain text containing one or more paragraphs,
+     * with or without externally specified embedding levels from <i>styled</i>
+     * text and computes the left-right-directionality of each character.<p>
+     *
+     * If the entire text is all of the same directionality, then
+     * the method may not perform all the steps described by the algorithm,
+     * i.e., some levels may not be the same as if all steps were performed.
+     * This is not relevant for unidirectional text.<br>
+     * For example, in pure LTR text with numbers the numbers would get
+     * a resolved level of 2 higher than the surrounding text according to
+     * the algorithm. This implementation may set all resolved levels to
+     * the same value in such a case.<p>
+     *
+     * The text can be composed of multiple paragraphs. Occurrence of a block
+     * separator in the text terminates a paragraph, and whatever comes next starts
+     * a new paragraph. The exception to this rule is when a Carriage Return (CR)
+     * is followed by a Line Feed (LF). Both CR and LF are block separators, but
+     * in that case, the pair of characters is considered as terminating the
+     * preceding paragraph, and a new paragraph will be started by a character
+     * coming after the LF.
+     *
+     * Although the text is passed here as a <code>String</code>, it is
+     * stored internally as an array of characters. Therefore the
+     * documentation will refer to indexes of the characters in the text.
+     *
+     * @param text contains the text that the Bidi algorithm will be performed
+     *        on. This text can be retrieved with <code>getText()</code> or
+     *        <code>getTextAsString</code>.<br>
+     *
+     * @param paraLevel specifies the default level for the text;
+     *        it is typically 0 (LTR) or 1 (RTL).
+     *        If the method shall determine the paragraph level from the text,
+     *        then <code>paraLevel</code> can be set to
+     *        either <code>LEVEL_DEFAULT_LTR</code>
+     *        or <code>LEVEL_DEFAULT_RTL</code>; if the text contains multiple
+     *        paragraphs, the paragraph level shall be determined separately for
+     *        each paragraph; if a paragraph does not include any strongly typed
+     *        character, then the desired default is used (0 for LTR or 1 for RTL).
+     *        Any other value between 0 and <code>MAX_EXPLICIT_LEVEL</code>
+     *        is also valid, with odd levels indicating RTL.
+     *
+     * @param embeddingLevels (in) may be used to preset the embedding and override levels,
+     *        ignoring characters like LRE and PDF in the text.
+     *        A level overrides the directional property of its corresponding
+     *        (same index) character if the level has the
+     *        <code>LEVEL_OVERRIDE</code> bit set.<br><br>
+     *        Except for that bit, it must be
+     *        <code>paraLevel<=embeddingLevels[]<=MAX_EXPLICIT_LEVEL</code>,
+     *        with one exception: a level of zero may be specified for a
+     *        paragraph separator even if <code>paraLevel&gt;0</code> when multiple
+     *        paragraphs are submitted in the same call to <code>setPara()</code>.<br><br>
+     *        <strong>Caution: </strong>A reference to this array, not a copy
+     *        of the levels, will be stored in the <code>Bidi</code> object;
+     *        the <code>embeddingLevels</code>
+     *        should not be modified to avoid unexpected results on subsequent
+     *        Bidi operations. However, the <code>setPara()</code> and
+     *        <code>setLine()</code> methods may modify some or all of the
+     *        levels.<br><br>
+     *        <strong>Note:</strong> the <code>embeddingLevels</code> array must
+     *        have one entry for each character in <code>text</code>.
+     *
+     * @throws IllegalArgumentException if the values in embeddingLevels are
+     *         not within the allowed range
+     *
+     * @see #LEVEL_DEFAULT_LTR
+     * @see #LEVEL_DEFAULT_RTL
+     * @see #LEVEL_OVERRIDE
+     * @see #MAX_EXPLICIT_LEVEL
+     * @stable ICU 3.8
+     */
+    void setPara(String text, byte paraLevel, byte[] embeddingLevels)
+    {
+        if (text == null) {
+            setPara(new char[0], paraLevel, embeddingLevels);
+        } else {
+            setPara(text.toCharArray(), paraLevel, embeddingLevels);
+        }
+    }
+
+    /**
+     * Perform the Unicode Bidi algorithm. It is defined in the
+     * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,
+     * version 13,
+     * also described in The Unicode Standard, Version 4.0 .<p>
+     *
+     * This method takes a piece of plain text containing one or more paragraphs,
+     * with or without externally specified embedding levels from <i>styled</i>
+     * text and computes the left-right-directionality of each character.<p>
+     *
+     * If the entire text is all of the same directionality, then
+     * the method may not perform all the steps described by the algorithm,
+     * i.e., some levels may not be the same as if all steps were performed.
+     * This is not relevant for unidirectional text.<br>
+     * For example, in pure LTR text with numbers the numbers would get
+     * a resolved level of 2 higher than the surrounding text according to
+     * the algorithm. This implementation may set all resolved levels to
+     * the same value in such a case.<p>
+     *
+     * The text can be composed of multiple paragraphs. Occurrence of a block
+     * separator in the text terminates a paragraph, and whatever comes next starts
+     * a new paragraph. The exception to this rule is when a Carriage Return (CR)
+     * is followed by a Line Feed (LF). Both CR and LF are block separators, but
+     * in that case, the pair of characters is considered as terminating the
+     * preceding paragraph, and a new paragraph will be started by a character
+     * coming after the LF.
+     *
+     * The text is stored internally as an array of characters. Therefore the
+     * documentation will refer to indexes of the characters in the text.
+     *
+     * @param chars contains the text that the Bidi algorithm will be performed
+     *        on. This text can be retrieved with <code>getText()</code> or
+     *        <code>getTextAsString</code>.<br>
+     *
+     * @param paraLevel specifies the default level for the text;
+     *        it is typically 0 (LTR) or 1 (RTL).
+     *        If the method shall determine the paragraph level from the text,
+     *        then <code>paraLevel</code> can be set to
+     *        either <code>LEVEL_DEFAULT_LTR</code>
+     *        or <code>LEVEL_DEFAULT_RTL</code>; if the text contains multiple
+     *        paragraphs, the paragraph level shall be determined separately for
+     *        each paragraph; if a paragraph does not include any strongly typed
+     *        character, then the desired default is used (0 for LTR or 1 for RTL).
+     *        Any other value between 0 and <code>MAX_EXPLICIT_LEVEL</code>
+     *        is also valid, with odd levels indicating RTL.
+     *
+     * @param embeddingLevels (in) may be used to preset the embedding and
+     *        override levels, ignoring characters like LRE and PDF in the text.
+     *        A level overrides the directional property of its corresponding
+     *        (same index) character if the level has the
+     *        <code>LEVEL_OVERRIDE</code> bit set.<br><br>
+     *        Except for that bit, it must be
+     *        <code>paraLevel<=embeddingLevels[]<=MAX_EXPLICIT_LEVEL</code>,
+     *        with one exception: a level of zero may be specified for a
+     *        paragraph separator even if <code>paraLevel&gt;0</code> when multiple
+     *        paragraphs are submitted in the same call to <code>setPara()</code>.<br><br>
+     *        <strong>Caution: </strong>A reference to this array, not a copy
+     *        of the levels, will be stored in the <code>Bidi</code> object;
+     *        the <code>embeddingLevels</code>
+     *        should not be modified to avoid unexpected results on subsequent
+     *        Bidi operations. However, the <code>setPara()</code> and
+     *        <code>setLine()</code> methods may modify some or all of the
+     *        levels.<br><br>
+     *        <strong>Note:</strong> the <code>embeddingLevels</code> array must
+     *        have one entry for each character in <code>text</code>.
+     *
+     * @throws IllegalArgumentException if the values in embeddingLevels are
+     *         not within the allowed range
+     *
+     * @see #LEVEL_DEFAULT_LTR
+     * @see #LEVEL_DEFAULT_RTL
+     * @see #LEVEL_OVERRIDE
+     * @see #MAX_EXPLICIT_LEVEL
+     * @stable ICU 3.8
+     */
+    public void setPara(char[] chars, byte paraLevel, byte[] embeddingLevels)
+    {
+        /* check the argument values */
+        if (paraLevel < INTERNAL_LEVEL_DEFAULT_LTR) {
+            verifyRange(paraLevel, 0, MAX_EXPLICIT_LEVEL + 1);
+        }
+        if (chars == null) {
+            chars = new char[0];
+        }
+
+        /* initialize the Bidi object */
+        this.paraBidi = null;          /* mark unfinished setPara */
+        this.text = chars;
+        this.length = this.originalLength = this.resultLength = text.length;
+        this.paraLevel = paraLevel;
+        this.direction = Bidi.DIRECTION_LEFT_TO_RIGHT;
+        this.paraCount = 1;
+
+        /* Allocate zero-length arrays instead of setting to null here; then
+         * checks for null in various places can be eliminated.
+         */
+        dirProps = new byte[0];
+        levels = new byte[0];
+        runs = new BidiRun[0];
+        isGoodLogicalToVisualRunsMap = false;
+        insertPoints.size = 0;          /* clean up from last call */
+        insertPoints.confirmed = 0;     /* clean up from last call */
+
+        /*
+         * Save the original paraLevel if contextual; otherwise, set to 0.
+         */
+        if (IsDefaultLevel(paraLevel)) {
+            defaultParaLevel = paraLevel;
+        } else {
+            defaultParaLevel = 0;
+        }
+
+        if (length == 0) {
+            /*
+             * For an empty paragraph, create a Bidi object with the paraLevel and
+             * the flags and the direction set but without allocating zero-length arrays.
+             * There is nothing more to do.
+             */
+            if (IsDefaultLevel(paraLevel)) {
+                this.paraLevel &= 1;
+                defaultParaLevel = 0;
+            }
+            if ((this.paraLevel & 1) != 0) {
+                flags = DirPropFlag(R);
+                direction = Bidi.DIRECTION_RIGHT_TO_LEFT;
+            } else {
+                flags = DirPropFlag(L);
+                direction = Bidi.DIRECTION_LEFT_TO_RIGHT;
+            }
+
+            runCount = 0;
+            paraCount = 0;
+            paraBidi = this;         /* mark successful setPara */
+            return;
+        }
+
+        runCount = -1;
+
+        /*
+         * Get the directional properties,
+         * the flags bit-set, and
+         * determine the paragraph level if necessary.
+         */
+        getDirPropsMemory(length);
+        dirProps = dirPropsMemory;
+        getDirProps();
+
+        /* the processed length may have changed if OPTION_STREAMING is set */
+        trailingWSStart = length;  /* the levels[] will reflect the WS run */
+
+        /* allocate paras memory */
+        if (paraCount > 1) {
+            getInitialParasMemory(paraCount);
+            paras = parasMemory;
+            paras[paraCount - 1] = length;
+        } else {
+            /* initialize paras for single paragraph */
+            paras = simpleParas;
+            simpleParas[0] = length;
+        }
+
+        /* are explicit levels specified? */
+        if (embeddingLevels == null) {
+            /* no: determine explicit levels according to the (Xn) rules */
+            getLevelsMemory(length);
+            levels = levelsMemory;
+            direction = resolveExplicitLevels();
+        } else {
+            /* set BN for all explicit codes, check that all levels are 0 or paraLevel..MAX_EXPLICIT_LEVEL */
+            levels = embeddingLevels;
+            direction = checkExplicitLevels();
+        }
+
+        /*
+         * The steps after (X9) in the Bidi algorithm are performed only if
+         * the paragraph text has mixed directionality!
+         */
+        switch (direction) {
+        case Bidi.DIRECTION_LEFT_TO_RIGHT:
+            /* make sure paraLevel is even */
+            paraLevel = (byte)((paraLevel + 1) & ~1);
+
+            /* all levels are implicitly at paraLevel (important for getLevels()) */
+            trailingWSStart = 0;
+            break;
+        case Bidi.DIRECTION_RIGHT_TO_LEFT:
+            /* make sure paraLevel is odd */
+            paraLevel |= 1;
+
+            /* all levels are implicitly at paraLevel (important for getLevels()) */
+            trailingWSStart = 0;
+            break;
+        default:
+            this.impTabPair = impTab_DEFAULT;
+
+            /*
+             * If there are no external levels specified and there
+             * are no significant explicit level codes in the text,
+             * then we can treat the entire paragraph as one run.
+             * Otherwise, we need to perform the following rules on runs of
+             * the text with the same embedding levels. (X10)
+             * "Significant" explicit level codes are ones that actually
+             * affect non-BN characters.
+             * Examples for "insignificant" ones are empty embeddings
+             * LRE-PDF, LRE-RLE-PDF-PDF, etc.
+             */
+            if (embeddingLevels == null && paraCount <= 1 &&
+                (flags & DirPropFlagMultiRuns) == 0) {
+                resolveImplicitLevels(0, length,
+                        GetLRFromLevel(GetParaLevelAt(0)),
+                        GetLRFromLevel(GetParaLevelAt(length - 1)));
+            } else {
+                /* sor, eor: start and end types of same-level-run */
+                int start, limit = 0;
+                byte level, nextLevel;
+                short sor, eor;
+
+                /* determine the first sor and set eor to it because of the loop body (sor=eor there) */
+                level = GetParaLevelAt(0);
+                nextLevel = levels[0];
+                if (level < nextLevel) {
+                    eor = GetLRFromLevel(nextLevel);
+                } else {
+                    eor = GetLRFromLevel(level);
+                }
+
+                do {
+                    /* determine start and limit of the run (end points just behind the run) */
+
+                    /* the values for this run's start are the same as for the previous run's end */
+                    start = limit;
+                    level = nextLevel;
+                    if ((start > 0) && (NoContextRTL(dirProps[start - 1]) == B)) {
+                        /* except if this is a new paragraph, then set sor = para level */
+                        sor = GetLRFromLevel(GetParaLevelAt(start));
+                    } else {
+                        sor = eor;
+                    }
+
+                    /* search for the limit of this run */
+                    while (++limit < length && levels[limit] == level) {}
+
+                    /* get the correct level of the next run */
+                    if (limit < length) {
+                        nextLevel = levels[limit];
+                    } else {
+                        nextLevel = GetParaLevelAt(length - 1);
+                    }
+
+                    /* determine eor from max(level, nextLevel); sor is last run's eor */
+                    if ((level & ~INTERNAL_LEVEL_OVERRIDE) < (nextLevel & ~INTERNAL_LEVEL_OVERRIDE)) {
+                        eor = GetLRFromLevel(nextLevel);
+                    } else {
+                        eor = GetLRFromLevel(level);
+                    }
+
+                    /* if the run consists of overridden directional types, then there
+                       are no implicit types to be resolved */
+                    if ((level & INTERNAL_LEVEL_OVERRIDE) == 0) {
+                        resolveImplicitLevels(start, limit, sor, eor);
+                    } else {
+                        /* remove the LEVEL_OVERRIDE flags */
+                        do {
+                            levels[start++] &= ~INTERNAL_LEVEL_OVERRIDE;
+                        } while (start < limit);
+                    }
+                } while (limit  < length);
+            }
+
+            /* reset the embedding levels for some non-graphic characters (L1), (X9) */
+            adjustWSLevels();
+
+            break;
+        }
+
+        resultLength += insertPoints.size;
+        paraBidi = this;             /* mark successful setPara */
+    }
+
+    /**
+     * Perform the Unicode Bidi algorithm on a given paragraph, as defined in the
+     * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,
+     * version 13,
+     * also described in The Unicode Standard, Version 4.0 .<p>
+     *
+     * This method takes a paragraph of text and computes the
+     * left-right-directionality of each character. The text should not
+     * contain any Unicode block separators.<p>
+     *
+     * The RUN_DIRECTION attribute in the text, if present, determines the base
+     * direction (left-to-right or right-to-left). If not present, the base
+     * direction is computed using the Unicode Bidirectional Algorithm,
+     * defaulting to left-to-right if there are no strong directional characters
+     * in the text. This attribute, if present, must be applied to all the text
+     * in the paragraph.<p>
+     *
+     * The BIDI_EMBEDDING attribute in the text, if present, represents
+     * embedding level information. Negative values from -1 to -62 indicate
+     * overrides at the absolute value of the level. Positive values from 1 to
+     * 62 indicate embeddings. Where values are zero or not defined, the base
+     * embedding level as determined by the base direction is assumed.<p>
+     *
+     * The NUMERIC_SHAPING attribute in the text, if present, converts European
+     * digits to other decimal digits before running the bidi algorithm. This
+     * attribute, if present, must be applied to all the text in the paragraph.
+     *
+     * If the entire text is all of the same directionality, then
+     * the method may not perform all the steps described by the algorithm,
+     * i.e., some levels may not be the same as if all steps were performed.
+     * This is not relevant for unidirectional text.<br>
+     * For example, in pure LTR text with numbers the numbers would get
+     * a resolved level of 2 higher than the surrounding text according to
+     * the algorithm. This implementation may set all resolved levels to
+     * the same value in such a case.<p>
+     *
+     * @param paragraph a paragraph of text with optional character and
+     *        paragraph attribute information
+     * @stable ICU 3.8
+     */
+    public void setPara(AttributedCharacterIterator paragraph)
+    {
+        byte paraLvl;
+        Boolean runDirection = (Boolean) paragraph.getAttribute(TextAttribute.RUN_DIRECTION);
+        NumericShaper shaper = (NumericShaper) paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING);
+        if (runDirection == null) {
+            paraLvl = INTERNAL_LEVEL_DEFAULT_LTR;
+        } else {
+            paraLvl = (runDirection.equals(TextAttribute.RUN_DIRECTION_LTR)) ?
+                        (byte)Bidi.DIRECTION_LEFT_TO_RIGHT : (byte)Bidi.DIRECTION_RIGHT_TO_LEFT;
+        }
+
+        byte[] lvls = null;
+        int len = paragraph.getEndIndex() - paragraph.getBeginIndex();
+        byte[] embeddingLevels = new byte[len];
+        char[] txt = new char[len];
+        int i = 0;
+        char ch = paragraph.first();
+        while (ch != AttributedCharacterIterator.DONE) {
+            txt[i] = ch;
+            Integer embedding = (Integer) paragraph.getAttribute(TextAttribute.BIDI_EMBEDDING);
+            if (embedding != null) {
+                byte level = embedding.byteValue();
+                if (level == 0) {
+                    /* no-op */
+                } else if (level < 0) {
+                    lvls = embeddingLevels;
+                    embeddingLevels[i] = (byte)((0 - level) | INTERNAL_LEVEL_OVERRIDE);
+                } else {
+                    lvls = embeddingLevels;
+                    embeddingLevels[i] = level;
+                }
+            }
+            ch = paragraph.next();
+            ++i;
+        }
+
+        if (shaper != null) {
+            shaper.shape(txt, 0, len);
+        }
+        setPara(txt, paraLvl, lvls);
+    }
+
+    /**
+     * Specify whether block separators must be allocated level zero,
+     * so that successive paragraphs will progress from left to right.
+     * This method must be called before <code>setPara()</code>.
+     * Paragraph separators (B) may appear in the text.  Setting them to level zero
+     * means that all paragraph separators (including one possibly appearing
+     * in the last text position) are kept in the reordered text after the text
+     * that they follow in the source text.
+     * When this feature is not enabled, a paragraph separator at the last
+     * position of the text before reordering will go to the first position
+     * of the reordered text when the paragraph level is odd.
+     *
+     * @param ordarParaLTR specifies whether paragraph separators (B) must
+     * receive level 0, so that successive paragraphs progress from left to right.
+     *
+     * @see #setPara
+     * @stable ICU 3.8
+     */
+    private void orderParagraphsLTR(boolean ordarParaLTR) {
+        orderParagraphsLTR = ordarParaLTR;
+    }
+
+    /**
+     * Get the directionality of the text.
+     *
+     * @return a value of <code>LTR</code>, <code>RTL</code> or <code>MIXED</code>
+     *         that indicates if the entire text
+     *         represented by this object is unidirectional,
+     *         and which direction, or if it is mixed-directional.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     *
+     * @see #LTR
+     * @see #RTL
+     * @see #MIXED
+     * @stable ICU 3.8
+     */
+    private byte getDirection()
+    {
+        verifyValidParaOrLine();
+        return direction;
+    }
+
+    /**
+     * Get the length of the text.
+     *
+     * @return The length of the text that the <code>Bidi</code> object was
+     *         created for.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @stable ICU 3.8
+     */
+    public int getLength()
+    {
+        verifyValidParaOrLine();
+        return originalLength;
+    }
+
+    /* paragraphs API methods ------------------------------------------------- */
+
+    /**
+     * Get the paragraph level of the text.
+     *
+     * @return The paragraph level. If there are multiple paragraphs, their
+     *         level may vary if the required paraLevel is LEVEL_DEFAULT_LTR or
+     *         LEVEL_DEFAULT_RTL.  In that case, the level of the first paragraph
+     *         is returned.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     *
+     * @see #LEVEL_DEFAULT_LTR
+     * @see #LEVEL_DEFAULT_RTL
+     * @see #getParagraph
+     * @see #getParagraphByIndex
+     * @stable ICU 3.8
+     */
+    public byte getParaLevel()
+    {
+        verifyValidParaOrLine();
+        return paraLevel;
+    }
+
+    /**
+     * Get the index of a paragraph, given a position within the text.<p>
+     *
+     * @param charIndex is the index of a character within the text, in the
+     *        range <code>[0..getProcessedLength()-1]</code>.
+     *
+     * @return The index of the paragraph containing the specified position,
+     *         starting from 0.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @throws IllegalArgumentException if charIndex is not within the legal range
+     *
+     * @see com.ibm.icu.text.BidiRun
+     * @see #getProcessedLength
+     * @stable ICU 3.8
+     */
+    public int getParagraphIndex(int charIndex)
+    {
+        verifyValidParaOrLine();
+        BidiBase bidi = paraBidi;             /* get Para object if Line object */
+        verifyRange(charIndex, 0, bidi.length);
+        int paraIndex;
+        for (paraIndex = 0; charIndex >= bidi.paras[paraIndex]; paraIndex++) {
+        }
+        return paraIndex;
+    }
+
+    /**
+     * <code>setLine()</code> returns a <code>Bidi</code> object to
+     * contain the reordering information, especially the resolved levels,
+     * for all the characters in a line of text. This line of text is
+     * specified by referring to a <code>Bidi</code> object representing
+     * this information for a piece of text containing one or more paragraphs,
+     * and by specifying a range of indexes in this text.<p>
+     * In the new line object, the indexes will range from 0 to <code>limit-start-1</code>.<p>
+     *
+     * This is used after calling <code>setPara()</code>
+     * for a piece of text, and after line-breaking on that text.
+     * It is not necessary if each paragraph is treated as a single line.<p>
+     *
+     * After line-breaking, rules (L1) and (L2) for the treatment of
+     * trailing WS and for reordering are performed on
+     * a <code>Bidi</code> object that represents a line.<p>
+     *
+     * <strong>Important: </strong>the line <code>Bidi</code> object may
+     * reference data within the global text <code>Bidi</code> object.
+     * You should not alter the content of the global text object until
+     * you are finished using the line object.
+     *
+     * @param start is the line's first index into the text.
+     *
+     * @param limit is just behind the line's last index into the text
+     *        (its last index +1).
+     *
+     * @return a <code>Bidi</code> object that will now represent a line of the text.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code>
+     * @throws IllegalArgumentException if start and limit are not in the range
+     *         <code>0&lt;=start&lt;limit&lt;=getProcessedLength()</code>,
+     *         or if the specified line crosses a paragraph boundary
+     *
+     * @see #setPara
+     * @see #getProcessedLength
+     * @stable ICU 3.8
+     */
+    public Bidi setLine(Bidi bidi, BidiBase bidiBase, Bidi newBidi, BidiBase newBidiBase, int start, int limit)
+    {
+        verifyValidPara();
+        verifyRange(start, 0, limit);
+        verifyRange(limit, 0, length+1);
+        if (getParagraphIndex(start) != getParagraphIndex(limit - 1)) {
+            /* the line crosses a paragraph boundary */
+            throw new IllegalArgumentException();
+        }
+
+        return BidiLine.setLine(bidi, this, newBidi, newBidiBase, start, limit);
+    }
+
+    /**
+     * Get the level for one character.
+     *
+     * @param charIndex the index of a character.
+     *
+     * @return The level for the character at <code>charIndex</code>.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @throws IllegalArgumentException if charIndex is not in the range
+     *         <code>0&lt;=charIndex&lt;getProcessedLength()</code>
+     *
+     * @see #getProcessedLength
+     * @stable ICU 3.8
+     */
+    public byte getLevelAt(int charIndex)
+    {
+        if (charIndex < 0 || charIndex >= length) {
+            return (byte)getBaseLevel();
+        }
+        verifyValidParaOrLine();
+        verifyRange(charIndex, 0, length);
+        return BidiLine.getLevelAt(this, charIndex);
+    }
+
+    /**
+     * Get an array of levels for each character.<p>
+     *
+     * Note that this method may allocate memory under some
+     * circumstances, unlike <code>getLevelAt()</code>.
+     *
+     * @return The levels array for the text,
+     *         or <code>null</code> if an error occurs.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @stable ICU 3.8
+     */
+    private byte[] getLevels()
+    {
+        verifyValidParaOrLine();
+        if (length <= 0) {
+            return new byte[0];
+        }
+        return BidiLine.getLevels(this);
+    }
+
+    /**
+     * Get the number of runs.
+     * This method may invoke the actual reordering on the
+     * <code>Bidi</code> object, after <code>setPara()</code>
+     * may have resolved only the levels of the text. Therefore,
+     * <code>countRuns()</code> may have to allocate memory,
+     * and may throw an exception if it fails to do so.
+     *
+     * @return The number of runs.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @stable ICU 3.8
+     */
+    public int countRuns()
+    {
+        verifyValidParaOrLine();
+        BidiLine.getRuns(this);
+        return runCount;
+    }
+
+    /**
+     * Get a visual-to-logical index map (array) for the characters in the
+     * <code>Bidi</code> (paragraph or line) object.
+     * <p>
+     * Some values in the map may be <code>MAP_NOWHERE</code> if the
+     * corresponding text characters are Bidi marks inserted in the visual
+     * output by the option <code>OPTION_INSERT_MARKS</code>.
+     * <p>
+     * When the visual output is altered by using options of
+     * <code>writeReordered()</code> such as <code>INSERT_LRM_FOR_NUMERIC</code>,
+     * <code>KEEP_BASE_COMBINING</code>, <code>OUTPUT_REVERSE</code>,
+     * <code>REMOVE_BIDI_CONTROLS</code>, the logical positions returned may not
+     * be correct. It is advised to use, when possible, reordering options
+     * such as {@link #OPTION_INSERT_MARKS} and {@link #OPTION_REMOVE_CONTROLS}.
+     *
+     * @return an array of <code>getResultLength()</code>
+     *        indexes which will reflect the reordering of the characters.<br><br>
+     *        The index map will result in
+     *        <code>indexMap[visualIndex]==logicalIndex</code>, where
+     *        <code>indexMap</code> represents the returned array.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     *
+     * @see #getLogicalMap
+     * @see #getLogicalIndex
+     * @see #getResultLength
+     * @see #MAP_NOWHERE
+     * @see #OPTION_INSERT_MARKS
+     * @see #writeReordered
+     * @stable ICU 3.8
+     */
+    private int[] getVisualMap()
+    {
+        /* countRuns() checks successful call to setPara/setLine */
+        countRuns();
+        if (resultLength <= 0) {
+            return new int[0];
+        }
+        return BidiLine.getVisualMap(this);
+    }
+
+    /**
+     * This is a convenience method that does not use a <code>Bidi</code> object.
+     * It is intended to be used for when an application has determined the levels
+     * of objects (character sequences) and just needs to have them reordered (L2).
+     * This is equivalent to using <code>getVisualMap()</code> on a
+     * <code>Bidi</code> object.
+     *
+     * @param levels is an array of levels that have been determined by
+     *        the application.
+     *
+     * @return an array of <code>levels.length</code>
+     *        indexes which will reflect the reordering of the characters.<p>
+     *        The index map will result in
+     *        <code>indexMap[visualIndex]==logicalIndex</code>, where
+     *        <code>indexMap</code> represents the returned array.
+     *
+     * @stable ICU 3.8
+     */
+    private static int[] reorderVisual(byte[] levels)
+    {
+        return BidiLine.reorderVisual(levels);
+    }
+
+    /**
+     * Constant indicating that the base direction depends on the first strong
+     * directional character in the text according to the Unicode Bidirectional
+     * Algorithm. If no strong directional character is present, the base
+     * direction is left-to-right.
+     * @stable ICU 3.8
+     */
+    private static final int INTERNAL_DIRECTION_DEFAULT_LEFT_TO_RIGHT = 0x7e;
+
+    /**
+     * Constant indicating that the base direction depends on the first strong
+     * directional character in the text according to the Unicode Bidirectional
+     * Algorithm. If no strong directional character is present, the base
+     * direction is right-to-left.
+     * @stable ICU 3.8
+     */
+    private static final int INTERMAL_DIRECTION_DEFAULT_RIGHT_TO_LEFT = 0x7f;
+
+    /**
+     * Create Bidi from the given text, embedding, and direction information.
+     * The embeddings array may be null. If present, the values represent
+     * embedding level information. Negative values from -1 to -61 indicate
+     * overrides at the absolute value of the level. Positive values from 1 to
+     * 61 indicate embeddings. Where values are zero, the base embedding level
+     * as determined by the base direction is assumed.<p>
+     *
+     * Note: this constructor calls setPara() internally.
+     *
+     * @param text an array containing the paragraph of text to process.
+     * @param textStart the index into the text array of the start of the
+     *        paragraph.
+     * @param embeddings an array containing embedding values for each character
+     *        in the paragraph. This can be null, in which case it is assumed
+     *        that there is no external embedding information.
+     * @param embStart the index into the embedding array of the start of the
+     *        paragraph.
+     * @param paragraphLength the length of the paragraph in the text and
+     *        embeddings arrays.
+     * @param flags a collection of flags that control the algorithm. The
+     *        algorithm understands the flags DIRECTION_LEFT_TO_RIGHT,
+     *        DIRECTION_RIGHT_TO_LEFT, DIRECTION_DEFAULT_LEFT_TO_RIGHT, and
+     *        DIRECTION_DEFAULT_RIGHT_TO_LEFT. Other values are reserved.
+     *
+     * @throws IllegalArgumentException if the values in embeddings are
+     *         not within the allowed range
+     *
+     * @see #DIRECTION_LEFT_TO_RIGHT
+     * @see #DIRECTION_RIGHT_TO_LEFT
+     * @see #DIRECTION_DEFAULT_LEFT_TO_RIGHT
+     * @see #DIRECTION_DEFAULT_RIGHT_TO_LEFT
+     * @stable ICU 3.8
+     */
+    public BidiBase(char[] text,
+             int textStart,
+             byte[] embeddings,
+             int embStart,
+             int paragraphLength,
+             int flags)
+     {
+        this(0, 0);
+        byte paraLvl;
+        switch (flags) {
+        case Bidi.DIRECTION_LEFT_TO_RIGHT:
+        default:
+            paraLvl = Bidi.DIRECTION_LEFT_TO_RIGHT;
+            break;
+        case Bidi.DIRECTION_RIGHT_TO_LEFT:
+            paraLvl = Bidi.DIRECTION_RIGHT_TO_LEFT;
+            break;
+        case Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT:
+            paraLvl = INTERNAL_LEVEL_DEFAULT_LTR;
+            break;
+        case Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT:
+            paraLvl = INTERNAL_LEVEL_DEFAULT_RTL;
+            break;
+        }
+        byte[] paraEmbeddings;
+        if (embeddings == null) {
+            paraEmbeddings = null;
+        } else {
+            paraEmbeddings = new byte[paragraphLength];
+            byte lev;
+            for (int i = 0; i < paragraphLength; i++) {
+                lev = embeddings[i + embStart];
+                if (lev < 0) {
+                    lev = (byte)((- lev) | INTERNAL_LEVEL_OVERRIDE);
+                } else if (lev == 0) {
+                    lev = paraLvl;
+                    if (paraLvl > MAX_EXPLICIT_LEVEL) {
+                        lev &= 1;
+                    }
+                }
+                paraEmbeddings[i] = lev;
+            }
+        }
+        if (textStart == 0 && embStart == 0 && paragraphLength == text.length) {
+            setPara(text, paraLvl, paraEmbeddings);
+        } else {
+            char[] paraText = new char[paragraphLength];
+            System.arraycopy(text, textStart, paraText, 0, paragraphLength);
+            setPara(paraText, paraLvl, paraEmbeddings);
+        }
+    }
+
+    /**
+     * Return true if the line is not left-to-right or right-to-left. This means
+     * it either has mixed runs of left-to-right and right-to-left text, or the
+     * base direction differs from the direction of the only run of text.
+     *
+     * @return true if the line is not left-to-right or right-to-left.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code>
+     * @stable ICU 3.8
+     */
+    public boolean isMixed()
+    {
+        return (!isLeftToRight() && !isRightToLeft());
+    }
+
+    /**
+    * Return true if the line is all left-to-right text and the base direction
+     * is left-to-right.
+     *
+     * @return true if the line is all left-to-right text and the base direction
+     *         is left-to-right.
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code>
+     * @stable ICU 3.8
+     */
+    public boolean isLeftToRight()
+    {
+        return (getDirection() == Bidi.DIRECTION_LEFT_TO_RIGHT && (paraLevel & 1) == 0);
+    }
+
+    /**
+     * Return true if the line is all right-to-left text, and the base direction
+     * is right-to-left
+     *
+     * @return true if the line is all right-to-left text, and the base
+     *         direction is right-to-left
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code>
+     * @stable ICU 3.8
+     */
+    public boolean isRightToLeft()
+    {
+        return (getDirection() == Bidi.DIRECTION_RIGHT_TO_LEFT && (paraLevel & 1) == 1);
+    }
+
+    /**
+     * Return true if the base direction is left-to-right
+     *
+     * @return true if the base direction is left-to-right
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     *
+     * @stable ICU 3.8
+     */
+    public boolean baseIsLeftToRight()
+    {
+        return (getParaLevel() == Bidi.DIRECTION_LEFT_TO_RIGHT);
+    }
+
+    /**
+     * Return the base level (0 if left-to-right, 1 if right-to-left).
+     *
+     * @return the base level
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     *
+     * @stable ICU 3.8
+     */
+    public int getBaseLevel()
+    {
+        return getParaLevel();
+    }
+
+    /**
+     * Compute the logical to visual run mapping
+     */
+    private void getLogicalToVisualRunsMap()
+    {
+        if (isGoodLogicalToVisualRunsMap) {
+            return;
+        }
+        int count = countRuns();
+        if ((logicalToVisualRunsMap == null) ||
+            (logicalToVisualRunsMap.length < count)) {
+            logicalToVisualRunsMap = new int[count];
+        }
+        int i;
+        long[] keys = new long[count];
+        for (i = 0; i < count; i++) {
+            keys[i] = ((long)(runs[i].start)<<32) + i;
+        }
+        Arrays.sort(keys);
+        for (i = 0; i < count; i++) {
+            logicalToVisualRunsMap[i] = (int)(keys[i] & 0x00000000FFFFFFFF);
+        }
+        keys = null;
+        isGoodLogicalToVisualRunsMap = true;
+    }
+
+    /**
+     * Return the level of the nth logical run in this line.
+     *
+     * @param run the index of the run, between 0 and <code>countRuns()-1</code>
+     *
+     * @return the level of the run
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @throws IllegalArgumentException if <code>run</code> is not in
+     *         the range <code>0&lt;=run&lt;countRuns()</code>
+     * @stable ICU 3.8
+     */
+    public int getRunLevel(int run)
+    {
+        verifyValidParaOrLine();
+        BidiLine.getRuns(this);
+        if (runCount == 1) {
+            return getParaLevel();
+        }
+        verifyIndex(run, 0, runCount);
+        getLogicalToVisualRunsMap();
+        return runs[logicalToVisualRunsMap[run]].level;
+    }
+
+    /**
+     * Return the index of the character at the start of the nth logical run in
+     * this line, as an offset from the start of the line.
+     *
+     * @param run the index of the run, between 0 and <code>countRuns()</code>
+     *
+     * @return the start of the run
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @throws IllegalArgumentException if <code>run</code> is not in
+     *         the range <code>0&lt;=run&lt;countRuns()</code>
+     * @stable ICU 3.8
+     */
+    public int getRunStart(int run)
+    {
+        verifyValidParaOrLine();
+        BidiLine.getRuns(this);
+        if (runCount == 1) {
+            return 0;
+        } else if (run == runCount) {
+            return length;
+        }
+        verifyIndex(run, 0, runCount);
+        getLogicalToVisualRunsMap();
+        return runs[logicalToVisualRunsMap[run]].start;
+    }
+
+    /**
+     * Return the index of the character past the end of the nth logical run in
+     * this line, as an offset from the start of the line. For example, this
+     * will return the length of the line for the last run on the line.
+     *
+     * @param run the index of the run, between 0 and <code>countRuns()</code>
+     *
+     * @return the limit of the run
+     *
+     * @throws IllegalStateException if this call is not preceded by a successful
+     *         call to <code>setPara</code> or <code>setLine</code>
+     * @throws IllegalArgumentException if <code>run</code> is not in
+     *         the range <code>0&lt;=run&lt;countRuns()</code>
+     * @stable ICU 3.8
+     */
+    public int getRunLimit(int run)
+    {
+        verifyValidParaOrLine();
+        BidiLine.getRuns(this);
+        if (runCount == 1) {
+            return length;
+        }
+        verifyIndex(run, 0, runCount);
+        getLogicalToVisualRunsMap();
+        int idx = logicalToVisualRunsMap[run];
+        int len = idx == 0 ? runs[idx].limit :
+                                runs[idx].limit - runs[idx-1].limit;
+        return runs[idx].start + len;
+    }
+
+    /**
+     * Return true if the specified text requires bidi analysis. If this returns
+     * false, the text will display left-to-right. Clients can then avoid
+     * constructing a Bidi object. Text in the Arabic Presentation Forms area of
+     * Unicode is presumed to already be shaped and ordered for display, and so
+     * will not cause this method to return true.
+     *
+     * @param text the text containing the characters to test
+     * @param start the start of the range of characters to test
+     * @param limit the limit of the range of characters to test
+     *
+     * @return true if the range of characters requires bidi analysis
+     *
+     * @stable ICU 3.8
+     */
+    public static boolean requiresBidi(char[] text,
+            int start,
+            int limit)
+    {
+        final int RTLMask = (1 << Bidi.DIRECTION_RIGHT_TO_LEFT |
+                1 << AL |
+                1 << RLE |
+                1 << RLO |
+                1 << AN);
+
+        if (0 > start || start > limit || limit > text.length) {
+            throw new IllegalArgumentException("Value start " + start +
+                      " is out of range 0 to " + limit);
+        }
+        for (int i = start; i < limit; ++i) {
+            if (Character.isHighSurrogate(text[i]) && i < (limit-1) &&
+                Character.isLowSurrogate(text[i+1])) {
+                if (((1 << UCharacter.getDirection(Character.codePointAt(text, i))) & RTLMask) != 0) {
+                    return true;
+                }
+            } else if (((1 << UCharacter.getDirection(text[i])) & RTLMask) != 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Reorder the objects in the array into visual order based on their levels.
+     * This is a utility method to use when you have a collection of objects
+     * representing runs of text in logical order, each run containing text at a
+     * single level. The elements at <code>index</code> from
+     * <code>objectStart</code> up to <code>objectStart + count</code> in the
+     * objects array will be reordered into visual order assuming
+     * each run of text has the level indicated by the corresponding element in
+     * the levels array (at <code>index - objectStart + levelStart</code>).
+     *
+     * @param levels an array representing the bidi level of each object
+     * @param levelStart the start position in the levels array
+     * @param objects the array of objects to be reordered into visual order
+     * @param objectStart the start position in the objects array
+     * @param count the number of objects to reorder
+     * @stable ICU 3.8
+     */
+    public static void reorderVisually(byte[] levels,
+            int levelStart,
+            Object[] objects,
+            int objectStart,
+            int count)
+    {
+        if (0 > levelStart || levels.length <= levelStart) {
+            throw new IllegalArgumentException("Value levelStart " +
+                      levelStart + " is out of range 0 to " +
+                      (levels.length-1));
+        }
+        if (0 > objectStart || objects.length <= objectStart) {
+            throw new IllegalArgumentException("Value objectStart " +
+                      levelStart + " is out of range 0 to " +
+                      (objects.length-1));
+        }
+        if (0 > count || objects.length < (objectStart+count)) {
+            throw new IllegalArgumentException("Value count " +
+                      levelStart + " is out of range 0 to " +
+                      (objects.length - objectStart));
+        }
+        byte[] reorderLevels = new byte[count];
+        System.arraycopy(levels, levelStart, reorderLevels, 0, count);
+        int[] indexMap = reorderVisual(reorderLevels);
+        Object[] temp = new Object[count];
+        System.arraycopy(objects, objectStart, temp, 0, count);
+        for (int i = 0; i < count; ++i) {
+            objects[objectStart + i] = temp[indexMap[i]];
+        }
+    }
+
+    /**
+     * Display the bidi internal state, used in debugging.
+     */
+    public String toString() {
+        StringBuffer buf = new StringBuffer(super.toString());
+
+        buf.append("[dir: " + direction);
+        buf.append(" baselevel: " + paraLevel);
+        buf.append(" length: " + length);
+        buf.append(" runs: ");
+        if (levels == null) {
+            buf.append("null");
+        } else {
+            buf.append('[');
+            buf.append(levels[0]);
+            for (int i = 0; i < levels.length; i++) {
+                buf.append(' ');
+                buf.append(levels[i]);
+            }
+            buf.append(']');
+        }
+        buf.append(" text: [0x");
+        buf.append(Integer.toHexString(text[0]));
+        for (int i = 0; i < text.length; i++) {
+            buf.append(" 0x");
+            buf.append(Integer.toHexString(text[i]));
+        }
+        buf.append(']');
+        buf.append(']');
+
+        return buf.toString();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/bidi/BidiLine.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,849 @@
+/*
+ * Portions Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+/*
+ *******************************************************************************
+ * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved         *
+ *                                                                             *
+ * The original version of this source code and documentation is copyrighted   *
+ * and owned by IBM, These materials are provided under terms of a License     *
+ * Agreement between IBM and Sun. This technology is protected by multiple     *
+ * US and International patents. This notice and attribution to IBM may not    *
+ * to removed.                                                                 *
+ *******************************************************************************
+ */
+/* Written by Simon Montagu, Matitiahu Allouche
+ * (ported from C code written by Markus W. Scherer)
+ */
+
+package sun.text.bidi;
+
+import java.text.Bidi;
+import java.util.Arrays;
+
+public final class BidiLine {
+
+    /*
+     * General remarks about the functions in this file:
+     *
+     * These functions deal with the aspects of potentially mixed-directional
+     * text in a single paragraph or in a line of a single paragraph
+     * which has already been processed according to
+     * the Unicode 3.0 Bidi algorithm as defined in
+     * http://www.unicode.org/unicode/reports/tr9/ , version 13,
+     * also described in The Unicode Standard, Version 4.0.1 .
+     *
+     * This means that there is a Bidi object with a levels
+     * and a dirProps array.
+     * paraLevel and direction are also set.
+     * Only if the length of the text is zero, then levels==dirProps==NULL.
+     *
+     * The overall directionality of the paragraph
+     * or line is used to bypass the reordering steps if possible.
+     * Even purely RTL text does not need reordering there because
+     * the getLogical/VisualIndex() methods can compute the
+     * index on the fly in such a case.
+     *
+     * The implementation of the access to same-level-runs and of the reordering
+     * do attempt to provide better performance and less memory usage compared to
+     * a direct implementation of especially rule (L2) with an array of
+     * one (32-bit) integer per text character.
+     *
+     * Here, the levels array is scanned as soon as necessary, and a vector of
+     * same-level-runs is created. Reordering then is done on this vector.
+     * For each run of text positions that were resolved to the same level,
+     * only 8 bytes are stored: the first text position of the run and the visual
+     * position behind the run after reordering.
+     * One sign bit is used to hold the directionality of the run.
+     * This is inefficient if there are many very short runs. If the average run
+     * length is <2, then this uses more memory.
+     *
+     * In a further attempt to save memory, the levels array is never changed
+     * after all the resolution rules (Xn, Wn, Nn, In).
+     * Many methods have to consider the field trailingWSStart:
+     * if it is less than length, then there is an implicit trailing run
+     * at the paraLevel,
+     * which is not reflected in the levels array.
+     * This allows a line Bidi object to use the same levels array as
+     * its paragraph parent object.
+     *
+     * When a Bidi object is created for a line of a paragraph, then the
+     * paragraph's levels and dirProps arrays are reused by way of setting
+     * a pointer into them, not by copying. This again saves memory and forbids to
+     * change the now shared levels for (L1).
+     */
+
+    /* handle trailing WS (L1) -------------------------------------------------- */
+
+    /*
+     * setTrailingWSStart() sets the start index for a trailing
+     * run of WS in the line. This is necessary because we do not modify
+     * the paragraph's levels array that we just point into.
+     * Using trailingWSStart is another form of performing (L1).
+     *
+     * To make subsequent operations easier, we also include the run
+     * before the WS if it is at the paraLevel - we merge the two here.
+     *
+     * This method is called only from setLine(), so paraLevel is
+     * set correctly for the line even when contextual multiple paragraphs.
+     */
+
+    static void setTrailingWSStart(BidiBase bidiBase)
+    {
+        byte[] dirProps = bidiBase.dirProps;
+        byte[] levels = bidiBase.levels;
+        int start = bidiBase.length;
+        byte paraLevel = bidiBase.paraLevel;
+
+        /* If the line is terminated by a block separator, all preceding WS etc...
+           are already set to paragraph level.
+           Setting trailingWSStart to pBidi->length will avoid changing the
+           level of B chars from 0 to paraLevel in getLevels when
+           orderParagraphsLTR==TRUE
+        */
+        if (BidiBase.NoContextRTL(dirProps[start - 1]) == BidiBase.B) {
+            bidiBase.trailingWSStart = start;   /* currently == bidiBase.length */
+            return;
+        }
+        /* go backwards across all WS, BN, explicit codes */
+        while (start > 0 &&
+                (BidiBase.DirPropFlagNC(dirProps[start - 1]) & BidiBase.MASK_WS) != 0) {
+            --start;
+        }
+
+        /* if the WS run can be merged with the previous run then do so here */
+        while (start > 0 && levels[start - 1] == paraLevel) {
+            --start;
+        }
+
+        bidiBase.trailingWSStart=start;
+    }
+
+    public static Bidi setLine(Bidi bidi, BidiBase paraBidi,
+                               Bidi newBidi, BidiBase newBidiBase,
+                               int start, int limit) {
+        int length;
+
+        BidiBase lineBidi = newBidiBase;
+
+        /* set the values in lineBidi from its paraBidi parent */
+        /* class members are already initialized to 0 */
+        // lineBidi.paraBidi = null;        /* mark unfinished setLine */
+        // lineBidi.flags = 0;
+        // lineBidi.controlCount = 0;
+
+        length = lineBidi.length = lineBidi.originalLength =
+                lineBidi.resultLength = limit - start;
+
+        lineBidi.text = new char[length];
+        System.arraycopy(paraBidi.text, start, lineBidi.text, 0, length);
+        lineBidi.paraLevel = paraBidi.GetParaLevelAt(start);
+        lineBidi.paraCount = paraBidi.paraCount;
+        lineBidi.runs = new BidiRun[0];
+        if (paraBidi.controlCount > 0) {
+            int j;
+            for (j = start; j < limit; j++) {
+                if (BidiBase.IsBidiControlChar(paraBidi.text[j])) {
+                    lineBidi.controlCount++;
+                }
+            }
+            lineBidi.resultLength -= lineBidi.controlCount;
+        }
+        /* copy proper subset of DirProps */
+        lineBidi.getDirPropsMemory(length);
+        lineBidi.dirProps = lineBidi.dirPropsMemory;
+        System.arraycopy(paraBidi.dirProps, start, lineBidi.dirProps, 0,
+                         length);
+        /* copy proper subset of Levels */
+        lineBidi.getLevelsMemory(length);
+        lineBidi.levels = lineBidi.levelsMemory;
+        System.arraycopy(paraBidi.levels, start, lineBidi.levels, 0,
+                         length);
+        lineBidi.runCount = -1;
+
+        if (paraBidi.direction != BidiBase.MIXED) {
+            /* the parent is already trivial */
+            lineBidi.direction = paraBidi.direction;
+
+            /*
+             * The parent's levels are all either
+             * implicitly or explicitly ==paraLevel;
+             * do the same here.
+             */
+            if (paraBidi.trailingWSStart <= start) {
+                lineBidi.trailingWSStart = 0;
+            } else if (paraBidi.trailingWSStart < limit) {
+                lineBidi.trailingWSStart = paraBidi.trailingWSStart - start;
+            } else {
+                lineBidi.trailingWSStart = length;
+            }
+        } else {
+            byte[] levels = lineBidi.levels;
+            int i, trailingWSStart;
+            byte level;
+
+            setTrailingWSStart(lineBidi);
+            trailingWSStart = lineBidi.trailingWSStart;
+
+            /* recalculate lineBidi.direction */
+            if (trailingWSStart == 0) {
+                /* all levels are at paraLevel */
+                lineBidi.direction = (byte)(lineBidi.paraLevel & 1);
+            } else {
+                /* get the level of the first character */
+                level = (byte)(levels[0] & 1);
+
+                /* if there is anything of a different level, then the line
+                   is mixed */
+                if (trailingWSStart < length &&
+                    (lineBidi.paraLevel & 1) != level) {
+                    /* the trailing WS is at paraLevel, which differs from
+                       levels[0] */
+                    lineBidi.direction = BidiBase.MIXED;
+                } else {
+                    /* see if levels[1..trailingWSStart-1] have the same
+                       direction as levels[0] and paraLevel */
+                    for (i = 1; ; i++) {
+                        if (i == trailingWSStart) {
+                            /* the direction values match those in level */
+                            lineBidi.direction = level;
+                            break;
+                        } else if ((levels[i] & 1) != level) {
+                            lineBidi.direction = BidiBase.MIXED;
+                            break;
+                        }
+                    }
+                }
+            }
+
+            switch(lineBidi.direction) {
+                case Bidi.DIRECTION_LEFT_TO_RIGHT:
+                    /* make sure paraLevel is even */
+                    lineBidi.paraLevel = (byte)
+                        ((lineBidi.paraLevel + 1) & ~1);
+
+                    /* all levels are implicitly at paraLevel (important for
+                       getLevels()) */
+                    lineBidi.trailingWSStart = 0;
+                    break;
+                case Bidi.DIRECTION_RIGHT_TO_LEFT:
+                    /* make sure paraLevel is odd */
+                    lineBidi.paraLevel |= 1;
+
+                    /* all levels are implicitly at paraLevel (important for
+                       getLevels()) */
+                    lineBidi.trailingWSStart = 0;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        newBidiBase.paraBidi = paraBidi; /* mark successful setLine */
+        return newBidi;
+    }
+
+    static byte getLevelAt(BidiBase bidiBase, int charIndex)
+    {
+        /* return paraLevel if in the trailing WS run, otherwise the real level */
+        if (bidiBase.direction != BidiBase.MIXED || charIndex >= bidiBase.trailingWSStart) {
+            return bidiBase.GetParaLevelAt(charIndex);
+        } else {
+            return bidiBase.levels[charIndex];
+        }
+    }
+
+    static byte[] getLevels(BidiBase bidiBase)
+    {
+        int start = bidiBase.trailingWSStart;
+        int length = bidiBase.length;
+
+        if (start != length) {
+            /* the current levels array does not reflect the WS run */
+            /*
+             * After the previous if(), we know that the levels array
+             * has an implicit trailing WS run and therefore does not fully
+             * reflect itself all the levels.
+             * This must be a Bidi object for a line, and
+             * we need to create a new levels array.
+             */
+            /* bidiBase.paraLevel is ok even if contextual multiple paragraphs,
+               since bidiBase is a line object                                     */
+            Arrays.fill(bidiBase.levels, start, length, bidiBase.paraLevel);
+
+            /* this new levels array is set for the line and reflects the WS run */
+            bidiBase.trailingWSStart = length;
+        }
+        if (length < bidiBase.levels.length) {
+            byte[] levels = new byte[length];
+            System.arraycopy(bidiBase.levels, 0, levels, 0, length);
+            return levels;
+        }
+        return bidiBase.levels;
+    }
+
+    static BidiRun getLogicalRun(BidiBase bidiBase, int logicalPosition)
+    {
+        /* this is done based on runs rather than on levels since levels have
+           a special interpretation when REORDER_RUNS_ONLY
+         */
+        BidiRun newRun = new BidiRun(), iRun;
+        getRuns(bidiBase);
+        int runCount = bidiBase.runCount;
+        int visualStart = 0, logicalLimit = 0;
+        iRun = bidiBase.runs[0];
+
+        for (int i = 0; i < runCount; i++) {
+            iRun = bidiBase.runs[i];
+            logicalLimit = iRun.start + iRun.limit - visualStart;
+            if ((logicalPosition >= iRun.start) &&
+                (logicalPosition < logicalLimit)) {
+                break;
+            }
+            visualStart = iRun.limit;
+        }
+        newRun.start = iRun.start;
+        newRun.limit = logicalLimit;
+        newRun.level = iRun.level;
+        return newRun;
+    }
+
+    /* in trivial cases there is only one trivial run; called by getRuns() */
+    private static void getSingleRun(BidiBase bidiBase, byte level) {
+        /* simple, single-run case */
+        bidiBase.runs = bidiBase.simpleRuns;
+        bidiBase.runCount = 1;
+
+        /* fill and reorder the single run */
+        bidiBase.runs[0] = new BidiRun(0, bidiBase.length, level);
+    }
+
+    /* reorder the runs array (L2) ---------------------------------------------- */
+
+    /*
+     * Reorder the same-level runs in the runs array.
+     * Here, runCount>1 and maxLevel>=minLevel>=paraLevel.
+     * All the visualStart fields=logical start before reordering.
+     * The "odd" bits are not set yet.
+     *
+     * Reordering with this data structure lends itself to some handy shortcuts:
+     *
+     * Since each run is moved but not modified, and since at the initial maxLevel
+     * each sequence of same-level runs consists of only one run each, we
+     * don't need to do anything there and can predecrement maxLevel.
+     * In many simple cases, the reordering is thus done entirely in the
+     * index mapping.
+     * Also, reordering occurs only down to the lowest odd level that occurs,
+     * which is minLevel|1. However, if the lowest level itself is odd, then
+     * in the last reordering the sequence of the runs at this level or higher
+     * will be all runs, and we don't need the elaborate loop to search for them.
+     * This is covered by ++minLevel instead of minLevel|=1 followed
+     * by an extra reorder-all after the reorder-some loop.
+     * About a trailing WS run:
+     * Such a run would need special treatment because its level is not
+     * reflected in levels[] if this is not a paragraph object.
+     * Instead, all characters from trailingWSStart on are implicitly at
+     * paraLevel.
+     * However, for all maxLevel>paraLevel, this run will never be reordered
+     * and does not need to be taken into account. maxLevel==paraLevel is only reordered
+     * if minLevel==paraLevel is odd, which is done in the extra segment.
+     * This means that for the main reordering loop we don't need to consider
+     * this run and can --runCount. If it is later part of the all-runs
+     * reordering, then runCount is adjusted accordingly.
+     */
+    private static void reorderLine(BidiBase bidiBase, byte minLevel, byte maxLevel) {
+
+        /* nothing to do? */
+        if (maxLevel<=(minLevel|1)) {
+            return;
+        }
+
+        BidiRun[] runs;
+        BidiRun tempRun;
+        byte[] levels;
+        int firstRun, endRun, limitRun, runCount;
+
+        /*
+         * Reorder only down to the lowest odd level
+         * and reorder at an odd minLevel in a separate, simpler loop.
+         * See comments above for why minLevel is always incremented.
+         */
+        ++minLevel;
+
+        runs = bidiBase.runs;
+        levels = bidiBase.levels;
+        runCount = bidiBase.runCount;
+
+        /* do not include the WS run at paraLevel<=old minLevel except in the simple loop */
+        if (bidiBase.trailingWSStart < bidiBase.length) {
+            --runCount;
+        }
+
+        while (--maxLevel >= minLevel) {
+            firstRun = 0;
+
+            /* loop for all sequences of runs */
+            for ( ; ; ) {
+                /* look for a sequence of runs that are all at >=maxLevel */
+                /* look for the first run of such a sequence */
+                while (firstRun < runCount && levels[runs[firstRun].start] < maxLevel) {
+                    ++firstRun;
+                }
+                if (firstRun >= runCount) {
+                    break;  /* no more such runs */
+                }
+
+                /* look for the limit run of such a sequence (the run behind it) */
+                for (limitRun = firstRun; ++limitRun < runCount &&
+                      levels[runs[limitRun].start]>=maxLevel; ) {}
+
+                /* Swap the entire sequence of runs from firstRun to limitRun-1. */
+                endRun = limitRun - 1;
+                while (firstRun < endRun) {
+                    tempRun = runs[firstRun];
+                    runs[firstRun] = runs[endRun];
+                    runs[endRun] = tempRun;
+                    ++firstRun;
+                    --endRun;
+                }
+
+                if (limitRun == runCount) {
+                    break;  /* no more such runs */
+                } else {
+                    firstRun = limitRun + 1;
+                }
+            }
+        }
+
+        /* now do maxLevel==old minLevel (==odd!), see above */
+        if ((minLevel & 1) == 0) {
+            firstRun = 0;
+
+            /* include the trailing WS run in this complete reordering */
+            if (bidiBase.trailingWSStart == bidiBase.length) {
+                --runCount;
+            }
+
+            /* Swap the entire sequence of all runs. (endRun==runCount) */
+            while (firstRun < runCount) {
+                tempRun = runs[firstRun];
+                runs[firstRun] = runs[runCount];
+                runs[runCount] = tempRun;
+                ++firstRun;
+                --runCount;
+            }
+        }
+    }
+
+    /* compute the runs array --------------------------------------------------- */
+
+    static int getRunFromLogicalIndex(BidiBase bidiBase, int logicalIndex) {
+        BidiRun[] runs = bidiBase.runs;
+        int runCount = bidiBase.runCount, visualStart = 0, i, length, logicalStart;
+
+        for (i = 0; i < runCount; i++) {
+            length = runs[i].limit - visualStart;
+            logicalStart = runs[i].start;
+            if ((logicalIndex >= logicalStart) && (logicalIndex < (logicalStart+length))) {
+                return i;
+            }
+            visualStart += length;
+        }
+        /* we should never get here */
+        throw new IllegalStateException("Internal ICU error in getRunFromLogicalIndex");
+    }
+
+    /*
+     * Compute the runs array from the levels array.
+     * After getRuns() returns true, runCount is guaranteed to be >0
+     * and the runs are reordered.
+     * Odd-level runs have visualStart on their visual right edge and
+     * they progress visually to the left.
+     * If option OPTION_INSERT_MARKS is set, insertRemove will contain the
+     * sum of appropriate LRM/RLM_BEFORE/AFTER flags.
+     * If option OPTION_REMOVE_CONTROLS is set, insertRemove will contain the
+     * negative number of BiDi control characters within this run.
+     */
+    static void getRuns(BidiBase bidiBase) {
+        /*
+         * This method returns immediately if the runs are already set. This
+         * includes the case of length==0 (handled in setPara)..
+         */
+        if (bidiBase.runCount >= 0) {
+            return;
+        }
+        if (bidiBase.direction != BidiBase.MIXED) {
+            /* simple, single-run case - this covers length==0 */
+            /* bidiBase.paraLevel is ok even for contextual multiple paragraphs */
+            getSingleRun(bidiBase, bidiBase.paraLevel);
+        } else /* BidiBase.MIXED, length>0 */ {
+            /* mixed directionality */
+            int length = bidiBase.length, limit;
+            byte[] levels = bidiBase.levels;
+            int i, runCount;
+            byte level = BidiBase.INTERNAL_LEVEL_DEFAULT_LTR;   /* initialize with no valid level */
+            /*
+             * If there are WS characters at the end of the line
+             * and the run preceding them has a level different from
+             * paraLevel, then they will form their own run at paraLevel (L1).
+             * Count them separately.
+             * We need some special treatment for this in order to not
+             * modify the levels array which a line Bidi object shares
+             * with its paragraph parent and its other line siblings.
+             * In other words, for the trailing WS, it may be
+             * levels[]!=paraLevel but we have to treat it like it were so.
+             */
+            limit = bidiBase.trailingWSStart;
+            /* count the runs, there is at least one non-WS run, and limit>0 */
+            runCount = 0;
+            for (i = 0; i < limit; ++i) {
+                /* increment runCount at the start of each run */
+                if (levels[i] != level) {
+                    ++runCount;
+                    level = levels[i];
+                }
+            }
+
+            /*
+             * We don't need to see if the last run can be merged with a trailing
+             * WS run because setTrailingWSStart() would have done that.
+             */
+            if (runCount == 1 && limit == length) {
+                /* There is only one non-WS run and no trailing WS-run. */
+                getSingleRun(bidiBase, levels[0]);
+            } else /* runCount>1 || limit<length */ {
+                /* allocate and set the runs */
+                BidiRun[] runs;
+                int runIndex, start;
+                byte minLevel = BidiBase.MAX_EXPLICIT_LEVEL + 1;
+                byte maxLevel=0;
+
+                /* now, count a (non-mergeable) WS run */
+                if (limit < length) {
+                    ++runCount;
+                }
+
+                /* runCount > 1 */
+                bidiBase.getRunsMemory(runCount);
+                runs = bidiBase.runsMemory;
+
+                /* set the runs */
+                /* FOOD FOR THOUGHT: this could be optimized, e.g.:
+                 * 464->444, 484->444, 575->555, 595->555
+                 * However, that would take longer. Check also how it would
+                 * interact with BiDi control removal and inserting Marks.
+                 */
+                runIndex = 0;
+
+                /* search for the run limits and initialize visualLimit values with the run lengths */
+                i = 0;
+                do {
+                    /* prepare this run */
+                    start = i;
+                    level = levels[i];
+                    if (level < minLevel) {
+                        minLevel = level;
+                    }
+                    if (level > maxLevel) {
+                        maxLevel = level;
+                    }
+
+                    /* look for the run limit */
+                    while (++i < limit && levels[i] == level) {}
+
+                    /* i is another run limit */
+                    runs[runIndex] = new BidiRun(start, i - start, level);
+                    ++runIndex;
+                } while (i < limit);
+
+                if (limit < length) {
+                    /* there is a separate WS run */
+                    runs[runIndex] = new BidiRun(limit, length - limit, bidiBase.paraLevel);
+                    /* For the trailing WS run, bidiBase.paraLevel is ok even
+                       if contextual multiple paragraphs.                   */
+                    if (bidiBase.paraLevel < minLevel) {
+                        minLevel = bidiBase.paraLevel;
+                    }
+                }
+
+                /* set the object fields */
+                bidiBase.runs = runs;
+                bidiBase.runCount = runCount;
+
+                reorderLine(bidiBase, minLevel, maxLevel);
+
+                /* now add the direction flags and adjust the visualLimit's to be just that */
+                /* this loop will also handle the trailing WS run */
+                limit = 0;
+                for (i = 0; i < runCount; ++i) {
+                    runs[i].level = levels[runs[i].start];
+                    limit = (runs[i].limit += limit);
+                }
+
+                /* Set the embedding level for the trailing WS run. */
+                /* For a RTL paragraph, it will be the *first* run in visual order. */
+                /* For the trailing WS run, bidiBase.paraLevel is ok even if
+                   contextual multiple paragraphs.                          */
+                if (runIndex < runCount) {
+                    int trailingRun = ((bidiBase.paraLevel & 1) != 0)? 0 : runIndex;
+                    runs[trailingRun].level = bidiBase.paraLevel;
+                }
+            }
+        }
+
+        /* handle insert LRM/RLM BEFORE/AFTER run */
+        if (bidiBase.insertPoints.size > 0) {
+            BidiBase.Point point;
+            int runIndex, ip;
+            for (ip = 0; ip < bidiBase.insertPoints.size; ip++) {
+                point = bidiBase.insertPoints.points[ip];
+                runIndex = getRunFromLogicalIndex(bidiBase, point.pos);
+                bidiBase.runs[runIndex].insertRemove |= point.flag;
+            }
+        }
+
+        /* handle remove BiDi control characters */
+        if (bidiBase.controlCount > 0) {
+            int runIndex, ic;
+            char c;
+            for (ic = 0; ic < bidiBase.length; ic++) {
+                c = bidiBase.text[ic];
+                if (BidiBase.IsBidiControlChar(c)) {
+                    runIndex = getRunFromLogicalIndex(bidiBase, ic);
+                    bidiBase.runs[runIndex].insertRemove--;
+                }
+            }
+        }
+    }
+
+    static int[] prepareReorder(byte[] levels, byte[] pMinLevel, byte[] pMaxLevel)
+    {
+        int start;
+        byte level, minLevel, maxLevel;
+
+        if (levels == null || levels.length <= 0) {
+            return null;
+        }
+
+        /* determine minLevel and maxLevel */
+        minLevel = BidiBase.MAX_EXPLICIT_LEVEL + 1;
+        maxLevel = 0;
+        for (start = levels.length; start>0; ) {
+            level = levels[--start];
+            if (level > BidiBase.MAX_EXPLICIT_LEVEL + 1) {
+                return null;
+            }
+            if (level < minLevel) {
+                minLevel = level;
+            }
+            if (level > maxLevel) {
+                maxLevel = level;
+            }
+        }
+        pMinLevel[0] = minLevel;
+        pMaxLevel[0] = maxLevel;
+
+        /* initialize the index map */
+        int[] indexMap = new int[levels.length];
+        for (start = levels.length; start > 0; ) {
+            --start;
+            indexMap[start] = start;
+        }
+
+        return indexMap;
+    }
+
+    static int[] reorderVisual(byte[] levels)
+    {
+        byte[] aMinLevel = new byte[1];
+        byte[] aMaxLevel = new byte[1];
+        int start, end, limit, temp;
+        byte minLevel, maxLevel;
+
+        int[] indexMap = prepareReorder(levels, aMinLevel, aMaxLevel);
+        if (indexMap == null) {
+            return null;
+        }
+
+        minLevel = aMinLevel[0];
+        maxLevel = aMaxLevel[0];
+
+        /* nothing to do? */
+        if (minLevel == maxLevel && (minLevel & 1) == 0) {
+            return indexMap;
+        }
+
+        /* reorder only down to the lowest odd level */
+        minLevel |= 1;
+
+        /* loop maxLevel..minLevel */
+        do {
+            start = 0;
+
+            /* loop for all sequences of levels to reorder at the current maxLevel */
+            for ( ; ; ) {
+                /* look for a sequence of levels that are all at >=maxLevel */
+                /* look for the first index of such a sequence */
+                while (start < levels.length && levels[start] < maxLevel) {
+                    ++start;
+                }
+                if (start >= levels.length) {
+                    break;  /* no more such runs */
+                }
+
+                /* look for the limit of such a sequence (the index behind it) */
+                for (limit = start; ++limit < levels.length && levels[limit] >= maxLevel; ) {}
+
+                /*
+                 * Swap the entire interval of indexes from start to limit-1.
+                 * We don't need to swap the levels for the purpose of this
+                 * algorithm: the sequence of levels that we look at does not
+                 * move anyway.
+                 */
+                end = limit - 1;
+                while (start < end) {
+                    temp = indexMap[start];
+                    indexMap[start] = indexMap[end];
+                    indexMap[end] = temp;
+
+                    ++start;
+                    --end;
+                }
+
+                if (limit == levels.length) {
+                    break;  /* no more such sequences */
+                } else {
+                    start = limit + 1;
+                }
+            }
+        } while (--maxLevel >= minLevel);
+
+        return indexMap;
+    }
+
+    static int[] getVisualMap(BidiBase bidiBase)
+    {
+        /* fill a visual-to-logical index map using the runs[] */
+        BidiRun[] runs = bidiBase.runs;
+        int logicalStart, visualStart, visualLimit;
+        int allocLength = bidiBase.length > bidiBase.resultLength ? bidiBase.length
+                                                          : bidiBase.resultLength;
+        int[] indexMap = new int[allocLength];
+
+        visualStart = 0;
+        int idx = 0;
+        for (int j = 0; j < bidiBase.runCount; ++j) {
+            logicalStart = runs[j].start;
+            visualLimit = runs[j].limit;
+            if (runs[j].isEvenRun()) {
+                do { /* LTR */
+                    indexMap[idx++] = logicalStart++;
+                } while (++visualStart < visualLimit);
+            } else {
+                logicalStart += visualLimit - visualStart;  /* logicalLimit */
+                do { /* RTL */
+                    indexMap[idx++] = --logicalStart;
+                } while (++visualStart < visualLimit);
+            }
+            /* visualStart==visualLimit; */
+        }
+
+        if (bidiBase.insertPoints.size > 0) {
+            int markFound = 0, runCount = bidiBase.runCount;
+            int insertRemove, i, j, k;
+            runs = bidiBase.runs;
+            /* count all inserted marks */
+            for (i = 0; i < runCount; i++) {
+                insertRemove = runs[i].insertRemove;
+                if ((insertRemove & (BidiBase.LRM_BEFORE|BidiBase.RLM_BEFORE)) > 0) {
+                    markFound++;
+                }
+                if ((insertRemove & (BidiBase.LRM_AFTER|BidiBase.RLM_AFTER)) > 0) {
+                    markFound++;
+                }
+            }
+            /* move back indexes by number of preceding marks */
+            k = bidiBase.resultLength;
+            for (i = runCount - 1; i >= 0 && markFound > 0; i--) {
+                insertRemove = runs[i].insertRemove;
+                if ((insertRemove & (BidiBase.LRM_AFTER|BidiBase.RLM_AFTER)) > 0) {
+                    indexMap[--k] = BidiBase.MAP_NOWHERE;
+                    markFound--;
+                }
+                visualStart = i > 0 ? runs[i-1].limit : 0;
+                for (j = runs[i].limit - 1; j >= visualStart && markFound > 0; j--) {
+                    indexMap[--k] = indexMap[j];
+                }
+                if ((insertRemove & (BidiBase.LRM_BEFORE|BidiBase.RLM_BEFORE)) > 0) {
+                    indexMap[--k] = BidiBase.MAP_NOWHERE;
+                    markFound--;
+                }
+            }
+        }
+        else if (bidiBase.controlCount > 0) {
+            int runCount = bidiBase.runCount, logicalEnd;
+            int insertRemove, length, i, j, k, m;
+            char uchar;
+            boolean evenRun;
+            runs = bidiBase.runs;
+            visualStart = 0;
+            /* move forward indexes by number of preceding controls */
+            k = 0;
+            for (i = 0; i < runCount; i++, visualStart += length) {
+                length = runs[i].limit - visualStart;
+                insertRemove = runs[i].insertRemove;
+                /* if no control found yet, nothing to do in this run */
+                if ((insertRemove == 0) && (k == visualStart)) {
+                    k += length;
+                    continue;
+                }
+                /* if no control in this run */
+                if (insertRemove == 0) {
+                    visualLimit = runs[i].limit;
+                    for (j = visualStart; j < visualLimit; j++) {
+                        indexMap[k++] = indexMap[j];
+                    }
+                    continue;
+                }
+                logicalStart = runs[i].start;
+                evenRun = runs[i].isEvenRun();
+                logicalEnd = logicalStart + length - 1;
+                for (j = 0; j < length; j++) {
+                    m = evenRun ? logicalStart + j : logicalEnd - j;
+                    uchar = bidiBase.text[m];
+                    if (!BidiBase.IsBidiControlChar(uchar)) {
+                        indexMap[k++] = m;
+                    }
+                }
+            }
+        }
+        if (allocLength == bidiBase.resultLength) {
+            return indexMap;
+        }
+        int[] newMap = new int[bidiBase.resultLength];
+        System.arraycopy(indexMap, 0, newMap, 0, bidiBase.resultLength);
+        return newMap;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/text/bidi/BidiRun.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,124 @@
+/*
+ * Portions Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+/*
+ *******************************************************************************
+ * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved         *
+ *                                                                             *
+ * The original version of this source code and documentation is copyrighted   *
+ * and owned by IBM, These materials are provided under terms of a License     *
+ * Agreement between IBM and Sun. This technology is protected by multiple     *
+ * US and International patents. This notice and attribution to IBM may not    *
+ * to removed.                                                                 *
+ *******************************************************************************
+ */
+/* Written by Simon Montagu, Matitiahu Allouche
+ * (ported from C code written by Markus W. Scherer)
+ */
+
+package sun.text.bidi;
+
+/**
+ * A BidiRun represents a sequence of characters at the same embedding level.
+ * The Bidi algorithm decomposes a piece of text into sequences of characters
+ * at the same embedding level, each such sequence is called a <quote>run</quote>.
+ *
+ * <p>A BidiRun represents such a run by storing its essential properties,
+ * but does not duplicate the characters which form the run.
+ *
+ * <p>The &quot;limit&quot; of the run is the position just after the
+ * last character, i.e., one more than that position.
+ *
+ * <p>This class has no public constructor, and its members cannot be
+ * modified by users.
+ *
+ * @see com.ibm.icu.text.Bidi
+ */
+public class BidiRun {
+
+    int start;              /* first logical position of the run */
+    int limit;              /* last visual position of the run +1 */
+    int insertRemove;       /* if >0, flags for inserting LRM/RLM before/after run,
+                               if <0, count of bidi controls within run            */
+    byte level;
+
+    /*
+     * Default constructor
+     *
+     * Note that members start and limit of a run instance have different
+     * meanings depending whether the run is part of the runs array of a Bidi
+     * object, or if it is a reference returned by getVisualRun() or
+     * getLogicalRun().
+     * For a member of the runs array of a Bidi object,
+     *   - start is the first logical position of the run in the source text.
+     *   - limit is one after the last visual position of the run.
+     * For a reference returned by getLogicalRun() or getVisualRun(),
+     *   - start is the first logical position of the run in the source text.
+     *   - limit is one after the last logical position of the run.
+     */
+    BidiRun()
+    {
+        this(0, 0, (byte)0);
+    }
+
+    /*
+     * Constructor
+     */
+    BidiRun(int start, int limit, byte embeddingLevel)
+    {
+        this.start = start;
+        this.limit = limit;
+        this.level = embeddingLevel;
+    }
+
+    /*
+     * Copy the content of a BidiRun instance
+     */
+    void copyFrom(BidiRun run)
+    {
+        this.start = run.start;
+        this.limit = run.limit;
+        this.level = run.level;
+        this.insertRemove = run.insertRemove;
+    }
+
+    /**
+     * Get level of run
+     */
+    public byte getEmbeddingLevel()
+    {
+        return level;
+    }
+
+    /**
+     * Check if run level is even
+     * @return true if the embedding level of this run is even, i.e. it is a
+     *  left-to-right run.
+     */
+    boolean isEvenRun()
+    {
+        return (level & 1) == 0;
+    }
+
+}
--- a/jdk/src/share/classes/sun/text/normalizer/UCharacter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/classes/sun/text/normalizer/UCharacter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2005-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -355,7 +355,7 @@
     private static int getEuropeanDigit(int ch) {
         if ((ch > 0x7a && ch < 0xff21)
             || ch < 0x41 || (ch > 0x5a && ch < 0x61)
-            || ch > 0xff5a || (ch > 0xff31 && ch < 0xff41)) {
+            || ch > 0xff5a || (ch > 0xff3a && ch < 0xff41)) {
             return -1;
         }
         if (ch <= 0x7a) {
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Mon Jul 06 11:42:37 2009 -0700
@@ -1783,7 +1783,7 @@
 
 
     struct jpeg_source_mgr *src;
-    JSAMPROW scanLinePtr;
+    JSAMPROW scanLinePtr = NULL;
     jint bands[MAX_BANDS];
     int i, j;
     jint *body;
@@ -1819,7 +1819,7 @@
 
     cinfo = (j_decompress_ptr) data->jpegObj;
 
-    if ((numBands < 1) || (numBands > cinfo->num_components) ||
+    if ((numBands < 1) ||
         (sourceXStart < 0) || (sourceXStart >= (jint)cinfo->image_width) ||
         (sourceYStart < 0) || (sourceYStart >= (jint)cinfo->image_height) ||
         (sourceWidth < 1) || (sourceWidth > (jint)cinfo->image_width) ||
@@ -1877,16 +1877,6 @@
         return data->abortFlag;  // We already threw an out of memory exception
     }
 
-    // Allocate a 1-scanline buffer
-    scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->num_components);
-    if (scanLinePtr == NULL) {
-        RELEASE_ARRAYS(env, data, src->next_input_byte);
-        JNU_ThrowByName( env,
-                         "java/lang/OutOfMemoryError",
-                         "Reading JPEG Stream");
-        return data->abortFlag;
-    }
-
     /* Establish the setjmp return context for sun_jpeg_error_exit to use. */
     jerr = (sun_jpeg_error_ptr) cinfo->err;
 
@@ -1900,7 +1890,10 @@
                                           buffer);
             JNU_ThrowByName(env, "javax/imageio/IIOException", buffer);
         }
-        free(scanLinePtr);
+        if (scanLinePtr != NULL) {
+            free(scanLinePtr);
+            scanLinePtr = NULL;
+        }
         return data->abortFlag;
     }
 
@@ -1938,6 +1931,23 @@
 
     jpeg_start_decompress(cinfo);
 
+    if (numBands !=  cinfo->output_components) {
+        JNU_ThrowByName(env, "javax/imageio/IIOException",
+                        "Invalid argument to native readImage");
+        return data->abortFlag;
+    }
+
+
+    // Allocate a 1-scanline buffer
+    scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components);
+    if (scanLinePtr == NULL) {
+        RELEASE_ARRAYS(env, data, src->next_input_byte);
+        JNU_ThrowByName( env,
+                         "java/lang/OutOfMemoryError",
+                         "Reading JPEG Stream");
+        return data->abortFlag;
+    }
+
     // loop over progressive passes
     done = FALSE;
     while (!done) {
@@ -1965,9 +1975,9 @@
 
         scanlineLimit = sourceYStart+sourceHeight;
         pixelLimit = scanLinePtr
-            +(sourceXStart+sourceWidth)*cinfo->num_components;
-
-        pixelStride = stepX*cinfo->num_components;
+            +(sourceXStart+sourceWidth)*cinfo->output_components;
+
+        pixelStride = stepX*cinfo->output_components;
         targetLine = 0;
 
         while ((data->abortFlag == JNI_FALSE)
@@ -1982,12 +1992,12 @@
                 // Optimization: The component bands are ordered sequentially,
                 // so we can simply use memcpy() to copy the intermediate
                 // scanline buffer into the raster.
-                in = scanLinePtr + (sourceXStart * cinfo->num_components);
+                in = scanLinePtr + (sourceXStart * cinfo->output_components);
                 if (pixelLimit > in) {
                     memcpy(out, in, pixelLimit - in);
                 }
             } else {
-                for (in = scanLinePtr+sourceXStart*cinfo->num_components;
+                for (in = scanLinePtr+sourceXStart*cinfo->output_components;
                      in < pixelLimit;
                      in += pixelStride) {
                     for (i = 0; i < numBands; i++) {
--- a/jdk/src/share/native/sun/font/bidi/cmemory.h	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Portions Copyright 2000 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998, 1999 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-* File CMEMORY.H
-*
-*  Contains stdlib.h/string.h memory functions
-*
-* @author       Bertrand A. Damiba
-*
-* Modification History:
-*
-*   Date        Name        Description
-*   6/20/98     Bertrand    Created.
-*  05/03/99     stephen     Changed from functions to macros.
-*
-*******************************************************************************
-*/
-
-#ifndef CMEMORY_H
-#define CMEMORY_H
-
-#include <stdlib.h>
-#include <string.h>
-
-#define icu_malloc(size) malloc(size)
-#define icu_realloc(buffer, size) realloc(buffer, size)
-#define icu_free(buffer) free(buffer)
-#define icu_memcpy(dst, src, size) memcpy(dst, src, size)
-#define icu_memmove(dst, src, size) memmove(dst, src, size)
-#define icu_memset(buffer, mark, size) memset(buffer, mark, size)
-#define icu_memcmp(buffer1, buffer2, size) memcmp(buffer1, buffer2,size)
-
-#endif
--- a/jdk/src/share/native/sun/font/bidi/jbidi.c	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Portions Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 2000 - 2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-// jni interface to native bidi from java
-
-#include <stdlib.h>
-#include "jbidi.h"
-
-#define U_COMMON_IMPLEMENTATION
-#include "ubidi.h"
-#include "ubidiimp.h"
-#include "uchardir.h"
-
-static jclass g_bidi_class = 0;
-static jmethodID g_bidi_reset = 0;
-
-static void resetBidi(JNIEnv *env, jclass cls, jobject bidi, jint dir, jint level, jint len, jintArray runs, jintArray cws) {
-    if (!g_bidi_class) {
-          g_bidi_class = (*env)->NewGlobalRef(env, cls);
-          g_bidi_reset = (*env)->GetMethodID(env, g_bidi_class, "reset", "(III[I[I)V");
-    }
-
-        (*env)->CallVoidMethod(env, bidi, g_bidi_reset, dir, level, len, runs, cws);
-}
-
-JNIEXPORT jint JNICALL Java_java_text_Bidi_nativeGetDirectionCode
-  (JNIEnv *env, jclass cls, jint cp)
-{
-    return (jint)u_getDirection((uint32_t)cp);
-}
-
-JNIEXPORT void JNICALL Java_java_text_Bidi_nativeBidiChars
-  (JNIEnv *env, jclass cls, jobject jbidi, jcharArray text, jint tStart, jbyteArray embs, jint eStart, jint length, jint dir)
-{
-    UErrorCode err = U_ZERO_ERROR;
-    UBiDi* bidi = ubidi_openSized(length, length, &err);
-    if (!U_FAILURE(err)) {
-        jchar *cText = (jchar*)(*env)->GetPrimitiveArrayCritical(env, text, NULL);
-        if (cText) {
-            UBiDiLevel baseLevel = (UBiDiLevel)dir;
-            jbyte *cEmbs = 0;
-            uint8_t *cEmbsAdj = 0;
-            if (embs != NULL) {
-                cEmbs = (jbyte*)(*env)->GetPrimitiveArrayCritical(env, embs, NULL);
-                if (cEmbs) {
-                    cEmbsAdj = (uint8_t*)(cEmbs + eStart);
-                }
-            }
-            ubidi_setPara(bidi, cText + tStart, length, baseLevel, cEmbsAdj, &err);
-            if (cEmbs) {
-                (*env)->ReleasePrimitiveArrayCritical(env, embs, cEmbs, JNI_ABORT);
-            }
-
-            (*env)->ReleasePrimitiveArrayCritical(env, text, cText, JNI_ABORT);
-
-            if (!U_FAILURE(err)) {
-                jint resDir = (jint)ubidi_getDirection(bidi);
-                jint resLevel = (jint)ubidi_getParaLevel(bidi);
-                jint resRunCount = 0;
-                jintArray resRuns = 0;
-                jintArray resCWS = 0;
-                if (resDir == UBIDI_MIXED) {
-                    resRunCount = (jint)ubidi_countRuns(bidi, &err);
-                    if (!U_FAILURE(err)) {
-                        if (resRunCount) {
-                            jint* cResRuns = (jint*)calloc(resRunCount * 2, sizeof(jint));
-                                  if (cResRuns) {
-                                    int32_t limit = 0;
-                                    UBiDiLevel level;
-                                    jint *p = cResRuns;
-                                    while (limit < length) {
-                                        ubidi_getLogicalRun(bidi, limit, &limit, &level);
-                                        *p++ = (jint)limit;
-                                        *p++ = (jint)level;
-                                    }
-
-                                    {
-                                        const DirProp *dp = bidi->dirProps;
-                                        jint ccws = 0;
-                                        jint n = 0;
-                                        p = cResRuns;
-                                        do {
-                                            if ((*(p+1) ^ resLevel) & 0x1) {
-                                                while (n < *p) {
-                                                    if (dp[n++] == WS) {
-                                                        ++ccws;
-                                                    }
-                                                }
-                                            } else {
-                                                n = *p;
-                                            }
-                                            p += 2;
-                                        } while (n < length);
-
-                                        resCWS = (*env)->NewIntArray(env, ccws);
-                                        if (resCWS) {
-                                            jint* cResCWS = (jint*)(*env)->GetPrimitiveArrayCritical(env, resCWS, NULL);
-                                            if (cResCWS) {
-                                                jint ccws = 0;
-                                                jint n = 0;
-                                                p = cResRuns;
-                                                do {
-                                                    if ((*(p+1) ^ resLevel) & 0x1) {
-                                                        while (n < *p) {
-                                                            if (dp[n] == WS) {
-                                                                cResCWS[ccws++] = n;
-                                                            }
-                                                            ++n;
-                                                        }
-                                                    } else {
-                                                        n = *p;
-                                                    }
-                                                    p += 2;
-                                                } while (n < length);
-                                                (*env)->ReleasePrimitiveArrayCritical(env, resCWS, cResCWS, 0);
-                                            }
-                                        }
-                                    }
-
-                                    resRuns = (*env)->NewIntArray(env, resRunCount * 2);
-                                    if (resRuns) {
-                                        (*env)->SetIntArrayRegion(env, resRuns, 0, resRunCount * 2, cResRuns);
-                                    }
-                                    free(cResRuns);
-                                }
-                            }
-                        }
-                    }
-
-                resetBidi(env, cls, jbidi, resDir, resLevel, length, resRuns, resCWS);
-            }
-        }
-        ubidi_close(bidi);
-    }
-}
--- a/jdk/src/share/native/sun/font/bidi/jbidi.h	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Portions Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 2000 - 2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class Bidi */
-
-#ifndef _Included_Bidi
-#define _Included_Bidi
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef Bidi_DIR_LTR
-#define Bidi_DIR_LTR 0L
-#undef Bidi_DIR_RTL
-#define Bidi_DIR_RTL 1L
-#undef Bidi_DIR_DEFAULT_LTR
-#define Bidi_DIR_DEFAULT_LTR -2L
-#undef Bidi_DIR_DEFAULT_RTL
-#define Bidi_DIR_DEFAULT_RTL -1L
-#undef Bidi_DIR_MIXED
-#define Bidi_DIR_MIXED -1L
-#undef Bidi_DIR_MIN
-#define Bidi_DIR_MIN -2L
-#undef Bidi_DIR_MAX
-#define Bidi_DIR_MAX 1L
-
-JNIEXPORT jint JNICALL Java_java_text_Bidi_nativeGetDirectionCode
-  (JNIEnv *, jclass, jint);
-
-JNIEXPORT void JNICALL Java_java_text_Bidi_nativeBidiChars
-  (JNIEnv *, jclass, jobject, jcharArray, jint, jbyteArray, jint, jint, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/jdk/src/share/native/sun/font/bidi/ubidi.c	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1433 +0,0 @@
-/*
- * Portions Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-*
-******************************************************************************
-*   file name:  ubidi.c
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999jul27
-*   created by: Markus W. Scherer
-*/
-
-/* set import/export definitions */
-#ifndef U_COMMON_IMPLEMENTATION
-#   define U_COMMON_IMPLEMENTATION
-#endif
-
-#include "cmemory.h"
-#include "utypes.h"
-#include "uchardir.h"
-#include "ubidi.h"
-#include "ubidiimp.h"
-
-/*
- * General implementation notes:
- *
- * Throughout the implementation, there are comments like (W2) that refer to
- * rules of the BiDi algorithm in its version 5, in this example to the second
- * rule of the resolution of weak types.
- *
- * For handling surrogate pairs, where two UChar's form one "abstract" (or UTF-32)
- * character according to UTF-16, the second UChar gets the directional property of
- * the entire character assigned, while the first one gets a BN, a boundary
- * neutral, type, which is ignored by most of the algorithm according to
- * rule (X9) and the implementation suggestions of the BiDi algorithm.
- *
- * Later, adjustWSLevels() will set the level for each BN to that of the
- * following character (UChar), which results in surrogate pairs getting the
- * same level on each of their surrogates.
- *
- * In a UTF-8 implementation, the same thing could be done: the last byte of
- * a multi-byte sequence would get the "real" property, while all previous
- * bytes of that sequence would get BN.
- *
- * It is not possible to assign all those parts of a character the same real
- * property because this would fail in the resolution of weak types with rules
- * that look at immediately surrounding types.
- *
- * As a related topic, this implementation does not remove Boundary Neutral
- * types from the input, but ignores them whereever this is relevant.
- * For example, the loop for the resolution of the weak types reads
- * types until it finds a non-BN.
- * Also, explicit embedding codes are neither changed into BN nor removed.
- * They are only treated the same way real BNs are.
- * As stated before, adjustWSLevels() takes care of them at the end.
- * For the purpose of conformance, the levels of all these codes
- * do not matter.
- *
- * Note that this implementation never modifies the dirProps
- * after the initial setup.
- *
- *
- * In this implementation, the resolution of weak types (Wn),
- * neutrals (Nn), and the assignment of the resolved level (In)
- * are all done in one single loop, in resolveImplicitLevels().
- * Changes of dirProp values are done on the fly, without writing
- * them back to the dirProps array.
- *
- *
- * This implementation contains code that allows to bypass steps of the
- * algorithm that are not needed on the specific paragraph
- * in order to speed up the most common cases considerably,
- * like text that is entirely LTR, or RTL text without numbers.
- *
- * Most of this is done by setting a bit for each directional property
- * in a flags variable and later checking for whether there are
- * any LTR characters or any RTL characters, or both, whether
- * there are any explicit embedding codes, etc.
- *
- * If the (Xn) steps are performed, then the flags are re-evaluated,
- * because they will then not contain the embedding codes any more
- * and will be adjusted for override codes, so that subsequently
- * more bypassing may be possible than what the initial flags suggested.
- *
- * If the text is not mixed-directional, then the
- * algorithm steps for the weak type resolution are not performed,
- * and all levels are set to the paragraph level.
- *
- * If there are no explicit embedding codes, then the (Xn) steps
- * are not performed.
- *
- * If embedding levels are supplied as a parameter, then all
- * explicit embedding codes are ignored, and the (Xn) steps
- * are not performed.
- *
- * White Space types could get the level of the run they belong to,
- * and are checked with a test of (flags&MASK_EMBEDDING) to
- * consider if the paragraph direction should be considered in
- * the flags variable.
- *
- * If there are no White Space types in the paragraph, then
- * (L1) is not necessary in adjustWSLevels().
- */
-
-/* prototypes --------------------------------------------------------------- */
-
-static void
-getDirProps(UBiDi *pBiDi, const UChar *text);
-
-static UBiDiDirection
-resolveExplicitLevels(UBiDi *pBiDi);
-
-static UBiDiDirection
-checkExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
-
-static UBiDiDirection
-directionFromFlags(Flags flags);
-
-static void
-resolveImplicitLevels(UBiDi *pBiDi,
-                      int32_t start, int32_t limit,
-                      DirProp sor, DirProp eor);
-
-static void
-adjustWSLevels(UBiDi *pBiDi);
-
-/* to avoid some conditional statements, use tiny constant arrays */
-static const Flags flagLR[2]={ DIRPROP_FLAG(L), DIRPROP_FLAG(R) };
-static const Flags flagE[2]={ DIRPROP_FLAG(LRE), DIRPROP_FLAG(RLE) };
-static const Flags flagO[2]={ DIRPROP_FLAG(LRO), DIRPROP_FLAG(RLO) };
-
-#define DIRPROP_FLAG_LR(level) flagLR[(level)&1]
-#define DIRPROP_FLAG_E(level) flagE[(level)&1]
-#define DIRPROP_FLAG_O(level) flagO[(level)&1]
-
-/* UBiDi object management -------------------------------------------------- */
-
-U_CAPI UBiDi * U_EXPORT2
-ubidi_open(void)
-{
-    UErrorCode errorCode=U_ZERO_ERROR;
-    return ubidi_openSized(0, 0, &errorCode);
-}
-
-U_CAPI UBiDi * U_EXPORT2
-ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode) {
-    UBiDi *pBiDi;
-
-    /* check the argument values */
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return NULL;
-    } else if(maxLength<0 || maxRunCount<0) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;    /* invalid arguments */
-    }
-
-    /* allocate memory for the object */
-    pBiDi=(UBiDi *)icu_malloc(sizeof(UBiDi));
-    if(pBiDi==NULL) {
-        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
-    }
-
-    /* reset the object, all pointers NULL, all flags FALSE, all sizes 0 */
-    icu_memset(pBiDi, 0, sizeof(UBiDi));
-
-    /* allocate memory for arrays as requested */
-    if(maxLength>0) {
-        if( !getInitialDirPropsMemory(pBiDi, maxLength) ||
-            !getInitialLevelsMemory(pBiDi, maxLength)
-        ) {
-            *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        }
-    } else {
-        pBiDi->mayAllocateText=TRUE;
-    }
-
-    if(maxRunCount>0) {
-        if(maxRunCount==1) {
-            /* use simpleRuns[] */
-            pBiDi->runsSize=sizeof(Run);
-        } else if(!getInitialRunsMemory(pBiDi, maxRunCount)) {
-            *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        }
-    } else {
-        pBiDi->mayAllocateRuns=TRUE;
-    }
-
-    if(U_SUCCESS(*pErrorCode)) {
-        return pBiDi;
-    } else {
-        ubidi_close(pBiDi);
-        return NULL;
-    }
-}
-
-/*
- * We are allowed to allocate memory if memory==NULL or
- * mayAllocate==TRUE for each array that we need.
- * We also try to grow and shrink memory as needed if we
- * allocate it.
- *
- * Assume sizeNeeded>0.
- * If *pMemory!=NULL, then assume *pSize>0.
- *
- * ### this realloc() may unnecessarily copy the old data,
- * which we know we don't need any more;
- * is this the best way to do this??
- */
-extern bool_t
-ubidi_getMemory(void **pMemory, int32_t *pSize, bool_t mayAllocate, int32_t sizeNeeded) {
-    /* check for existing memory */
-    if(*pMemory==NULL) {
-        /* we need to allocate memory */
-        if(mayAllocate && (*pMemory=icu_malloc(sizeNeeded))!=NULL) {
-            *pSize=sizeNeeded;
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    } else {
-        /* there is some memory, is it enough or too much? */
-        if(sizeNeeded>*pSize && !mayAllocate) {
-            /* not enough memory, and we must not allocate */
-            return FALSE;
-        } else if(sizeNeeded!=*pSize && mayAllocate) {
-            /* we may try to grow or shrink */
-            void *memory;
-
-            if((memory=icu_realloc(*pMemory, sizeNeeded))!=NULL) {
-                *pMemory=memory;
-                *pSize=sizeNeeded;
-                return TRUE;
-            } else {
-                /* we failed to grow */
-                return FALSE;
-            }
-        } else {
-            /* we have at least enough memory and must not allocate */
-            return TRUE;
-        }
-    }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_close(UBiDi *pBiDi) {
-    if(pBiDi!=NULL) {
-        if(pBiDi->dirPropsMemory!=NULL) {
-            icu_free(pBiDi->dirPropsMemory);
-        }
-        if(pBiDi->levelsMemory!=NULL) {
-            icu_free(pBiDi->levelsMemory);
-        }
-        if(pBiDi->runsMemory!=NULL) {
-            icu_free(pBiDi->runsMemory);
-        }
-        icu_free(pBiDi);
-    }
-}
-
-/* set to approximate "inverse BiDi" ---------------------------------------- */
-
-U_CAPI void U_EXPORT2
-ubidi_setInverse(UBiDi *pBiDi, bool_t isInverse) {
-    if(pBiDi!=NULL) {
-        pBiDi->isInverse=isInverse;
-    }
-}
-
-U_CAPI bool_t U_EXPORT2
-ubidi_isInverse(UBiDi *pBiDi) {
-    if(pBiDi!=NULL) {
-        return pBiDi->isInverse;
-    } else {
-        return FALSE;
-    }
-}
-
-/* ubidi_setPara ------------------------------------------------------------ */
-
-U_CAPI void U_EXPORT2
-ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
-              UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
-              UErrorCode *pErrorCode) {
-    UBiDiDirection direction;
-
-    /* check the argument values */
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return;
-    } else if(pBiDi==NULL || text==NULL ||
-              ((UBIDI_MAX_EXPLICIT_LEVEL<paraLevel) && !IS_DEFAULT_LEVEL(paraLevel)) ||
-              length<-1
-    ) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return;
-    }
-
-    if(length==-1) {
-        // length=u_strlen(text);
-                const UChar *p = text - 1;
-                while(*++p);
-                length = p - text;
-    }
-
-    /* initialize the UBiDi structure */
-    pBiDi->text=text;
-    pBiDi->length=length;
-    pBiDi->paraLevel=paraLevel;
-    pBiDi->direction=UBIDI_LTR;
-    pBiDi->trailingWSStart=length;  /* the levels[] will reflect the WS run */
-
-    pBiDi->dirProps=NULL;
-    pBiDi->levels=NULL;
-    pBiDi->runs=NULL;
-
-    if(length==0) {
-        /*
-         * For an empty paragraph, create a UBiDi object with the paraLevel and
-         * the flags and the direction set but without allocating zero-length arrays.
-         * There is nothing more to do.
-         */
-        if(IS_DEFAULT_LEVEL(paraLevel)) {
-            pBiDi->paraLevel&=1;
-        }
-        if(paraLevel&1) {
-            pBiDi->flags=DIRPROP_FLAG(R);
-            pBiDi->direction=UBIDI_RTL;
-        } else {
-            pBiDi->flags=DIRPROP_FLAG(L);
-            pBiDi->direction=UBIDI_LTR;
-        }
-
-        pBiDi->runCount=0;
-        return;
-    }
-
-    pBiDi->runCount=-1;
-
-    /*
-     * Get the directional properties,
-     * the flags bit-set, and
-     * determine the partagraph level if necessary.
-     */
-    if(getDirPropsMemory(pBiDi, length)) {
-        pBiDi->dirProps=pBiDi->dirPropsMemory;
-        getDirProps(pBiDi, text);
-    } else {
-        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        return;
-    }
-
-    if (getLevelsMemory(pBiDi, length)) {
-        pBiDi->levels=pBiDi->levelsMemory;
-        /* are explicit levels specified? */
-        if(embeddingLevels==NULL) {
-            /* no: determine explicit levels according to the (Xn) rules */
-            direction=resolveExplicitLevels(pBiDi);
-        } else {
-            /* set BN for all explicit codes, check that all levels are paraLevel..UBIDI_MAX_EXPLICIT_LEVEL */
-            icu_memcpy(pBiDi->levels, embeddingLevels, length);
-            direction=checkExplicitLevels(pBiDi, pErrorCode);
-            if(U_FAILURE(*pErrorCode)) {
-                 return;
-            }
-        }
-    } else {
-        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        return;
-    }
-
-    /*
-     * The steps after (X9) in the UBiDi algorithm are performed only if
-     * the paragraph text has mixed directionality!
-     */
-    pBiDi->direction=direction;
-    switch(direction) {
-    case UBIDI_LTR:
-        /* make sure paraLevel is even */
-        pBiDi->paraLevel=(UBiDiLevel)((pBiDi->paraLevel+1)&~1);
-
-        /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
-        pBiDi->trailingWSStart=0;
-        break;
-    case UBIDI_RTL:
-        /* make sure paraLevel is odd */
-        pBiDi->paraLevel|=1;
-
-        /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
-        pBiDi->trailingWSStart=0;
-        break;
-    default:
-        /*
-         * If there are no external levels specified and there
-         * are no significant explicit level codes in the text,
-         * then we can treat the entire paragraph as one run.
-         * Otherwise, we need to perform the following rules on runs of
-         * the text with the same embedding levels. (X10)
-         * "Significant" explicit level codes are ones that actually
-         * affect non-BN characters.
-         * Examples for "insignificant" ones are empty embeddings
-         * LRE-PDF, LRE-RLE-PDF-PDF, etc.
-         */
-        if(embeddingLevels==NULL && !(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) {
-            resolveImplicitLevels(pBiDi, 0, length,
-                                    GET_LR_FROM_LEVEL(pBiDi->paraLevel),
-                                    GET_LR_FROM_LEVEL(pBiDi->paraLevel));
-        } else {
-            /* sor, eor: start and end types of same-level-run */
-            UBiDiLevel *levels=pBiDi->levels;
-            int32_t start, limit=0;
-            UBiDiLevel level, nextLevel;
-            DirProp sor, eor;
-
-            /* determine the first sor and set eor to it because of the loop body (sor=eor there) */
-            level=pBiDi->paraLevel;
-            nextLevel=levels[0];
-            if(level<nextLevel) {
-                eor=GET_LR_FROM_LEVEL(nextLevel);
-            } else {
-                eor=GET_LR_FROM_LEVEL(level);
-            }
-
-            do {
-                /* determine start and limit of the run (end points just behind the run) */
-
-                /* the values for this run's start are the same as for the previous run's end */
-                sor=eor;
-                start=limit;
-                level=nextLevel;
-
-                /* search for the limit of this run */
-                while(++limit<length && levels[limit]==level) {}
-
-                /* get the correct level of the next run */
-                if(limit<length) {
-                    nextLevel=levels[limit];
-                } else {
-                    nextLevel=pBiDi->paraLevel;
-                }
-
-                /* determine eor from max(level, nextLevel); sor is last run's eor */
-                if((level&~UBIDI_LEVEL_OVERRIDE)<(nextLevel&~UBIDI_LEVEL_OVERRIDE)) {
-                    eor=GET_LR_FROM_LEVEL(nextLevel);
-                } else {
-                    eor=GET_LR_FROM_LEVEL(level);
-                }
-
-                /* if the run consists of overridden directional types, then there
-                   are no implicit types to be resolved */
-                if(!(level&UBIDI_LEVEL_OVERRIDE)) {
-                    resolveImplicitLevels(pBiDi, start, limit, sor, eor);
-                } else {
-                    /* remove the UBIDI_LEVEL_OVERRIDE flags */
-                    do {
-                        levels[start++]&=~UBIDI_LEVEL_OVERRIDE;
-                    } while(start<limit);
-                }
-            } while(limit<length);
-        }
-
-        /* reset the embedding levels for some non-graphic characters (L1), (X9) */
-        adjustWSLevels(pBiDi);
-
-        /* for "inverse BiDi", ubidi_getRuns() modifies the levels of numeric runs following RTL runs */
-        if(pBiDi->isInverse) {
-            if(!ubidi_getRuns(pBiDi)) {
-                *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-                return;
-            }
-        }
-        break;
-    }
-}
-
-/* perform (P2)..(P3) ------------------------------------------------------- */
-
-/*
- * Get the directional properties for the text,
- * calculate the flags bit-set, and
- * determine the partagraph level if necessary.
- */
-static void
-getDirProps(UBiDi *pBiDi, const UChar *text) {
-    DirProp *dirProps=pBiDi->dirPropsMemory;    /* pBiDi->dirProps is const */
-
-    int32_t i=0, i0, i1, length=pBiDi->length;
-    Flags flags=0;      /* collect all directionalities in the text */
-    UChar uchar;
-    DirProp dirProp;
-
-    if(IS_DEFAULT_LEVEL(pBiDi->paraLevel)) {
-        /* determine the paragraph level (P2..P3) */
-        for(;;) {
-            uchar=text[i];
-            if(!IS_FIRST_SURROGATE(uchar) || i+1==length || !IS_SECOND_SURROGATE(text[i+1])) {
-                /* not a surrogate pair */
-                flags|=DIRPROP_FLAG(dirProps[i]=dirProp=u_charDirection(uchar));
-            } else {
-                /* a surrogate pair */
-                dirProps[i++]=BN;   /* first surrogate in the pair gets the BN type */
-                flags|=DIRPROP_FLAG(dirProps[i]=dirProp=u_surrogatePairDirection(uchar, text[i]))|DIRPROP_FLAG(BN);
-            }
-            ++i;
-            if(dirProp==L) {
-                pBiDi->paraLevel=0;
-                break;
-            } else if(dirProp==R || dirProp==AL) {
-                pBiDi->paraLevel=1;
-                break;
-            } else if(i>=length) {
-                /*
-                 * see comment in ubidi.h:
-                 * the DEFAULT_XXX values are designed so that
-                 * their bit 0 alone yields the intended default
-                 */
-                pBiDi->paraLevel&=1;
-                break;
-            }
-        }
-    } else {
-        flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
-    }
-
-    /* get the rest of the directional properties and the flags bits */
-    while(i<length) {
-        uchar=text[i];
-        if(!IS_FIRST_SURROGATE(uchar) || i+1==length || !IS_SECOND_SURROGATE(text[i+1])) {
-            /* not a surrogate pair */
-            flags|=DIRPROP_FLAG(dirProps[i]=u_charDirection(uchar));
-        } else {
-            /* a surrogate pair */
-            dirProps[i++]=BN;   /* first surrogate in the pair gets the BN type */
-            flags|=DIRPROP_FLAG(dirProps[i]=dirProp=u_surrogatePairDirection(uchar, text[i]))|DIRPROP_FLAG(BN);
-        }
-        ++i;
-    }
-    if(flags&MASK_EMBEDDING) {
-        flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
-    }
-
-    pBiDi->flags=flags;
-}
-
-/* perform (X1)..(X9) ------------------------------------------------------- */
-
-/*
- * Resolve the explicit levels as specified by explicit embedding codes.
- * Recalculate the flags to have them reflect the real properties
- * after taking the explicit embeddings into account.
- *
- * The BiDi algorithm is designed to result in the same behavior whether embedding
- * levels are externally specified (from "styled text", supposedly the preferred
- * method) or set by explicit embedding codes (LRx, RLx, PDF) in the plain text.
- * That is why (X9) instructs to remove all explicit codes (and BN).
- * However, in a real implementation, this removal of these codes and their index
- * positions in the plain text is undesirable since it would result in
- * reallocated, reindexed text.
- * Instead, this implementation leaves the codes in there and just ignores them
- * in the subsequent processing.
- * In order to get the same reordering behavior, positions with a BN or an
- * explicit embedding code just get the same level assigned as the last "real"
- * character.
- *
- * Some implementations, not this one, then overwrite some of these
- * directionality properties at "real" same-level-run boundaries by
- * L or R codes so that the resolution of weak types can be performed on the
- * entire paragraph at once instead of having to parse it once more and
- * perform that resolution on same-level-runs.
- * This limits the scope of the implicit rules in effectively
- * the same way as the run limits.
- *
- * Instead, this implementation does not modify these codes.
- * On one hand, the paragraph has to be scanned for same-level-runs, but
- * on the other hand, this saves another loop to reset these codes,
- * or saves making and modifying a copy of dirProps[].
- *
- *
- * Note that (Pn) and (Xn) changed significantly from version 4 of the BiDi algorithm.
- *
- *
- * Handling the stack of explicit levels (Xn):
- *
- * With the BiDi stack of explicit levels,
- * as pushed with each LRE, RLE, LRO, and RLO and popped with each PDF,
- * the explicit level must never exceed UBIDI_MAX_EXPLICIT_LEVEL==61.
- *
- * In order to have a correct push-pop semantics even in the case of overflows,
- * there are two overflow counters:
- * - countOver60 is incremented with each LRx at level 60
- * - from level 60, one RLx increases the level to 61
- * - countOver61 is incremented with each LRx and RLx at level 61
- *
- * Popping levels with PDF must work in the opposite order so that level 61
- * is correct at the correct point. Underflows (too many PDFs) must be checked.
- *
- * This implementation assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd.
- */
-
-static UBiDiDirection
-resolveExplicitLevels(UBiDi *pBiDi) {
-    const DirProp *dirProps=pBiDi->dirProps;
-    UBiDiLevel *levels=pBiDi->levels;
-
-    int32_t i=0, length=pBiDi->length;
-    Flags flags=pBiDi->flags;       /* collect all directionalities in the text */
-    DirProp dirProp;
-    UBiDiLevel level=pBiDi->paraLevel;
-
-    UBiDiDirection direction;
-
-    /* determine if the text is mixed-directional or single-directional */
-    direction=directionFromFlags(flags);
-
-    /* we may not need to resolve any explicit levels */
-    if(direction!=UBIDI_MIXED) {
-        /* not mixed directionality: levels don't matter - trailingWSStart will be 0 */
-    } else if(!(flags&MASK_EXPLICIT) || pBiDi->isInverse) {
-        /* mixed, but all characters are at the same embedding level */
-        /* or we are in "inverse BiDi" */
-        /* set all levels to the paragraph level */
-        for(i=0; i<length; ++i) {
-            levels[i]=level;
-        }
-    } else {
-        /* continue to perform (Xn) */
-
-        /* (X1) level is set for all codes, embeddingLevel keeps track of the push/pop operations */
-        /* both variables may carry the UBIDI_LEVEL_OVERRIDE flag to indicate the override status */
-        UBiDiLevel embeddingLevel=level, newLevel, stackTop=0;
-
-        UBiDiLevel stack[UBIDI_MAX_EXPLICIT_LEVEL];        /* we never push anything >=UBIDI_MAX_EXPLICIT_LEVEL */
-        uint32_t countOver60=0, countOver61=0;  /* count overflows of explicit levels */
-
-        /* recalculate the flags */
-        flags=0;
-
-        /* since we assume that this is a single paragraph, we ignore (X8) */
-        for(i=0; i<length; ++i) {
-            dirProp=dirProps[i];
-            switch(dirProp) {
-            case LRE:
-            case LRO:
-                /* (X3, X5) */
-                newLevel=(UBiDiLevel)((embeddingLevel+2)&~(UBIDI_LEVEL_OVERRIDE|1)); /* least greater even level */
-                if(newLevel<=UBIDI_MAX_EXPLICIT_LEVEL) {
-                    stack[stackTop]=embeddingLevel;
-                    ++stackTop;
-                    embeddingLevel=newLevel;
-                    if(dirProp==LRO) {
-                        embeddingLevel|=UBIDI_LEVEL_OVERRIDE;
-                    } else {
-                        embeddingLevel&=~UBIDI_LEVEL_OVERRIDE;
-                    }
-                } else if((embeddingLevel&~UBIDI_LEVEL_OVERRIDE)==UBIDI_MAX_EXPLICIT_LEVEL) {
-                    ++countOver61;
-                } else /* (embeddingLevel&~UBIDI_LEVEL_OVERRIDE)==UBIDI_MAX_EXPLICIT_LEVEL-1 */ {
-                    ++countOver60;
-                }
-                flags|=DIRPROP_FLAG(BN);
-                break;
-            case RLE:
-            case RLO:
-                /* (X2, X4) */
-                newLevel=(UBiDiLevel)(((embeddingLevel&~UBIDI_LEVEL_OVERRIDE)+1)|1); /* least greater odd level */
-                if(newLevel<=UBIDI_MAX_EXPLICIT_LEVEL) {
-                    stack[stackTop]=embeddingLevel;
-                    ++stackTop;
-                    embeddingLevel=newLevel;
-                    if(dirProp==RLO) {
-                        embeddingLevel|=UBIDI_LEVEL_OVERRIDE;
-                    } else {
-                        embeddingLevel&=~UBIDI_LEVEL_OVERRIDE;
-                    }
-                } else {
-                    ++countOver61;
-                }
-                flags|=DIRPROP_FLAG(BN);
-                break;
-            case PDF:
-                /* (X7) */
-                /* handle all the overflow cases first */
-                if(countOver61>0) {
-                    --countOver61;
-                } else if(countOver60>0 && (embeddingLevel&~UBIDI_LEVEL_OVERRIDE)!=UBIDI_MAX_EXPLICIT_LEVEL) {
-                    /* handle LRx overflows from level 60 */
-                    --countOver60;
-                } else if(stackTop>0) {
-                    /* this is the pop operation; it also pops level 61 while countOver60>0 */
-                    --stackTop;
-                    embeddingLevel=stack[stackTop];
-                /* } else { (underflow) */
-                }
-                flags|=DIRPROP_FLAG(BN);
-                break;
-            case B:
-                /*
-                 * We do not really expect to see a paragraph separator (B),
-                 * but we should do something reasonable with it,
-                 * especially at the end of the text.
-                 */
-                stackTop=0;
-                countOver60=countOver61=0;
-                embeddingLevel=level=pBiDi->paraLevel;
-                flags|=DIRPROP_FLAG(B);
-                break;
-            case BN:
-                /* BN, LRE, RLE, and PDF are supposed to be removed (X9) */
-                /* they will get their levels set correctly in adjustWSLevels() */
-                flags|=DIRPROP_FLAG(BN);
-                break;
-            default:
-                /* all other types get the "real" level */
-                if(level!=embeddingLevel) {
-                    level=embeddingLevel;
-                    if(level&UBIDI_LEVEL_OVERRIDE) {
-                        flags|=DIRPROP_FLAG_O(level)|DIRPROP_FLAG_MULTI_RUNS;
-                    } else {
-                        flags|=DIRPROP_FLAG_E(level)|DIRPROP_FLAG_MULTI_RUNS;
-                    }
-                }
-                if(!(level&UBIDI_LEVEL_OVERRIDE)) {
-                    flags|=DIRPROP_FLAG(dirProp);
-                }
-                break;
-            }
-
-            /*
-             * We need to set reasonable levels even on BN codes and
-             * explicit codes because we will later look at same-level runs (X10).
-             */
-            levels[i]=level;
-        }
-        if(flags&MASK_EMBEDDING) {
-            flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
-        }
-
-        /* subsequently, ignore the explicit codes and BN (X9) */
-
-        /* again, determine if the text is mixed-directional or single-directional */
-        pBiDi->flags=flags;
-        direction=directionFromFlags(flags);
-    }
-    return direction;
-}
-
-/*
- * Use a pre-specified embedding levels array:
- *
- * Adjust the directional properties for overrides (->LEVEL_OVERRIDE),
- * ignore all explicit codes (X9),
- * and check all the preset levels.
- *
- * Recalculate the flags to have them reflect the real properties
- * after taking the explicit embeddings into account.
- */
-static UBiDiDirection
-checkExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
-    const DirProp *dirProps=pBiDi->dirProps;
-    UBiDiLevel *levels=pBiDi->levels;
-
-    int32_t i, length=pBiDi->length;
-    Flags flags=0;  /* collect all directionalities in the text */
-    UBiDiLevel level, paraLevel=pBiDi->paraLevel;
-
-    for(i=0; i<length; ++i) {
-      // dlf: we special case levels array for java, 0 means base level, not actually 0
-      if (levels[i] == 0) {
-        levels[i] = paraLevel;
-      }
-        level=levels[i];
-        if(level&UBIDI_LEVEL_OVERRIDE) {
-            /* keep the override flag in levels[i] but adjust the flags */
-            level&=~UBIDI_LEVEL_OVERRIDE;     /* make the range check below simpler */
-            flags|=DIRPROP_FLAG_O(level);
-        } else {
-            /* set the flags */
-            flags|=DIRPROP_FLAG_E(level)|DIRPROP_FLAG(dirProps[i]);
-        }
-        if(level<paraLevel || UBIDI_MAX_EXPLICIT_LEVEL<level) {
-            /* level out of bounds */
-            *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-            return UBIDI_LTR;
-        }
-    }
-    if(flags&MASK_EMBEDDING) {
-        flags|=DIRPROP_FLAG_LR(pBiDi->paraLevel);
-    }
-
-    /* determine if the text is mixed-directional or single-directional */
-    pBiDi->flags=flags;
-    return directionFromFlags(flags);
-}
-
-/* determine if the text is mixed-directional or single-directional */
-static UBiDiDirection
-directionFromFlags(Flags flags) {
-    /* if the text contains AN and neutrals, then some neutrals may become RTL */
-    if(!(flags&MASK_RTL || ((flags&DIRPROP_FLAG(AN)) && (flags&MASK_POSSIBLE_N)))) {
-        return UBIDI_LTR;
-    } else if(!(flags&MASK_LTR)) {
-        return UBIDI_RTL;
-    } else {
-        return UBIDI_MIXED;
-    }
-}
-
-/* perform rules (Wn), (Nn), and (In) on a run of the text ------------------ */
-
-/*
- * This implementation of the (Wn) rules applies all rules in one pass.
- * In order to do so, it needs a look-ahead of typically 1 character
- * (except for W5: sequences of ET) and keeps track of changes
- * in a rule Wp that affect a later Wq (p<q).
- *
- * historyOfEN is a variable-saver: it contains 4 boolean states;
- * a bit in it set to 1 means:
- *  bit 0: the current code is an EN after W2
- *  bit 1: the current code is an EN after W4
- *  bit 2: the previous code was an EN after W2
- *  bit 3: the previous code was an EN after W4
- * In other words, b0..1 have transitions of EN in the current iteration,
- * while b2..3 have the transitions of EN in the previous iteration.
- * A simple historyOfEN<<=2 suffices for the propagation.
- *
- * The (Nn) and (In) rules are also performed in that same single loop,
- * but effectively one iteration behind for white space.
- *
- * Since all implicit rules are performed in one step, it is not necessary
- * to actually store the intermediate directional properties in dirProps[].
- */
-
-#define EN_SHIFT 2
-#define EN_AFTER_W2 1
-#define EN_AFTER_W4 2
-#define EN_ALL 3
-#define PREV_EN_AFTER_W2 4
-#define PREV_EN_AFTER_W4 8
-
-static void
-resolveImplicitLevels(UBiDi *pBiDi,
-                      int32_t start, int32_t limit,
-                      DirProp sor, DirProp eor) {
-    const DirProp *dirProps=pBiDi->dirProps;
-    UBiDiLevel *levels=pBiDi->levels;
-
-    int32_t i, next, neutralStart=-1;
-    DirProp prevDirProp, dirProp, nextDirProp, lastStrong, beforeNeutral=L;
-    UBiDiLevel numberLevel;
-    uint8_t historyOfEN;
-
-    /* initialize: current at sor, next at start (it is start<limit) */
-    next=start;
-    dirProp=lastStrong=sor;
-    nextDirProp=dirProps[next];
-    historyOfEN=0;
-
-    if(pBiDi->isInverse) {
-        /*
-         * For "inverse BiDi", we set the levels of numbers just like for
-         * regular L characters, plus a flag that ubidi_getRuns() will use
-         * to set a similar flag on the corresponding output run.
-         */
-        numberLevel=levels[start];
-        if(numberLevel&1) {
-            ++numberLevel;
-        }
-    } else {
-        /* normal BiDi: least greater even level */
-        numberLevel=(UBiDiLevel)((levels[start]+2)&~1);
-    }
-
-    /*
-     * In all steps of this implementation, BN and explicit embedding codes
-     * must be treated as if they didn't exist (X9).
-     * They will get levels set before a non-neutral character, and remain
-     * undefined before a neutral one, but adjustWSLevels() will take care
-     * of all of them.
-     */
-    while(DIRPROP_FLAG(nextDirProp)&MASK_BN_EXPLICIT) {
-        if(++next<limit) {
-            nextDirProp=dirProps[next];
-        } else {
-            nextDirProp=eor;
-            break;
-        }
-    }
-
-    /*
-     * Note: at the end of this file, there is a prototype
-     * of a version of this function that uses a statetable
-     * at the core of this state machine.
-     * If you make changes to this state machine,
-     * please update that prototype as well.
-     */
-
-    /* loop for entire run */
-    while(next<limit) {
-        /* advance */
-        prevDirProp=dirProp;
-        dirProp=nextDirProp;
-        i=next;
-        do {
-            if(++next<limit) {
-                nextDirProp=dirProps[next];
-            } else {
-                nextDirProp=eor;
-                break;
-            }
-        } while(DIRPROP_FLAG(nextDirProp)&MASK_BN_EXPLICIT);
-        historyOfEN<<=EN_SHIFT;
-
-        /* (W1..W7) */
-        switch(dirProp) {
-        case L:
-            lastStrong=L;
-            break;
-        case R:
-            lastStrong=R;
-            break;
-        case AL:
-            /* (W3) */
-            lastStrong=AL;
-            dirProp=R;
-            break;
-        case EN:
-            /* we have to set historyOfEN correctly */
-            if(lastStrong==AL) {
-                /* (W2) */
-                dirProp=AN;
-            } else {
-                if(lastStrong==L) {
-                    /* (W7) */
-                    dirProp=L;
-                }
-                /* this EN stays after (W2) and (W4) - at least before (W7) */
-                historyOfEN|=EN_ALL;
-            }
-            break;
-        case ES:
-            if( historyOfEN&PREV_EN_AFTER_W2 &&     /* previous was EN before (W4) */
-                nextDirProp==EN && lastStrong!=AL   /* next is EN and (W2) won't make it AN */
-            ) {
-                /* (W4) */
-                if(lastStrong!=L) {
-                    dirProp=EN;
-                } else {
-                    /* (W7) */
-                    dirProp=L;
-                }
-                historyOfEN|=EN_AFTER_W4;
-            } else {
-                /* (W6) */
-                dirProp=ON;
-            }
-            break;
-        case CS:
-            if( historyOfEN&PREV_EN_AFTER_W2 &&     /* previous was EN before (W4) */
-                nextDirProp==EN && lastStrong!=AL   /* next is EN and (W2) won't make it AN */
-            ) {
-                /* (W4) */
-                if(lastStrong!=L) {
-                    dirProp=EN;
-                } else {
-                    /* (W7) */
-                    dirProp=L;
-                }
-                historyOfEN|=EN_AFTER_W4;
-            } else if(prevDirProp==AN &&                    /* previous was AN */
-                      (nextDirProp==AN ||                   /* next is AN */
-                      (nextDirProp==EN && lastStrong==AL))  /* or (W2) will make it one */
-            ) {
-                /* (W4) */
-                dirProp=AN;
-            } else {
-                /* (W6) */
-                dirProp=ON;
-            }
-            break;
-        case ET:
-            /* get sequence of ET; advance only next, not current, previous or historyOfEN */
-            if(next<limit) {
-                while(DIRPROP_FLAG(nextDirProp)&MASK_ET_NSM_BN /* (W1), (X9) */) {
-                    if(++next<limit) {
-                        nextDirProp=dirProps[next];
-                    } else {
-                        nextDirProp=eor;
-                        break;
-                    }
-                }
-            }
-
-            /* now process the sequence of ET like a single ET */
-            if((historyOfEN&PREV_EN_AFTER_W4) ||     /* previous was EN before (W5) */
-                (nextDirProp==EN && lastStrong!=AL)   /* next is EN and (W2) won't make it AN */
-            ) {
-                /* (W5) */
-                if(lastStrong!=L) {
-                    dirProp=EN;
-                } else {
-                    /* (W7) */
-                    dirProp=L;
-                }
-            } else {
-                /* (W6) */
-                dirProp=ON;
-            }
-
-            /* apply the result of (W1), (W5)..(W7) to the entire sequence of ET */
-            break;
-        case NSM:
-            /* (W1) */
-            dirProp=prevDirProp;
-            /* set historyOfEN back to prevDirProp's historyOfEN */
-            historyOfEN>>=EN_SHIFT;
-            /*
-             * Technically, this should be done before the switch() in the form
-             *      if(nextDirProp==NSM) {
-             *          dirProps[next]=nextDirProp=dirProp;
-             *      }
-             *
-             * - effectively one iteration ahead.
-             * However, whether the next dirProp is NSM or is equal to the current dirProp
-             * does not change the outcome of any condition in (W2)..(W7).
-             */
-            break;
-        default:
-            break;
-        }
-
-        /* here, it is always [prev,this,next]dirProp!=BN; it may be next>i+1 */
-
-        /* perform (Nn) - here, only L, R, EN, AN, and neutrals are left */
-        /* for "inverse BiDi", treat neutrals like L */
-        /* this is one iteration late for the neutrals */
-        if(DIRPROP_FLAG(dirProp)&MASK_N) {
-            if(neutralStart<0) {
-                /* start of a sequence of neutrals */
-                neutralStart=i;
-                beforeNeutral=prevDirProp;
-            }
-        } else /* not a neutral, can be only one of { L, R, EN, AN } */ {
-            /*
-             * Note that all levels[] values are still the same at this
-             * point because this function is called for an entire
-             * same-level run.
-             * Therefore, we need to read only one actual level.
-             */
-            UBiDiLevel level=levels[i];
-
-            if(neutralStart>=0) {
-                UBiDiLevel final;
-                /* end of a sequence of neutrals (dirProp is "afterNeutral") */
-                if(!(pBiDi->isInverse)) {
-                    if(beforeNeutral==L) {
-                        if(dirProp==L) {
-                            final=0;                /* make all neutrals L (N1) */
-                        } else {
-                            final=level;            /* make all neutrals "e" (N2) */
-                        }
-                    } else /* beforeNeutral is one of { R, EN, AN } */ {
-                        if(dirProp==L) {
-                            final=level;            /* make all neutrals "e" (N2) */
-                        } else {
-                            final=1;                /* make all neutrals R (N1) */
-                        }
-                    }
-                } else {
-                    /* "inverse BiDi": collapse [before]dirProps L, EN, AN into L */
-                    if(beforeNeutral!=R) {
-                        if(dirProp!=R) {
-                            final=0;                /* make all neutrals L (N1) */
-                        } else {
-                            final=level;            /* make all neutrals "e" (N2) */
-                        }
-                    } else /* beforeNeutral is one of { R, EN, AN } */ {
-                        if(dirProp!=R) {
-                            final=level;            /* make all neutrals "e" (N2) */
-                        } else {
-                            final=1;                /* make all neutrals R (N1) */
-                        }
-                    }
-                }
-                /* perform (In) on the sequence of neutrals */
-                if((level^final)&1) {
-                    /* do something only if we need to _change_ the level */
-                    do {
-                        ++levels[neutralStart];
-                    } while(++neutralStart<i);
-                }
-                neutralStart=-1;
-            }
-
-            /* perform (In) on the non-neutral character */
-            /*
-             * in the cases of (W5), processing a sequence of ET,
-             * and of (X9), skipping BN,
-             * there may be multiple characters from i to <next
-             * that all get (virtually) the same dirProp and (really) the same level
-             */
-            if(dirProp==L) {
-                if(level&1) {
-                    ++level;
-                } else {
-                    i=next;     /* we keep the levels */
-                }
-            } else if(dirProp==R) {
-                if(!(level&1)) {
-                    ++level;
-                } else {
-                    i=next;     /* we keep the levels */
-                }
-            } else /* EN or AN */ {
-                /* this level depends on whether we do "inverse BiDi" */
-                level=numberLevel;
-            }
-
-            /* apply the new level to the sequence, if necessary */
-            while(i<next) {
-                levels[i++]=level;
-            }
-        }
-    }
-
-    /* perform (Nn) - here,
-       the character after the the neutrals is eor, which is either L or R */
-    /* this is one iteration late for the neutrals */
-    if(neutralStart>=0) {
-        /*
-         * Note that all levels[] values are still the same at this
-         * point because this function is called for an entire
-         * same-level run.
-         * Therefore, we need to read only one actual level.
-         */
-        UBiDiLevel level=levels[neutralStart], final;
-
-        /* end of a sequence of neutrals (eor is "afterNeutral") */
-        if(!(pBiDi->isInverse)) {
-            if(beforeNeutral==L) {
-                if(eor==L) {
-                    final=0;                /* make all neutrals L (N1) */
-                } else {
-                    final=level;            /* make all neutrals "e" (N2) */
-                }
-            } else /* beforeNeutral is one of { R, EN, AN } */ {
-                if(eor==L) {
-                    final=level;            /* make all neutrals "e" (N2) */
-                } else {
-                    final=1;                /* make all neutrals R (N1) */
-                }
-            }
-        } else {
-            /* "inverse BiDi": collapse [before]dirProps L, EN, AN into L */
-            if(beforeNeutral!=R) {
-                if(eor!=R) {
-                    final=0;                /* make all neutrals L (N1) */
-                } else {
-                    final=level;            /* make all neutrals "e" (N2) */
-                }
-            } else /* beforeNeutral is one of { R, EN, AN } */ {
-                if(eor!=R) {
-                    final=level;            /* make all neutrals "e" (N2) */
-                } else {
-                    final=1;                /* make all neutrals R (N1) */
-                }
-            }
-        }
-        /* perform (In) on the sequence of neutrals */
-        if((level^final)&1) {
-            /* do something only if we need to _change_ the level */
-            do {
-                ++levels[neutralStart];
-            } while(++neutralStart<limit);
-        }
-    }
-}
-
-/* perform (L1) and (X9) ---------------------------------------------------- */
-
-/*
- * Reset the embedding levels for some non-graphic characters (L1).
- * This function also sets appropriate levels for BN, and
- * explicit embedding types that are supposed to have been removed
- * from the paragraph in (X9).
- */
-static void
-adjustWSLevels(UBiDi *pBiDi) {
-    const DirProp *dirProps=pBiDi->dirProps;
-    UBiDiLevel *levels=pBiDi->levels;
-    int32_t i;
-
-    if(pBiDi->flags&MASK_WS) {
-        UBiDiLevel paraLevel=pBiDi->paraLevel;
-        Flags flag;
-
-        i=pBiDi->trailingWSStart;
-        while(i>0) {
-            /* reset a sequence of WS/BN before eop and B/S to the paragraph paraLevel */
-            while(i>0 && DIRPROP_FLAG(dirProps[--i])&MASK_WS) {
-                levels[i]=paraLevel;
-            }
-
-            /* reset BN to the next character's paraLevel until B/S, which restarts above loop */
-            /* here, i+1 is guaranteed to be <length */
-            while(i>0) {
-                flag=DIRPROP_FLAG(dirProps[--i]);
-                if(flag&MASK_BN_EXPLICIT) {
-                    levels[i]=levels[i+1];
-                } else if(flag&MASK_B_S) {
-                    levels[i]=paraLevel;
-                    break;
-                }
-            }
-        }
-    }
-
-    /* now remove the UBIDI_LEVEL_OVERRIDE flags, if any */
-    /* (a separate loop can be optimized more easily by a compiler) */
-    if(pBiDi->flags&MASK_OVERRIDE) {
-        for(i=pBiDi->trailingWSStart; i>0;) {
-            levels[--i]&=~UBIDI_LEVEL_OVERRIDE;
-        }
-    }
-}
-
-/* -------------------------------------------------------------------------- */
-
-U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getDirection(const UBiDi *pBiDi) {
-    if(pBiDi!=NULL) {
-        return pBiDi->direction;
-    } else {
-        return UBIDI_LTR;
-    }
-}
-
-U_CAPI const UChar * U_EXPORT2
-ubidi_getText(const UBiDi *pBiDi) {
-    if(pBiDi!=NULL) {
-        return pBiDi->text;
-    } else {
-        return NULL;
-    }
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getLength(const UBiDi *pBiDi) {
-    if(pBiDi!=NULL) {
-        return pBiDi->length;
-    } else {
-        return 0;
-    }
-}
-
-U_CAPI UBiDiLevel U_EXPORT2
-ubidi_getParaLevel(const UBiDi *pBiDi) {
-    if(pBiDi!=NULL) {
-        return pBiDi->paraLevel;
-    } else {
-        return 0;
-    }
-}
-
-/* statetable prototype ----------------------------------------------------- */
-
-/*
- * This is here for possible future
- * performance work and is not compiled right now.
- */
-
-#if 0
-/*
- * This is a piece of code that could be part of ubidi.c/resolveImplicitLevels().
- * It replaces in the (Wn) state machine the switch()-if()-cascade with
- * just a few if()s and a state table.
- */
-
-/* use the state table only for the following dirProp's */
-#define MASK_W_TABLE (FLAG(L)|FLAG(R)|FLAG(AL)|FLAG(EN)|FLAG(ES)|FLAG(CS)|FLAG(ET)|FLAG(AN))
-
-/*
- * inputs:
- *
- * 0..1 historyOfEN - 2b
- * 2    prevDirProp==AN - 1b
- * 3..4 lastStrong, one of { L, R, AL, none } - 2b
- * 5..7 dirProp, one of { L, R, AL, EN, ES, CS, ET, AN } - 3b
- * 8..9 nextDirProp, one of { EN, AN, other }
- *
- * total: 10b=1024 states
- */
-enum { _L, _R, _AL, _EN, _ES, _CS, _ET, _AN, _OTHER };  /* lastStrong, dirProp */
-enum { __EN, __AN, __OTHER };                           /* nextDirProp */
-
-#define LAST_STRONG_SHIFT 3
-#define DIR_PROP_SHIFT 5
-#define NEXT_DIR_PROP_SHIFT 8
-
-/* masks after shifting */
-#define LAST_STRONG_MASK 3
-#define DIR_PROP_MASK 7
-#define STATE_MASK 0x1f
-
-/* convert dirProp into _dirProp (above enum) */
-static DirProp inputDirProp[dirPropCount]={ _X<<DIR_PROP_SHIFT, ... };
-
-/* convert dirProp into __dirProp (above enum) */
-static DirProp inputNextDirProp[dirPropCount]={ __X<<NEXT_DIR_PROP_SHIFT, ... };
-
-/*
- * outputs:
- *
- * dirProp, one of { L, R, EN, AN, ON } - 3b
- *
- * 0..1 historyOfEN - 2b
- * 2    prevDirProp==AN - 1b
- * 3..4 lastStrong, one of { L, R, AL, none } - 2b
- * 5..7 new dirProp, one of { L, R, EN, AN, ON }
- *
- * total: 8 bits=1 byte per state
- */
-enum { ___L, ___R, ___EN, ___AN, ___ON, ___count };
-
-/* convert ___dirProp into dirProp (above enum) */
-static DirProp outputDirProp[___count]={ X, ... };
-
-/* state table */
-static uint8_t wnTable[1024]={ /* calculate with switch()-if()-cascade */ };
-
-static void
-resolveImplicitLevels(BiDi *pBiDi,
-                      Index start, Index end,
-                      DirProp sor, DirProp eor) {
-    /* new variable */
-    uint8_t state;
-
-    /* remove variable lastStrong */
-
-    /* set initial state (set lastStrong, the rest is 0) */
-    state= sor==L ? 0 : _R<<LAST_STRONG_SHIFT;
-
-    while(next<limit) {
-        /* advance */
-        prevDirProp=dirProp;
-        dirProp=nextDirProp;
-        i=next;
-        do {
-            if(++next<limit) {
-                nextDirProp=dirProps[next];
-            } else {
-                nextDirProp=eor;
-                break;
-            }
-        } while(FLAG(nextDirProp)&MASK_BN_EXPLICIT);
-
-        /* (W1..W7) */
-        /* ### This may be more efficient with a switch(dirProp). */
-        if(FLAG(dirProp)&MASK_W_TABLE) {
-            state=wnTable[
-                    ((int)state)|
-                    inputDirProp[dirProp]|
-                    inputNextDirProp[nextDirProp]
-            ];
-            dirProp=outputDirProp[state>>DIR_PROP_SHIFT];
-            state&=STATE_MASK;
-        } else if(dirProp==ET) {
-            /* get sequence of ET; advance only next, not current, previous or historyOfEN */
-            while(next<limit && FLAG(nextDirProp)&MASK_ET_NSM_BN /* (W1), (X9) */) {
-                if(++next<limit) {
-                    nextDirProp=dirProps[next];
-                } else {
-                    nextDirProp=eor;
-                    break;
-                }
-            }
-
-            state=wnTable[
-                    ((int)state)|
-                    _ET<<DIR_PROP_SHIFT|
-                    inputNextDirProp[nextDirProp]
-            ];
-            dirProp=outputDirProp[state>>DIR_PROP_SHIFT];
-            state&=STATE_MASK;
-
-            /* apply the result of (W1), (W5)..(W7) to the entire sequence of ET */
-        } else if(dirProp==NSM) {
-            /* (W1) */
-            dirProp=prevDirProp;
-            /* keep prevDirProp's EN and AN states! */
-        } else /* other */ {
-            /* set EN and AN states to 0 */
-            state&=LAST_STRONG_MASK<<LAST_STRONG_SHIFT;
-        }
-
-        /* perform (Nn) and (In) as usual */
-    }
-    /* perform (Nn) and (In) as usual */
-}
-#endif
--- a/jdk/src/share/native/sun/font/bidi/ubidi.h	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,913 +0,0 @@
-/*
- * Portions Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-*   file name:  ubidi.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999jul27
-*   created by: Markus W. Scherer
-*/
-
-#ifndef UBIDI_H
-#define UBIDI_H
-
-#include "utypes.h"
-#include "uchardir.h"
-
-/*
- * javadoc-style comments are intended to be transformed into HTML
- * using DOC++ - see
- * http://www.zib.de/Visual/software/doc++/index.html .
- *
- * The HTML documentation is created with
- *  doc++ -H ubidi.h
- *
- * The following #define trick allows us to do it all in one file
- * and still be able to compile it.
- */
-#define DOCXX_TAG
-#define BIDI_SAMPLE_CODE
-
-/**
- * @name BiDi algorithm for ICU
- *
- * <h2>BiDi algorithm for ICU</h2>
- *
- * This is an implementation of the Unicode Bidirectional algorithm.
- * The algorithm is defined in the
- * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Technical Report 9</a>,
- * version 5, also described in The Unicode Standard, Version 3.0 .<p>
- *
- * <h3>General remarks about the API:</h3>
- *
- * In functions with an error code parameter,
- * the <code>pErrorCode</code> pointer must be valid
- * and the value that it points to must not indicate a failure before
- * the function call. Otherwise, the function returns immediately.
- * After the function call, the value indicates success or failure.<p>
- *
- * The <quote>limit</quote> of a sequence of characters is the position just after their
- * last character, i.e., one more than that position.<p>
- *
- * Some of the API functions provide access to <quote>runs</quote>.
- * Such a <quote>run</quote> is defined as a sequence of characters
- * that are at the same embedding level
- * after performing the BiDi algorithm.<p>
- *
- * @author Markus W. Scherer
- */
-DOCXX_TAG
-/*@{*/
-
-/**
- * UBiDiLevel is the type of the level values in this
- * BiDi implementation.
- * It holds an embedding level and indicates the visual direction
- * by its bit&nbsp;0 (even/odd value).<p>
- *
- * It can also hold non-level values for the
- * <code>paraLevel</code> and <code>embeddingLevels</code>
- * arguments of <code>ubidi_setPara()</code>; there:
- * <ul>
- * <li>bit&nbsp;7 of an <code>embeddingLevels[]</code>
- * value indicates whether the using application is
- * specifying the level of a character to <i>override</i> whatever the
- * BiDi implementation would resolve it to.</li>
- * <li><code>paraLevel</code> can be set to the
- * pesudo-level values <code>UBIDI_DEFAULT_LTR</code>
- * and <code>UBIDI_DEFAULT_RTL</code>.</li>
- *
- * @see ubidi_setPara
- *
- * <p>The related constants are not real, valid level values.
- * <code>UBIDI_DEFAULT_XXX</code> can be used to specify
- * a default for the paragraph level for
- * when the <code>ubidi_setPara()</code> function
- * shall determine it but there is no
- * strongly typed character in the input.<p>
- *
- * Note that the value for <code>UBIDI_DEFAULT_LTR</code> is even
- * and the one for <code>UBIDI_DEFAULT_RTL</code> is odd,
- * just like with normal LTR and RTL level values -
- * these special values are designed that way. Also, the implementation
- * assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd.
- *
- * @see UBIDI_DEFAULT_LTR
- * @see UBIDI_DEFAULT_RTL
- * @see UBIDI_LEVEL_OVERRIDE
- * @see UBIDI_MAX_EXPLICIT_LEVEL
- */
-typedef uint8_t UBiDiLevel;
-
-/** @memo If there is no strong character, then set the paragraph level to 0 (left-to-right). */
-#define UBIDI_DEFAULT_LTR 0xfe
-
-/** @memo If there is no strong character, then set the paragraph level to 1 (right-to-left). */
-#define UBIDI_DEFAULT_RTL 0xff
-
-/**
- * @memo Maximum explicit embedding level
- * (The maximum resolved level can be up to <code>UBIDI_MAX_EXPLICIT_LEVEL+1</code>).
- */
-#define UBIDI_MAX_EXPLICIT_LEVEL 61
-
-/** @memo Bit flag for level input: overrides directional properties. */
-#define UBIDI_LEVEL_OVERRIDE 0x80
-
-/**
- * @memo <code>UBiDiDirection</code> values indicate the text direction.
- */
-enum UBiDiDirection {
-    /** @memo All left-to-right text. This is a 0 value. */
-    UBIDI_LTR,
-    /** @memo All right-to-left text. This is a 1 value. */
-    UBIDI_RTL,
-    /** @memo Mixed-directional text. */
-    UBIDI_MIXED
-};
-
-typedef enum UBiDiDirection UBiDiDirection;
-
-/**
- * Forward declaration of the <code>UBiDi</code> structure for the declaration of
- * the API functions. Its fields are implementation-specific.<p>
- * This structure holds information about a paragraph of text
- * with BiDi-algorithm-related details, or about one line of
- * such a paragraph.<p>
- * Reordering can be done on a line, or on a paragraph which is
- * then interpreted as one single line.
- */
-struct UBiDi;
-
-typedef struct UBiDi UBiDi;
-
-/**
- * Allocate a <code>UBiDi</code> structure.
- * Such an object is initially empty. It is assigned
- * the BiDi properties of a paragraph by <code>ubidi_setPara()</code>
- * or the BiDi properties of a line of a paragraph by
- * <code>ubidi_getLine()</code>.<p>
- * This object can be reused for as long as it is not deallocated
- * by calling <code>ubidi_close()</code>.<p>
- * <code>ubidi_set()</code> will allocate additional memory for
- * internal structures as necessary.
- *
- * @return An empty <code>UBiDi</code> object.
- */
-U_CAPI UBiDi * U_EXPORT2
-ubidi_open();
-
-/**
- * Allocate a <code>UBiDi</code> structure with preallocated memory
- * for internal structures.
- * This function provides a <code>UBiDi</code> object like <code>ubidi_open()</code>
- * with no arguments, but it also preallocates memory for internal structures
- * according to the sizings supplied by the caller.<p>
- * Subsequent functions will not allocate any more memory, and are thus
- * guaranteed not to fail because of lack of memory.<p>
- * The preallocation can be limited to some of the internal memory
- * by setting some values to 0 here. That means that if, e.g.,
- * <code>maxRunCount</code> cannot be reasonably predetermined and should not
- * be set to <code>maxLength</code> (the only failproof value) to avoid
- * wasting memory, then <code>maxRunCount</code> could be set to 0 here
- * and the internal structures that are associated with it will be allocated
- * on demand, just like with <code>ubidi_open()</code>.
- *
- * @param maxLength is the maximum paragraph or line length that internal memory
- *        will be preallocated for. An attempt to associate this object with a
- *        longer text will fail, unless this value is 0, which leaves the allocation
- *        up to the implementation.
- *
- * @param maxRunCount is the maximum anticipated number of same-level runs
- *        that internal memory will be preallocated for. An attempt to access
- *        visual runs on an object that was not preallocated for as many runs
- *        as the text was actually resolved to will fail,
- *        unless this value is 0, which leaves the allocation up to the implementation.<p>
- *        The number of runs depends on the actual text and maybe anywhere between
- *        1 and <code>maxLength</code>. It is typically small.<p>
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @return An empty <code>UBiDi</code> object with preallocated memory.
- */
-U_CAPI UBiDi * U_EXPORT2
-ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
-
-/**
- * <code>ubidi_close()</code> must be called to free the memory
- * associated with a UBiDi object.<p>
- *
- * <strong>Important: </strong>
- * If a <code>UBiDi</code> object is the <quote>child</quote>
- * of another one (its <quote>parent</quote>), after calling
- * <code>ubidi_setLine()</code>, then the child object must
- * be destroyed (closed) or reused (by calling
- * <code>ubidi_setPara()</code> or <code>ubidi_setLine()</code>)
- * before the parent object.
- *
- * @param pBiDi is a <code>UBiDi</code> object.
- *
- * @see ubidi_setPara
- * @see ubidi_setLine
- */
-U_CAPI void U_EXPORT2
-ubidi_close(UBiDi *pBiDi);
-
-/**
- * Perform the Unicode BiDi algorithm. It is defined in the
- * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Technical Report 9</a>,
- * version 5,
- * also described in The Unicode Standard, Version 3.0 .<p>
- *
- * This function takes a single plain text paragraph with or without
- * externally specified embedding levels from <quote>styled</quote> text
- * and computes the left-right-directionality of each character.<p>
- *
- * If the entire paragraph consists of text of only one direction, then
- * the function may not perform all the steps described by the algorithm,
- * i.e., some levels may not be the same as if all steps were performed.
- * This is not relevant for unidirectional text.<br>
- * For example, in pure LTR text with numbers the numbers would get
- * a resolved level of 2 higher than the surrounding text according to
- * the algorithm. This implementation may set all resolved levels to
- * the same value in such a case.<p>
- *
- * The text must be externally split into separate paragraphs (rule P1).
- * Paragraph separators (B) should appear at most at the very end.
- *
- * @param pBiDi A <code>UBiDi</code> object allocated with <code>ubidi_open()</code>
- *        which will be set to contain the reordering information,
- *        especially the resolved levels for all the characters in <code>text</code>.
- *
- * @param text is a pointer to the single-paragraph text that the
- *        BiDi algorithm will be performed on
- *        (step (P1) of the algorithm is performed externally).
- *        <strong>The text must be (at least) <code>length</code> long.</strong>
- *
- * @param length is the length of the text; if <code>length==-1</code> then
- *        the text must be zero-terminated.
- *
- * @param paraLevel specifies the default level for the paragraph;
- *        it is typically 0 (LTR) or 1 (RTL).
- *        If the function shall determine the paragraph level from the text,
- *        then <code>paraLevel</code> can be set to
- *        either <code>UBIDI_DEFAULT_LTR</code>
- *        or <code>UBIDI_DEFAULT_RTL</code>;
- *        if there is no strongly typed character, then
- *        the desired default is used (0 for LTR or 1 for RTL).
- *        Any other value between 0 and <code>UBIDI_MAX_EXPLICIT_LEVEL</code> is also valid,
- *        with odd levels indicating RTL.
- *
- * @param embeddingLevels (in) may be used to preset the embedding and override levels,
- *        ignoring characters like LRE and PDF in the text.
- *        A level overrides the directional property of its corresponding
- *        (same index) character if the level has the
- *        <code>UBIDI_LEVEL_OVERRIDE</code> bit set.<p>
- *        Except for that bit, it must be
- *        <code>paraLevel&lt;=embeddingLevels[]&lt;=UBIDI_MAX_EXPLICIT_LEVEL</code>.<p>
- *        <strong>Caution: </strong>A copy of this pointer, not of the levels,
- *        will be stored in the <code>UBiDi</code> object;
- *        the <code>embeddingLevels</code> array must not be
- *        deallocated before the <code>UBiDi</code> structure is destroyed or reused,
- *        and the <code>embeddingLevels</code>
- *        should not be modified to avoid unexpected results on subsequent BiDi operations.
- *        However, the <code>ubidi_setPara()</code> and
- *        <code>ubidi_setLine()</code> functions may modify some or all of the levels.<p>
- *        After the <code>UBiDi</code> object is reused or destroyed, the caller
- *        must take care of the deallocation of the <code>embeddingLevels</code> array.<p>
- *        <strong>The <code>embeddingLevels</code> array must be
- *        at least <code>length</code> long.</strong>
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- */
-U_CAPI void U_EXPORT2
-ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
-              UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
-              UErrorCode *pErrorCode);
-
-/**
- * <code>ubidi_getLine()</code> sets a <code>UBiDi</code> to
- * contain the reordering information, especially the resolved levels,
- * for all the characters in a line of text. This line of text is
- * specified by referring to a <code>UBiDi</code> object representing
- * this information for a paragraph of text, and by specifying
- * a range of indexes in this paragraph.<p>
- * In the new line object, the indexes will range from 0 to <code>limit-start</code>.<p>
- *
- * This is used after calling <code>ubidi_setPara()</code>
- * for a paragraph, and after line-breaking on that paragraph.
- * It is not necessary if the paragraph is treated as a single line.<p>
- *
- * After line-breaking, rules (L1) and (L2) for the treatment of
- * trailing WS and for reordering are performed on
- * a <code>UBiDi</code> object that represents a line.<p>
- *
- * <strong>Important: </strong><code>pLineBiDi</code> shares data with
- * <code>pParaBiDi</code>.
- * You must destroy or reuse <code>pLineBiDi</code> before <code>pParaBiDi</code>.
- * In other words, you must destroy or reuse the <code>UBiDi</code> object for a line
- * before the object for its parent paragraph.
- *
- * @param pParaBiDi is the parent paragraph object.
- *
- * @param start is the line's first index into the paragraph text.
- *
- * @param limit is just behind the line's last index into the paragraph text
- *        (its last index +1).<br>
- *        It must be <code>0&lt;=start&lt;=limit&lt;=</code>paragraph length.
- *
- * @param pLineBiDi is the object that will now represent a line of the paragraph.
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @see ubidi_setPara
- */
-U_CAPI void U_EXPORT2
-ubidi_setLine(const UBiDi *pParaBiDi,
-              int32_t start, int32_t limit,
-              UBiDi *pLineBiDi,
-              UErrorCode *pErrorCode);
-
-/**
- * Get the directionality of the text.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @return A <code>UBIDI_XXX</code> value that indicates if the entire text
- *         represented by this object is unidirectional,
- *         and which direction, or if it is mixed-directional.
- *
- * @see UBiDiDirection
- */
-U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getDirection(const UBiDi *pBiDi);
-
-/**
- * Get the length of the text.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @return The length of the text that the UBiDi object was created for.
- */
-U_CAPI int32_t U_EXPORT2
-ubidi_getLength(const UBiDi *pBiDi);
-
-/**
- * Get the paragraph level of the text.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @return The paragraph level.
- *
- * @see UBiDiLevel
- */
-U_CAPI UBiDiLevel U_EXPORT2
-ubidi_getParaLevel(const UBiDi *pBiDi);
-
-/**
- * Get the level for one character.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param charIndex the index of a character.
- *
- * @return The level for the character at charIndex.
- *
- * @see UBiDiLevel
- */
-U_CAPI UBiDiLevel U_EXPORT2
-ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex);
-
-/**
- * Get an array of levels for each character.<p>
- *
- * Note that this function may allocate memory under some
- * circumstances, unlike <code>ubidi_getLevelAt()</code>.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @return The levels array for the text,
- *         or <code>NULL</code> if an error occurs.
- *
- * @see UBiDiLevel
- */
-U_CAPI const UBiDiLevel * U_EXPORT2
-ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode);
-
-/**
- * Get a logical run.
- * This function returns information about a run and is used
- * to retrieve runs in logical order.<p>
- * This is especially useful for line-breaking on a paragraph.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param logicalStart is the first character of the run.
- *
- * @param pLogicalLimit will receive the limit of the run.
- *        The l-value that you point to here may be the
- *        same expression (variable) as the one for
- *        <code>logicalStart</code>.
- *        This pointer can be <code>NULL</code> if this
- *        value is not necessary.
- *
- * @param pLevel will receive the level of the run.
- *        This pointer can be <code>NULL</code> if this
- *        value is not necessary.
- */
-U_CAPI void U_EXPORT2
-ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalStart,
-                    int32_t *pLogicalLimit, UBiDiLevel *pLevel);
-
-/**
- * Get the number of runs.
- * This function may invoke the actual reordering on the
- * <code>UBiDi</code> object, after <code>ubidi_setPara()</code>
- * may have resolved only the levels of the text. Therefore,
- * <code>ubidi_countRuns()</code> may have to allocate memory,
- * and may fail doing so.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @return The number of runs.
- */
-U_CAPI int32_t U_EXPORT2
-ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
-
-/**
- * Get one run's logical start, length, and directionality,
- * which can be 0 for LTR or 1 for RTL.
- * In an RTL run, the character at the logical start is
- * visually on the right of the displayed run.
- * The length is the number of characters in the run.<p>
- * <code>ubidi_countRuns()</code> should be called
- * before the runs are retrieved.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param runIndex is the number of the run in visual order, in the
- *        range <code>[0..ubidi_countRuns(pBiDi)-1]</code>.
- *
- * @param pLogicalStart is the first logical character index in the text.
- *        The pointer may be <code>NULL</code> if this index is not needed.
- *
- * @param pLength is the number of characters (at least one) in the run.
- *        The pointer may be <code>NULL</code> if this is not needed.
- *
- * @return the directionality of the run,
- *         <code>UBIDI_LTR==0</code> or <code>UBIDI_RTL==1</code>,
- *         never <code>UBIDI_MIXED</code>.
- *
- * @see ubidi_countRuns
- *
- * Example:
- * <pre>
- *&nbsp; int32_t i, count=ubidi_countRuns(pBiDi),
- *&nbsp;         logicalStart, visualIndex=0, length;
- *&nbsp; for(i=0; i&lt;count; ++i) {
- *&nbsp;     if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, i, &logicalStart, &length)) {
- *&nbsp;         do { // LTR
- *&nbsp;             show_char(text[logicalStart++], visualIndex++);
- *&nbsp;         } while(--length>0);
- *&nbsp;     } else {
- *&nbsp;         logicalStart+=length;  // logicalLimit
- *&nbsp;         do { // RTL
- *&nbsp;             show_char(text[--logicalStart], visualIndex++);
- *&nbsp;         } while(--length>0);
- *&nbsp;     }
- *&nbsp; }
- * </pre>
- *
- * Note that in right-to-left runs, code like this places
- * modifier letters before base characters and second surrogates
- * before first ones.
- */
-U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
-                   int32_t *pLogicalStart, int32_t *pLength);
-
-/**
- * Get the visual position from a logical text position.
- * If such a mapping is used many times on the same
- * <code>UBiDi</code> object, then calling
- * <code>ubidi_getLogicalMap()</code> is more efficient.<p>
- *
- * Note that in right-to-left runs, this mapping places
- * modifier letters before base characters and second surrogates
- * before first ones.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param logicalIndex is the index of a character in the text.
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @return The visual position of this character.
- *
- * @see ubidi_getLogicalMap
- * @see ubidi_getLogicalIndex
- */
-U_CAPI int32_t U_EXPORT2
-ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode);
-
-/**
- * Get the logical text position from a visual position.
- * If such a mapping is used many times on the same
- * <code>UBiDi</code> object, then calling
- * <code>ubidi_getVisualMap()</code> is more efficient.<p>
- *
- * This is the inverse function to <code>ubidi_getVisualIndex()</code>.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param visualIndex is the visual position of a character.
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @return The index of this character in the text.
- *
- * @see ubidi_getVisualMap
- * @see ubidi_getVisualIndex
- */
-U_CAPI int32_t U_EXPORT2
-ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode);
-
-/**
- * Get a logical-to-visual index map (array) for the characters in the UBiDi
- * (paragraph or line) object.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param indexMap is a pointer to an array of <code>ubidi_getLength()</code>
- *        indexes which will reflect the reordering of the characters.
- *        The array does not need to be initialized.<p>
- *        The index map will result in <code>indexMap[logicalIndex]==visualIndex</code>.<p>
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @see ubidi_getVisualMap
- * @see ubidi_getVisualIndex
- */
-U_CAPI void U_EXPORT2
-ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
-
-/**
- * Get a visual-to-logical index map (array) for the characters in the UBiDi
- * (paragraph or line) object.
- *
- * @param pBiDi is the paragraph or line <code>UBiDi</code> object.
- *
- * @param indexMap is a pointer to an array of <code>ubidi_getLength()</code>
- *        indexes which will reflect the reordering of the characters.
- *        The array does not need to be initialized.<p>
- *        The index map will result in <code>indexMap[visualIndex]==logicalIndex</code>.<p>
- *
- * @param pErrorCode must be a valid pointer to an error code value,
- *        which must not indicate a failure before the function call.
- *
- * @see ubidi_getLogicalMap
- * @see ubidi_getLogicalIndex
- */
-U_CAPI void U_EXPORT2
-ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode);
-
-/**
- * This is a convenience function that does not use a UBiDi object.
- * It is intended to be used for when an application has determined the levels
- * of objects (character sequences) and just needs to have them reordered (L2).
- * This is equivalent to using <code>ubidi_getLogicalMap</code> on a
- * <code>UBiDi</code> object.
- *
- * @param levels is an array with <code>length</code> levels that have been determined by
- *        the application.
- *
- * @param length is the number of levels in the array, or, semantically,
- *        the number of objects to be reordered.
- *        It must be <code>length&gt;0</code>.
- *
- * @param indexMap is a pointer to an array of <code>length</code>
- *        indexes which will reflect the reordering of the characters.
- *        The array does not need to be initialized.<p>
- *        The index map will result in <code>indexMap[logicalIndex]==visualIndex</code>.
- */
-U_CAPI void U_EXPORT2
-ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
-
-/**
- * This is a convenience function that does not use a UBiDi object.
- * It is intended to be used for when an application has determined the levels
- * of objects (character sequences) and just needs to have them reordered (L2).
- * This is equivalent to using <code>ubidi_getVisualMap</code> on a
- * <code>UBiDi</code> object.
- *
- * @param levels is an array with <code>length</code> levels that have been determined by
- *        the application.
- *
- * @param length is the number of levels in the array, or, semantically,
- *        the number of objects to be reordered.
- *        It must be <code>length&gt;0</code>.
- *
- * @param indexMap is a pointer to an array of <code>length</code>
- *        indexes which will reflect the reordering of the characters.
- *        The array does not need to be initialized.<p>
- *        The index map will result in <code>indexMap[visualIndex]==logicalIndex</code>.
- */
-U_CAPI void U_EXPORT2
-ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap);
-
-/**
- * Invert an index map.
- * The one-to-one index mapping of the first map is inverted and written to
- * the second one.
- *
- * @param srcMap is an array with <code>length</code> indexes
- *        which define the original mapping.
- *
- * @param destMap is an array with <code>length</code> indexes
- *        which will be filled with the inverse mapping.
- *
- * @param length is the length of each array.
- */
-U_CAPI void U_EXPORT2
-ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length);
-
-/**
- * @name Sample code for the ICU BiDi API
- *
- * <h2>Rendering a paragraph with the ICU BiDi API</h2>
- *
- * This is (hypothetical) sample code that illustrates
- * how the ICU BiDi API could be used to render a paragraph of text.
- * Rendering code depends highly on the graphics system,
- * therefore this sample code must make a lot of assumptions,
- * which may or may not match any existing graphics system's properties.
- *
- * <p>The basic assumptions are:</p>
- * <ul>
- * <li>Rendering is done from left to right on a horizontal line.</li>
- * <li>A run of single-style, unidirectional text can be rendered at once.</li>
- * <li>Such a run of text is passed to the graphics system with
- *     characters (code units) in logical order.</li>
- * <li>The line-breaking algorithm is very complicated
- *     and Locale-dependent -
- *     and therefore its implementation omitted from this sample code.</li>
- * </ul>
- *
- * <pre>
- *&nbsp; #include "ubidi.h"
- *&nbsp;
- *&nbsp; typedef enum {
- *&nbsp;     styleNormal=0, styleSelected=1,
- *&nbsp;     styleBold=2, styleItalics=4,
- *&nbsp;     styleSuper=8, styleSub=16
- *&nbsp; } Style;
- *&nbsp;
- *&nbsp; typedef struct { int32_t limit; Style style; } StyleRun;
- *&nbsp;
- *&nbsp; int getTextWidth(const UChar *text, int32_t start, int32_t limit,
- *&nbsp;                  const StyleRun *styleRuns, int styleRunCount);
- *&nbsp;
- *&nbsp; // set *pLimit and *pStyleRunLimit for a line
- *&nbsp; // from text[start] and from styleRuns[styleRunStart]
- *&nbsp; // using ubidi_getLogicalRun(para, ...)
- *&nbsp; void getLineBreak(const UChar *text, int32_t start, int32_t *pLimit,
- *&nbsp;                   UBiDi *para,
- *&nbsp;                   const StyleRun *styleRuns, int styleRunStart, int *pStyleRunLimit,
- *&nbsp;                   int *pLineWidth);
- *&nbsp;
- *&nbsp; // render runs on a line sequentially, always from left to right
- *&nbsp;
- *&nbsp; // prepare rendering a new line
- *&nbsp; void startLine(UBiDiDirection textDirection, int lineWidth);
- *&nbsp;
- *&nbsp; // render a run of text and advance to the right by the run width
- *&nbsp; // the text[start..limit-1] is always in logical order
- *&nbsp; void renderRun(const UChar *text, int32_t start, int32_t limit,
- *&nbsp;                UBiDiDirection textDirection, Style style);
- *&nbsp;
- *&nbsp; // We could compute a cross-product
- *&nbsp; // from the style runs with the directional runs
- *&nbsp; // and then reorder it.
- *&nbsp; // Instead, here we iterate over each run type
- *&nbsp; // and render the intersections -
- *&nbsp; // with shortcuts in simple (and common) cases.
- *&nbsp; // renderParagraph() is the main function.
- *&nbsp;
- *&nbsp; // render a directional run with
- *&nbsp; // (possibly) multiple style runs intersecting with it
- *&nbsp; void renderDirectionalRun(const UChar *text,
- *&nbsp;                           int32_t start, int32_t limit,
- *&nbsp;                           UBiDiDirection direction,
- *&nbsp;                           const StyleRun *styleRuns, int styleRunCount) {
- *&nbsp;     int i;
- *&nbsp;
- *&nbsp;     // iterate over style runs
- *&nbsp;     if(direction==UBIDI_LTR) {
- *&nbsp;         int styleLimit;
- *&nbsp;
- *&nbsp;         for(i=0; i&lt;styleRunCount; ++i) {
- *&nbsp;             styleLimit=styleRun[i].limit;
- *&nbsp;             if(start&lt;styleLimit) {
- *&nbsp;                 if(styleLimit>limit) { styleLimit=limit; }
- *&nbsp;                 renderRun(text, start, styleLimit,
- *&nbsp;                           direction, styleRun[i].style);
- *&nbsp;                 if(styleLimit==limit) { break; }
- *&nbsp;                 start=styleLimit;
- *&nbsp;             }
- *&nbsp;         }
- *&nbsp;     } else {
- *&nbsp;         int styleStart;
- *&nbsp;
- *&nbsp;         for(i=styleRunCount-1; i>=0; --i) {
- *&nbsp;             if(i>0) {
- *&nbsp;                 styleStart=styleRun[i-1].limit;
- *&nbsp;             } else {
- *&nbsp;                 styleStart=0;
- *&nbsp;             }
- *&nbsp;             if(limit>=styleStart) {
- *&nbsp;                 if(styleStart&lt;start) { styleStart=start; }
- *&nbsp;                 renderRun(text, styleStart, limit,
- *&nbsp;                           direction, styleRun[i].style);
- *&nbsp;                 if(styleStart==start) { break; }
- *&nbsp;                 limit=styleStart;
- *&nbsp;             }
- *&nbsp;         }
- *&nbsp;     }
- *&nbsp; }
- *&nbsp;
- *&nbsp; // the line object represents text[start..limit-1]
- *&nbsp; void renderLine(UBiDi *line, const UChar *text,
- *&nbsp;                 int32_t start, int32_t limit,
- *&nbsp;                 const StyleRun *styleRuns, int styleRunCount) {
- *&nbsp;     UBiDiDirection direction=ubidi_getDirection(line);
- *&nbsp;     if(direction!=UBIDI_MIXED) {
- *&nbsp;         // unidirectional
- *&nbsp;         if(styleRunCount&lt;=1) {
- *&nbsp;             renderRun(text, start, limit, direction, styleRuns[0].style);
- *&nbsp;         } else {
- *&nbsp;             renderDirectionalRun(text, start, limit,
- *&nbsp;                                  direction, styleRuns, styleRunCount);
- *&nbsp;         }
- *&nbsp;     } else {
- *&nbsp;         // mixed-directional
- *&nbsp;         int32_t count, i, length;
- *&nbsp;         UBiDiLevel level;
- *&nbsp;
- *&nbsp;         count=ubidi_countRuns(para, pErrorCode);
- *&nbsp;         if(U_SUCCESS(*pErrorCode)) {
- *&nbsp;             if(styleRunCount&lt;=1) {
- *&nbsp;                 Style style=styleRuns[0].style;
- *&nbsp;
- *&nbsp;                 // iterate over directional runs
- *&nbsp;                 for(i=0; i&lt;count; ++i) {
- *&nbsp;                     direction=ubidi_getVisualRun(para, i, &start, &length);
- *&nbsp;                     renderRun(text, start, start+length, direction, style);
- *&nbsp;                 }
- *&nbsp;             } else {
- *&nbsp;                 int32_t j;
- *&nbsp;
- *&nbsp;                 // iterate over both directional and style runs
- *&nbsp;                 for(i=0; i&lt;count; ++i) {
- *&nbsp;                     direction=ubidi_getVisualRun(line, i, &start, &length);
- *&nbsp;                     renderDirectionalRun(text, start, start+length,
- *&nbsp;                                          direction, styleRuns, styleRunCount);
- *&nbsp;                 }
- *&nbsp;             }
- *&nbsp;         }
- *&nbsp;     }
- *&nbsp; }
- *&nbsp;
- *&nbsp; void renderParagraph(const UChar *text, int32_t length,
- *&nbsp;                      UBiDiDirection textDirection,
- *&nbsp;                      const StyleRun *styleRuns, int styleRunCount,
- *&nbsp;                      int lineWidth,
- *&nbsp;                      UErrorCode *pErrorCode) {
- *&nbsp;     UBiDi *para;
- *&nbsp;
- *&nbsp;     if(pErrorCode==NULL || U_FAILURE(*pErrorCode) || length&lt;=0) {
- *&nbsp;         return;
- *&nbsp;     }
- *&nbsp;
- *&nbsp;     para=ubidi_openSized(length, 0, pErrorCode);
- *&nbsp;     if(para==NULL) { return; }
- *&nbsp;
- *&nbsp;     ubidi_setPara(para, text, length,
- *&nbsp;                   textDirection ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR,
- *&nbsp;                   NULL, pErrorCode);
- *&nbsp;     if(U_SUCCESS(*pErrorCode)) {
- *&nbsp;         UBiDiLevel paraLevel=1&ubidi_getParaLevel(para);
- *&nbsp;         StyleRun styleRun={ length, styleNormal };
- *&nbsp;         int width;
- *&nbsp;
- *&nbsp;         if(styleRuns==NULL || styleRunCount&lt;=0) {
- *&nbsp;             styleRunCount=1;
- *&nbsp;             styleRuns=&styleRun;
- *&nbsp;         }
- *&nbsp;
- *&nbsp;         // assume styleRuns[styleRunCount-1].limit>=length
- *&nbsp;
- *&nbsp;         width=getTextWidth(text, 0, length, styleRuns, styleRunCount);
- *&nbsp;         if(width&lt;=lineWidth) {
- *&nbsp;             // everything fits onto one line
- *&nbsp;
- *&nbsp;             // prepare rendering a new line from either left or right
- *&nbsp;             startLine(paraLevel, width);
- *&nbsp;
- *&nbsp;             renderLine(para, text, 0, length,
- *&nbsp;                        styleRuns, styleRunCount);
- *&nbsp;         } else {
- *&nbsp;             UBiDi *line;
- *&nbsp;
- *&nbsp;             // we need to render several lines
- *&nbsp;             line=ubidi_openSized(length, 0, pErrorCode);
- *&nbsp;             if(line!=NULL) {
- *&nbsp;                 int32_t start=0, limit;
- *&nbsp;                 int styleRunStart=0, styleRunLimit;
- *&nbsp;
- *&nbsp;                 for(;;) {
- *&nbsp;                     limit=length;
- *&nbsp;                     styleRunLimit=styleRunCount;
- *&nbsp;                     getLineBreak(text, start, &limit, para,
- *&nbsp;                                  styleRuns, styleRunStart, &styleRunLimit,
- *&nbsp;                                  &width);
- *&nbsp;                     ubidi_setLine(para, start, limit, line, pErrorCode);
- *&nbsp;                     if(U_SUCCESS(*pErrorCode)) {
- *&nbsp;                         // prepare rendering a new line
- *&nbsp;                         // from either left or right
- *&nbsp;                         startLine(paraLevel, width);
- *&nbsp;
- *&nbsp;                         renderLine(line, text, start, limit,
- *&nbsp;                                    styleRuns+styleRunStart,
- *&nbsp;                                    styleRunLimit-styleRunStart);
- *&nbsp;                     }
- *&nbsp;                     if(limit==length) { break; }
- *&nbsp;                     start=limit;
- *&nbsp;                     styleRunStart=styleRunLimit-1;
- *&nbsp;                     if(start>=styleRuns[styleRunStart].limit) {
- *&nbsp;                         ++styleRunStart;
- *&nbsp;                     }
- *&nbsp;                 }
- *&nbsp;
- *&nbsp;                 ubidi_close(line);
- *&nbsp;             }
- *&nbsp;         }
- *&nbsp;     }
- *&nbsp;
- *&nbsp;     ubidi_close(para);
- *&nbsp; }
- * </pre>
- */
-BIDI_SAMPLE_CODE
-/*@{*/
-/*@}*/
-
-/*@}*/
-
-#endif
--- a/jdk/src/share/native/sun/font/bidi/ubidiimp.h	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-/*
- * Portions Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-*   file name:  ubidiimp.h
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999aug06
-*   created by: Markus W. Scherer
-*/
-
-#ifndef UBIDIIMP_H
-#define UBIDIIMP_H
-
-/* set import/export definitions */
-#ifdef U_COMMON_IMPLEMENTATION
-
-#include "utypes.h"
-#include "uchardir.h"
-
-/* miscellaneous definitions ---------------------------------------------- */
-
-typedef uint8_t DirProp;
-typedef uint32_t Flags;
-
-/*  Comparing the description of the BiDi algorithm with this implementation
-    is easier with the same names for the BiDi types in the code as there.
-    See UCharDirection in uchar.h .
-*/
-enum {
-    L=  U_LEFT_TO_RIGHT,
-    R=  U_RIGHT_TO_LEFT,
-    EN= U_EUROPEAN_NUMBER,
-    ES= U_EUROPEAN_NUMBER_SEPARATOR,
-    ET= U_EUROPEAN_NUMBER_TERMINATOR,
-    AN= U_ARABIC_NUMBER,
-    CS= U_COMMON_NUMBER_SEPARATOR,
-    B=  U_BLOCK_SEPARATOR,
-    S=  U_SEGMENT_SEPARATOR,
-    WS= U_WHITE_SPACE_NEUTRAL,
-    ON= U_OTHER_NEUTRAL,
-    LRE=U_LEFT_TO_RIGHT_EMBEDDING,
-    LRO=U_LEFT_TO_RIGHT_OVERRIDE,
-    AL= U_RIGHT_TO_LEFT_ARABIC,
-    RLE=U_RIGHT_TO_LEFT_EMBEDDING,
-    RLO=U_RIGHT_TO_LEFT_OVERRIDE,
-    PDF=U_POP_DIRECTIONAL_FORMAT,
-    NSM=U_DIR_NON_SPACING_MARK,
-    BN= U_BOUNDARY_NEUTRAL,
-    dirPropCount
-};
-
-/*
- * Sometimes, bit values are more appropriate
- * to deal with directionality properties.
- * Abbreviations in these macro names refer to names
- * used in the BiDi algorithm.
- */
-#define DIRPROP_FLAG(dir) (1UL<<(dir))
-
-/* special flag for multiple runs from explicit embedding codes */
-#define DIRPROP_FLAG_MULTI_RUNS (1UL<<31)
-
-/* are there any characters that are LTR or RTL? */
-#define MASK_LTR (DIRPROP_FLAG(L)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(AN)|DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO))
-#define MASK_RTL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO))
-
-/* explicit embedding codes */
-#define MASK_LRX (DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO))
-#define MASK_RLX (DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO))
-#define MASK_OVERRIDE (DIRPROP_FLAG(LRO)|DIRPROP_FLAG(RLO))
-
-#define MASK_EXPLICIT (MASK_LRX|MASK_RLX|DIRPROP_FLAG(PDF))
-#define MASK_BN_EXPLICIT (DIRPROP_FLAG(BN)|MASK_EXPLICIT)
-
-/* paragraph and segment separators */
-#define MASK_B_S (DIRPROP_FLAG(B)|DIRPROP_FLAG(S))
-
-/* all types that are counted as White Space or Neutral in some steps */
-#define MASK_WS (MASK_B_S|DIRPROP_FLAG(WS)|MASK_BN_EXPLICIT)
-#define MASK_N (DIRPROP_FLAG(ON)|MASK_WS)
-
-/* all types that are included in a sequence of European Terminators for (W5) */
-#define MASK_ET_NSM_BN (DIRPROP_FLAG(ET)|DIRPROP_FLAG(NSM)|MASK_BN_EXPLICIT)
-
-/* types that are neutrals or could becomes neutrals in (Wn) */
-#define MASK_POSSIBLE_N (DIRPROP_FLAG(CS)|DIRPROP_FLAG(ES)|DIRPROP_FLAG(ET)|MASK_N)
-
-/*
- * These types may be changed to "e",
- * the embedding type (L or R) of the run,
- * in the BiDi algorithm (N2)
- */
-#define MASK_EMBEDDING (DIRPROP_FLAG(NSM)|MASK_POSSIBLE_N)
-
-/* the dirProp's L and R are defined to 0 and 1 values in UCharDirection */
-#define GET_LR_FROM_LEVEL(level) ((DirProp)((level)&1))
-
-#define IS_DEFAULT_LEVEL(level) (((level)&0xfe)==0xfe)
-
-/* handle surrogate pairs --------------------------------------------------- */
-/* Note: dlf added for java */
-#define IS_FIRST_SURROGATE(uchar) (((uchar)&0xfc00)==0xd800)
-#define IS_SECOND_SURROGATE(uchar) (((uchar)&0xfc00)==0xdc00)
-
-/* get the UTF-32 value directly from the surrogate pseudo-characters */
-#define SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
-#define GET_UTF_32(first, second) (((first)<<10UL)+(second)-SURROGATE_OFFSET)
-
-/* Run structure for reordering --------------------------------------------- */
-
-typedef struct Run {
-    int32_t logicalStart,   /* first character of the run; b31 indicates even/odd level */
-                visualLimit;    /* last visual position of the run +1 */
-} Run;
-
-/* in a Run, logicalStart will get this bit set if the run level is odd */
-#define INDEX_ODD_BIT (1UL<<31)
-
-#define MAKE_INDEX_ODD_PAIR(index, level) (index|((uint32_t)level<<31))
-#define ADD_ODD_BIT_FROM_LEVEL(x, level)  ((x)|=((uint32_t)level<<31))
-#define REMOVE_ODD_BIT(x)                 ((x)&=~INDEX_ODD_BIT)
-
-#define GET_INDEX(x)   (x&~INDEX_ODD_BIT)
-#define GET_ODD_BIT(x) ((uint32_t)x>>31)
-#define IS_ODD_RUN(x)  ((x&INDEX_ODD_BIT)!=0)
-#define IS_EVEN_RUN(x) ((x&INDEX_ODD_BIT)==0)
-
-U_CFUNC bool_t
-ubidi_getRuns(UBiDi *pBiDi);
-
-/* UBiDi structure ----------------------------------------------------------- */
-
-struct UBiDi {
-    /* alias pointer to the current text */
-    const UChar *text;
-
-    /* length of the current text */
-    int32_t length;
-
-    /* memory sizes in bytes */
-    int32_t dirPropsSize, levelsSize, runsSize;
-
-    /* allocated memory */
-    DirProp *dirPropsMemory;
-    UBiDiLevel *levelsMemory;
-    Run *runsMemory;
-
-    /* indicators for whether memory may be allocated after ubidi_open() */
-    bool_t mayAllocateText, mayAllocateRuns;
-
-    /* arrays with one value per text-character */
-    const DirProp *dirProps;
-    UBiDiLevel *levels;
-
-    /* are we performing an approximation of the "inverse BiDi" algorithm? */
-    bool_t isInverse;
-
-    /* the paragraph level */
-    UBiDiLevel paraLevel;
-
-    /* the overall paragraph or line directionality - see UBiDiDirection */
-    UBiDiDirection direction;
-
-    /* flags is a bit set for which directional properties are in the text */
-    Flags flags;
-
-    /* characters after trailingWSStart are WS and are */
-    /* implicitly at the paraLevel (rule (L1)) - levels may not reflect that */
-    int32_t trailingWSStart;
-
-    /* fields for line reordering */
-    int32_t runCount;     /* ==-1: runs not set up yet */
-    Run *runs;
-
-    /* for non-mixed text, we only need a tiny array of runs (no malloc()) */
-    Run simpleRuns[1];
-};
-
-/* helper function to (re)allocate memory if allowed */
-extern bool_t
-ubidi_getMemory(void **pMemory, int32_t *pSize, bool_t mayAllocate, int32_t sizeNeeded);
-
-/* helper macros for each allocated array in UBiDi */
-#define getDirPropsMemory(pBiDi, length) \
-        ubidi_getMemory((void **)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \
-                        (pBiDi)->mayAllocateText, (length))
-
-#define getLevelsMemory(pBiDi, length) \
-        ubidi_getMemory((void **)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \
-                        (pBiDi)->mayAllocateText, (length))
-
-#define getRunsMemory(pBiDi, length) \
-        ubidi_getMemory((void **)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \
-                        (pBiDi)->mayAllocateRuns, (length)*sizeof(Run))
-
-/* additional macros used by ubidi_open() - always allow allocation */
-#define getInitialDirPropsMemory(pBiDi, length) \
-        ubidi_getMemory((void **)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \
-                        TRUE, (length))
-
-#define getInitialLevelsMemory(pBiDi, length) \
-        ubidi_getMemory((void **)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \
-                        TRUE, (length))
-
-#define getInitialRunsMemory(pBiDi, length) \
-        ubidi_getMemory((void **)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \
-                        TRUE, (length)*sizeof(Run))
-
-#endif
-
-#endif
--- a/jdk/src/share/native/sun/font/bidi/ubidiln.c	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,996 +0,0 @@
-/*
- * Portions Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-*   file name:  ubidiln.c
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 1999aug06
-*   created by: Markus W. Scherer
-*/
-
-/* set import/export definitions */
-#ifndef U_COMMON_IMPLEMENTATION
-#   define U_COMMON_IMPLEMENTATION
-#endif
-
-#include "cmemory.h"
-#include "utypes.h"
-#include "uchardir.h"
-#include "ubidi.h"
-#include "ubidiimp.h"
-
-/*
- * General remarks about the functions in this file:
- *
- * These functions deal with the aspects of potentially mixed-directional
- * text in a single paragraph or in a line of a single paragraph
- * which has already been processed according to
- * the Unicode 3.0 BiDi algorithm as defined in
- * http://www.unicode.org/unicode/reports/tr9/ , version 5,
- * also described in The Unicode Standard, Version 3.0 .
- *
- * This means that there is a UBiDi object with a levels
- * and a dirProps array.
- * paraLevel and direction are also set.
- * Only if the length of the text is zero, then levels==dirProps==NULL.
- *
- * The overall directionality of the paragraph
- * or line is used to bypass the reordering steps if possible.
- * Even purely RTL text does not need reordering there because
- * the ubidi_getLogical/VisualIndex() functions can compute the
- * index on the fly in such a case.
- *
- * The implementation of the access to same-level-runs and of the reordering
- * do attempt to provide better performance and less memory usage compared to
- * a direct implementation of especially rule (L2) with an array of
- * one (32-bit) integer per text character.
- *
- * Here, the levels array is scanned as soon as necessary, and a vector of
- * same-level-runs is created. Reordering then is done on this vector.
- * For each run of text positions that were resolved to the same level,
- * only 8 bytes are stored: the first text position of the run and the visual
- * position behind the run after reordering.
- * One sign bit is used to hold the directionality of the run.
- * This is inefficient if there are many very short runs. If the average run
- * length is <2, then this uses more memory.
- *
- * In a further attempt to save memory, the levels array is never changed
- * after all the resolution rules (Xn, Wn, Nn, In).
- * Many functions have to consider the field trailingWSStart:
- * if it is less than length, then there is an implicit trailing run
- * at the paraLevel,
- * which is not reflected in the levels array.
- * This allows a line UBiDi object to use the same levels array as
- * its paragraph parent object.
- *
- * When a UBiDi object is created for a line of a paragraph, then the
- * paragraph's levels and dirProps arrays are reused by way of setting
- * a pointer into them, not by copying. This again saves memory and forbids to
- * change the now shared levels for (L1).
- */
-
-/* prototypes --------------------------------------------------------------- */
-
-static void
-setTrailingWSStart(UBiDi *pBiDi);
-
-static void
-getSingleRun(UBiDi *pBiDi, UBiDiLevel level);
-
-static void
-reorderLine(UBiDi *pBiDi, UBiDiLevel minLevel, UBiDiLevel maxLevel);
-
-static bool_t
-prepareReorder(const UBiDiLevel *levels, int32_t length,
-               int32_t *indexMap,
-               UBiDiLevel *pMinLevel, UBiDiLevel *pMaxLevel);
-
-/* ubidi_setLine ------------------------------------------------------------ */
-
-U_CAPI void U_EXPORT2
-ubidi_setLine(const UBiDi *pParaBiDi,
-              int32_t start, int32_t limit,
-              UBiDi *pLineBiDi,
-              UErrorCode *pErrorCode) {
-    int32_t length;
-
-    /* check the argument values */
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return;
-    } else if(pParaBiDi==NULL || pLineBiDi==NULL) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return;
-    } else if(start<0 || start>limit || limit>pParaBiDi->length) {
-        *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
-        return;
-    }
-
-    /* set the values in pLineBiDi from its pParaBiDi parent */
-    pLineBiDi->text=pParaBiDi->text+start;
-    length=pLineBiDi->length=limit-start;
-    pLineBiDi->paraLevel=pParaBiDi->paraLevel;
-
-    pLineBiDi->runs=NULL;
-    pLineBiDi->flags=0;
-
-    if(length>0) {
-        pLineBiDi->dirProps=pParaBiDi->dirProps+start;
-        pLineBiDi->levels=pParaBiDi->levels+start;
-        pLineBiDi->runCount=-1;
-
-        if(pParaBiDi->direction!=UBIDI_MIXED) {
-            /* the parent is already trivial */
-            pLineBiDi->direction=pParaBiDi->direction;
-
-            /*
-             * The parent's levels are all either
-             * implicitly or explicitly ==paraLevel;
-             * do the same here.
-             */
-            if(pParaBiDi->trailingWSStart<=start) {
-                pLineBiDi->trailingWSStart=0;
-            } else if(pParaBiDi->trailingWSStart<limit) {
-                pLineBiDi->trailingWSStart=pParaBiDi->trailingWSStart-start;
-            } else {
-                pLineBiDi->trailingWSStart=length;
-            }
-        } else {
-            const UBiDiLevel *levels=pLineBiDi->levels;
-            int32_t i, trailingWSStart;
-            UBiDiLevel level;
-
-            setTrailingWSStart(pLineBiDi);
-            trailingWSStart=pLineBiDi->trailingWSStart;
-
-            /* recalculate pLineBiDi->direction */
-            if(trailingWSStart==0) {
-                /* all levels are at paraLevel */
-                pLineBiDi->direction=(UBiDiDirection)(pLineBiDi->paraLevel&1);
-            } else {
-                /* get the level of the first character */
-                level=(UBiDiLevel)(levels[0]&1);
-
-                /* if there is anything of a different level, then the line is mixed */
-                if(trailingWSStart<length && (pLineBiDi->paraLevel&1)!=level) {
-                    /* the trailing WS is at paraLevel, which differs from levels[0] */
-                    pLineBiDi->direction=UBIDI_MIXED;
-                } else {
-                    /* see if levels[1..trailingWSStart-1] have the same direction as levels[0] and paraLevel */
-                    i=1;
-                    for(;;) {
-                        if(i==trailingWSStart) {
-                            /* the direction values match those in level */
-                            pLineBiDi->direction=(UBiDiDirection)level;
-                            break;
-                        } else if((levels[i]&1)!=level) {
-                            pLineBiDi->direction=UBIDI_MIXED;
-                            break;
-                        }
-                        ++i;
-                    }
-                }
-            }
-
-            switch(pLineBiDi->direction) {
-            case UBIDI_LTR:
-                /* make sure paraLevel is even */
-                pLineBiDi->paraLevel=(UBiDiLevel)((pLineBiDi->paraLevel+1)&~1);
-
-                /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
-                pLineBiDi->trailingWSStart=0;
-                break;
-            case UBIDI_RTL:
-                /* make sure paraLevel is odd */
-                pLineBiDi->paraLevel|=1;
-
-                /* all levels are implicitly at paraLevel (important for ubidi_getLevels()) */
-                pLineBiDi->trailingWSStart=0;
-                break;
-            default:
-                break;
-            }
-        }
-    } else {
-        /* create an object for a zero-length line */
-        pLineBiDi->direction=pLineBiDi->paraLevel&1 ? UBIDI_RTL : UBIDI_LTR;
-        pLineBiDi->trailingWSStart=pLineBiDi->runCount=0;
-
-        pLineBiDi->dirProps=NULL;
-        pLineBiDi->levels=NULL;
-    }
-    return;
-}
-
-U_CAPI UBiDiLevel U_EXPORT2
-ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex) {
-    /* return paraLevel if in the trailing WS run, otherwise the real level */
-    if(pBiDi==NULL || charIndex<0 || pBiDi->length<=charIndex) {
-        return 0;
-    } else if(pBiDi->direction!=UBIDI_MIXED || charIndex>=pBiDi->trailingWSStart) {
-        return pBiDi->paraLevel;
-    } else {
-        return pBiDi->levels[charIndex];
-    }
-}
-
-U_CAPI const UBiDiLevel * U_EXPORT2
-ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
-    int32_t start, length;
-
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return NULL;
-    } else if(pBiDi==NULL || (length=pBiDi->length)<=0) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
-    }
-
-    if((start=pBiDi->trailingWSStart)==length) {
-        /* the current levels array reflects the WS run */
-        return pBiDi->levels;
-    }
-
-    /*
-     * After the previous if(), we know that the levels array
-     * has an implicit trailing WS run and therefore does not fully
-     * reflect itself all the levels.
-     * This must be a UBiDi object for a line, and
-     * we need to create a new levels array.
-     */
-
-    if(getLevelsMemory(pBiDi, length)) {
-        UBiDiLevel *levels=pBiDi->levelsMemory;
-
-        if(start>0 && levels!=pBiDi->levels) {
-            icu_memcpy(levels, pBiDi->levels, start);
-        }
-        icu_memset(levels+start, pBiDi->paraLevel, length-start);
-
-        /* this new levels array is set for the line and reflects the WS run */
-        pBiDi->trailingWSStart=length;
-        return pBiDi->levels=levels;
-    } else {
-        /* out of memory */
-        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
-    }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalStart,
-                    int32_t *pLogicalLimit, UBiDiLevel *pLevel) {
-    int32_t length;
-
-    if(pBiDi==NULL || logicalStart<0 || (length=pBiDi->length)<=logicalStart) {
-        return;
-    }
-
-    if(pBiDi->direction!=UBIDI_MIXED || logicalStart>=pBiDi->trailingWSStart) {
-        if(pLogicalLimit!=NULL) {
-            *pLogicalLimit=length;
-        }
-        if(pLevel!=NULL) {
-            *pLevel=pBiDi->paraLevel;
-        }
-    } else {
-        UBiDiLevel *levels=pBiDi->levels;
-        UBiDiLevel level=levels[logicalStart];
-
-        /* search for the end of the run */
-        length=pBiDi->trailingWSStart;
-        while(++logicalStart<length && level==levels[logicalStart]) {}
-
-        if(pLogicalLimit!=NULL) {
-            *pLogicalLimit=logicalStart;
-        }
-        if(pLevel!=NULL) {
-            *pLevel=level;
-        }
-    }
-}
-
-/* handle trailing WS (L1) -------------------------------------------------- */
-
-/*
- * setTrailingWSStart() sets the start index for a trailing
- * run of WS in the line. This is necessary because we do not modify
- * the paragraph's levels array that we just point into.
- * Using trailingWSStart is another form of performing (L1).
- *
- * To make subsequent operations easier, we also include the run
- * before the WS if it is at the paraLevel - we merge the two here.
- */
-static void
-setTrailingWSStart(UBiDi *pBiDi) {
-    /* pBiDi->direction!=UBIDI_MIXED */
-
-    const DirProp *dirProps=pBiDi->dirProps;
-    UBiDiLevel *levels=pBiDi->levels;
-    int32_t start=pBiDi->length;
-    UBiDiLevel paraLevel=pBiDi->paraLevel;
-
-    /* go backwards across all WS, BN, explicit codes */
-    while(start>0 && DIRPROP_FLAG(dirProps[start-1])&MASK_WS) {
-        --start;
-    }
-
-    /* if the WS run can be merged with the previous run then do so here */
-    while(start>0 && levels[start-1]==paraLevel) {
-        --start;
-    }
-
-    pBiDi->trailingWSStart=start;
-}
-
-/* runs API functions ------------------------------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode) {
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return -1;
-    } else if(pBiDi==NULL || (pBiDi->runCount<0 && !ubidi_getRuns(pBiDi))) {
-        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        return -1;
-    } else {
-        return pBiDi->runCount;
-    }
-}
-
-U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
-                   int32_t *pLogicalStart, int32_t *pLength) {
-    if( pBiDi==NULL || runIndex<0 ||
-        (pBiDi->runCount==-1 && !ubidi_getRuns(pBiDi)) ||
-        runIndex>=pBiDi->runCount
-    ) {
-        return UBIDI_LTR;
-    } else {
-        int32_t start=pBiDi->runs[runIndex].logicalStart;
-        if(pLogicalStart!=NULL) {
-            *pLogicalStart=GET_INDEX(start);
-        }
-        if(pLength!=NULL) {
-            if(runIndex>0) {
-                *pLength=pBiDi->runs[runIndex].visualLimit-
-                         pBiDi->runs[runIndex-1].visualLimit;
-            } else {
-                *pLength=pBiDi->runs[0].visualLimit;
-            }
-        }
-        return (UBiDiDirection)GET_ODD_BIT(start);
-    }
-}
-
-/* compute the runs array --------------------------------------------------- */
-
-/*
- * Compute the runs array from the levels array.
- * After ubidi_getRuns() returns TRUE, runCount is guaranteed to be >0
- * and the runs are reordered.
- * Odd-level runs have visualStart on their visual right edge and
- * they progress visually to the left.
- */
-U_CFUNC bool_t
-ubidi_getRuns(UBiDi *pBiDi) {
-    if(pBiDi->direction!=UBIDI_MIXED) {
-        /* simple, single-run case - this covers length==0 */
-        getSingleRun(pBiDi, pBiDi->paraLevel);
-    } else /* UBIDI_MIXED, length>0 */ {
-        /* mixed directionality */
-        int32_t length=pBiDi->length, limit;
-
-        /*
-         * If there are WS characters at the end of the line
-         * and the run preceding them has a level different from
-         * paraLevel, then they will form their own run at paraLevel (L1).
-         * Count them separately.
-         * We need some special treatment for this in order to not
-         * modify the levels array which a line UBiDi object shares
-         * with its paragraph parent and its other line siblings.
-         * In other words, for the trailing WS, it may be
-         * levels[]!=paraLevel but we have to treat it like it were so.
-         */
-        limit=pBiDi->trailingWSStart;
-        if(limit==0) {
-            /* there is only WS on this line */
-            getSingleRun(pBiDi, pBiDi->paraLevel);
-        } else {
-            UBiDiLevel *levels=pBiDi->levels;
-            int32_t i, runCount;
-            UBiDiLevel level=UBIDI_DEFAULT_LTR;   /* initialize with no valid level */
-
-            /* count the runs, there is at least one non-WS run, and limit>0 */
-            runCount=0;
-            for(i=0; i<limit; ++i) {
-                /* increment runCount at the start of each run */
-                if(levels[i]!=level) {
-                    ++runCount;
-                    level=levels[i];
-                }
-            }
-
-            /*
-             * We don't need to see if the last run can be merged with a trailing
-             * WS run because setTrailingWSStart() would have done that.
-             */
-            if(runCount==1 && limit==length) {
-                /* There is only one non-WS run and no trailing WS-run. */
-                getSingleRun(pBiDi, levels[0]);
-            } else /* runCount>1 || limit<length */ {
-                /* allocate and set the runs */
-                Run *runs;
-                int32_t runIndex, start;
-                UBiDiLevel minLevel=UBIDI_MAX_EXPLICIT_LEVEL+1, maxLevel=0;
-
-                /* now, count a (non-mergable) WS run */
-                if(limit<length) {
-                    ++runCount;
-                }
-
-                /* runCount>1 */
-                if(getRunsMemory(pBiDi, runCount)) {
-                    runs=pBiDi->runsMemory;
-                } else {
-                    return FALSE;
-                }
-
-                /* set the runs */
-                /* this could be optimized, e.g.: 464->444, 484->444, 575->555, 595->555 */
-                /* however, that would take longer and make other functions more complicated */
-                runIndex=0;
-
-                /* search for the run limits and initialize visualLimit values with the run lengths */
-                i=0;
-                do {
-                    /* prepare this run */
-                    start=i;
-                    level=levels[i];
-                    if(level<minLevel) {
-                        minLevel=level;
-                    }
-                    if(level>maxLevel) {
-                        maxLevel=level;
-                    }
-
-                    /* look for the run limit */
-                    while(++i<limit && levels[i]==level) {}
-
-                    /* i is another run limit */
-                    runs[runIndex].logicalStart=start;
-                    runs[runIndex].visualLimit=i-start;
-                    ++runIndex;
-                } while(i<limit);
-
-                if(limit<length) {
-                    /* there is a separate WS run */
-                    runs[runIndex].logicalStart=limit;
-                    runs[runIndex].visualLimit=length-limit;
-                    if(pBiDi->paraLevel<minLevel) {
-                        minLevel=pBiDi->paraLevel;
-                    }
-                }
-
-                /* set the object fields */
-                pBiDi->runs=runs;
-                pBiDi->runCount=runCount;
-
-                reorderLine(pBiDi, minLevel, maxLevel);
-
-                /* now add the direction flags and adjust the visualLimit's to be just that */
-                ADD_ODD_BIT_FROM_LEVEL(runs[0].logicalStart, levels[runs[0].logicalStart]);
-                limit=runs[0].visualLimit;
-                for(i=1; i<runIndex; ++i) {
-                    ADD_ODD_BIT_FROM_LEVEL(runs[i].logicalStart, levels[runs[i].logicalStart]);
-                    limit=runs[i].visualLimit+=limit;
-                }
-
-                /* same for the trailing WS run */
-                if(runIndex<runCount) {
-                    ADD_ODD_BIT_FROM_LEVEL(runs[i].logicalStart, pBiDi->paraLevel);
-                    runs[runIndex].visualLimit+=limit;
-                }
-            }
-        }
-    }
-    return TRUE;
-}
-
-/* in trivial cases there is only one trivial run; called by ubidi_getRuns() */
-static void
-getSingleRun(UBiDi *pBiDi, UBiDiLevel level) {
-    /* simple, single-run case */
-    pBiDi->runs=pBiDi->simpleRuns;
-    pBiDi->runCount=1;
-
-    /* fill and reorder the single run */
-    pBiDi->runs[0].logicalStart=MAKE_INDEX_ODD_PAIR(0, level);
-    pBiDi->runs[0].visualLimit=pBiDi->length;
-}
-
-/* reorder the runs array (L2) ---------------------------------------------- */
-
-/*
- * Reorder the same-level runs in the runs array.
- * Here, runCount>1 and maxLevel>=minLevel>=paraLevel.
- * All the visualStart fields=logical start before reordering.
- * The "odd" bits are not set yet.
- *
- * Reordering with this data structure lends itself to some handy shortcuts:
- *
- * Since each run is moved but not modified, and since at the initial maxLevel
- * each sequence of same-level runs consists of only one run each, we
- * don't need to do anything there and can predecrement maxLevel.
- * In many simple cases, the reordering is thus done entirely in the
- * index mapping.
- * Also, reordering occurs only down to the lowest odd level that occurs,
- * which is minLevel|1. However, if the lowest level itself is odd, then
- * in the last reordering the sequence of the runs at this level or higher
- * will be all runs, and we don't need the elaborate loop to search for them.
- * This is covered by ++minLevel instead of minLevel|=1 followed
- * by an extra reorder-all after the reorder-some loop.
- * About a trailing WS run:
- * Such a run would need special treatment because its level is not
- * reflected in levels[] if this is not a paragraph object.
- * Instead, all characters from trailingWSStart on are implicitly at
- * paraLevel.
- * However, for all maxLevel>paraLevel, this run will never be reordered
- * and does not need to be taken into account. maxLevel==paraLevel is only reordered
- * if minLevel==paraLevel is odd, which is done in the extra segment.
- * This means that for the main reordering loop we don't need to consider
- * this run and can --runCount. If it is later part of the all-runs
- * reordering, then runCount is adjusted accordingly.
- */
-static void
-reorderLine(UBiDi *pBiDi, UBiDiLevel minLevel, UBiDiLevel maxLevel) {
-    Run *runs;
-    UBiDiLevel *levels;
-    int32_t firstRun, endRun, limitRun, runCount,
-    temp;
-
-    /* nothing to do? */
-    if(maxLevel<=(minLevel|1)) {
-        return;
-    }
-
-    /*
-     * Reorder only down to the lowest odd level
-     * and reorder at an odd minLevel in a separate, simpler loop.
-     * See comments above for why minLevel is always incremented.
-     */
-    ++minLevel;
-
-    runs=pBiDi->runs;
-    levels=pBiDi->levels;
-    runCount=pBiDi->runCount;
-
-    /* do not include the WS run at paraLevel<=old minLevel except in the simple loop */
-    if(pBiDi->trailingWSStart<pBiDi->length) {
-        --runCount;
-    }
-
-    while(--maxLevel>=minLevel) {
-        firstRun=0;
-
-        /* loop for all sequences of runs */
-        for(;;) {
-            /* look for a sequence of runs that are all at >=maxLevel */
-            /* look for the first run of such a sequence */
-            while(firstRun<runCount && levels[runs[firstRun].logicalStart]<maxLevel) {
-                ++firstRun;
-            }
-            if(firstRun>=runCount) {
-                break;  /* no more such runs */
-            }
-
-            /* look for the limit run of such a sequence (the run behind it) */
-            for(limitRun=firstRun; ++limitRun<runCount && levels[runs[limitRun].logicalStart]>=maxLevel;) {}
-
-            /* Swap the entire sequence of runs from firstRun to limitRun-1. */
-            endRun=limitRun-1;
-            while(firstRun<endRun) {
-                temp=runs[firstRun].logicalStart;
-                runs[firstRun].logicalStart=runs[endRun].logicalStart;
-                runs[endRun].logicalStart=temp;
-
-                temp=runs[firstRun].visualLimit;
-                runs[firstRun].visualLimit=runs[endRun].visualLimit;
-                runs[endRun].visualLimit=temp;
-
-                ++firstRun;
-                --endRun;
-            }
-
-            if(limitRun==runCount) {
-                break;  /* no more such runs */
-            } else {
-                firstRun=limitRun+1;
-            }
-        }
-    }
-
-    /* now do maxLevel==old minLevel (==odd!), see above */
-    if(!(minLevel&1)) {
-        firstRun=0;
-
-        /* include the trailing WS run in this complete reordering */
-        if(pBiDi->trailingWSStart==pBiDi->length) {
-            --runCount;
-        }
-
-        /* Swap the entire sequence of all runs. (endRun==runCount) */
-        while(firstRun<runCount) {
-            temp=runs[firstRun].logicalStart;
-            runs[firstRun].logicalStart=runs[runCount].logicalStart;
-            runs[runCount].logicalStart=temp;
-
-            temp=runs[firstRun].visualLimit;
-            runs[firstRun].visualLimit=runs[runCount].visualLimit;
-            runs[runCount].visualLimit=temp;
-
-            ++firstRun;
-            --runCount;
-        }
-    }
-}
-
-/* reorder a line based on a levels array (L2) ------------------------------ */
-
-U_CAPI void U_EXPORT2
-ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) {
-    int32_t start, limit, sumOfSosEos;
-    UBiDiLevel minLevel, maxLevel;
-
-    if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
-        return;
-    }
-
-    /* nothing to do? */
-    if(minLevel==maxLevel && (minLevel&1)==0) {
-        return;
-    }
-
-    /* reorder only down to the lowest odd level */
-    minLevel|=1;
-
-    /* loop maxLevel..minLevel */
-    do {
-        start=0;
-
-        /* loop for all sequences of levels to reorder at the current maxLevel */
-        for(;;) {
-            /* look for a sequence of levels that are all at >=maxLevel */
-            /* look for the first index of such a sequence */
-            while(start<length && levels[start]<maxLevel) {
-                ++start;
-            }
-            if(start>=length) {
-                break;  /* no more such sequences */
-            }
-
-            /* look for the limit of such a sequence (the index behind it) */
-            for(limit=start; ++limit<length && levels[limit]>=maxLevel;) {}
-
-            /*
-             * sos=start of sequence, eos=end of sequence
-             *
-             * The closed (inclusive) interval from sos to eos includes all the logical
-             * and visual indexes within this sequence. They are logically and
-             * visually contiguous and in the same range.
-             *
-             * For each run, the new visual index=sos+eos-old visual index;
-             * we pre-add sos+eos into sumOfSosEos ->
-             * new visual index=sumOfSosEos-old visual index;
-             */
-            sumOfSosEos=start+limit-1;
-
-            /* reorder each index in the sequence */
-            do {
-                indexMap[start]=sumOfSosEos-indexMap[start];
-            } while(++start<limit);
-
-            /* start==limit */
-            if(limit==length) {
-                break;  /* no more such sequences */
-            } else {
-                start=limit+1;
-            }
-        }
-    } while(--maxLevel>=minLevel);
-}
-
-U_CAPI void U_EXPORT2
-ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) {
-    int32_t start, end, limit, temp;
-    UBiDiLevel minLevel, maxLevel;
-
-    if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
-        return;
-    }
-
-    /* nothing to do? */
-    if(minLevel==maxLevel && (minLevel&1)==0) {
-        return;
-    }
-
-    /* reorder only down to the lowest odd level */
-    minLevel|=1;
-
-    /* loop maxLevel..minLevel */
-    do {
-        start=0;
-
-        /* loop for all sequences of levels to reorder at the current maxLevel */
-        for(;;) {
-            /* look for a sequence of levels that are all at >=maxLevel */
-            /* look for the first index of such a sequence */
-            while(start<length && levels[start]<maxLevel) {
-                ++start;
-            }
-            if(start>=length) {
-                break;  /* no more such runs */
-            }
-
-            /* look for the limit of such a sequence (the index behind it) */
-            for(limit=start; ++limit<length && levels[limit]>=maxLevel;) {}
-
-            /*
-             * Swap the entire interval of indexes from start to limit-1.
-             * We don't need to swap the levels for the purpose of this
-             * algorithm: the sequence of levels that we look at does not
-             * move anyway.
-             */
-            end=limit-1;
-            while(start<end) {
-                temp=indexMap[start];
-                indexMap[start]=indexMap[end];
-                indexMap[end]=temp;
-
-                ++start;
-                --end;
-            }
-
-            if(limit==length) {
-                break;  /* no more such sequences */
-            } else {
-                start=limit+1;
-            }
-        }
-    } while(--maxLevel>=minLevel);
-}
-
-static bool_t
-prepareReorder(const UBiDiLevel *levels, int32_t length,
-               int32_t *indexMap,
-               UBiDiLevel *pMinLevel, UBiDiLevel *pMaxLevel) {
-    int32_t start;
-    UBiDiLevel level, minLevel, maxLevel;
-
-    if(levels==NULL || length<=0) {
-        return FALSE;
-    }
-
-    /* determine minLevel and maxLevel */
-    minLevel=UBIDI_MAX_EXPLICIT_LEVEL+1;
-    maxLevel=0;
-    for(start=length; start>0;) {
-        level=levels[--start];
-        if(level>UBIDI_MAX_EXPLICIT_LEVEL+1) {
-            return FALSE;
-        }
-        if(level<minLevel) {
-            minLevel=level;
-        }
-        if(level>maxLevel) {
-            maxLevel=level;
-        }
-    }
-    *pMinLevel=minLevel;
-    *pMaxLevel=maxLevel;
-
-    /* initialize the index map */
-    for(start=length; start>0;) {
-        --start;
-        indexMap[start]=start;
-    }
-
-    return TRUE;
-}
-
-/* API functions for logical<->visual mapping ------------------------------- */
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) {
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return 0;
-    } else if(pBiDi==NULL) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return 0;
-    } else if(logicalIndex<0 || pBiDi->length<=logicalIndex) {
-        *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
-        return 0;
-    } else {
-        /* we can do the trivial cases without the runs array */
-        switch(pBiDi->direction) {
-        case UBIDI_LTR:
-            return logicalIndex;
-        case UBIDI_RTL:
-            return pBiDi->length-logicalIndex-1;
-        default:
-            if(pBiDi->runCount<0 && !ubidi_getRuns(pBiDi)) {
-                *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-                return 0;
-            } else {
-                Run *runs=pBiDi->runs;
-                int32_t i, visualStart=0, offset, length;
-
-                /* linear search for the run, search on the visual runs */
-                for(i=0;; ++i) {
-                    length=runs[i].visualLimit-visualStart;
-                    offset=logicalIndex-GET_INDEX(runs[i].logicalStart);
-                    if(offset>=0 && offset<length) {
-                        if(IS_EVEN_RUN(runs[i].logicalStart)) {
-                            /* LTR */
-                            return visualStart+offset;
-                        } else {
-                            /* RTL */
-                            return visualStart+length-offset-1;
-                        }
-                    }
-                    visualStart+=length;
-                }
-            }
-        }
-    }
-}
-
-U_CAPI int32_t U_EXPORT2
-ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode) {
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return 0;
-    } else if(pBiDi==NULL) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return 0;
-    } else if(visualIndex<0 || pBiDi->length<=visualIndex) {
-        *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
-        return 0;
-    } else {
-        /* we can do the trivial cases without the runs array */
-        switch(pBiDi->direction) {
-        case UBIDI_LTR:
-            return visualIndex;
-        case UBIDI_RTL:
-            return pBiDi->length-visualIndex-1;
-        default:
-            if(pBiDi->runCount<0 && !ubidi_getRuns(pBiDi)) {
-                *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-                return 0;
-            } else {
-                Run *runs=pBiDi->runs;
-                int32_t i, runCount=pBiDi->runCount, start;
-
-                if(runCount<=10) {
-                    /* linear search for the run */
-                    for(i=0; visualIndex>=runs[i].visualLimit; ++i) {}
-                } else {
-                    /* binary search for the run */
-                    int32_t begin=0, limit=runCount;
-
-                    /* the middle if() will guaranteed find the run, we don't need a loop limit */
-                    for(;;) {
-                        i=(begin+limit)/2;
-                        if(visualIndex>=runs[i].visualLimit) {
-                            begin=i+1;
-                        } else if(i==0 || visualIndex>=runs[i-1].visualLimit) {
-                            break;
-                        } else {
-                            limit=i;
-                        }
-                    }
-                }
-
-                start=runs[i].logicalStart;
-                if(IS_EVEN_RUN(start)) {
-                    /* LTR */
-                    /* the offset in runs[i] is visualIndex-runs[i-1].visualLimit */
-                    if(i>0) {
-                        visualIndex-=runs[i-1].visualLimit;
-                    }
-                    return GET_INDEX(start)+visualIndex;
-                } else {
-                    /* RTL */
-                    return GET_INDEX(start)+runs[i].visualLimit-visualIndex-1;
-                }
-            }
-        }
-    }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
-    UBiDiLevel *levels;
-
-    /* ubidi_getLevels() checks all of its and our arguments */
-    if((levels=(UBiDiLevel *)ubidi_getLevels(pBiDi, pErrorCode))==NULL) {
-        /* no op */
-    } else if(indexMap==NULL) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-    } else {
-        ubidi_reorderLogical(levels, pBiDi->length, indexMap);
-    }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
-    /* ubidi_countRuns() checks all of its and our arguments */
-    if(ubidi_countRuns(pBiDi, pErrorCode)<=0) {
-        /* no op */
-    } else if(indexMap==NULL) {
-        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-    } else {
-        /* fill a visual-to-logical index map using the runs[] */
-        Run *runs=pBiDi->runs, *runsLimit=runs+pBiDi->runCount;
-        int32_t logicalStart, visualStart, visualLimit;
-
-        visualStart=0;
-        for(; runs<runsLimit; ++runs) {
-            logicalStart=runs->logicalStart;
-            visualLimit=runs->visualLimit;
-            if(IS_EVEN_RUN(logicalStart)) {
-                do { /* LTR */
-                    *indexMap++ = logicalStart++;
-                } while(++visualStart<visualLimit);
-            } else {
-                REMOVE_ODD_BIT(logicalStart);
-                logicalStart+=visualLimit-visualStart;  /* logicalLimit */
-                do { /* RTL */
-                    *indexMap++ = --logicalStart;
-                } while(++visualStart<visualLimit);
-            }
-            /* visualStart==visualLimit; */
-        }
-    }
-}
-
-U_CAPI void U_EXPORT2
-ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length) {
-    if(srcMap!=NULL && destMap!=NULL) {
-        srcMap+=length;
-        while(length>0) {
-            destMap[*--srcMap]=--length;
-        }
-    }
-}
--- a/jdk/src/share/native/sun/font/bidi/uchardir.c	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,652 +0,0 @@
-/*
- * Portions Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-*
-* File UCHAR.CPP
-*
-* Modification History:
-*
-*   Date        Name        Description
-*   11/30/1999  dfelt       Creation.  Extract from uchar.c, reduce to data
-*                             query only.
-********************************************************************************
-*/
-
-#include "uchardir.h"
-
-/* new 4.0 surrogate data */
-static uint32_t ASCII_START = 0x0;
-static uint32_t ASCII_LIMIT = 0x80;
-static uint8_t ASCII[] = {
-    (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12,
-    (uint8_t)0x12, (uint8_t)0x08, (uint8_t)0x07, (uint8_t)0x08, (uint8_t)0x09, (uint8_t)0x07, (uint8_t)0x12, (uint8_t)0x12,
-    (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12,
-    (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x12, (uint8_t)0x07, (uint8_t)0x07, (uint8_t)0x07, (uint8_t)0x08,
-    (uint8_t)0x09, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x04, (uint8_t)0x04, (uint8_t)0x04, (uint8_t)0x0a, (uint8_t)0x0a,
-    (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x04, (uint8_t)0x06, (uint8_t)0x04, (uint8_t)0x06, (uint8_t)0x03,
-    (uint8_t)0x02, (uint8_t)0x02, (uint8_t)0x02, (uint8_t)0x02, (uint8_t)0x02, (uint8_t)0x02, (uint8_t)0x02, (uint8_t)0x02,
-    (uint8_t)0x02, (uint8_t)0x02, (uint8_t)0x06, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a,
-    (uint8_t)0x0a, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-    (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-    (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-    (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a,
-    (uint8_t)0x0a, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-    (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-    (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-    (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x12,
-};
-static uint32_t RTL_START = 0x591;
-static uint32_t RTL_LIMIT = 0x671;
-static uint8_t RTL[] = {
-    (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-    (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-    (uint8_t)0x11, (uint8_t)0x01, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-    (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-    (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-    (uint8_t)0x11, (uint8_t)0x01, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x01, (uint8_t)0x11, (uint8_t)0x01,
-    (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x01, (uint8_t)0x11, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01,
-    (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01,
-    (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01,
-    (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01,
-    (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01,
-    (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01,
-    (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01,
-    (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x01, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x06, (uint8_t)0x0d, (uint8_t)0x0a, (uint8_t)0x0a, (uint8_t)0x11,
-    (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-    (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-    (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x05,
-    (uint8_t)0x05, (uint8_t)0x05, (uint8_t)0x05, (uint8_t)0x05, (uint8_t)0x05, (uint8_t)0x05, (uint8_t)0x05, (uint8_t)0x05,
-    (uint8_t)0x05, (uint8_t)0x04, (uint8_t)0x05, (uint8_t)0x05, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x11,
-};
-static uint8_t t0[] = {
-  (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x9b, (uint8_t)0xab, (uint8_t)0xca, (uint8_t)0x99,
-  (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0xaa, (uint8_t)0xab,
-  (uint8_t)0xcd, (uint8_t)0xd5, (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd5, (uint8_t)0x75, (uint8_t)0x74,
-  (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x7d, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xd9,
-  (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x9a, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99,
-  (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99,
-  (uint8_t)0x7d, (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0x55, (uint8_t)0x33, (uint8_t)0xd0, (uint8_t)0xdd, (uint8_t)0xd3, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x0d,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xd0,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0x0d, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x18, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x18, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x18, (uint8_t)0x88, (uint8_t)0x18,
-  (uint8_t)0x18, (uint8_t)0x81, (uint8_t)0x81, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-  (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x72, (uint8_t)0xdd,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x28, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x82, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22,
-  (uint8_t)0x66, (uint8_t)0x66, (uint8_t)0x66, (uint8_t)0x66, (uint8_t)0x66, (uint8_t)0x56, (uint8_t)0x62, (uint8_t)0x22,
-  (uint8_t)0x82, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x82, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x82, (uint8_t)0x28, (uint8_t)0x8d, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x22,
-  (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x29,
-  (uint8_t)0x28, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x82, (uint8_t)0x22, (uint8_t)0x22,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x08, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x80, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x55, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x80, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x00,
-  (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x08, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x00,
-  (uint8_t)0x05, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x80, (uint8_t)0x08,
-  (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd5, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x88,
-  (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x05,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x80,
-  (uint8_t)0x08, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x08, (uint8_t)0x80, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x08, (uint8_t)0x08, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x00,
-  (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x80,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88,
-  (uint8_t)0x80, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x08, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xc0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xd0, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x80, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x05, (uint8_t)0x08, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd8, (uint8_t)0x88, (uint8_t)0xc0,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0x0d,
-  (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xd0,
-  (uint8_t)0xcc, (uint8_t)0xcc, (uint8_t)0xcc, (uint8_t)0xcc, (uint8_t)0xcc, (uint8_t)0xc9, (uint8_t)0x99, (uint8_t)0x01,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xca, (uint8_t)0xee, (uint8_t)0xee, (uint8_t)0xec,
-  (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0x5d, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x0d, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0c,
-  (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99,
-  (uint8_t)0x30, (uint8_t)0x00, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xd0,
-  (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xd0,
-  (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0x55, (uint8_t)0x55,
-  (uint8_t)0x55, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xd0, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x0d, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x50,
-  (uint8_t)0x00, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33,
-  (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x33, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x3d, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x0d, (uint8_t)0x0d,
-  (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0xd0, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0,
-  (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0xcd, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x8d, (uint8_t)0xd0, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0xdd,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x0d,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x01, (uint8_t)0x81,
-  (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x15, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0xdd,
-  (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x22, (uint8_t)0x2d, (uint8_t)0x22,
-  (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x7d, (uint8_t)0x70, (uint8_t)0xd7, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd5,
-  (uint8_t)0xdd, (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xd0, (uint8_t)0xd5, (uint8_t)0x5d, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x0d, (uint8_t)0xd5, (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd5, (uint8_t)0x75, (uint8_t)0x74,
-  (uint8_t)0x55, (uint8_t)0xdd, (uint8_t)0xd5, (uint8_t)0x50, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xdd, (uint8_t)0xd0,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x09, (uint8_t)0x99, (uint8_t)0xdd, (uint8_t)0x00,
-  (uint8_t)0x0d, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x09, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x99, (uint8_t)0x98, (uint8_t)0x88, (uint8_t)0x88,
-  (uint8_t)0x88, (uint8_t)0x80, (uint8_t)0x08, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x88, (uint8_t)0x88, (uint8_t)0x00,
-  (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x33,
-  (uint8_t)0x09, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00, (uint8_t)0x00,
-};
-
-static uint8_t t1[] = {
-  (uint8_t)0x00, (uint8_t)0x01, (uint8_t)0x02, (uint8_t)0x03, (uint8_t)0x04, (uint8_t)0x05, (uint8_t)0x04, (uint8_t)0x06,
-  (uint8_t)0x07, (uint8_t)0x08, (uint8_t)0x09, (uint8_t)0x0a, (uint8_t)0x0b, (uint8_t)0x0c, (uint8_t)0x0b, (uint8_t)0x0c,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0d, (uint8_t)0x0e, (uint8_t)0x0e, (uint8_t)0x0f, (uint8_t)0x10,
-  (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x12, (uint8_t)0x11, (uint8_t)0x13,
-  (uint8_t)0x14, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x15,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x16, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x17, (uint8_t)0x18, (uint8_t)0x19, (uint8_t)0x1a, (uint8_t)0x1b, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1d, (uint8_t)0x1e, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x20, (uint8_t)0x21, (uint8_t)0x22, (uint8_t)0x23,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x24, (uint8_t)0x25, (uint8_t)0x26,
-  (uint8_t)0x27, (uint8_t)0x28, (uint8_t)0x1f, (uint8_t)0x11, (uint8_t)0x29, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x2a, (uint8_t)0x23, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x2b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x2c, (uint8_t)0x2d, (uint8_t)0x2e, (uint8_t)0x2f, (uint8_t)0x0b,
-  (uint8_t)0x30, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x2c, (uint8_t)0x31, (uint8_t)0x0b, (uint8_t)0x2f, (uint8_t)0x32,
-  (uint8_t)0x2b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x2c, (uint8_t)0x33, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x34,
-  (uint8_t)0x2b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x2c, (uint8_t)0x35, (uint8_t)0x0b, (uint8_t)0x2f, (uint8_t)0x36,
-  (uint8_t)0x30, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x37, (uint8_t)0x38, (uint8_t)0x39, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x3a, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x3b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x3c,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x3d, (uint8_t)0x3e, (uint8_t)0x3f, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x2c, (uint8_t)0x40, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x38, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x41, (uint8_t)0x42, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x43, (uint8_t)0x44, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x45, (uint8_t)0x46, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x47, (uint8_t)0x0b, (uint8_t)0x48, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x49,
-  (uint8_t)0x4a, (uint8_t)0x4b, (uint8_t)0x11, (uint8_t)0x4c, (uint8_t)0x39, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x4d, (uint8_t)0x4e, (uint8_t)0x0b, (uint8_t)0x47, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x4f, (uint8_t)0x50, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x51, (uint8_t)0x0b, (uint8_t)0x51, (uint8_t)0x0b, (uint8_t)0x2f, (uint8_t)0x0b, (uint8_t)0x2f,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x52, (uint8_t)0x53, (uint8_t)0x54, (uint8_t)0x0b, (uint8_t)0x55,
-  (uint8_t)0x56, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x57, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x58, (uint8_t)0x59, (uint8_t)0x5a, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x5b, (uint8_t)0x5c, (uint8_t)0x5d, (uint8_t)0x5d, (uint8_t)0x5e,
-  (uint8_t)0x5f, (uint8_t)0x10, (uint8_t)0x60, (uint8_t)0x61, (uint8_t)0x10, (uint8_t)0x62, (uint8_t)0x63, (uint8_t)0x64,
-  (uint8_t)0x65, (uint8_t)0x0b, (uint8_t)0x66, (uint8_t)0x67, (uint8_t)0x0b, (uint8_t)0x11, (uint8_t)0x68, (uint8_t)0x0b,
-  (uint8_t)0x69, (uint8_t)0x6a, (uint8_t)0x6b, (uint8_t)0x6c, (uint8_t)0x6d, (uint8_t)0x6e, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x6f, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x70, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x05,
-  (uint8_t)0x10, (uint8_t)0x71, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x04, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x72, (uint8_t)0x0b, (uint8_t)0x73, (uint8_t)0x0b, (uint8_t)0x74, (uint8_t)0x74,
-  (uint8_t)0x74, (uint8_t)0x75, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x76, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x77, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x78,
-  (uint8_t)0x10, (uint8_t)0x79, (uint8_t)0x79, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x7a, (uint8_t)0x10, (uint8_t)0x77, (uint8_t)0x10, (uint8_t)0x7b, (uint8_t)0x7c, (uint8_t)0x7d, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x7e, (uint8_t)0x10, (uint8_t)0x7f, (uint8_t)0x0b, (uint8_t)0x10, (uint8_t)0x80, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x78, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x10, (uint8_t)0x81, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x82,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x70, (uint8_t)0x0b, (uint8_t)0x80,
-  (uint8_t)0x83, (uint8_t)0x10, (uint8_t)0x84, (uint8_t)0x85, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x86, (uint8_t)0x04, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x87,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x5e, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x10, (uint8_t)0x0b, (uint8_t)0x88,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x7d, (uint8_t)0x89, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x8a,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x8b, (uint8_t)0x0b, (uint8_t)0x8c,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x72, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x8d, (uint8_t)0x8e, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x8f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x90,
-  (uint8_t)0x11, (uint8_t)0x0b, (uint8_t)0x91, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x92, (uint8_t)0x93, (uint8_t)0x1f,
-  (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x1f, (uint8_t)0x27,
-  (uint8_t)0x94, (uint8_t)0x03, (uint8_t)0x04, (uint8_t)0x05, (uint8_t)0x04, (uint8_t)0x05, (uint8_t)0x70, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x95, (uint8_t)0x96,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x97, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c, (uint8_t)0x1c,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x98, (uint8_t)0x99,
-  (uint8_t)0x9a, (uint8_t)0x0b, (uint8_t)0x9b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x10, (uint8_t)0x72, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x9c, (uint8_t)0x74, (uint8_t)0x74, (uint8_t)0x74,
-  (uint8_t)0x9d, (uint8_t)0x0b, (uint8_t)0x08, (uint8_t)0x08, (uint8_t)0x08, (uint8_t)0x08, (uint8_t)0x08, (uint8_t)0x08,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11,
-  (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x11, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-  (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b, (uint8_t)0x0b,
-};
-
-static uint8_t ix[] = {
-  (uint8_t)0x01, (uint8_t)0x23, (uint8_t)0x45, (uint8_t)0x67, (uint8_t)0x78, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x97, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x7a,
-  (uint8_t)0xbc, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0xd7, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0xe7, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-  (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77, (uint8_t)0x77,
-};
-
-#define LOWBITS 4
-#define MEDBITS 7
-#define HIGHBITS (21 - MEDBITS - LOWBITS)
-
-#define HIGHSHIFT (LOWBITS + MEDBITS)
-
-#define BLOCKSIZE (1 << LOWBITS)
-#define IBLOCKSIZE (1 << MEDBITS)
-#define ISIZE (1 << HIGHBITS)
-
-#define BLOCKMASK (BLOCKSIZE - 1)
-#define IBLOCKMASK (IBLOCKSIZE - 1)
-#define IMASK (ISIZE - 1)
-
-static uint8_t jx2i[] = {
-    0, 1, 13, 2, 3, 4, 5, 6, 17, 18, 7, 8, 9, 10
-};
-
-static uint8_t x2i[] = {
-    /* LRE RLE PDF LRO RLO */
-    11, 14, 16, 12, 15
-};
-
-static UCharDirection u_getDirectionInternal(uint32_t cp) {
-  int dc;
-  int n;
-  int bi = cp & BLOCKMASK;
-  int ibi = (cp >> LOWBITS) & IBLOCKMASK;
-  int i = (cp >> HIGHSHIFT) & IMASK;
-
-  n = ix[i >> 1];
-  if ((i & 1) == 0) {
-    n >>= 4;
-  }
-  n &= 0x0f;
-  n = t1[n * IBLOCKSIZE + ibi];
-  n = n * BLOCKSIZE + bi;
-  dc = t0[n >> 1];
-  if ((n & 1) == 0) {
-    dc >>= 4;
-  }
-  dc &= 0x0f;
-  if (dc > 13) {
-    dc = x2i[cp - 0x202a];
-  } else {
-    dc = jx2i[dc];
-  }
-  return dc;
-}
-
-UCharDirection u_getDirection(uint32_t cp) {
-  if (cp < ASCII_LIMIT) {
-    return ASCII[cp];
-  }
-  if (cp < RTL_START) {
-    return u_getDirectionInternal(cp);
-  }
-  if (cp < RTL_LIMIT) {
-    return RTL[cp - RTL_START];
-  }
-  if (cp < 0x110000) {
-    return u_getDirectionInternal(cp);
-  }
-  return 0;
-}
-
-UCharDirection
-u_charDirection(UChar ch) {
-    return u_getDirection(ch);
-}
-
-#define LEAD_SURROGATE_SHIFT 10
-#define SURROGATE_OFFSET (0x010000 - (0xd800 << 10) - 0xdc00)
-
-UCharDirection
-u_surrogatePairDirection(UChar lead, UChar trail) {
-    uint32_t cp = ((uint32_t)lead << LEAD_SURROGATE_SHIFT) + trail + SURROGATE_OFFSET;
-    return u_getDirection(cp);
-}
--- a/jdk/src/share/native/sun/font/bidi/uchardir.h	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Portions Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-*
-* File UCHARDIR.H
-*
-* Modification History:
-*
-*   Date          Name        Description
-*   11/30/1999    dfelt       Creation.  Copied UCharDirection from uchar.h
-********************************************************************************
-*/
-
-#ifndef UCHARDIR_H
-#define UCHARDIR_H
-
-#include "utypes.h"
-
-/*===========================================================================*/
-/* Unicode version number                                                    */
-/*===========================================================================*/
-#define UNICODE_VERSION  "3.0.0.beta"
-
-enum UCharDirection   {
-    U_LEFT_TO_RIGHT               = 0,
-    U_RIGHT_TO_LEFT               = 1,
-    U_EUROPEAN_NUMBER             = 2,
-    U_EUROPEAN_NUMBER_SEPARATOR   = 3,
-    U_EUROPEAN_NUMBER_TERMINATOR  = 4,
-    U_ARABIC_NUMBER               = 5,
-    U_COMMON_NUMBER_SEPARATOR     = 6,
-    U_BLOCK_SEPARATOR             = 7,
-    U_SEGMENT_SEPARATOR           = 8,
-    U_WHITE_SPACE_NEUTRAL         = 9,
-    U_OTHER_NEUTRAL               = 10,
-    U_LEFT_TO_RIGHT_EMBEDDING     = 11,
-    U_LEFT_TO_RIGHT_OVERRIDE      = 12,
-    U_RIGHT_TO_LEFT_ARABIC        = 13,
-    U_RIGHT_TO_LEFT_EMBEDDING     = 14,
-    U_RIGHT_TO_LEFT_OVERRIDE      = 15,
-    U_POP_DIRECTIONAL_FORMAT      = 16,
-    U_DIR_NON_SPACING_MARK        = 17,
-    U_BOUNDARY_NEUTRAL            = 18,
-    U_CHAR_DIRECTION_COUNT
-};
-
-typedef enum UCharDirection UCharDirection;
-
-/**
-  * Returns the linguistic direction property of a character.
-  * <P>
-  * Returns the linguistic direction property of a character.
-  * For example, 0x0041 (letter A) has the LEFT_TO_RIGHT directional
-  * property.
-  * @see UCharDirection
-  */
-U_CAPI UCharDirection U_EXPORT2
-u_charDirection(UChar c);
-
-U_CAPI UCharDirection U_EXPORT2
-u_getDirection(uint32_t cp);
-
-U_CAPI UCharDirection U_EXPORT2
-u_surrogatePairDirection(UChar lead, UChar trail);
-
-#endif /*_UCHAR*/
-/*eof*/
--- a/jdk/src/share/native/sun/font/bidi/utypes.h	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Portions Copyright 2000-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * (C) Copyright Taligent, Inc.,  1996, 1997                                 *
- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-/*
-*
-*  FILE NAME : UTYPES.H (formerly ptypes.h)
-*
-*   Date        Name        Description
-*   12/11/96    helena      Creation.
-*   02/27/97    aliu        Added typedefs for UClassID, int8, int16, int32,
-*                           uint8, uint16, and uint32.
-*   04/01/97    aliu        Added XP_CPLUSPLUS and modified to work under C as
-*                            well as C++.
-*                           Modified to use memcpy() for icu_arrayCopy() fns.
-*   04/14/97    aliu        Added TPlatformUtilities.
-*   05/07/97    aliu        Added import/export specifiers (replacing the old
-*                           broken EXT_CLASS).  Added version number for our
-*                           code.  Cleaned up header.
-*    6/20/97    helena      Java class name change.
-*   08/11/98    stephen     UErrorCode changed from typedef to enum
-*   08/12/98    erm         Changed T_ANALYTIC_PACKAGE_VERSION to 3
-*   08/14/98    stephen     Added icu_arrayCopy() for int8_t, int16_t, int32_t
-*   12/09/98    jfitz       Added BUFFER_OVERFLOW_ERROR (bug 1100066)
-*   04/20/99    stephen     Cleaned up & reworked for autoconf.
-*                           Renamed to utypes.h.
-*   05/05/99    stephen     Changed to use <inttypes.h>
-*   10/12/00    dfelt       Adapted to use javavm types (plus juint from j2d)
-*******************************************************************************
-*/
-
-#ifndef UTYPES_H
-#define UTYPES_H
-
-// doesn't seem to be a way of getting around this
-
-//#if defined(WIN32) || defined(_WIN32)
-// not needed since we don't export to another dll
-
-#if 0
-
-#define U_EXPORT __declspec(dllexport)
-#define U_EXPORT2
-#define U_IMPORT __declspec(dllimport)
-
-#else
-
-#define U_EXPORT
-#define U_EXPORT2
-#define U_IMPORT
-
-#endif
-
-#ifdef XP_CPLUSPLUS
-#   define U_CFUNC extern "C"
-#   define U_CDECL_BEGIN extern "C" {
-#   define U_CDECL_END   }
-#else
-#   define U_CFUNC
-#   define U_CDECL_BEGIN
-#   define U_CDECL_END
-#endif
-#define U_CAPI U_CFUNC U_EXPORT
-
-// defines jboolean, jchar, jshort, and jint via jni_md.h
-#include "jni.h"
-// defines jubyte, jushort, juint
-#include "j2d_md.h"
-
-typedef jboolean bool_t;
-
-/*
- * win32 does not have standard definitions for the following:
- */
-#ifdef WIN32
-
-#ifndef __int8_t_defined
-typedef jbyte    int8_t;
-typedef jshort   int16_t;
-typedef jint     int32_t;
-#endif
-
-typedef jubyte   uint8_t;
-typedef jushort  uint16_t;
-typedef juint    uint32_t;
-
-#endif /* WIN32 */
-
-/*===========================================================================*/
-/* Unicode character                                                         */
-/*===========================================================================*/
-typedef uint16_t UChar;
-
-
-/** Error code to replace exception handling */
-enum UErrorCode {
-    U_ERROR_INFO_START        = -128,     /* Start of information results (semantically successful) */
-    U_USING_FALLBACK_ERROR    = -128,
-    U_USING_DEFAULT_ERROR     = -127,
-    U_ERROR_INFO_LIMIT,
-
-    U_ZERO_ERROR              =  0,       /* success */
-
-    U_ILLEGAL_ARGUMENT_ERROR  =  1,       /* Start of codes indicating failure */
-    U_MISSING_RESOURCE_ERROR  =  2,
-    U_INVALID_FORMAT_ERROR    =  3,
-    U_FILE_ACCESS_ERROR       =  4,
-    U_INTERNAL_PROGRAM_ERROR  =  5,       /* Indicates a bug in the library code */
-    U_MESSAGE_PARSE_ERROR     =  6,
-    U_MEMORY_ALLOCATION_ERROR =  7,       /* Memory allocation error */
-    U_INDEX_OUTOFBOUNDS_ERROR =  8,
-    U_PARSE_ERROR             =  9,       /* Equivalent to Java ParseException */
-    U_INVALID_CHAR_FOUND      = 10,       /* In the Character conversion routines: Invalid character or sequence was encountered*/
-    U_TRUNCATED_CHAR_FOUND    = 11,       /* In the Character conversion routines: More bytes are required to complete the conversion successfully*/
-    U_ILLEGAL_CHAR_FOUND      = 12,       /* In codeset conversion: a sequence that does NOT belong in the codepage has been encountered*/
-    U_INVALID_TABLE_FORMAT    = 13,       /* Conversion table file found, but corrupted*/
-    U_INVALID_TABLE_FILE      = 14,       /* Conversion table file not found*/
-    U_BUFFER_OVERFLOW_ERROR   = 15,       /* A result would not fit in the supplied buffer */
-    U_UNSUPPORTED_ERROR       = 16,       /* Requested operation not supported in current context */
-    U_ERROR_LIMIT
-};
-
-#ifndef XP_CPLUSPLUS
-typedef enum UErrorCode UErrorCode;
-#endif
-
-/* Use the following to determine if an UErrorCode represents */
-/* operational success or failure. */
-#ifdef XP_CPLUSPLUS
-inline bool_t U_SUCCESS(UErrorCode code) { return (bool_t)(code<=U_ZERO_ERROR); }
-inline bool_t U_FAILURE(UErrorCode code) { return (bool_t)(code>U_ZERO_ERROR); }
-#else
-#define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
-#define U_FAILURE(x) ((x)>U_ZERO_ERROR)
-#endif
-
-#ifndef TRUE
-#   define TRUE  1
-#endif
-#ifndef FALSE
-#   define FALSE 0
-#endif
-
-// UTYPES_H
-#endif
--- a/jdk/src/share/native/sun/font/layout/LETypes.h	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/share/native/sun/font/layout/LETypes.h	Mon Jul 06 11:42:37 2009 -0700
@@ -36,7 +36,8 @@
 #define LE_USE_CMEMORY
 
 #ifdef LE_USE_CMEMORY
-#include "cmemory.h"
+#include <stdlib.h>
+#include <string.h>
 #endif
 
 #ifndef _LP64
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Mon Jul 06 11:42:37 2009 -0700
@@ -337,7 +337,7 @@
     char errmsg[128];
     int xinawareScreen;
     void* xrenderLibHandle = NULL;
-    XRenderFindVisualFormatFunc *XRenderFindVisualFormat = NULL;
+    XRenderFindVisualFormatFunc* xrenderFindVisualFormat = NULL;
     int major_opcode, first_event, first_error;
 
     if (usingXinerama) {
@@ -435,7 +435,7 @@
 #endif
 
         if (xrenderLibHandle != NULL) {
-            XRenderFindVisualFormat =
+            xrenderFindVisualFormat =
                 (XRenderFindVisualFormatFunc*)dlsym(xrenderLibHandle,
                                                     "XRenderFindVisualFormat");
         }
@@ -454,8 +454,8 @@
         graphicsConfigs [ind]->awt_depth = pVITrue [i].depth;
         memcpy (&graphicsConfigs [ind]->awt_visInfo, &pVITrue [i],
                 sizeof (XVisualInfo));
-       if (XRenderFindVisualFormat != NULL) {
-            XRenderPictFormat *format = XRenderFindVisualFormat (awt_display,
+       if (xrenderFindVisualFormat != NULL) {
+            XRenderPictFormat *format = xrenderFindVisualFormat (awt_display,
                     pVITrue [i].visual);
             if (format &&
                 format->type == PictTypeDirect &&
--- a/jdk/src/solaris/native/sun/awt/awt_p.h	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_p.h	Mon Jul 06 11:42:37 2009 -0700
@@ -48,6 +48,7 @@
 #include <X11/Xatom.h>
 #include <X11/keysym.h>
 #include <X11/keysymdef.h>
+#include <X11/extensions/Xrender.h>
 #ifndef XAWT
 #include <Xm/CascadeB.h>
 #include <Xm/DrawingA.h>
@@ -120,48 +121,8 @@
 
 #ifndef HEADLESS
 
-/* Note: until we include the <X11/extensions/Xrender.h> explicitly
- * we have to define a couple of things ourselves.
- */
-typedef unsigned long   PictFormat;
-#define PictTypeIndexed             0
-#define PictTypeDirect              1
-
-typedef struct {
-    short   red;
-    short   redMask;
-    short   green;
-    short   greenMask;
-    short   blue;
-    short   blueMask;
-    short   alpha;
-    short   alphaMask;
-} XRenderDirectFormat;
-
-typedef struct {
-    PictFormat      id;
-    int         type;
-    int         depth;
-    XRenderDirectFormat direct;
-    Colormap        colormap;
-} XRenderPictFormat;
-
-#define PictFormatID        (1 << 0)
-#define PictFormatType      (1 << 1)
-#define PictFormatDepth     (1 << 2)
-#define PictFormatRed       (1 << 3)
-#define PictFormatRedMask   (1 << 4)
-#define PictFormatGreen     (1 << 5)
-#define PictFormatGreenMask (1 << 6)
-#define PictFormatBlue      (1 << 7)
-#define PictFormatBlueMask  (1 << 8)
-#define PictFormatAlpha     (1 << 9)
-#define PictFormatAlphaMask (1 << 10)
-#define PictFormatColormap  (1 << 11)
-
 typedef XRenderPictFormat *
 XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
-/* END OF Xrender.h chunk */
 
 typedef struct _AwtGraphicsConfigData  {
     int         awt_depth;
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -1254,6 +1254,8 @@
         WIN_MSG(WM_AWT_CREATECONTEXT)
         WIN_MSG(WM_AWT_DESTROYCONTEXT)
         WIN_MSG(WM_AWT_ASSOCIATECONTEXT)
+        WIN_MSG(WM_AWT_GET_DEFAULT_IME_HANDLER)
+        WIN_MSG(WM_AWT_HANDLE_NATIVE_IME_EVENT)
         WIN_MSG(WM_AWT_PRE_KEYDOWN)
         WIN_MSG(WM_AWT_PRE_KEYUP)
         WIN_MSG(WM_AWT_PRE_SYSKEYDOWN)
@@ -3334,7 +3336,13 @@
             // reset
             resetKbdState( kbdState );
         }else {
-            printf ("++++Whats that? wkey 0x%x (%d)\n", i,i);
+            // k > 1: this key does generate multiple characters. Ignore it.
+            // An example: Arabic Lam and Alef ligature.
+            // There will be no extended keycode and thus shortcuts for this  key.
+            // XXX shouldn't we reset the kbd state?
+#ifdef DEBUG
+            DTRACE_PRINTLN2("wkey 0x%02X (%d)", i,i);
+#endif
         }
         kbdState[i] = 0; // "key unpressed"
     }
--- a/jdk/src/windows/native/sun/windows/awt_InputMethod.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_InputMethod.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -91,16 +91,19 @@
 {
     TRY;
 
-    //get C++ Class of Focused Component
-    if (peer == 0)      return;
-    AwtComponent* p = (AwtComponent*)JNI_GET_PDATA(peer);
-    if (p == 0)         return;
+    jobject selfGlobalRef = env->NewGlobalRef(self);
+    jobject peerGlobalRef = env->NewGlobalRef(peer);
+
+    EnableNativeIMEStruct *enis = new EnableNativeIMEStruct;
 
-    p->SetInputMethod(self, useNativeCompWindow);
+    enis->self = selfGlobalRef;
+    enis->peer = peerGlobalRef;
+    enis->context = context;
+    enis->useNativeCompWindow = useNativeCompWindow;
 
-    // use special message to call ImmAssociateContext() in main thread.
     AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
-                                          reinterpret_cast<WPARAM>(p->GetHWnd()), context);
+                                          reinterpret_cast<WPARAM>(enis), (LPARAM)0);
+    // global refs are deleted in message handler
 
     CATCH_BAD_ALLOC;
 }
@@ -116,16 +119,18 @@
 {
     TRY_NO_VERIFY;
 
-    //get C++ Class of Focused Component
-    if (peer == 0)      return;
-    AwtComponent* p = (AwtComponent*)JNI_GET_PDATA(peer);
-    if (p == 0)         return;
+    jobject peerGlobalRef = env->NewGlobalRef(peer);
+    // self reference is not used
 
-    p->SetInputMethod(NULL, TRUE);
+    EnableNativeIMEStruct *enis = new EnableNativeIMEStruct;
+    enis->self = NULL;
+    enis->peer = peerGlobalRef;
+    enis->context = NULL;
+    enis->useNativeCompWindow = JNI_TRUE;
 
-    // use special message to call ImmAssociateContext() in main thread.
     AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
-                                          reinterpret_cast<WPARAM>(p->GetHWnd()), NULL);
+                                          reinterpret_cast<WPARAM>(enis), (LPARAM)0);
+    // global refs are deleted in message handler
 
     CATCH_BAD_ALLOC;
 }
@@ -167,23 +172,14 @@
     if (id >= java_awt_event_InputMethodEvent_INPUT_METHOD_FIRST &&
         id <= java_awt_event_InputMethodEvent_INPUT_METHOD_LAST)
     {
-        long modifiers = p->GetJavaModifiers();
-        if (msg.message==WM_CHAR || msg.message==WM_SYSCHAR) {
-            WCHAR unicodeChar = L'\0';
-            unicodeChar = (WCHAR)msg.wParam;
-            p->SendKeyEvent(java_awt_event_KeyEvent_KEY_TYPED,
-                            0, //to be fixed nowMillis(),
-                            java_awt_event_KeyEvent_CHAR_UNDEFINED,
-                            unicodeChar,
-                            modifiers,
-                            java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN, (jlong)0,
-                            &msg);
-        } else {
-            MSG* pCopiedMsg = new MSG;
-            *pCopiedMsg = msg;
-            p->SendMessage(WM_AWT_HANDLE_EVENT, (WPARAM) FALSE,
-                        (LPARAM) pCopiedMsg);
-        }
+        jobject peerGlobalRef = env->NewGlobalRef(peer);
+
+        // use special message to access pData on the toolkit thread
+        AwtToolkit::GetInstance().SendMessage(WM_AWT_HANDLE_NATIVE_IME_EVENT,
+                                              reinterpret_cast<WPARAM>(peerGlobalRef),
+                                              reinterpret_cast<LPARAM>(&msg));
+        // global ref is deleted in message handler
+
         (env)->SetBooleanField(event, AwtAWTEvent::consumedID, JNI_TRUE);
     }
 
@@ -373,22 +369,27 @@
        Windows system creates a default input method window for the
        toolkit thread.
     */
-    HWND hwndIME = AwtToolkit::GetInstance().GetInputMethodWindow();
-    if (hwndIME == NULL) {
-        if (peer == NULL) {
-            return;
-        }
+
+    HWND defaultIMEHandler = AwtToolkit::GetInstance().GetInputMethodWindow();
+
+    if (defaultIMEHandler == NULL)
+    {
+        jobject peerGlobalRef = env->NewGlobalRef(peer);
 
-        AwtComponent* p = (AwtComponent*)JNI_GET_PDATA(peer);
-        if (p == NULL || (hwndIME = ImmGetDefaultIMEWnd(p->GetHWnd())) == NULL) {
-            return;
+        // use special message to access pData on the toolkit thread
+        LRESULT res = AwtToolkit::GetInstance().SendMessage(WM_AWT_GET_DEFAULT_IME_HANDLER,
+                                          reinterpret_cast<WPARAM>(peerGlobalRef), 0);
+        // global ref is deleted in message handler
+
+        if (res == TRUE) {
+            defaultIMEHandler = AwtToolkit::GetInstance().GetInputMethodWindow();
         }
-
-        AwtToolkit::GetInstance().SetInputMethodWindow(hwndIME);
     }
 
-    ::SendMessage(hwndIME, WM_IME_CONTROL,
-                  visible ? IMC_OPENSTATUSWINDOW : IMC_CLOSESTATUSWINDOW, 0);
+    if (defaultIMEHandler != NULL) {
+        ::SendMessage(defaultIMEHandler, WM_IME_CONTROL,
+                      visible ? IMC_OPENSTATUSWINDOW : IMC_CLOSESTATUSWINDOW, 0);
+    }
 }
 
 /*
@@ -417,6 +418,7 @@
     // use special message to open candidate window in main thread.
     AwtToolkit::GetInstance().SendMessage(WM_AWT_OPENCANDIDATEWINDOW,
                                           (WPARAM)peerGlobalRef, MAKELONG(x, y));
+    // global ref is deleted in message handler
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Mon Jul 06 11:42:37 2009 -0700
@@ -804,8 +804,73 @@
           return 0;
       }
       case WM_AWT_ASSOCIATECONTEXT: {
-          AwtComponent *p = AwtComponent::GetComponent((HWND)wParam);
-          p->ImmAssociateContext((HIMC)lParam);
+          EnableNativeIMEStruct *data = (EnableNativeIMEStruct*)wParam;
+
+          jobject peer = data->peer;
+          jobject self = data->self;
+          jint context = data->context;
+          jboolean useNativeCompWindow = data->useNativeCompWindow;
+
+          AwtComponent* comp = (AwtComponent*)JNI_GET_PDATA(peer);
+          if (comp != NULL)
+          {
+              comp->SetInputMethod(self, useNativeCompWindow);
+              comp->ImmAssociateContext((HIMC)context);
+          }
+
+          if (peer != NULL) {
+              env->DeleteGlobalRef(peer);
+          }
+          if (self != NULL) {
+              env->DeleteGlobalRef(self);
+          }
+
+          delete data;
+          return 0;
+      }
+      case WM_AWT_GET_DEFAULT_IME_HANDLER: {
+          LRESULT ret = (LRESULT)FALSE;
+          jobject peer = (jobject)wParam;
+
+          AwtComponent* comp = (AwtComponent*)JNI_GET_PDATA(peer);
+          if (comp != NULL) {
+              HWND defaultIMEHandler = ImmGetDefaultIMEWnd(comp->GetHWnd());
+              if (defaultIMEHandler != NULL) {
+                  AwtToolkit::GetInstance().SetInputMethodWindow(defaultIMEHandler);
+                  ret = (LRESULT)TRUE;
+              }
+          }
+
+          if (peer != NULL) {
+              env->DeleteGlobalRef(peer);
+          }
+          return ret;
+      }
+      case WM_AWT_HANDLE_NATIVE_IME_EVENT: {
+          jobject peer = (jobject)wParam;
+          AwtComponent* comp = (AwtComponent*)JNI_GET_PDATA(peer);
+          MSG* msg = (MSG*)lParam;
+
+          long modifiers = comp->GetJavaModifiers();
+          if ((comp != NULL) && (msg->message==WM_CHAR || msg->message==WM_SYSCHAR)) {
+              WCHAR unicodeChar = (WCHAR)msg->wParam;
+              comp->SendKeyEvent(java_awt_event_KeyEvent_KEY_TYPED,
+                                 0, //to be fixed nowMillis(),
+                                 java_awt_event_KeyEvent_CHAR_UNDEFINED,
+                                 unicodeChar,
+                                 modifiers,
+                                 java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN, (jlong)0,
+                                 msg);
+          } else if (comp != NULL) {
+              MSG* pCopiedMsg = new MSG;
+              *pCopiedMsg = *msg;
+              comp->SendMessage(WM_AWT_HANDLE_EVENT, (WPARAM) FALSE,
+                                (LPARAM) pCopiedMsg);
+          }
+
+          if (peer != NULL) {
+              env->DeleteGlobalRef(peer);
+          }
           return 0;
       }
       case WM_AWT_ENDCOMPOSITION: {
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.h	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.h	Mon Jul 06 11:42:37 2009 -0700
@@ -61,6 +61,14 @@
 typedef VOID (CALLBACK* IDLEPROC)(VOID);
 typedef BOOL (CALLBACK* PEEKMESSAGEPROC)(MSG&);
 
+// Struct for _WInputMethod_enable|disableNativeIME method
+struct EnableNativeIMEStruct {
+    jobject self;
+    jobject peer;
+    jint context;
+    jboolean useNativeCompWindow;
+};
+
 /*
  * class JNILocalFrame
  * Push/PopLocalFrame helper
--- a/jdk/src/windows/native/sun/windows/awtmsg.h	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awtmsg.h	Mon Jul 06 11:42:37 2009 -0700
@@ -208,6 +208,8 @@
     WM_AWT_CREATECONTEXT,
     WM_AWT_DESTROYCONTEXT,
     WM_AWT_ASSOCIATECONTEXT,
+    WM_AWT_GET_DEFAULT_IME_HANDLER,
+    WM_AWT_HANDLE_NATIVE_IME_EVENT,
     WM_AWT_PRE_KEYDOWN,
     WM_AWT_PRE_KEYUP,
     WM_AWT_PRE_SYSKEYDOWN,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,22 @@
+<HTML>
+  <!--  @test
+        @bug 4023283
+        @summary Checks that an Error which propogate up to the EventDispatch
+        loop does not crash AWT.
+        @author Andrei Dmitriev: area=awt.event
+        @library ../../regtesthelpers
+        @build Util
+        @run main LoopRobustness
+  -->
+  <HEAD>
+  <TITLE>LoopRobustness</TITLE>
+  </HEAD>
+  <BODY>
+  This is automatic test.
+  
+  <APPLET CODE="LoopRobustness.class"
+          CODEBASE = "."
+          WIDTH=350 HEIGHT=100>
+  </APPLET>
+  </BODY>                                                             
+  </HTML>
--- a/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java	Mon Jul 06 11:42:37 2009 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,10 @@
  * @bug 4023283
  * @summary Checks that an Error which propogate up to the EventDispatch
  * loop does not crash AWT.
- * @author Andrei Dmitriev Oleg Sukhodolsky
+ * @author Andrei Dmitriev: area=awt.event
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main LoopRobustness
  */
 
 import java.awt.*;
--- a/jdk/test/java/awt/Graphics/DrawImageBG/SystemBgColorTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/test/java/awt/Graphics/DrawImageBG/SystemBgColorTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -59,7 +59,6 @@
         if (errcount > 0) {
             throw new RuntimeException(errcount+" errors");
         }
-        System.exit(0); // For 1.3 and earlier VMs...
     }
 
     static int cmap[] = {
--- a/jdk/test/java/text/Bidi/BidiBug.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/test/java/text/Bidi/BidiBug.java	Mon Jul 06 11:42:37 2009 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4827312
+ * @bug 4827312 6850113
  * @summary verify that argument validity check is not fooled by overflow
  */
 public class BidiBug {
@@ -33,9 +33,9 @@
         java.text.Bidi bidi = new java.text.Bidi(new char[20],10,buff,Integer.MAX_VALUE-3,4,1);
     }
     catch (IllegalArgumentException e) {
-        System.out.println(e);
+        System.out.println("Passed: " + e);
         return; // success
     }
-    throw new RuntimeException("didn't throw error, though we didn't crash either");
+    throw new RuntimeException("Failed: Bidi didn't throw error, though we didn't crash either");
   }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/Bidi/BidiConformance.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,2334 @@
+/*
+ * Copyright (c) 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6850113
+ * @summary confirm the behavior of new Bidi implementation. (Backward compatibility)
+ */
+
+import java.awt.font.NumericShaper;
+import java.awt.font.TextAttribute;
+import java.text.AttributedString;
+import java.text.Bidi;
+import java.util.Arrays;
+
+public class BidiConformance {
+
+    /* internal flags */
+    private static boolean error = false;
+    private static boolean verbose = false;
+    private static boolean abort = false;
+
+    public static void main(String[] args) {
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if (arg.equals("-verbose")) {
+                verbose = true;
+            } else if (arg.equals("-abort")) {
+                abort = true;
+            }
+        }
+
+        BidiConformance bc = new BidiConformance();
+        bc.test();
+
+        if (error) {
+            throw new RuntimeException("Failed.");
+        } else {
+            System.out.println("Passed.");
+        }
+    }
+
+    private void test() {
+        testConstants();
+        testConstructors();
+        testMethods();
+
+        testMethods4Constructor1();  // Bidi(AttributedCharacterIterator)
+        testMethods4Constructor2();  // Bidi(String, int)
+        testMethods4Constructor3();  // Bidi(char[], ...)
+    }
+
+    private void testConstants() {
+        System.out.println("*** Test constants");
+
+        checkResult("Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT",
+                     -2, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
+        checkResult("Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT",
+                     -1, Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT);
+        checkResult("Bidi.DIRECTION_LEFT_TO_RIGHT",
+                     0, Bidi.DIRECTION_LEFT_TO_RIGHT);
+        checkResult("Bidi.DIRECTION_RIGHT_TO_LEFT",
+                     1, Bidi.DIRECTION_RIGHT_TO_LEFT);
+    }
+
+    private void testConstructors() {
+        System.out.println("*** Test constructors");
+
+        testConstructor1();  // Bidi(AttributedCharacterIterator)
+        testConstructor2();  // Bidi(String, int)
+        testConstructor3();  // Bidi(char[], ...)
+    }
+
+    private void testMethods() {
+        System.out.println("*** Test methods");
+
+        testMethod_createLineBidi1();
+        testMethod_createLineBidi2();
+        testMethod_getLevelAt();
+        testMethod_getRunLevel();
+        testMethod_getRunLimit();
+        testMethod_getRunStart();
+        testMethod_reorderVisually1();
+        testMethod_reorderVisually2();
+        testMethod_requiresBidi();
+    }
+
+    private void testMethods4Constructor1() {
+        System.out.println("*** Test methods for constructor 1");
+
+        String paragraph;
+        Bidi bidi;
+        NumericShaper ns = NumericShaper.getShaper(NumericShaper.ARABIC);
+
+        for (int textNo = 0; textNo < data4Constructor1.length; textNo++) {
+            paragraph = data4Constructor1[textNo][0];
+            int start = paragraph.indexOf('<')+1;
+            int limit = paragraph.indexOf('>');
+            int testNo;
+
+            System.out.println("*** Test textNo=" + textNo +
+                ": Bidi(AttributedCharacterIterator\"" +
+                toReadableString(paragraph) + "\") " +
+                "  start=" + start + ", limit=" + limit);
+
+            // Test 0
+            testNo = 0;
+            System.out.println(" Test#" + testNo +": RUN_DIRECTION_LTR");
+            AttributedString astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_LTR);
+            bidi = new Bidi(astr.getIterator());
+
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 1
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTION_LTR, BIDI_EMBEDDING(1)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_LTR);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(1),
+                              start, limit);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 2
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIERCTION_LTR, BIDI_EMBEDDING(2)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_LTR);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(2),
+                              start, limit);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 3
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTIOIN_LTR, BIDI_EMBEDDING(-3)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_LTR);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-3),
+                              start, limit);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 4
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTION_LTR, BIDI_EMBEDDING(-4)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_LTR);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-4),
+                              start, limit);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 5
+            ++testNo;
+            System.out.println(" Test#" + testNo + ": RUN_DIRECTION_RTL");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_RTL);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 6
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTION_RTL, BIDI_EMBEDDING(1)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_RTL);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(1),
+                              start, limit);
+            try {
+                bidi = new Bidi(astr.getIterator());
+                callTestEachMethod4Constructor1(textNo, testNo, bidi);
+            }
+            catch (IllegalArgumentException e) {
+                errorHandling("  Unexpected exception: " + e);
+            }
+
+            // Test 7
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTION_RTL, BIDI_EMBEDDING(2)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_RTL);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(2),
+                              start, limit);
+            try {
+                bidi = new Bidi(astr.getIterator());
+                callTestEachMethod4Constructor1(textNo, testNo, bidi);
+            }
+            catch (IllegalArgumentException e) {
+                errorHandling("  Unexpected exception: " + e);
+            }
+
+            // Test 8
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTION_RTL, BIDI_EMBEDDING(-3)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_RTL);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-3),
+                              start, limit);
+            try {
+                bidi = new Bidi(astr.getIterator());
+                callTestEachMethod4Constructor1(textNo, testNo, bidi);
+            }
+            catch (IllegalArgumentException e) {
+                errorHandling("  Unexpected exception: " + e);
+            }
+
+            // Test 9
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTION_RTL, BIDI_EMBEDDING(-4)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_RTL);
+            astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-4),
+                              start, limit);
+            try {
+                bidi = new Bidi(astr.getIterator());
+                callTestEachMethod4Constructor1(textNo, testNo, bidi);
+            }
+            catch (IllegalArgumentException e) {
+                errorHandling("  Unexpected exception: " + e);
+            }
+
+            // Test 10
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": TextAttribute not specified");
+            astr = new AttributedString(paragraph);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 11
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                ": RUN_DIRECTION_LTR, NUMERIC_SHAPING(ARABIC)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_LTR);
+            astr.addAttribute(TextAttribute.NUMERIC_SHAPING, ns);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+
+            // Test 12
+            ++testNo;
+            System.out.println(" Test#" + testNo +
+                 ": RUN_DIRECTION_RTL, NUMERIC_SHAPING(ARABIC)");
+            astr = new AttributedString(paragraph);
+            astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                              TextAttribute.RUN_DIRECTION_RTL);
+            astr.addAttribute(TextAttribute.NUMERIC_SHAPING, ns);
+            bidi = new Bidi(astr.getIterator());
+            callTestEachMethod4Constructor1(textNo, testNo, bidi);
+        }
+    }
+
+    private void testMethods4Constructor2() {
+        System.out.println("*** Test methods for constructor 2");
+
+        String paragraph;
+        Bidi bidi;
+
+        for (int textNo = 0; textNo < data4Constructor2.length; textNo++) {
+            paragraph = data4Constructor2[textNo][0];
+            for (int flagNo = 0; flagNo < FLAGS.length; flagNo++) {
+                int flag = FLAGS[flagNo];
+
+                System.out.println("*** Test textNo=" + textNo +
+                    ": Bidi(\"" + toReadableString(paragraph) +
+                    "\", " + getFlagName(flag) + ")");
+
+                bidi = new Bidi(paragraph, flag);
+                callTestEachMethod4Constructor2(textNo, flagNo, bidi);
+            }
+        }
+    }
+
+    private void testMethods4Constructor3() {
+        System.out.println("*** Test methods for constructor 3");
+
+        String paragraph;
+        Bidi bidi;
+
+        for (int textNo = 0; textNo < data4Constructor3.length; textNo++) {
+            paragraph = data4Constructor3[textNo][0];
+            char[] c = paragraph.toCharArray();
+            int start = paragraph.indexOf('<')+1;
+            byte[][] embeddings = (c.length < emb4Constructor3[1][0].length) ?
+                                  emb4Constructor3[0] : emb4Constructor3[1];
+            for (int flagNo = 0; flagNo < FLAGS.length; flagNo++) {
+                int flag = FLAGS[flagNo];
+                for (int embNo = 0; embNo < embeddings.length; embNo++) {
+                    int dataNo = flagNo * FLAGS.length + embNo;
+
+                    System.out.println("*** Test textNo=" + textNo +
+                        ": Bidi(char[]\"" + toReadableString(paragraph) +
+                        "\", 0, embeddings={" + toString(embeddings[embNo]) +
+                        "}, " + c.length + ", " +
+                       getFlagName(flag) + ")" + "  dataNo=" + dataNo);
+
+                    try {
+                        bidi = new Bidi(c, 0, embeddings[embNo], 0,
+                                        c.length, flag);
+                        callTestEachMethod4Constructor3(textNo, dataNo, bidi);
+                    }
+                    catch (Exception e) {
+                        errorHandling("  Unexpected exception: " + e);
+                    }
+                }
+            }
+        }
+    }
+
+    private void testConstructor1() {
+        Bidi bidi;
+
+        try {
+            bidi = new Bidi(null);
+            errorHandling("Bidi((AttributedCharacterIterator)null) " +
+                "should throw an IAE.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (NullPointerException e) {
+            errorHandling("Bidi((AttributedCharacterIterator)null) " +
+                "should not throw an NPE but an IAE.");
+        }
+
+        String paragraph = data4Constructor1[1][0];
+        int start = paragraph.indexOf('<')+1;
+        int limit = paragraph.indexOf('>');
+        AttributedString astr = new AttributedString(paragraph);
+        astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                          TextAttribute.RUN_DIRECTION_RTL);
+        astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-61),
+                          start, limit);
+        try {
+            bidi = new Bidi(astr.getIterator());
+            for (int i = start; i < limit; i++) {
+                if (bidi.getLevelAt(i) != 61) {
+                    errorHandling("Bidi(AttributedCharacterIterator).getLevelAt(" +
+                        i + ") should not be " + bidi.getLevelAt(i) +
+                        " but 60 when BIDI_EMBEDDING is -61.");
+                }
+            }
+        }
+        catch (Exception e) {
+            errorHandling("  Unexpected exception: " + e);
+        }
+
+        astr = new AttributedString(paragraph);
+        astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                          TextAttribute.RUN_DIRECTION_RTL);
+        astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-62),
+                          start, limit);
+        try {
+            bidi = new Bidi(astr.getIterator());
+            for (int i = start; i < limit; i++) {
+                if (bidi.getLevelAt(i) != 1) {
+                    errorHandling("Bidi(AttributedCharacterIterator).getLevelAt() " +
+                        "should be 1 when BIDI_EMBEDDING is -62.");
+                }
+            }
+        }
+        catch (Exception e) {
+            errorHandling("  Unexpected exception: " + e);
+        }
+
+        astr = new AttributedString(paragraph);
+        astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                          TextAttribute.RUN_DIRECTION_RTL);
+        astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(60),
+                          start, limit);
+        try {
+            bidi = new Bidi(astr.getIterator());
+            for (int i = start; i < limit; i++) {
+                if (bidi.getLevelAt(i) != 61) {
+                    errorHandling("Bidi(AttributedCharacterIterator).getLevelAt() " +
+                        "should be 61 when BIDI_EMBEDDING is 60.");
+                }
+            }
+        }
+        catch (Exception e) {
+            errorHandling("  Unexpected exception: " + e);
+        }
+
+        astr = new AttributedString(paragraph);
+        astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                          TextAttribute.RUN_DIRECTION_RTL);
+        astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(61),
+                          start, limit);
+        try {
+            bidi = new Bidi(astr.getIterator());
+            for (int i = start; i < limit; i++) {
+                if (bidi.getLevelAt(i) != 61) {
+                    errorHandling("Bidi(AttributedCharacterIterator).getLevelAt(" +
+                        i + ") should not be " + bidi.getLevelAt(i) +
+                        " but 61 when BIDI_EMBEDDING is 61.");
+                }
+            }
+        }
+        catch (Exception e) {
+            errorHandling("  Unexpected exception: " + e);
+        }
+
+        astr = new AttributedString(paragraph);
+        astr.addAttribute(TextAttribute.RUN_DIRECTION,
+                          TextAttribute.RUN_DIRECTION_RTL);
+        astr.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(62),
+                          start, limit);
+        try {
+            bidi = new Bidi(astr.getIterator());
+            for (int i = start; i < limit; i++) {
+                if (bidi.getLevelAt(i) != 1) {
+                    errorHandling("Bidi(AttributedCharacterIterator).getLevelAt()" +
+                        " should not be " + bidi.getLevelAt(i) +
+                        " but 1 when BIDI_EMBEDDING is 62.");
+                }
+            }
+        }
+        catch (Exception e) {
+            errorHandling("  Unexpected exception: " + e);
+        }
+    }
+
+    private void testConstructor2() {
+        Bidi bidi;
+
+        try {
+            bidi = new Bidi(null, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
+            errorHandling("Bidi((String)null, DIRECTION_DEFAULT_LEFT_TO_RIGHT)" +
+                " should throw an IAE.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (NullPointerException e) {
+            errorHandling("Bidi((String)null, DIRECTION_DEFAULT_LEFT_TO_RIGHT) " +
+                "should not throw an NPE but an IAE.");
+        }
+
+        try {
+            bidi = new Bidi("abc", -3);
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(\"abc\", -3) should not throw an exception: " +
+                e);
+        }
+
+        try {
+            bidi = new Bidi("abc", 2);
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(\"abc\", 2) should not throw an exception: " +
+                e);
+        }
+    }
+
+    private void testConstructor3() {
+        char[] text = {'a', 'b', 'c', 'd', 'e'};
+        byte[] embeddings = {0, 0, 0, 0, 0};
+        Bidi bidi;
+
+        try {
+            bidi = new Bidi(null, 0, embeddings, 0, 5,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            errorHandling("Bidi(char[], ...) should throw an IAE " +
+                "when text=null.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (NullPointerException e) {
+            errorHandling("Bidi(char[], ...) should not throw an NPE " +
+                "but an IAE when text=null.");
+        }
+
+        try {
+            bidi = new Bidi(text, -1, embeddings, 0, 5,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            errorHandling("Bidi(char[], ...) should throw an IAE " +
+                "when textStart is incorrect(-1: too small).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("Bidi(char[], ...) should not throw an NPE " +
+                "but an IAE when textStart is incorrect(-1: too small).");
+        }
+
+        try {
+            bidi = new Bidi(text, 4, embeddings, 0, 2,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            errorHandling("Bidi(char[], ...) should throw an IAE " +
+                "when textStart is incorrect(4: too large).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("Bidi(char[], ...) should not throw an NPE " +
+                "but an IAE when textStart is incorrect(4: too large).");
+        }
+
+        byte[] actualLevels = new byte[text.length];
+        byte[] validEmbeddings1 = {0, -61, -60, -2, -1};
+        byte[] expectedLevels1  = {0,  61,  60,  2,  1};
+        try {
+            bidi = new Bidi(text, 0, validEmbeddings1, 0, 5,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            for (int i = 0; i < text.length; i++) {
+                actualLevels[i] = (byte)bidi.getLevelAt(i);
+            }
+            if (!Arrays.equals(expectedLevels1, actualLevels)) {
+                errorHandling("Bidi(char[], ...).getLevelAt()" +
+                    " should be {" + toString(actualLevels) +
+                    "} when embeddings are {" +
+                    toString(expectedLevels1) + "}.");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(char[], ...) should not throw an exception " +
+                "when embeddings is valid(-61).");
+        }
+
+        byte[] validEmbeddings2 = {0,  61,  60,  2,  1};
+        byte[] expectedLevels2  = {0,  62,  60,  2,  2};
+        try {
+            bidi = new Bidi(text, 0, validEmbeddings2, 0, 5,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            for (int i = 0; i < text.length; i++) {
+                actualLevels[i] = (byte)bidi.getLevelAt(i);
+            }
+            if (!Arrays.equals(expectedLevels2, actualLevels)) {
+                errorHandling("Bidi(char[], ...).getLevelAt()" +
+                    " should be {" + toString(actualLevels) +
+                    "} when embeddings are {" +
+                    toString(expectedLevels2) + "}.");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(char[], ...) should not throw an exception " +
+                "when embeddings is valid(61).");
+        }
+
+        byte[] invalidEmbeddings1 = {0, -62, 0, 0, 0};
+        try {
+            bidi = new Bidi(text, 0, invalidEmbeddings1, 0, 5,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            if (bidi.getLevelAt(1) != 0) {
+                errorHandling("Bidi(char[], ...).getLevelAt(1) should be 0 " +
+                    "when embeddings[1] is -62.");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(char[], ...) should not throw an exception " +
+                "even when embeddings includes -62.");
+        }
+
+        byte[] invalidEmbeddings2 = {0, 62, 0, 0, 0};
+        try {
+            bidi = new Bidi(text, 0, invalidEmbeddings2, 0, 5,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            if (bidi.getLevelAt(1) != 0) {
+                errorHandling("Bidi(char[], ...).getLevelAt(1) should be 0 " +
+                    "when embeddings[1] is 62.");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(char[], ...) should not throw an exception " +
+                "even when embeddings includes 62.");
+        }
+
+        try {
+            bidi = new Bidi(text, 0, embeddings, 0, -1,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            errorHandling("Bidi(char[], ...) should throw an IAE " +
+                "when paragraphLength=-1(too small).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (NegativeArraySizeException e) {
+            errorHandling("Bidi(char[], ...) should not throw an NASE " +
+                "but an IAE when paragraphLength=-1(too small).");
+        }
+
+        try {
+            bidi = new Bidi(text, 0, embeddings, 0, 6,
+                            Bidi.DIRECTION_LEFT_TO_RIGHT);
+            errorHandling("Bidi(char[], ...) should throw an IAE " +
+                "when paragraphLength=6(too large).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("Bidi(char[], ...) should not throw an AIOoBE " +
+                "but an IAE when paragraphLength=6(too large).");
+        }
+
+        try {
+            bidi = new Bidi(text, 0, embeddings, 0, 4, -3);
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(char[], ...) should not throw an exception " +
+                "even when flag=-3(too small).");
+        }
+
+        try {
+            bidi = new Bidi(text, 0, embeddings, 0, 5, 2);
+        }
+        catch (Exception e) {
+            errorHandling("Bidi(char[], ...) should not throw an exception " +
+                "even when flag=2(too large).");
+        }
+    }
+
+    private void callTestEachMethod4Constructor1(int textNo,
+                                                 int testNo,
+                                                 Bidi bidi) {
+        testEachMethod(bidi,
+                       data4Constructor1[textNo][0],
+                       data4Constructor1[textNo][testNo+1],
+                       baseIsLTR4Constructor1[textNo][testNo],
+                       isLTR_isRTL4Constructor1[textNo][0][testNo],
+                       isLTR_isRTL4Constructor1[textNo][1][testNo]);
+System.out.println(bidi.toString());
+    }
+
+    private void callTestEachMethod4Constructor2(int textNo,
+                                                 int flagNo,
+                                                 Bidi bidi) {
+        testEachMethod(bidi,
+                       data4Constructor2[textNo][0],
+                       data4Constructor2[textNo][flagNo+1],
+                       baseIsLTR4Constructor2[textNo][flagNo],
+                       isLTR_isRTL4Constructor2[textNo][0][flagNo],
+                       isLTR_isRTL4Constructor2[textNo][1][flagNo]);
+System.out.println(bidi.toString());
+    }
+
+    private void callTestEachMethod4Constructor3(int textNo,
+                                                 int dataNo,
+                                                 Bidi bidi) {
+        testEachMethod(bidi,
+                       data4Constructor3[textNo][0],
+                       data4Constructor3[textNo][dataNo+1],
+                       baseIsLTR4Constructor3[textNo][dataNo],
+                       isLTR_isRTL4Constructor3[textNo][0][dataNo],
+                       isLTR_isRTL4Constructor3[textNo][1][dataNo]);
+System.out.println(bidi.toString());
+    }
+
+    private StringBuilder sb = new StringBuilder();
+    private void testEachMethod(Bidi bidi,
+                                String text,
+                                String expectedLevels,
+                                boolean expectedBaseIsLTR,
+                                boolean expectedIsLTR,
+                                boolean expectedIsRTL
+                               ) {
+        /* Test baseIsLeftToRight() */
+        boolean actualBoolean = bidi.baseIsLeftToRight();
+        checkResult("baseIsLeftToRight()", expectedBaseIsLTR, actualBoolean);
+
+        /* Test getBaseLevel() */
+        int expectedInt = (expectedBaseIsLTR) ? 0 : 1;
+        int actualInt = bidi.getBaseLevel();
+        checkResult("getBaseLevel()", expectedInt, actualInt);
+
+        /* Test getLength() */
+        expectedInt = text.length();
+        actualInt = bidi.getLength();
+        checkResult("getLength()", expectedInt, actualInt);
+
+        /* Test getLevelAt() */
+        sb.setLength(0);
+        for (int i = 0; i < text.length(); i++) {
+            sb.append(bidi.getLevelAt(i));
+        }
+        checkResult("getLevelAt()", expectedLevels, sb.toString());
+
+        /* Test getRunCount() */
+        expectedInt = getRunCount(expectedLevels);
+        actualInt = bidi.getRunCount();
+        checkResult("getRunCount()", expectedInt, actualInt);
+
+        /* Test getRunLevel(), getRunLimit() and getRunStart() */
+        if (expectedInt == actualInt) {
+            int runCount = expectedInt;
+            int[] expectedRunLevels = getRunLevels_int(runCount, expectedLevels);
+            int[] expectedRunLimits = getRunLimits(runCount, expectedLevels);
+            int[] expectedRunStarts = getRunStarts(runCount, expectedLevels);
+            int[] actualRunLevels = new int[runCount];
+            int[] actualRunLimits = new int[runCount];
+            int[] actualRunStarts = new int[runCount];
+
+            for (int k = 0; k < runCount; k++) {
+                actualRunLevels[k] = bidi.getRunLevel(k);
+                actualRunLimits[k] = bidi.getRunLimit(k);
+                actualRunStarts[k] = bidi.getRunStart(k);
+            }
+
+            checkResult("getRunLevel()", expectedRunLevels, actualRunLevels);
+            checkResult("getRunStart()", expectedRunStarts, actualRunStarts);
+            checkResult("getRunLimit()", expectedRunLimits, actualRunLimits);
+        }
+
+        /* Test isLeftToRight() */
+        boolean expectedBoolean = expectedIsLTR;
+        actualBoolean = bidi.isLeftToRight();
+        checkResult("isLeftToRight()", expectedBoolean, actualBoolean);
+
+        /* Test isMixed() */
+        expectedBoolean = !(expectedIsLTR || expectedIsRTL);
+        actualBoolean = bidi.isMixed();
+        checkResult("isMixed()", expectedBoolean, actualBoolean);
+
+        /* Test isRightToLeft() */
+        expectedBoolean = expectedIsRTL;
+        actualBoolean = bidi.isRightToLeft();
+        checkResult("isRightToLeft()", expectedBoolean, actualBoolean);
+    }
+
+    private int getRunCount(String levels) {
+        int len = levels.length();
+        char c = levels.charAt(0);
+        int runCount = 1;
+
+        for (int index = 1; index < len; index++) {
+            if (levels.charAt(index) != c) {
+                runCount++;
+                c = levels.charAt(index);
+            }
+        }
+
+        return runCount;
+    }
+
+    private int[] getRunLevels_int(int runCount, String levels) {
+        int[] array = new int[runCount];
+        int len = levels.length();
+        char c = levels.charAt(0);
+        int i = 0;
+        array[i++] = c - '0';
+
+        for (int index = 1; index < len; index++) {
+            if (levels.charAt(index) != c) {
+                c = levels.charAt(index);
+                array[i++] = c - '0';
+            }
+        }
+
+        return array;
+    }
+
+    private byte[] getRunLevels_byte(int runCount, String levels) {
+        byte[] array = new byte[runCount];
+        int len = levels.length();
+        char c = levels.charAt(0);
+        int i = 0;
+        array[i++] = (byte)(c - '0');
+
+        for (int index = 1; index < len; index++) {
+            if (levels.charAt(index) != c) {
+                c = levels.charAt(index);
+                array[i++] = (byte)(c - '0');
+            }
+        }
+
+        return array;
+    }
+
+    private int[] getRunLimits(int runCount, String levels) {
+        int[] array = new int[runCount];
+        int len = levels.length();
+        char c = levels.charAt(0);
+        int i = 0;
+
+        for (int index = 1; index < len; index++) {
+            if (levels.charAt(index) != c) {
+                c = levels.charAt(index);
+                array[i++] = index;
+            }
+        }
+        array[i] = len;
+
+        return array;
+    }
+
+    private int[] getRunStarts(int runCount, String levels) {
+        int[] array = new int[runCount];
+        int len = levels.length();
+        char c = levels.charAt(0);
+        int i = 1;
+
+        for (int index = 1; index < len; index++) {
+            if (levels.charAt(index) != c) {
+                c = levels.charAt(index);
+                array[i++] = index;
+            }
+        }
+
+        return array;
+    }
+
+    private String[] getObjects(int runCount, String text, String levels) {
+        String[] array = new String[runCount];
+        int[] runLimits = getRunLimits(runCount, levels);
+        int runStart = 0;
+
+        for (int i = 0; i < runCount; i++) {
+            array[i] = text.substring(runStart, runLimits[i]);
+            runStart = runLimits[i];
+        }
+
+        return array;
+    }
+
+    private void testMethod_createLineBidi1() {
+        System.out.println("*** Test createLineBidi() 1");
+
+        String str = " ABC 123. " + HebrewABC + " " + NKo123 + ". ABC 123";
+
+        int lineStart = str.indexOf('.') + 2;
+        int lineLimit = str.lastIndexOf('.') + 2;
+        Bidi bidi = new Bidi(str, FLAGS[0]);
+        Bidi lineBidi = bidi.createLineBidi(lineStart, lineLimit);
+
+        checkResult("getBaseLevel()",
+            bidi.getBaseLevel(), lineBidi.getBaseLevel());
+        checkResult("getLevelAt(5)",
+            bidi.getLevelAt(lineStart+5), lineBidi.getLevelAt(5));
+    }
+
+    private void testMethod_createLineBidi2() {
+        System.out.println("*** Test createLineBidi() 2");
+
+        Bidi bidi = new Bidi(data4Constructor1[0][0], FLAGS[0]);
+        int len = data4Constructor1[0][0].length();
+
+        try {
+            Bidi lineBidi = bidi.createLineBidi(0, len);
+        }
+        catch (Exception e) {
+            errorHandling("createLineBidi(0, textLength)" +
+                " should not throw an exception.");
+        }
+
+        try {
+            Bidi lineBidi = bidi.createLineBidi(-1, len);
+            errorHandling("createLineBidi(-1, textLength)" +
+                " should throw an IAE.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+
+        try {
+            Bidi lineBidi = bidi.createLineBidi(0, len+1);
+            errorHandling("createLineBidi(0, textLength+1)" +
+                " should throw an IAE.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+    }
+
+    /*
+     * Confirm that getLevelAt() doesn't throw an exception for invalid offset
+     * unlike ICU4J.
+     */
+    private void testMethod_getLevelAt() {
+        System.out.println("*** Test getLevelAt()");
+
+        Bidi bidi = new Bidi(data4Constructor1[1][0], FLAGS[0]);
+        int len = data4Constructor1[1][0].length();
+
+        try {
+            int level = bidi.getLevelAt(-1);
+            if (level != bidi.getBaseLevel()) {
+                errorHandling("getLevelAt(-1) returned a wrong level." +
+                    " Expected=" + bidi.getBaseLevel() + ", got=" + level);
+            }
+        }
+        catch (Exception e) {
+            errorHandling("getLevelAt(-1) should not throw an exception.");
+        }
+
+        try {
+            int level = bidi.getLevelAt(len+1);
+            if (level != bidi.getBaseLevel()) {
+                errorHandling("getLevelAt(textLength+1)" +
+                    " returned a wrong level." +
+                    " Expected=" + bidi.getBaseLevel() + ", got=" + level);
+            }
+        }
+        catch (Exception e) {
+            errorHandling("getLevelAt(-1) should not throw an exception.");
+        }
+    }
+
+    private void testMethod_getRunLevel() {
+        System.out.println("*** Test getRunLevel()");
+
+        String str = "ABC 123";
+        int length = str.length();
+        Bidi bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT);
+
+        try {
+            if (bidi.getRunLevel(-1) != 0 ||  // runCount - 2
+                bidi.getRunLevel(0) != 0 ||   // runCount - 1
+                bidi.getRunLevel(1) != 0 ||   // runCount
+                bidi.getRunLevel(2) != 0) {   // runCount + 1
+                errorHandling("getRunLevel() should return 0" +
+                    " when getRunCount() is 1.");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("getRunLevel() should not throw an exception " +
+                "when getRunCount() is 1.");
+        }
+
+        str = "ABC " + HebrewABC + " 123";
+        length = str.length();
+        bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT);
+
+        try {
+            bidi.getRunLevel(-1);
+            errorHandling("getRunLevel() should throw an AIOoBE " +
+                "when run is -1(too small).");
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+        }
+        catch (IllegalArgumentException e) {
+            errorHandling("getRunLevel() should not throw an IAE " +
+                "but an AIOoBE when run is -1(too small).");
+        }
+
+        try {
+            bidi.getRunLevel(0);
+            bidi.getRunLevel(1);
+            bidi.getRunLevel(2);
+        }
+        catch (Exception e) {
+            errorHandling("getRunLevel() should not throw an exception" +
+                " when run is from 0 to 2(runCount-1).");
+        }
+
+        try {
+            bidi.getRunLevel(3);
+            errorHandling("getRunLevel() should throw an AIOoBE" +
+                " when run is 3(same as runCount).");
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+        }
+        catch (IllegalArgumentException e) {
+            errorHandling("getRunLevel() should not throw an IAE " +
+                "but an AIOoBE when run is 3(same as runCount).");
+        }
+    }
+
+    private void testMethod_getRunLimit() {
+        System.out.println("*** Test getRunLimit()");
+
+        String str = "ABC 123";
+        int length = str.length();
+        Bidi bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT);
+
+        try {
+            if (bidi.getRunLimit(-1) != length ||  // runCount - 2
+                bidi.getRunLimit(0) != length ||   // runCount - 1
+                bidi.getRunLimit(1) != length ||   // runCount
+                bidi.getRunLimit(2) != length) {   // runCount + 1
+                errorHandling("getRunLimit() should return " + length +
+                    " when getRunCount() is 1.");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("getRunLimit() should not throw an exception " +
+                "when getRunCount() is 1.");
+        }
+
+        str = "ABC " + ArabicABC + " 123";
+        length = str.length();
+        bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT);
+
+        try {
+            bidi.getRunLimit(-1);
+            errorHandling("getRunLimit() should throw an AIOoBE " +
+                "when run is -1(too small).");
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+        }
+        catch (IllegalArgumentException e) {
+            errorHandling("getRunLimit() should not throw an IAE " +
+                "but an AIOoBE when run is -1(too small).");
+        }
+
+        try {
+            bidi.getRunLimit(0);
+            bidi.getRunLimit(1);
+            bidi.getRunLimit(2);
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("getRunLimit() should not throw an AIOOBE " +
+                "when run is from 0 to 2(runCount-1).");
+        }
+
+        try {
+            bidi.getRunLimit(3);
+            errorHandling("getRunLimit() should throw an AIOoBE " +
+                "when run is 3(same as runCount).");
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+        }
+        catch (IllegalArgumentException e) {
+            errorHandling("getRunLimit() should not throw an IAE " +
+                "but an AIOoBE when run is 3(same as runCount).");
+        }
+    }
+
+    private void testMethod_getRunStart() {
+        System.out.println("*** Test getRunStart()");
+
+        String str = "ABC 123";
+        int length = str.length();
+        Bidi bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT);
+
+        try {
+            if (bidi.getRunStart(-1) != 0 ||  // runCount - 2
+                bidi.getRunStart(0) != 0 ||   // runCount - 1
+                bidi.getRunStart(1) != 0 ||   // runCount
+                bidi.getRunStart(2) != 0) {   // runCount + 1
+                errorHandling("getRunStart() should return 0" +
+                    " when getRunCount() is 1.");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("getRunLimit() should not throw an exception" +
+                " when getRunCount() is 1.");
+        }
+
+        str = "ABC " + NKoABC + " 123";
+        length = str.length();
+        bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT);
+
+        try {
+            bidi.getRunStart(-1);
+            errorHandling("getRunStart() should throw an AIOoBE" +
+                " when run is -1(too small).");
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+        }
+        catch (IllegalArgumentException e) {
+            errorHandling("getRunStart() should not throw an IAE " +
+                "but an AIOoBE when run is -1(too small).");
+        }
+
+        try {
+            bidi.getRunStart(0);
+            bidi.getRunStart(1);
+            bidi.getRunStart(2);
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("getRunStart() should not throw an AIOOBE " +
+                "when run is from 0 to 2(runCount-1).");
+        }
+
+        try {
+            if (bidi.getRunStart(3) != length) {
+                errorHandling("getRunStart() should return " + length +
+                    " when run is 3(same as runCount).");
+            }
+        }
+        catch (Exception e) {
+            errorHandling("getRunStart() should not throw an exception " +
+                "when run is 3(same as runCount).");
+        }
+
+        try {
+            bidi.getRunStart(4);
+            errorHandling("getRunStart() should throw an AIOoBE " +
+                "when run is runCount+1(too large).");
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+        }
+        catch (IllegalArgumentException e) {
+            errorHandling("getRunStart() should not throw an IAE " +
+                "but an AIOoBE when run is runCount+1(too large).");
+        }
+    }
+
+    private void testMethod_reorderVisually1() {
+        System.out.println("*** Test reorderVisually() 1");
+
+        for (int textNo = 0; textNo < data4reorderVisually.length; textNo++) {
+            Object[] objects = data4reorderVisually[textNo][0];
+            byte[] levels = getLevels(data4reorderVisually[textNo]);
+            Object[] expectedObjects = data4reorderVisually[textNo][2];
+
+            Bidi.reorderVisually(levels, 0, objects, 0, objects.length);
+
+            checkResult("textNo=" + textNo + ": reorderVisually(levels=[" +
+                toString(levels) + "], objects=[" + toString(objects) + "])",
+                expectedObjects, objects);
+        }
+    }
+
+    private void testMethod_reorderVisually2() {
+        System.out.println("*** Test reorderVisually() 2");
+
+        Object[] objects = data4reorderVisually[0][0];
+        byte[] levels = getLevels(data4reorderVisually[0]);
+        int count = objects.length;
+        int llen = levels.length;
+        int olen = objects.length;
+
+        try {
+            Bidi.reorderVisually(null, 0, objects, 0, count);
+            errorHandling("reorderVisually() should throw a NPE " +
+                "when levels is null.");
+        }
+        catch (NullPointerException e) {
+        }
+
+        try {
+            Bidi.reorderVisually(levels, -1, objects, 0, count);
+            errorHandling("reorderVisually() should throw an IAE " +
+                "when levelStart is -1.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("reorderVisually() should not throw an AIOoBE " +
+                "but an IAE when levelStart is -1.");
+        }
+
+        try {
+            Bidi.reorderVisually(levels, llen, objects, 0, count);
+            errorHandling("reorderVisually() should throw an IAE " +
+                "when levelStart is 6(levels.length).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("reorderVisually() should not throw an AIOoBE " +
+                "but an IAE when levelStart is 6(levels.length).");
+        }
+
+        try {
+            Bidi.reorderVisually(levels, 0, null, 0, count);
+            errorHandling("reorderVisually() should throw a NPE" +
+                " when objects is null.");
+        }
+        catch (NullPointerException e) {
+        }
+
+        try {
+            Bidi.reorderVisually(levels, 0, objects, -1, count);
+            errorHandling("reorderVisually() should throw an IAE" +
+                " when objectStart is -1.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("reorderVisually() should not throw an AIOoBE " +
+                "but an IAE when objectStart is -1.");
+        }
+
+        try {
+            Bidi.reorderVisually(levels, 0, objects, 6, objects.length);
+            errorHandling("reorderVisually() should throw an IAE " +
+                "when objectStart is 6(objects.length).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+
+        try {
+            Bidi.reorderVisually(levels, 0, objects, 0, -1);
+            errorHandling("reorderVisually() should throw an IAE " +
+                "when count is -1.");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (NegativeArraySizeException e) {
+            errorHandling("reorderVisually() should not throw an NASE " +
+                "but an IAE when count is -1.");
+        }
+
+        try {
+            Bidi.reorderVisually(levels, 0, objects, 0, count+1);
+            errorHandling("reorderVisually() should throw an IAE " +
+                "when count is 7(objects.length+1).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("reorderVisually() should not throw an AIOoBE " +
+                "but an IAE when count is 7(objects.length+1).");
+        }
+
+        try {
+            Bidi.reorderVisually(levels, 0, objects, 0, 0);
+            checkResult("reorderVisually(count=0)",
+                data4reorderVisually[0][0], objects);
+        }
+        catch (Exception e) {
+            errorHandling("reorderVisually() should not throw an exception" +
+                " when count is 0.");
+        }
+    }
+
+    private void testMethod_requiresBidi() {
+        System.out.println("*** Test requiresBidi()");
+
+        String paragraph;
+        char[] text;
+        Bidi bidi;
+
+        for (int textNo = 0; textNo < data4Constructor2.length; textNo++) {
+            paragraph = data4Constructor2[textNo][0];
+            text = paragraph.toCharArray();
+            boolean rBidi = Bidi.requiresBidi(text, 0, text.length);
+            if (rBidi != requiresBidi4Constructor2[textNo]) {
+                error = true;
+                System.err.println("Unexpected requiresBidi() value" +
+                    " for requiresBidi(\"" + paragraph + "\", " + 0 + ", " +
+                    text.length + ")." +
+                    "\n    Expected: " + requiresBidi4Constructor2[textNo] +
+                    "\n    Got     : " + rBidi);
+            } else if (verbose) {
+                System.out.println("  Okay : requiresBidi() for" +
+                    " requiresBidi(\"" + paragraph + "\", " + 0 + ", " +
+                    text.length + ")  Got: " + rBidi);
+            }
+        }
+
+        char[] txt = {'A', 'B', 'C', 'D', 'E'};
+        int textLength = txt.length;
+
+        try {
+            Bidi.requiresBidi(txt, -1, textLength);
+            errorHandling("requiresBidi() should throw an IAE" +
+                " when start is -1(too small).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("requiresBidi() should not throw an AIOoBE " +
+                "but an IAE when start is -1(too small).");
+        }
+
+        try {
+            Bidi.requiresBidi(txt, textLength, textLength);
+        }
+        catch (Exception e) {
+            errorHandling("requiresBidi() should not throw an exception " +
+                "when start is textLength.");
+        }
+
+        try {
+            Bidi.requiresBidi(txt, textLength+1, textLength);
+            errorHandling("requiresBidi() should throw an IAE" +
+                " when start is textLength+1(too large).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+
+        try {
+            Bidi.requiresBidi(txt, 0, -1);
+            errorHandling("requiresBidi() should throw an IAE" +
+                " when limit is -1(too small).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+
+        try {
+            Bidi.requiresBidi(txt, 0, textLength+1);
+            errorHandling("requiresBidi() should throw an IAE" +
+                " when limit is textLength+1(too large).");
+        }
+        catch (IllegalArgumentException e) {
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            errorHandling("requiresBidi() should not throw an AIOoBE " +
+                "but an IAE when limit is textLength+1(too large).");
+        }
+    }
+
+    private void checkResult(String name,
+                             int expectedValue,
+                             int actualValue) {
+        if (expectedValue != actualValue) {
+            errorHandling("Unexpected " + name + " value." +
+                " Expected: " + expectedValue + " Got: " + actualValue);
+        } else if (verbose) {
+            System.out.println("  Okay : " + name + " = " + actualValue);
+        }
+    }
+
+    private void checkResult(String name,
+                             boolean expectedValue,
+                             boolean actualValue) {
+        if (expectedValue != actualValue) {
+            errorHandling("Unexpected " + name + " value." +
+                " Expected: " + expectedValue + " Got: " + actualValue);
+        } else if (verbose) {
+            System.out.println("  Okay : " + name + " = " + actualValue);
+        }
+    }
+
+    private void checkResult(String name,
+                             String expectedValue,
+                             String actualValue) {
+        if (!expectedValue.equals(actualValue)) {
+            errorHandling("Unexpected " + name + " value." +
+                "\n\tExpected: \"" + expectedValue + "\"" +
+                "\n\tGot:      \"" + actualValue + "\"");
+        } else if (verbose) {
+            System.out.println("  Okay : " + name + " = \"" +
+                actualValue + "\"");
+        }
+    }
+
+    private void checkResult(String name,
+                             int[] expectedValues,
+                             int[] actualValues) {
+        if (!Arrays.equals(expectedValues, actualValues)) {
+            errorHandling("Unexpected " + name + " value." +
+                "\n\tExpected: " + toString(expectedValues) + "" +
+                "\n\tGot:      " + toString(actualValues) + "");
+        } else if (verbose) {
+            System.out.println("  Okay : " + name + " = " +
+                toString(actualValues));
+        }
+    }
+
+    private void checkResult(String name,
+                             Object[] expectedValues,
+                             Object[] actualValues) {
+        if (!Arrays.equals(expectedValues, actualValues)) {
+            errorHandling("Unexpected " + name + " value." +
+                "\n\tExpected: [" + toString(expectedValues) +
+                "]\n\tGot:      [" + toString(actualValues) + "]");
+        } else if (verbose) {
+            System.out.println("  Okay : " + name + " Reordered objects = [" +
+                toString(actualValues) + "]");
+        }
+    }
+
+    private void errorHandling(String msg) {
+        if (abort) {
+            throw new RuntimeException("Error: " + msg);
+        } else {
+            error = true;
+            System.err.println("**Error:" + msg);
+        }
+    }
+
+    private String toString(int[] values) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < values.length-1; i++) {
+            sb.append((int)values[i]);
+            sb.append(' ');
+        }
+        sb.append((int)values[values.length-1]);
+
+        return sb.toString();
+    }
+
+    private String toString(byte[] values) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < values.length-1; i++) {
+            sb.append((byte)values[i]);
+            sb.append(' ');
+        }
+        sb.append((byte)values[values.length-1]);
+
+        return sb.toString();
+    }
+
+    private String toString(Object[] values) {
+        StringBuilder sb = new StringBuilder();
+        String name;
+
+        for (int i = 0; i < values.length-1; i++) {
+            if ((name = getStringName((String)values[i])) != null) {
+                sb.append(name);
+                sb.append(", ");
+            } else {
+                sb.append('"');
+                sb.append((String)values[i]);
+                sb.append("\", ");
+            }
+        }
+        if ((name = getStringName((String)values[values.length-1])) != null) {
+            sb.append(name);
+        } else {
+            sb.append('"');
+            sb.append((String)values[values.length-1]);
+            sb.append('\"');
+        }
+
+        return sb.toString();
+    }
+
+    private String getStringName(String str) {
+        if (ArabicABC.equals(str)) return "ArabicABC";
+        else if (Arabic123.equals(str)) return "Arabic123";
+        else if (PArabicABC.equals(str)) return "ArabicABC(Presentation form)";
+        else if (HebrewABC.equals(str)) return "HebrewABC";
+        else if (KharoshthiABC.equals(str)) return "KharoshthiABC(RTL)";
+        else if (Kharoshthi123.equals(str)) return "Kharoshthi123(RTL)";
+        else if (NKoABC.equals(str)) return "NKoABC(RTL)";
+        else if (NKo123.equals(str)) return "NKo123(RTL)";
+        else if (OsmanyaABC.equals(str)) return "OsmanyaABC(LTR)";
+        else if (Osmanya123.equals(str)) return "Osmanya123(LTR)";
+        else return null;
+    }
+
+    private String getFlagName(int flag) {
+        if (flag == -2 || flag == 0x7e) return FLAGNAMES[0];
+        else if (flag == -1 || flag == 0x7f) return FLAGNAMES[1];
+        else if (flag == 0) return FLAGNAMES[2];
+        else if (flag == 1) return FLAGNAMES[3];
+        else return "Unknown(0x" + Integer.toHexString(flag) + ")";
+    }
+
+    private String toReadableString(String str) {
+         String s = str;
+
+         s = s.replaceAll(ArabicABC, "ArabicABC");
+         s = s.replaceAll(Arabic123, "Arabic123");
+         s = s.replaceAll(PArabicABC, "ArabicABC(Presentation form)");
+         s = s.replaceAll(HebrewABC, "HebrewABC");
+         s = s.replaceAll(KharoshthiABC, "KharoshthiABC");
+         s = s.replaceAll(Kharoshthi123, "Kharoshthi123");
+         s = s.replaceAll(NKoABC, "NKoABC");
+         s = s.replaceAll(NKo123, "NKo123");
+         s = s.replaceAll(OsmanyaABC, "OsmanyaABC");
+         s = s.replaceAll(Osmanya123, "Osmanya123");
+
+         return s;
+    }
+
+    private  byte[] getLevels(Object[][] data) {
+        int levelLength = data[0].length;
+        byte[] array = new byte[levelLength];
+        int textIndex = 0;
+
+        for (int i = 0; i < levelLength; i++) {
+            array[i] = (byte)(((String)data[1][0]).charAt(textIndex) - '0');
+            textIndex += ((String)data[0][i]).length();
+        }
+
+        return array;
+    }
+
+
+    /* Bidi pubilc constants */
+    private static final int[] FLAGS = {
+        Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT,  // -2 (0x7e in ICU4J)
+        Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT,  // -1 (0x7f in ICU4J)
+        Bidi.DIRECTION_LEFT_TO_RIGHT,          //  0
+        Bidi.DIRECTION_RIGHT_TO_LEFT           //  1
+    };
+
+    /* Bidi pubilc constants names */
+    private static final String[] FLAGNAMES = {
+        "DIRECTION_DEFAULT_LEFT_TO_RIGHT",  // -2
+        "DIRECTION_DEFAULT_RIGHT_TO_LEFT",  // -1
+        "DIRECTION_LEFT_TO_RIGHT",          //  0
+        "DIRECTION_RIGHT_TO_LEFT",          //  1
+    };
+
+    /* Bidirectional Character Types */
+    private static final char L   = '\u200E';
+    private static final char R   = '\u202F';
+    private static final char LRE = '\u202A';
+    private static final char RLE = '\u202B';
+    private static final char PDF = '\u202C';
+    private static final char LRO = '\u202D';
+    private static final char RLO = '\u202E';
+
+    /*
+     *  0x05D0-0x05EA:   [R]   Hewbrew letters (Strong)
+     *  0x0627-0x063A:   [AL]  Arabic letters (Strong)
+     *  0x0660-0x0669:   [AN]  Arabic-Indic digits (Weak)
+     *  0x07CA-0x07E7:   [R]   NKo letters (Strong)
+     *  0x07C0-0x07C9:   [R]   NKo digits (Strong)
+     *  0xFE50-0xFEFF:   [AL]  Arabic presentaion form (Strong)
+     *  0x10480-0x1049D: [L]   Osmanya letters (Strong)
+     *  0x104A0-0x104A9: [L]   Osmanya digits (Strong)
+     *  0x10A10-0x10A33: [R]   Kharoshthi letters (Strong)
+     *  0x10A40-0x10A43: [R]   Kharoshthi digits (Strong)
+     *
+     *  0x200E:          [L]   Left-to-right mark (Implicit, Strong)
+     *  0x200F:          [R]   Right-to-left mark (Implicit, Strong)
+     *  0x202A:          [LRE] Left-to-right embedding (Explicit, Strong)
+     *  0x202B:          [RLE] Right-to-left embedding (Explicit, Strong)
+     *  0x202C:          [PDF] Pop directional formatting (Explicit, Weak)
+     *  0x202D:          [LRO] Left-to-right override (Explicit, Strong)
+     *  0x202E:          [RLO] Right-to-left override (Explicit, Strong)
+     */
+
+    /* Right-to-left */
+    private static String ArabicABC = "\u0627\u0628\u0629";
+    private static String Arabic123 = "\u0661\u0662\u0663";
+    private static String PArabicABC = "\uFE97\uFE92\uFE8E";
+    private static String HebrewABC = "\u05D0\u05D1\u05D2";
+    private static String KharoshthiABC =
+        new String(Character.toChars(0x10A10)) +
+        new String(Character.toChars(0x10A11)) +
+        new String(Character.toChars(0x10A12));
+    private static String Kharoshthi123 =
+        new String(Character.toChars(0x10A40)) +
+        new String(Character.toChars(0x10A41)) +
+        new String(Character.toChars(0x10A42));
+    private static String NKoABC = "\u07CA\u07CB\u07CC";
+    private static String NKo123 = "\u07C1\u07C2\u07C3";
+
+    /* Left-to-right */
+    private static String OsmanyaABC =
+        new String(Character.toChars(0x10480)) +
+        new String(Character.toChars(0x10481)) +
+        new String(Character.toChars(0x10482));
+    private static String Osmanya123 =
+        new String(Character.toChars(0x104A0)) +
+        new String(Character.toChars(0x104A1)) +
+        new String(Character.toChars(0x104A2));
+
+    /* --------------------------------------------------------------------- */
+
+    /*
+     * Test data for Bidi(char[], ...) constructor and methods
+     */
+
+    /* Text for Bidi processing and its levels */
+    private static String[][] data4Constructor1 = {
+        /* For Text #0 */
+        {"abc <ABC XYZ> xyz.",
+             "000000000000000000", "000002222222000000", "000000000000000000",
+             "000003333333000000", "000000000000000000",
+             "222222222222222221", "222222222222222221", "222222222222222221",
+             "222113333333112221", "222224444444222221",
+             "000000000000000000", "000000000000000000", "222222222222222221"},
+
+        /* For Text #1 */
+        {"ABC <" + HebrewABC + " " + NKo123 + "> XYZ.",
+             "000001111111000000", "000001111111000000", "000003333333000000",
+             "000003333333000000", "000000000000000000",
+             "222111111111112221", "222111111111112221", "222223333333222221",
+             "222113333333112221", "222224444444222221",
+             "000001111111000000", "000001111111000000", "222111111111112221"},
+
+        /* For Text #2 */
+        {NKoABC + " <ABC XYZ> " + NKo123 + ".",
+             "111000000000001110", "111112222222111110", "111002222222001110",
+             "111113333333111110", "111004444444001110",
+             "111112222222111111", "111112222222111111", "111112222222111111",
+             "111111111111111111", "111114444444111111",
+             "111112222222111111", "111000000000001110", "111112222222111111"},
+
+        /* For Text #3 */
+        {HebrewABC + " <" + ArabicABC + " " + Arabic123 + "> " + NKo123 + ".",
+             "111111111222111110", "111111111222111110", "111003333444001110",
+             "111113333333111110", "111004444444001110",
+             "111111111222111111", "111111111222111111", "111113333444111111",
+             "111111111111111111", "111114444444111111",
+             "111111111222111111", "111111111222111110", "111111111222111111"},
+
+        /* For Text #4 */
+        {"abc <" + NKoABC + " 123> xyz.",
+             "000001111222000000", "000001111222000000", "000003333444000000",
+             "000003333333000000", "000000000000000000",
+             "222111111222112221", "222111111222112221", "222223333444222221",
+             "222113333333112221", "222224444444222221",
+             "000001111222000000", "000001111222000000", "222111111222112221"},
+
+        /* For Text #5 */
+        {"abc <ABC " + NKo123 + "> xyz.",
+             "000000000111000000", "000002221111000000", "000002222333000000",
+             "000003333333000000", "000000000000000000",
+             "222222221111112221", "222222221111112221", "222222222333222221",
+             "222113333333112221", "222224444444222221",
+             "000000000111000000", "000000000111000000", "222222221111112221"},
+
+        /* For Text #6 */
+        {ArabicABC + " <" + NKoABC + " 123" + "> " + Arabic123 + ".",
+             "111111111222112220", "111111111222112220", "111003333444002220",
+             "111113333333112220", "111004444444002220",
+             "111111111222112221", "111111111222112221", "111113333444112221",
+             "111113333333112221", "111114444444112221",
+             "111111111222112221", "111111111222112220", "111111111222112221"},
+
+        /* For Text #7 */
+        {ArabicABC + " <XYZ " + NKoABC + "> " + Arabic123 + ".",
+             "111000000111112220", "111112221111112220", "111002222333002220",
+             "111113333333112220", "111004444444002220",
+             "111112221111112221", "111112221111112221", "111112222333112221",
+             "111113333333112221", "111114444444112221",
+             "111112221111112221", "111000000111112220", "111112221111112221"},
+
+        /* For Text #8 */
+        {OsmanyaABC + " <" + KharoshthiABC + " " + Kharoshthi123 + "> " +
+         Osmanya123 + ".",
+             "000000001111111111111000000000", "000000001111111111111000000000",
+             "000000003333333333333000000000", "000000003333333333333000000000",
+             "000000000000000000000000000000",
+             "222222111111111111111112222221", "222222111111111111111112222221",
+             "222222223333333333333222222221", "222222113333333333333112222221",
+             "222222224444444444444222222221",
+             "000000001111111111111000000000", "000000001111111111111000000000",
+             "222222111111111111111112222221"},
+
+        /* For Text #9 */
+        {KharoshthiABC + " <" + OsmanyaABC + " " + Osmanya123 + "> " +
+         Kharoshthi123 + ".",
+             "111111000000000000000001111110", "111111112222222222222111111110",
+             "111111002222222222222001111110", "111111113333333333333111111110",
+             "111111004444444444444001111110",
+             "111111112222222222222111111111", "111111112222222222222111111111",
+             "111111112222222222222111111111", "111111111111111111111111111111",
+             "111111114444444444444111111111",
+             "111111112222222222222111111111", "111111000000000000000001111110",
+             "111111112222222222222111111111"},
+    };
+
+    /* Golden data for baseIsLeftToRight() results */
+    private static boolean[][] baseIsLTR4Constructor1 = {
+        /* For Text #0 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         true,  true,  false},
+
+        /* For Text #1 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         true,  true,  false},
+
+        /* For Text #2 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         false, true,  false},
+
+        /* For Text #3 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         false, true,  false},
+
+        /* For Text #4 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         true,  true,  false},
+
+        /* For Text #5 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         true,  true,  false},
+
+        /* For Text #6 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         false, true,  false},
+
+        /* For Text #7 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         false, true,  false},
+
+        /* For Text #8 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         true,  true,  false},
+
+        /* For Text #9 */
+        {true,  true,  true,  true,  true,
+         false, false, false, false, false,
+         false, true,  false},
+    };
+
+    /* Golden data for isLeftToRight() & isRightToLeft() results */
+    private static boolean[][][] isLTR_isRTL4Constructor1 = {
+        /* For Text #0 */
+         /* isLeftToRight() results */
+        {{true,  false, true,  false, true,
+          false, false, false, false, false,
+          true,  true,  false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false}},
+
+        /* For Text #1 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, true,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false}},
+
+        /* For Text #2 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, true,  false,
+          false, false, false}},
+
+        /* For Text #3 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, true,  false,
+          false, false, false}},
+
+        /* For Text #4 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, true,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false}},
+
+        /* For Text #5 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, true,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false}},
+
+        /* For Text #6 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false}},
+
+        /* For Text #7 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false}},
+
+        /* For Text #8 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, true,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false}},
+
+        /* For Text #9 */
+         /* isLeftToRight() results */
+        {{false, false, false, false, false,
+          false, false, false, false, false,
+          false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false, false,
+          false, false, false, true,  false,
+          false, false, false}},
+    };
+
+    /* --------------------------------------------------------------------- */
+
+    /*
+     * Test data for Bidi(String, int) constructor and methods
+     */
+
+    /* Text for Bidi processing and its levels */
+    private static String[][] data4Constructor2 = {
+        /* For Text #0 */
+        {" ABC 123.",
+             "000000000", "000000000", "000000000", "122222221"},
+
+        /* For Text #1 */
+        {" ABC " + HebrewABC + " " + NKo123 + " 123.",
+             "00000111111112220", "00000111111112220", "00000111111112220",
+             "12221111111112221"},
+
+        /* For Text #2 */
+        {" ABC " + ArabicABC + " " + Arabic123 + " 123.",
+             "00000111122212220", "00000111122212220", "00000111122212220",
+             "12221111122212221"},
+
+        /* For Text #3 */
+        {" " + NKoABC + " ABC 123 " + NKo123 + ".",
+             "11111222222211111", "11111222222211111", "01110000000001110",
+             "11111222222211111"},
+
+        /* For Text #4 */
+        {" " + ArabicABC + " ABC 123 " + Arabic123 + ".",
+             "11111222222212221", "11111222222212221", "01110000000002220",
+             "11111222222212221"},
+
+        /* For Text #5 */
+        {" " + HebrewABC + " " + NKo123 + ".",
+             "111111111", "111111111", "011111110", "111111111"},
+
+        /* For Text #6 */
+        {" " + ArabicABC + " " + Arabic123 + ".",
+             "111112221", "111112221", "011112220", "111112221"},
+
+        /* For Text #7 */
+        {" " + KharoshthiABC + " " + Kharoshthi123 + ".",
+             "111111111111111", "111111111111111", "011111111111110",
+             "111111111111111"},
+
+        /* For Text #8 */
+        {L + HebrewABC + " " + NKo123 + ".",
+             "011111110", "011111110", "011111110", "211111111"},
+
+        /* For Text #9 */
+        {R + "ABC " + Osmanya123 + ".",
+             "000000000000", "000000000000", "000000000000", "122222222221"},
+
+        /* For Text #10 */
+        {"ABC " + PArabicABC + " " + PArabicABC + " 123",
+             "000011111111222", "000011111111222", "000011111111222",
+             "222111111111222"},
+
+        /* For Text #11 */
+        {RLE + "ABC " + HebrewABC + " " + NKo123 + "." + PDF,
+             "22221111111110", "22221111111110", "22221111111110",
+             "44443333333331"},
+
+        /* For Text #12 */
+        {"He said \"" + RLE + "ABC " + HebrewABC + " " + NKo123 + PDF + ".\"",
+             "000000000222211111111000", "000000000222211111111000",
+             "000000000222211111111000", "222222211444433333333111"},
+
+        /* For Text #13 */
+        {LRO + "He said \"" + RLE + "ABC " + NKoABC + " " + NKo123 + PDF +
+         ".\"" + PDF,
+             "22222222224444333333332220", "22222222224444333333332220",
+             "22222222224444333333332220", "22222222224444333333332221"},
+
+        /* For Text #14 */
+        {LRO + "He said \"" + RLE + "ABC " + HebrewABC + " " + NKo123 + PDF +
+         ".\"",  // PDF missing
+             "2222222222444433333333222", "2222222222444433333333222",
+             "2222222222444433333333222", "2222222222444433333333222"},
+
+        /* For Text #15 */
+        {"Did you say '" + LRE + "he said \"" + RLE + "ABC " + HebrewABC +
+         " " + NKo123 + PDF + "\"" + PDF + "'?",
+             "0000000000000222222222244443333333322000",
+             "0000000000000222222222244443333333322000",
+             "0000000000000222222222244443333333322000",
+             "2222222222222222222222244443333333322111"},
+
+        /* For Text #16 */
+        {RLO + "Did you say '" + LRE + "he said \"" + RLE + "ABC " +
+         HebrewABC + " " + NKo123 + PDF + "\"" + PDF + "'?" + PDF,
+             "111111111111112222222222444433333333221110",
+             "111111111111112222222222444433333333221110",
+             "111111111111112222222222444433333333221110",
+             "333333333333334444444444666655555555443331"},
+
+        /* For Text #17 */
+        {RLO + "Did you say '" + LRE + "he said \"" + RLE + "ABC " +
+         HebrewABC + " " + NKo123 + PDF + "\"" + PDF + "'?",  // PDF missing
+             "11111111111111222222222244443333333322111",
+             "11111111111111222222222244443333333322111",
+             "11111111111111222222222244443333333322111",
+             "33333333333333444444444466665555555544333"},
+
+        /* For Text #18 */
+        {" ABC (" + ArabicABC + " " + Arabic123 + ") 123.",
+             "0000001111222112220", "0000001111222112220",
+             "0000001111222112220", "1222111111222112221"},
+
+        /* For Text #19 */
+        {" " + HebrewABC + " (ABC 123) " + NKo123 + ".",
+             "1111112222222111111", "1111112222222111111",
+             "0111000000000001110", "1111112222222111111"},
+
+        /* For Text #20 */
+        {" He said \"" + RLE + "ABC " + NKoABC + " " + NKo123 + PDF + ".\" ",
+             "00000000002222111111110000", "00000000002222111111110000",
+             "00000000002222111111110000", "12222222114444333333331111"},
+
+        /* For Text #21 */
+        {" Did you say '" + LRE + "he said \"" + RLE + "ABC " + HebrewABC +
+         " " + NKo123 + PDF + "\"" + PDF + "'? ",
+             "000000000000002222222222444433333333220000",
+             "000000000000002222222222444433333333220000",
+             "000000000000002222222222444433333333220000",
+             "122222222222222222222222444433333333221111"},
+
+        /* For Text #22 */
+        {RLE + OsmanyaABC + " " + KharoshthiABC + " " + Kharoshthi123 + "." +
+         PDF,
+             "22222221111111111111110", "22222221111111111111110",
+             "22222221111111111111110", "44444443333333333333331"},
+    };
+
+    /* Golden data for baseIsLeftToRight() results */
+    private static boolean[][] baseIsLTR4Constructor2 = {
+        /* For Text #0 - $4  */
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {false, false, true,  false},
+        {false, false, true,  false},
+
+        /* For Text #5 - $9  */
+        {false, false, true,  false},
+        {false, false, true,  false},
+        {false, false, true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+
+        /* For Text #10 - $14  */
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+
+        /* For Text #15 - $19  */
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {false, false, true,  false},
+
+        /* For Text #20 - $22  */
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+        {true,  true,  true,  false},
+    };
+
+    /* Golden data for isLeftToRight() & isRightToLeft() results */
+    private static boolean[][][] isLTR_isRTL4Constructor2 = {
+        /* isLeftToRight() results   &   isRightToLeft() results   */
+        /* For Text #0 - $4  */
+        {{true,  true,  true,  false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+
+        /* For Text #5 - $9  */
+        {{false, false, false, false}, {true,  true,  false, true }},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {true,  true,  false, true }},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{true,  true,  true,  false}, {false, false, false, false}},
+
+        /* For Text #10 - $14  */
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+
+        /* For Text #15 - $19  */
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+
+        /* For Text #20 - $22  */
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+        {{false, false, false, false}, {false, false, false, false}},
+    };
+
+    /* Golden data for requiresBidi() results */
+    private static boolean[] requiresBidi4Constructor2 = {
+        /* For Text #0 - $9  */
+        false, true,  true,  true,  true,
+        true,  true,  true,  true,  false,
+
+        /* For Text #10 - $19  */
+        true,  true,  true,  true,  true,
+        true,  true,  true,  true,  true,
+
+        /* For Text #20 - $22  */
+        true,  true,  true,
+    };
+
+    /* --------------------------------------------------------------------- */
+
+    /*
+     * Test data for Bidi(char[], ...) constructor and methods
+     */
+
+    /* Enbeddings */
+    private static byte[][][] emb4Constructor3 = {
+        /* Embeddings for paragraphs which don't include surrogate pairs. */
+        {{0, 0, 0, 0, 0,  1,  1,  1,  1,  1,  1,  1, 0, 0, 0, 0, 0, 0},
+         {0, 0, 0, 0, 0,  2,  2,  2,  2,  2,  2,  2, 0, 0, 0, 0, 0, 0},
+         {0, 0, 0, 0, 0, -3, -3, -3, -3, -3, -3, -3, 0, 0, 0, 0, 0, 0},
+         {0, 0, 0, 0, 0, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0}},
+
+        /* Embeddings for paragraphs which include surrogate pairs. */
+        {{ 0,  0,  0,  0,  0,  0,  0,  0,
+           1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+           0,  0,  0,  0,  0,  0,  0,  0,  0},
+         { 0,  0,  0,  0,  0,  0,  0,  0,
+           2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
+           0,  0,  0,  0,  0,  0,  0,  0,  0},
+         { 0,  0,  0,  0,  0,  0,  0,  0,
+          -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
+           0,  0,  0,  0,  0,  0,  0,  0,  0},
+         { 0,  0,  0,  0,  0,  0,  0,  0,
+          -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
+           0,  0,  0,  0,  0,  0,  0,  0,  0}},
+    };
+
+    /* Text for Bidi processing and its levels */
+    private static String[][] data4Constructor3 = {
+        /* For Text #0 */
+        {"abc <ABC XYZ> xyz.",
+             /* DIRECTION_DEFAULT_LEFT_TO_RIGHT */
+             "000002222222000000", "000000000000000000",
+             "000003333333000000", "000000000000000000",
+             /* DIRECTION_DEFAULT_RIGHT_TO_LEFT */
+             "222222222222222221", "222222222222222221",
+             "222113333333112221", "222224444444222221",
+             /* DIRECTION_LEFT_TO_RIGHT */
+             "000002222222000000", "000000000000000000",
+             "000003333333000000", "000000000000000000",
+             /* DIRECTION_RIGHT_TO_LEFT */
+             "222222222222222221", "222222222222222221",
+             "222113333333112221", "222224444444222221"},
+
+        /* For Text #1 */
+        {"ABC <" + HebrewABC + " " + NKo123 + "> XYZ.",
+             /* DIRECTION_DEFAULT_LEFT_TO_RIGHT */
+             "000001111111000000", "000003333333000000",
+             "000003333333000000", "000000000000000000",
+             /* DIRECTION_DEFAULT_RIGHT_TO_LEFT */
+             "222111111111112221", "222223333333222221",
+             "222113333333112221", "222224444444222221",
+             /* DIRECTION_LEFT_TO_RIGHT */
+             "000001111111000000", "000003333333000000",
+             "000003333333000000", "000000000000000000",
+             /* DIRECTION_RIGHT_TO_LEFT */
+             "222111111111112221", "222223333333222221",
+             "222113333333112221", "222224444444222221"},
+
+        /* For Text #2 */
+        {NKoABC + " <ABC XYZ> " + NKo123 + ".",
+             /* DIRECTION_DEFAULT_LEFT_TO_RIGHT */
+             "111112222222111111", "111112222222111111",
+             "111111111111111111", "111114444444111111",
+             /* DIRECTION_DEFAULT_RIGHT_TO_LEFT */
+             "111112222222111111", "111112222222111111",
+             "111111111111111111", "111114444444111111",
+             /* DIRECTION_LEFT_TO_RIGHT */
+             "111112222222111110", "111002222222001110",
+             "111113333333111110", "111004444444001110",
+             /* DIRECTION_RIGHT_TO_LEFT */
+             "111112222222111111", "111112222222111111",
+             "111111111111111111", "111114444444111111"},
+
+        /* For Text #3 */
+        {HebrewABC + " <" + ArabicABC + " " + Arabic123 + "> " + NKo123 + ".",
+             /* DIRECTION_DEFAULT_LEFT_TO_RIGHT */
+             "111111111222111111", "111113333444111111",
+             "111111111111111111", "111114444444111111",
+             /* DIRECTION_DEFAULT_RIGHT_TO_LEFT */
+             "111111111222111111", "111113333444111111",
+             "111111111111111111", "111114444444111111",
+             /* DIRECTION_LEFT_TO_RIGHT */
+             "111111111222111110", "111003333444001110",
+             "111113333333111110", "111004444444001110",
+             /* DIRECTION_RIGHT_TO_LEFT */
+             "111111111222111111", "111113333444111111",
+             "111111111111111111", "111114444444111111"},
+
+        /* For Text #4 */
+        {"abc <123 456> xyz.",
+             /* DIRECTION_DEFAULT_LEFT_TO_RIGHT */
+             "000002221222000000", "000000000000000000",
+             "000003333333000000", "000000000000000000",
+             /* DIRECTION_DEFAULT_RIGHT_TO_LEFT */
+             "222222222222222221", "222222222222222221",
+             "222113333333112221", "222224444444222221",
+             /* DIRECTION_LEFT_TO_RIGHT */
+             "000002221222000000", "000000000000000000",
+             "000003333333000000", "000000000000000000",
+             /* DIRECTION_RIGHT_TO_LEFT */
+             "222222222222222221", "222222222222222221",
+             "222113333333112221", "222224444444222221"},
+
+        /* For Text #5 */
+        {OsmanyaABC + " <" + KharoshthiABC + " " + Kharoshthi123 + "> " +
+         Osmanya123 + ".",
+             /* DIRECTION_DEFAULT_LEFT_TO_RIGHT */
+             "000000001111111111111000000000", "000000003333333333333000000000",
+             "000000003333333333333000000000", "000000000000000000000000000000",
+             /* DIRECTION_DEFAULT_RIGHT_TO_LEFT */
+             "222222111111111111111112222221", "222222223333333333333222222221",
+             "222222113333333333333112222221", "222222224444444444444222222221",
+             /* DIRECTION_LEFT_TO_RIGHT */
+             "000000001111111111111000000000", "000000003333333333333000000000",
+             "000000003333333333333000000000", "000000000000000000000000000000",
+             /* DIRECTION_RIGHT_TO_LEFT */
+             "222222111111111111111112222221", "222222223333333333333222222221",
+             "222222113333333333333112222221", "222222224444444444444222222221"},
+
+        /* For Text #6 */
+        {KharoshthiABC + " <" + OsmanyaABC + " " + Osmanya123 + "> " +
+         Kharoshthi123 + ".",
+             /* DIRECTION_DEFAULT_LEFT_TO_RIGHT */
+             "111111112222222222222111111111", "111111112222222222222111111111",
+             "111111111111111111111111111111", "111111114444444444444111111111",
+             /* DIRECTION_DEFAULT_RIGHT_TO_LEFT */
+             "111111112222222222222111111111", "111111112222222222222111111111",
+             "111111111111111111111111111111", "111111114444444444444111111111",
+             /* DIRECTION_LEFT_TO_RIGHT */
+             "111111112222222222222111111110", "111111002222222222222001111110",
+             "111111113333333333333111111110", "111111004444444444444001111110",
+             /* DIRECTION_RIGHT_TO_LEFT */
+             "111111112222222222222111111111", "111111112222222222222111111111",
+             "111111111111111111111111111111", "111111114444444444444111111111"},
+    };
+
+    /* Golden data for baseIsLeftToRight() results */
+    private static boolean[][] baseIsLTR4Constructor3 = {
+        /* For Text #0 */
+        {true,  true,  true,  true,    // DIRECTION_DEFAULT_LEFT_TO_RIGHT
+         true,  true,  true,  true,    // DIRECTION_DEFAULT_RIGHT_TO_LEFT
+         true,  true,  true,  true,    // DIRECTION_LEFT_TO_RIGHT
+         false, false, false, false},  // DIRECTION_RIGHT_TO_LEFT
+
+        /* For Text #1 */
+        {true,  true,  true,  true,
+         true,  true,  true,  true,
+         true,  true,  true,  true,
+         false, false, false, false},
+
+        /* For Text #2 */
+        {false, false, false, false,
+         false, false, false, false,
+         true,  true,  true,  true,
+         false, false, false, false},
+
+        /* For Text #3 */
+        {false, false, false, false,
+         false, false, false, false,
+         true,  true,  true,  true,
+         false, false, false, false},
+
+        /* For Text #4 */
+        {true,  true,  true,  true,
+         true,  true,  true,  true,
+         true,  true,  true,  true,
+         false, false, false, false},
+
+        /* For Text #5 */
+        {true,  true,  true,  true,
+         true,  true,  true,  true,
+         true,  true,  true,  true,
+         false, false, false, false},
+
+        /* For Text #6 */
+        {false, false, false, false,
+         false, false, false, false,
+         true,  true,  true,  true,
+         false, false, false, false},
+    };
+
+    /* Golden data for isLeftToRight() & isRightToLeft() results */
+    private static boolean[][][] isLTR_isRTL4Constructor3 = {
+        /* For Text #0 */
+         /* isLeftToRight() results */
+        {{false, true,  false, true,     // DIRECTION_DEFAULT_LEFT_TO_RIGHT
+          false, false, false, false,    // DIRECTION_DEFAULT_RIGHT_TO_LEFT
+          false, true,  false, true,     // DIRECTION_LEFT_TO_RIGHT
+          false, false, false, false},   // DIRECTION_RIGHT_TO_LEFT
+         /* isRightToLeft() results   */
+         {false, false, false, false,    // DIRECTION_DEFAULT_LEFT_TO_RIGHT
+          false, false, false, false,    // DIRECTION_DEFAULT_RIGHT_TO_LEFT
+          false, false, false, false,    // DIRECTION_LEFT_TO_RIGHT
+          false, false, false, false}},  // DIRECTION_RIGHT_TO_LEFTT
+
+        /* For Text #1 */
+         /* isLeftToRight() results */
+        {{false, false, false, true,
+          false, false, false, false,
+          false, false, false, true,
+          false, false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false,
+          false, false, false, false,
+          false, false, false, false,
+          false, false, false, false}},
+
+        /* For Text #2 */
+         /* isLeftToRight() results */
+        {{false, false, false, false,
+          false, false, false, false,
+          false, false, false, false,
+          false, false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, true,  false,
+          false, false, true,  false,
+          false, false, false, false,
+          false, false, true,  false}},
+
+        /* For Text #3 */
+         /* isLeftToRight() results */
+        {{false, false, false, false,
+          false, false, false, false,
+          false, false, false, false,
+          false, false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, true,  false,
+          false, false, true,  false,
+          false, false, false, false,
+          false, false, true,  false}},
+
+        /* For Text #4 */
+         /* isLeftToRight() results */
+        {{false, true,  false, true,
+          false, false, false, false,
+          false, true,  false, true,
+          false, false, false, false },
+         /* isRightToLeft() results   */
+         {false, false, false, false,
+          false, false, false, false,
+          false, false, false, false,
+          false, false, false, false}},
+
+        /* For Text #5 */
+         /* isLeftToRight() results */
+        {{false, false, false, true,
+          false, false, false, false,
+          false, false, false, true,
+          false, false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, false, false,
+          false, false, false, false,
+          false, false, false, false,
+          false, false, false, false}},
+
+        /* For Text #6 */
+         /* isLeftToRight() results */
+        {{false, false, false, false,
+          false, false, false, false,
+          false, false, false, false,
+          false, false, false, false},
+         /* isRightToLeft() results   */
+         {false, false, true,  false,
+          false, false, true,  false,
+          false, false, false, false,
+          false, false, true,  false}},
+    };
+
+    /* --------------------------------------------------------------------- */
+
+    /*
+     * Test data for reorderVisually() methods
+     */
+
+    private static Object[][][] data4reorderVisually = {
+        {{"ABC", " ", "abc", " ", ArabicABC, "."},   // Original text
+         {"000000001110"},                           // levels
+         {"ABC", " ", "abc", " ", ArabicABC, "."}},  // Reordered text
+
+        {{"ABC", " ", HebrewABC, " ", NKoABC, "."},
+         {"222111111111"},
+         {".", NKoABC, " ", HebrewABC, " ", "ABC"}},
+
+        {{OsmanyaABC, " ", HebrewABC, " ", KharoshthiABC, "."},
+         {"222222111111111111"},
+         {".", KharoshthiABC, " ", HebrewABC, " ", OsmanyaABC,}},
+
+        {{"ABC", " ", Osmanya123, " ", "\"", OsmanyaABC, " ", Kharoshthi123,
+          " ", KharoshthiABC, ".", "\""},
+         {"0000000000002222221111111111111100"},
+         {"ABC", " ", Osmanya123, " ", "\"", KharoshthiABC, " ", Kharoshthi123,
+          " ", OsmanyaABC, ".", "\""}},
+    };
+
+}
--- a/jdk/test/java/text/Bidi/BidiEmbeddingTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/jdk/test/java/text/Bidi/BidiEmbeddingTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4396492 4396496 4778510
+ * @bug 4396492 4396496 4778510 6850113
  * @summary verify that the embedding values processed by the bidi code use negative values to
  * indicate overrides, rather than using bit 7.  Also tests Bidi without loading awt classes to
  * confirm that Bidi can be used without awt. Verify that embedding level 0 is properly mapped
@@ -89,10 +89,12 @@
                                " at level " + bidi2.getRunLevel(i));
         }
 
-        System.out.println(bidi2);
+        System.out.println(bidi2 + "\n");
 
         if (bidi.getRunCount() != 3 || bidi2.getRunCount() != 3) {
             throw new Error("Bidi run count incorrect");
+        } else {
+            System.out.println("test1() passed.\n");
         }
     }
 
@@ -123,10 +125,12 @@
                                " at level " + bidi.getRunLevel(i));
         }
 
-        System.out.println(bidi);
+        System.out.println(bidi + "\n");
 
         if (bidi.getRunCount() != 6) { // runs of spaces and angles at embedding bound,s and final period, each get level 1
             throw new Error("Bidi embedding processing failed");
+        } else {
+            System.out.println("test2() passed.\n");
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/Bidi/Bug6850113.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+/*
+ * @test
+ * @bug 6850113
+ * @summary Verify the return value of digit() for some digits.
+ */
+
+import sun.text.normalizer.UCharacter;
+
+public class Bug6850113 {
+
+    public static void main(String[] args) {
+        boolean err = false;
+
+        // Fullwidth Latin capital letters
+        for (int i = 0xff21, j = 10; i <= 0xff3a; i++, j++) {
+            if (UCharacter.digit(i, 36) != j) {
+                err = true;
+                System.out.println("Error: UCharacter.digit(0x" +
+                    Integer.toHexString(i) + ", 36) returned " +
+                    UCharacter.digit(i, 36) + ", expected=" + j);
+            }
+        }
+
+        // Fullwidth Latin small letters
+        for (int i = 0xff41, j = 10; i <= 0xff5a; i++, j++) {
+            if (UCharacter.digit(i, 36) != j) {
+                err = true;
+                System.out.println("Error: UCharacter.digit(0x" +
+                    Integer.toHexString(i) + ", 36) returned " +
+                    UCharacter.digit(i, 36) + ", expected=" + j);
+            }
+        }
+
+        if (err) {
+            throw new RuntimeException("UCharacter.digit():  Wrong return value");
+        }
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/CachePremissionsTest/CachePermissionsTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     6684104
+ * @summary Test verifies that ImageIO checks all permissions required for
+ *           the file cache usage:
+ *
+ *          no policy file: No security restrictions.
+ *             Expected result: ImageIO creates file-cached stream.
+ *
+ *          w.policy: the case when we have read and write permissions
+ *              for java.io.temp directory but have only write permission
+ *              for a temp file.
+ *             Expected result: ImageIO create a memory-cached stream
+ *              image output stream.
+ *
+ *          rw.policy: the case when we  have read and write permissions
+ *              for java.io.temp directory but have only read and write
+ *              permission for a temp cache file.
+ *             Expected result: ImageIO creates a memory-cached stream
+ *              because temporary cache file can not be deleted.
+ *
+ *          rwd.policy: the case when we  have read and write permissions
+ *              for java.io.temp directory and have all required permissions
+ *             (read, write, and delete) for a temporary cache file.
+ *             Expected result: ImageIO creates file-cached stream.
+ *
+ *           -Djava.security.debug=access can be used to verify file permissions.
+ *
+ * @run     main CachePermissionsTest true
+ * @run     main/othervm/policy=w.policy CachePermissionsTest false
+ * @run     main/othervm/policy=rw.policy CachePermissionsTest false
+ * @run     main/othervm/policy=rwd.policy CachePermissionsTest true
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+import javax.imageio.stream.ImageOutputStream;
+
+import javax.imageio.ImageIO;
+
+
+public class CachePermissionsTest {
+    public static void main(String[] args) {
+        boolean isFileCacheExpected =
+            Boolean.valueOf(args[0]).booleanValue();
+        System.out.println("Is file cache expected: " + isFileCacheExpected);
+
+        ImageIO.setUseCache(true);
+
+        System.out.println("java.io.tmpdir is " + System.getProperty("java.io.tmpdir"));
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        try {
+            ImageOutputStream ios = ImageIO.createImageOutputStream(baos);
+
+            boolean isFileCache = ios.isCachedFile();
+            System.out.println("Is file cache used: " + isFileCache);
+
+            if (isFileCache !=isFileCacheExpected) {
+                System.out.println("WARNING: file chace usage is not as expected!");
+            }
+
+            System.out.println("Verify data writing...");
+            for (int i = 0; i < 8192; i++) {
+                ios.writeInt(i);
+            }
+
+            System.out.println("Verify data reading...");
+            ios.seek(0L);
+
+            for (int i = 0; i < 8192; i++) {
+                int j = ios.readInt();
+                if (i != j) {
+                    throw new RuntimeException("Wrong data in the stream " + j + " instead of " + i);
+                }
+            }
+
+            System.out.println("Verify stream closing...");
+            ios.close();
+        } catch (IOException e) {
+            /*
+             * Something went wrong?
+             */
+            throw new RuntimeException("Test FAILED.", e);
+        } catch (SecurityException e) {
+            /*
+             * We do not expect security execptions here:
+             * we there are any security restrition, ImageIO
+             * should swith to memory-cached streams, instead
+             * of using file cache.
+             */
+            throw new RuntimeException("Test FAILED.", e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/CachePremissionsTest/rw.policy	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,5 @@
+grant {
+      permission java.util.PropertyPermission "test.classes", "read";
+      permission java.util.PropertyPermission "java.io.tmpdir", "read";
+      permission java.io.FilePermission "${java.io.tmpdir}${/}*", "read, write";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/CachePremissionsTest/rwd.policy	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,5 @@
+grant {
+      permission java.util.PropertyPermission "test.classes", "read";
+      permission java.util.PropertyPermission "java.io.tmpdir", "read";
+      permission java.io.FilePermission "${java.io.tmpdir}${/}*", "read, write, delete";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/CachePremissionsTest/w.policy	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,5 @@
+grant {
+      permission java.util.PropertyPermission "test.classes", "read";
+      permission java.util.PropertyPermission "java.io.tmpdir", "read";
+      permission java.io.FilePermission "${java.io.tmpdir}${/}*", "write";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/bmp/TopDownTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     6296893
+ * @summary Test verifies that the isTopDown flag does not cause
+ *          a writing of bmp image in wrong scanline layout.
+ * @run     main TopDownTest
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+
+import java.awt.image.IndexColorModel;
+import java.io.File;
+import java.io.IOException;
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.ImageWriter;
+import javax.imageio.plugins.bmp.BMPImageWriteParam;
+import javax.imageio.stream.ImageOutputStream;
+import static java.awt.image.BufferedImage.TYPE_INT_RGB;
+import static java.awt.image.BufferedImage.TYPE_BYTE_INDEXED;
+
+public class TopDownTest {
+
+    public static void main(String[] args) throws IOException {
+        BufferedImage src = createTestImage(24);
+
+        writeWithCompression(src, "BI_BITFIELDS");
+
+        writeWithCompression(src, "BI_RGB");
+
+        src = createTestImage(8);
+        writeWithCompression(src, "BI_RLE8");
+
+        src = createTestImage(4);
+        writeWithCompression(src, "BI_RLE4");
+
+    }
+
+    private static void writeWithCompression(BufferedImage src,
+                                             String compression) throws IOException
+    {
+        System.out.println("Compression: " + compression);
+        ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
+        if (writer == null) {
+            throw new RuntimeException("Test failed: no bmp writer available");
+        }
+        File fout = File.createTempFile(compression + "_", ".bmp",
+                                        new File("."));
+
+        ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
+        writer.setOutput(ios);
+
+        BMPImageWriteParam param = (BMPImageWriteParam)
+                writer.getDefaultWriteParam();
+        param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
+        param.setCompressionType(compression);
+        param.setTopDown(true);
+        writer.write(null, new IIOImage(src, null, null), param);
+        writer.dispose();
+        ios.flush();
+        ios.close();
+
+        BufferedImage dst = ImageIO.read(fout);
+
+        verify(dst);
+    }
+
+    private static void verify(BufferedImage dst) {
+        int top_rgb = dst.getRGB(50, 25);
+        System.out.printf("top_rgb: %x\n", top_rgb);
+        int bot_rgb = dst.getRGB(50, 75);
+        System.out.printf("bot_rgb: %x\n", bot_rgb);
+
+        // expect to see blue color on the top of image
+        if (top_rgb != 0xff0000ff) {
+            throw new RuntimeException("Invaid top color: " +
+                        Integer.toHexString(bot_rgb));
+        }
+        if (bot_rgb != 0xffff0000) {
+            throw new RuntimeException("Invalid bottom color: " +
+                    Integer.toHexString(bot_rgb));
+        }
+    }
+
+    private static BufferedImage createTestImage(int bpp) {
+
+        BufferedImage img = null;
+        switch (bpp) {
+            case 8:
+                img = new BufferedImage(100, 100, TYPE_BYTE_INDEXED);
+                break;
+            case 4: {
+                byte[] r = new byte[16];
+                byte[] g = new byte[16];
+                byte[] b = new byte[16];
+
+                r[1] = (byte)0xff;
+                b[0] = (byte)0xff;
+
+                IndexColorModel icm = new IndexColorModel(4, 16, r, g, b);
+                img = new BufferedImage(100, 100, TYPE_BYTE_INDEXED, icm);
+                }
+                break;
+            case 24:
+            default:
+            img = new BufferedImage(100, 100, TYPE_INT_RGB);
+        }
+        Graphics g = img.createGraphics();
+        g.setColor(Color.blue);
+        g.fillRect(0, 0, 100, 50);
+        g.setColor(Color.red);
+        g.fillRect(0, 50, 100, 50);
+        g.dispose();
+        return img;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/jpeg/ReadAsGrayTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     4893408
+ *
+ * @summary Test verifies that Image I/O jpeg reader correctly handles
+ *          destination types if number of color components in destination
+ *          differs from number of color components in the jpeg image.
+ *          Particularly, it verifies reading YCbCr image as a grayscaled
+ *          and reading grayscaled jpeg as a RGB.
+ *
+ * @run     main ReadAsGrayTest
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReadParam;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageTypeSpecifier;
+import javax.imageio.stream.ImageInputStream;
+import static java.awt.image.BufferedImage.TYPE_3BYTE_BGR;
+import static java.awt.image.BufferedImage.TYPE_BYTE_GRAY;
+import static java.awt.color.ColorSpace.TYPE_GRAY;
+import static java.awt.color.ColorSpace.CS_sRGB;
+
+public class ReadAsGrayTest {
+    static Color[] colors = new Color[] {
+        Color.white, Color.red, Color.green,
+        Color.blue, Color.black };
+
+    static final int dx = 50;
+    static final int h = 100;
+
+    static ColorSpace sRGB = ColorSpace.getInstance(CS_sRGB);
+
+
+    public static void main(String[] args) throws IOException {
+        System.out.println("Type TYPE_BYTE_GRAY");
+        doTest(TYPE_BYTE_GRAY);
+
+        System.out.println("Type TYPE_3BYTE_BGR");
+        doTest(TYPE_3BYTE_BGR);
+
+        System.out.println("Test PASSED.");
+    }
+
+    private static void doTest(int type) throws IOException {
+        BufferedImage src = createTestImage(type);
+
+        File f = new File("test.jpg");
+
+        if (!ImageIO.write(src, "jpg", f)) {
+            throw new RuntimeException("Failed to write test image.");
+        }
+
+        ImageInputStream iis = ImageIO.createImageInputStream(f);
+        ImageReader reader = ImageIO.getImageReaders(iis).next();
+        reader.setInput(iis);
+
+        Iterator<ImageTypeSpecifier> types = reader.getImageTypes(0);
+        ImageTypeSpecifier srgb = null;
+        ImageTypeSpecifier gray = null;
+        // look for gray and srgb types
+        while ((srgb == null || gray == null) && types.hasNext()) {
+            ImageTypeSpecifier t = types.next();
+            if (t.getColorModel().getColorSpace().getType() == TYPE_GRAY) {
+                gray = t;
+            }
+            if (t.getColorModel().getColorSpace() == sRGB) {
+                srgb = t;
+            }
+        }
+        if (gray == null) {
+            throw new RuntimeException("No gray type available.");
+        }
+        if (srgb == null) {
+            throw new RuntimeException("No srgb type available.");
+        }
+
+        System.out.println("Read as GRAY...");
+        testType(reader, gray, src);
+
+        System.out.println("Read as sRGB...");
+        testType(reader, srgb, src);
+    }
+
+    private static void testType(ImageReader reader,
+                                 ImageTypeSpecifier t,
+                                 BufferedImage src)
+        throws IOException
+    {
+        ImageReadParam p = reader.getDefaultReadParam();
+        p.setDestinationType(t);
+        BufferedImage dst = reader.read(0, p);
+
+        verify(src, dst, t);
+    }
+
+    private static void verify(BufferedImage src,
+                               BufferedImage dst,
+                               ImageTypeSpecifier type)
+    {
+        BufferedImage test =
+                type.createBufferedImage(src.getWidth(), src.getHeight());
+        Graphics2D g = test.createGraphics();
+        g.drawImage(src, 0, 0, null);
+        g.dispose();
+
+        for (int i = 0; i < colors.length; i++) {
+            int x = i * dx + dx / 2;
+            int y = h / 2;
+
+            Color c_test = new Color(test.getRGB(x, y));
+            Color c_dst = new Color(dst.getRGB(x, y));
+
+            if (!compareWithTolerance(c_test, c_dst, 0.01f)) {
+                String msg = String.format("Invalid color: %x instead of %x",
+                                           c_dst.getRGB(), c_test.getRGB());
+                throw new RuntimeException("Test failed: " + msg);
+            }
+        }
+        System.out.println("Verified.");
+    }
+
+    private static boolean compareWithTolerance(Color a, Color b, float delta) {
+        float[] a_rgb = new float[3];
+        a_rgb = a.getRGBColorComponents(a_rgb);
+        float[] b_rgb = new float[3];
+        b_rgb = b.getRGBColorComponents(b_rgb);
+
+        for (int i = 0; i < 3; i++) {
+            if (Math.abs(a_rgb[i] - b_rgb[i]) > delta) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private static BufferedImage createTestImage(int type) {
+        BufferedImage img = new BufferedImage(dx * colors.length, h, type);
+
+        Graphics2D g = img.createGraphics();
+        for (int i = 0; i < colors.length; i++) {
+            g.setColor(colors[i]);
+            g.fillRect(i * dx, 0, dx, h);
+        }
+        g.dispose();
+
+        return img;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/wbmp/CanDecodeTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     5101862
+ * @summary Test verifies that SPI of WBMP image reader
+ *           does not claims to be able to decode QT movies,
+ *           tga images, or ico files.
+ * @run     main CanDecodeTest
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Vector;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.spi.ImageReaderSpi;
+import javax.imageio.stream.ImageInputStream;
+
+public class CanDecodeTest {
+
+    public static void main(String[] args) throws IOException {
+        ImageReader r =
+                ImageIO.getImageReadersByFormatName("WBMP").next();
+        ImageReaderSpi spi = r.getOriginatingProvider();
+
+        Vector<TestCase> tests = getTestCases();
+        for (TestCase t : tests) {
+            t.doTest(spi);
+        }
+        System.out.println("Test passed.");
+    }
+
+    private static Vector<TestCase> getTestCases() {
+        Vector<TestCase> v = new Vector<TestCase>(4);
+        v.add(new TestCase("wbmp", new byte[]{(byte) 0x00, (byte) 0x00,
+                    (byte) 0x60, (byte) 0x14}, 244, true));
+        v.add(new TestCase("mov", new byte[]{(byte) 0x00, (byte) 0x00,
+                    (byte) 0x07, (byte) 0xb5, (byte) 0x6d}, 82397, false));
+        v.add(new TestCase("tga", new byte[]{(byte) 0x00, (byte) 0x00,
+                    (byte) 0x0a, (byte) 0x00}, 39693, false));
+        v.add(new TestCase("ico", new byte[]{(byte) 0x00, (byte) 0x00,
+                    (byte) 0x01, (byte) 0x00}, 1078, false));
+        return v;
+    }
+
+    private static class TestCase {
+
+        private String title;
+        private byte[] header;
+        private int dataLength;
+        private boolean canDecode;
+
+        public TestCase(String title, byte[] header,
+                int dataLength, boolean canDecode) {
+            this.title = title;
+            this.dataLength = dataLength;
+            this.header = header.clone();
+            this.canDecode = canDecode;
+
+        }
+
+        public void doTest(ImageReaderSpi spi) throws IOException {
+            System.out.println("Test for " + title +
+                    (canDecode ? " (can decode)" : " (can't decode)"));
+            System.out.print("As a stream...");
+            ImageInputStream iis =
+                    ImageIO.createImageInputStream(getDataStream());
+
+            if (spi.canDecodeInput(iis) != canDecode) {
+                throw new RuntimeException("Test failed: wrong decideion " +
+                        "for stream data");
+            }
+            System.out.println("OK");
+
+            System.out.print("As a file...");
+            iis = ImageIO.createImageInputStream(getDataFile());
+            if (spi.canDecodeInput(iis) != canDecode) {
+                throw new RuntimeException("Test failed: wrong decideion " +
+                        "for file data");
+            }
+            System.out.println("OK");
+        }
+
+        private byte[] getData() {
+            byte[] data = new byte[dataLength];
+            Arrays.fill(data, (byte) 0);
+            System.arraycopy(header, 0, data, 0, header.length);
+
+            return data;
+        }
+        public InputStream getDataStream() {
+            return new ByteArrayInputStream(getData());
+        }
+
+        public File getDataFile() throws IOException {
+            File f = File.createTempFile("wbmp_", "." + title, new File("."));
+            FileOutputStream fos = new FileOutputStream(f);
+            fos.write(getData());
+            fos.flush();
+            fos.close();
+
+            return f;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/pisces/ScaleTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.*;
+import java.awt.geom.Ellipse2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import javax.imageio.ImageIO;
+
+
+public class ScaleTest {
+  public static void main(String[] args) throws Exception {
+    BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
+    Graphics2D g = image.createGraphics();
+
+    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+    g.setPaint(Color.WHITE);
+    g.fill(new Rectangle(image.getWidth(), image.getHeight()));
+    g.scale(.9, .9);
+    g.setPaint(Color.BLACK);
+    g.setStroke(new BasicStroke(0.5f));
+    g.draw(new Ellipse2D.Double(25, 25, 150, 150));
+
+    // To visually check it
+    //ImageIO.write(image, "PNG", new File(args[0]));
+
+    boolean nonWhitePixelFound = false;
+    for (int x = 100; x < 200; ++x) {
+      if (image.getRGB(x, 90) != Color.WHITE.getRGB()) {
+        nonWhitePixelFound = true;
+        break;
+      }
+    }
+    if (!nonWhitePixelFound) {
+      throw new RuntimeException("A circle is rendered like a 'C' shape.");
+    }
+  }
+}
--- a/langtools/.hgtags	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/.hgtags	Mon Jul 06 11:42:37 2009 -0700
@@ -35,3 +35,5 @@
 5bcac54d408b436d2364925ee7947b5609e07962 jdk7-b58
 88bcb6772159602317f2e184a69010737db72270 jdk7-b59
 5cdce469ea2ad90d308c9abe420fd0643c0a6b9e jdk7-b60
+522520757dd34321b27a7145ecbd24ac4fb64f34 jdk7-b61
+6855e5aa3348f185fe5b443ee43a1b00ec5d390e jdk7-b62
--- a/langtools/make/Makefile	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/make/Makefile	Mon Jul 06 11:42:37 2009 -0700
@@ -120,6 +120,14 @@
   endif
 endif 
 
+ifdef SOURCE_LANGUAGE_VERSION
+  ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
+else
+  ifdef JAVAC_SOURCE_ARG 
+    ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
+  endif
+endif 
+
 ifdef ALT_BOOTDIR
   ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR)
   ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
--- a/langtools/make/build.properties	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/make/build.properties	Mon Jul 06 11:42:37 2009 -0700
@@ -32,7 +32,8 @@
 # boot.java.home = /opt/jdk/1.5.0 
 boot.java = ${boot.java.home}/bin/java
 boot.javac = ${boot.java.home}/bin/javac
-boot.javac.target = 5
+boot.javac.source = 6
+boot.javac.target = 6
 
 # This is the JDK used to run the product version of the tools,
 # for example, for testing. If you're building a complete JDK, specify that.
@@ -59,7 +60,8 @@
 bootstrap.full.version = ${bootstrap.release}-${build.number}
 
 # options for the <javac> tasks used to compile the tools
-javac.target = 6
+javac.source = 5
+javac.target = 5
 javac.debug = true
 javac.debuglevel = source,lines
 javac.no.jdk.warnings = -XDignore.symbol.file=true
--- a/langtools/make/build.xml	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/make/build.xml	Mon Jul 06 11:42:37 2009 -0700
@@ -315,7 +315,7 @@
     <target name="build-javap" depends="build-javac">
         <build-tool name="javap"
                     includes="${javap.includes}"
-                    jarmainclass="sun.tools.javap.Main"
+                    jarmainclass="com.sun.tools.javap.Main"
                     jarclasspath="javac.jar"/>
     </target>
     
@@ -400,6 +400,7 @@
             <attribute name="java" default="java"/>
             <attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
             <attribute name="javac.java.home" default="${boot.java.home}"/>
+            <attribute name="javac.source" default="${javac.source}"/>
             <attribute name="javac.target" default="${javac.target}"/>
             <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
             <attribute name="jarclasspath" default=""/>
@@ -418,6 +419,7 @@
                     release="@{release}"
                     full.version="@{full.version}"
                     javac.bootclasspath="@{javac.bootclasspath}"
+                    javac.source="@{javac.source}"
                     javac.target="@{javac.target}"
                 />
                 <mkdir dir="@{bin.dir}"/>
@@ -442,6 +444,7 @@
             <attribute name="lib.dir" default="${dist.lib.dir}"/>
             <attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
             <attribute name="javac.java.home" default="${boot.java.home}"/>
+            <attribute name="javac.source" default="${javac.source}"/>
             <attribute name="javac.target" default="${javac.target}"/>
             <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
             <attribute name="jarclasspath" default=""/>
@@ -457,6 +460,7 @@
                     release="@{release}"
                     full.version="@{full.version}"
                     javac.bootclasspath="@{javac.bootclasspath}"
+                    javac.source="@{javac.source}"
                     javac.target="@{javac.target}"
                 />
                 <mkdir dir="@{lib.dir}"/>
@@ -481,6 +485,7 @@
             <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
             <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
             <attribute name="javac.java.home" default="${boot.java.home}"/>
+            <attribute name="javac.source" default="${javac.source}"/>
             <attribute name="javac.target" default="${javac.target}"/>
             <attribute name="release" default="${release}"/>
             <attribute name="full.version" default="${full.version}"/>
@@ -509,6 +514,7 @@
                        includes="@{includes}"
                        sourcepath=""
                        includeAntRuntime="no"
+                       source="@{javac.source}"
                        target="@{javac.target}">
                     <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
                     <compilerarg line="${javac.version.opt}"/>
@@ -522,6 +528,7 @@
                        excludes="@{excludes}"
                        sourcepath=""
                        includeAntRuntime="no"
+                       source="@{javac.source}"
                        target="@{javac.target}"
                        debug="${javac.debug}" 
                        debuglevel="${javac.debuglevel}">
@@ -547,6 +554,7 @@
     <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
         <presetdef name="build-bootstrap-tool">
             <build-tool
+                javac.source="${boot.javac.source}"
                 javac.target="${boot.javac.target}"
                 gensrc.dir="${build.bootstrap.dir}/gensrc"
                 classes.dir="${build.bootstrap.dir}/classes"
@@ -562,6 +570,7 @@
     <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
         <presetdef name="build-bootstrap-jar">
             <build-jar
+                javac.source="${boot.javac.source}"
                 javac.target="${boot.javac.target}"
                 gensrc.dir="${build.bootstrap.dir}/gensrc"
                 classes.dir="${build.bootstrap.dir}/classes"
--- a/langtools/src/share/classes/com/sun/tools/apt/main/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/apt/main/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,6 @@
 package com.sun.tools.apt.main;
 
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -37,14 +36,15 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Collections;
-import java.util.Collection;
 
 import java.net.URLClassLoader;
 import java.net.URL;
-import java.io.File;
 import java.net.MalformedURLException;
 
-import com.sun.tools.javac.file.Paths;
+import javax.tools.JavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Type;
@@ -766,6 +766,7 @@
         providedFactory = factory;
 
         Context context = new Context();
+        JavacFileManager.preRegister(context);
         options = Options.instance(context);
         Bark bark;
 
@@ -862,14 +863,14 @@
             }
             origOptions = Collections.unmodifiableMap(origOptions);
 
+            JavacFileManager fm = (JavacFileManager) context.get(JavaFileManager.class);
             {
                 // Note: it might be necessary to check for an empty
                 // component ("") of the source path or class path
-                Paths paths = Paths.instance(context);
 
                 String sourceDest = options.get("-s");
-                if (paths.sourcePath() != null) {
-                    for(File f: paths.sourcePath())
+                if (fm.hasLocation(StandardLocation.SOURCE_PATH)) {
+                    for(File f: fm.getLocation(StandardLocation.SOURCE_PATH))
                         augmentedSourcePath += (f + File.pathSeparator);
                     augmentedSourcePath += (sourceDest == null)?".":sourceDest;
                 } else {
@@ -880,8 +881,8 @@
                 }
 
                 String classDest = options.get("-d");
-                if (paths.userClassPath() != null) {
-                    for(File f: paths.userClassPath())
+                if (fm.hasLocation(StandardLocation.CLASS_PATH)) {
+                    for(File f: fm.getLocation(StandardLocation.CLASS_PATH))
                         baseClassPath += (f + File.pathSeparator);
                     // put baseClassPath into map to handle any
                     // value needed for the classloader
@@ -908,9 +909,8 @@
              * uses.
              */
                 String aptclasspath = "";
-                Paths paths = Paths.instance(context);
                 String bcp = "";
-                Collection<File> bootclasspath = paths.bootClassPath();
+                Iterable<? extends File> bootclasspath = fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH);
 
                 if (bootclasspath != null) {
                     for(File f: bootclasspath)
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassTranslator.java	Mon Jul 06 11:42:37 2009 -0700
@@ -95,7 +95,7 @@
         if (cp2 == null) {
             ConstantPool.CPInfo[] pool2 = new ConstantPool.CPInfo[cp.size()];
             boolean eq = true;
-            for (int i = 0; i < cp.size(); i++) {
+            for (int i = 0; i < cp.size(); ) {
                 ConstantPool.CPInfo cpInfo;
                 try {
                     cpInfo = cp.get(i);
@@ -107,11 +107,7 @@
                 pool2[i] = cpInfo2;
                 if (cpInfo.getTag() != cpInfo2.getTag())
                     throw new IllegalStateException();
-                switch (cpInfo.getTag()) {
-                    case ConstantPool.CONSTANT_Double:
-                    case ConstantPool.CONSTANT_Long:
-                        i += 1;
-                }
+                i += cpInfo.size();
             }
 
             if (eq)
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -118,13 +118,8 @@
         ConstantPool pool = classFile.constant_pool;
         int size = pool.size();
         out.writeShort(size);
-        try {
-            for (int i = 1; i < size; ) {
-                i += constantPoolWriter.write(pool.get(i), out);
-            }
-        } catch (ConstantPoolException e) {
-            throw new Error(e); // ??
-        }
+        for (CPInfo cpInfo: pool.entries())
+            constantPoolWriter.write(cpInfo, out);
     }
 
     protected void writeFields() throws IOException {
--- a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,6 +26,7 @@
 package com.sun.tools.classfile;
 
 import java.io.IOException;
+import java.util.Iterator;
 
 /**
  * See JVMS3, section 4.5.
@@ -223,6 +224,40 @@
         throw new EntryNotFound(value);
     }
 
+    public Iterable<CPInfo> entries() {
+        return new Iterable<CPInfo>() {
+            public Iterator<CPInfo> iterator() {
+                return new Iterator<CPInfo>() {
+
+                    public boolean hasNext() {
+                        return next < pool.length;
+                    }
+
+                    public CPInfo next() {
+                        current = pool[next];
+                        switch (current.getTag()) {
+                            case CONSTANT_Double:
+                            case CONSTANT_Long:
+                                next += 2;
+                                break;
+                            default:
+                                next += 1;
+                        }
+                        return current;
+                    }
+
+                    public void remove() {
+                        throw new UnsupportedOperationException();
+                    }
+
+                    private CPInfo current;
+                    private int next = 1;
+
+                };
+            }
+        };
+    }
+
     private CPInfo[] pool;
 
     public interface Visitor<R,P> {
@@ -250,6 +285,12 @@
 
         public abstract int getTag();
 
+        /** The number of slots in the constant pool used by this entry.
+         * 2 for CONSTANT_Double and CONSTANT_Long; 1 for everything else. */
+        public int size() {
+            return 1;
+        }
+
         public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
 
         protected final ConstantPool cp;
@@ -310,6 +351,20 @@
             return cp.getUTF8Value(name_index);
         }
 
+        public String getBaseName() throws ConstantPoolException {
+            String name = getName();
+            int index = name.indexOf("[L") + 1;
+            return name.substring(index);
+        }
+
+        public int getDimensionCount() throws ConstantPoolException {
+            String name = getName();
+            int count = 0;
+            while (name.charAt(count) == '[')
+                count++;
+            return count;
+        }
+
         @Override
         public String toString() {
             return "CONSTANT_Class_info[name_index: " + name_index + "]";
@@ -336,6 +391,11 @@
         }
 
         @Override
+        public int size() {
+            return 2;
+        }
+
+        @Override
         public String toString() {
             return "CONSTANT_Double_info[value: " + value + "]";
         }
@@ -449,6 +509,11 @@
         }
 
         @Override
+        public int size() {
+            return 2;
+        }
+
+        @Override
         public String toString() {
             return "CONSTANT_Long_info[value: " + value + "]";
         }
--- a/langtools/src/share/classes/com/sun/tools/classfile/StackMapTable_attribute.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/StackMapTable_attribute.java	Mon Jul 06 11:42:37 2009 -0700
@@ -107,6 +107,8 @@
             return 1;
         }
 
+        public abstract int getOffsetDelta();
+
         public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
 
         public final int frame_type;
@@ -130,6 +132,10 @@
         public <R, D> R accept(Visitor<R, D> visitor, D data) {
             return visitor.visit_same_frame(this, data);
         }
+
+        public int getOffsetDelta() {
+            return frame_type;
+        }
     }
 
     public static class same_locals_1_stack_item_frame extends stack_map_frame {
@@ -149,6 +155,10 @@
             return visitor.visit_same_locals_1_stack_item_frame(this, data);
         }
 
+        public int getOffsetDelta() {
+            return frame_type - 64;
+        }
+
         public final verification_type_info[] stack;
     }
 
@@ -170,6 +180,10 @@
             return visitor.visit_same_locals_1_stack_item_frame_extended(this, data);
         }
 
+        public int getOffsetDelta() {
+            return offset_delta;
+        }
+
         public final int offset_delta;
         public final verification_type_info[] stack;
     }
@@ -189,6 +203,10 @@
             return visitor.visit_chop_frame(this, data);
         }
 
+        public int getOffsetDelta() {
+            return offset_delta;
+        }
+
         public final int offset_delta;
     }
 
@@ -207,6 +225,10 @@
             return visitor.visit_same_frame_extended(this, data);
         }
 
+        public int getOffsetDelta() {
+            return offset_delta;
+        }
+
         public final int offset_delta;
     }
 
@@ -232,6 +254,10 @@
             return visitor.visit_append_frame(this, data);
         }
 
+        public int getOffsetDelta() {
+            return offset_delta;
+        }
+
         public final int offset_delta;
         public final verification_type_info[] locals;
     }
@@ -266,6 +292,10 @@
             return visitor.visit_full_frame(this, data);
         }
 
+        public int getOffsetDelta() {
+            return offset_delta;
+        }
+
         public final int offset_delta;
         public final int number_of_locals;
         public final verification_type_info[] locals;
@@ -308,7 +338,7 @@
             }
         }
 
-        verification_type_info(int tag) {
+        protected verification_type_info(int tag) {
             this.tag = tag;
         }
 
--- a/langtools/src/share/classes/com/sun/tools/classfile/Type.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Type.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,10 @@
 
 package com.sun.tools.classfile;
 
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /*
  *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
@@ -33,8 +36,9 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class Type {
+public abstract class Type {
     protected Type() { }
+    public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
 
     protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
         sb.append(prefix);
@@ -52,11 +56,33 @@
             append(sb, prefix, types, suffix);
     }
 
+    public interface Visitor<R,P> {
+        R visitSimpleType(SimpleType type, P p);
+        R visitArrayType(ArrayType type, P p);
+        R visitMethodType(MethodType type, P p);
+        R visitClassSigType(ClassSigType type, P p);
+        R visitClassType(ClassType type, P p);
+        R visitInnerClassType(InnerClassType type, P p);
+        R visitTypeArgType(TypeArgType type, P p);
+        R visitWildcardType(WildcardType type, P p);
+    }
+
     public static class SimpleType extends Type {
         public SimpleType(String name) {
             this.name = name;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitSimpleType(this, data);
+        }
+
+        public boolean isPrimitiveType() {
+            return primitiveTypes.contains(name);
+        }
+        // where
+        private static final Set<String> primitiveTypes = new HashSet<String>(Arrays.asList(
+            "boolean", "byte", "char", "double", "float", "int", "long", "short", "void"));
+
         @Override
         public String toString() {
             return name;
@@ -70,6 +96,10 @@
             this.elemType = elemType;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitArrayType(this, data);
+        }
+
         @Override
         public String toString() {
             return elemType + "[]";
@@ -93,6 +123,10 @@
             this.throwsTypes = throwsTypes;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitMethodType(this, data);
+        }
+
         @Override
         public String toString() {
             StringBuilder sb = new StringBuilder();
@@ -116,6 +150,10 @@
             this.superinterfaceTypes = superinterfaceTypes;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitClassSigType(this, data);
+        }
+
         @Override
         public String toString() {
             StringBuilder sb = new StringBuilder();
@@ -139,6 +177,10 @@
             this.typeArgs = typeArgs;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitClassType(this, data);
+        }
+
         @Override
         public String toString() {
             StringBuilder sb = new StringBuilder();
@@ -158,6 +200,10 @@
             this.innerType = innerType;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitInnerClassType(this, data);
+        }
+
         @Override
         public String toString() {
             return outerType + "." + innerType;
@@ -174,6 +220,10 @@
             this.interfaceBounds = interfaceBounds;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitTypeArgType(this, data);
+        }
+
         @Override
         public String toString() {
             StringBuilder sb = new StringBuilder();
@@ -209,6 +259,10 @@
             this.boundType = boundType;
         }
 
+        public <R, D> R accept(Visitor<R, D> visitor, D data) {
+            return visitor.visitWildcardType(this, data);
+        }
+
         @Override
         public String toString() {
             if (kind == null)
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java	Mon Jul 06 11:42:37 2009 -0700
@@ -43,6 +43,9 @@
  */
 public abstract class Printer implements Type.Visitor<String, Locale>, Symbol.Visitor<String, Locale> {
 
+    List<Type> seenCaptured = List.nil();
+    static final int PRIME = 997;  // largest prime less than 1000
+
     /**
      * This method should be overriden in order to provide proper i18n support.
      *
@@ -54,7 +57,18 @@
     protected abstract String localize(Locale locale, String key, Object... args);
 
     /**
-     * Create a printer with default i18n support provided my Messages.
+     * Maps a captured type into an unique identifier.
+     *
+     * @param t the captured type for which an id is to be retrieved
+     * @param locale locale settings
+     * @return unique id representing this captured type
+     */
+    protected abstract String capturedVarId(CapturedType t, Locale locale);
+
+    /**
+     * Create a printer with default i18n support provided by Messages. By default,
+     * captured types ids are generated using hashcode.
+     *
      * @param messages Messages class to be used for i18n
      * @return printer visitor instance
      */
@@ -63,6 +77,11 @@
             @Override
             protected String localize(Locale locale, String key, Object... args) {
                 return messages.getLocalizedString(locale, key, args);
+            }
+
+            @Override
+            protected String capturedVarId(CapturedType t, Locale locale) {
+                return (t.hashCode() & 0xFFFFFFFFL) % PRIME + "";
         }};
     }
 
@@ -120,9 +139,20 @@
 
     @Override
     public String visitCapturedType(CapturedType t, Locale locale) {
-        return localize(locale, "compiler.misc.type.captureof",
-            (t.hashCode() & 0xFFFFFFFFL) % Type.CapturedType.PRIME,
-            visit(t.wildcard, locale));
+        if (seenCaptured.contains(t))
+            return localize(locale, "compiler.misc.type.captureof.1",
+                capturedVarId(t, locale));
+        else {
+            try {
+                seenCaptured = seenCaptured.prepend(t);
+                return localize(locale, "compiler.misc.type.captureof",
+                    capturedVarId(t, locale),
+                    visit(t.wildcard, locale));
+            }
+            finally {
+                seenCaptured = seenCaptured.tail;
+            }
+        }
     }
 
     @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Mon Jul 06 11:42:37 2009 -0700
@@ -95,7 +95,7 @@
         this.name = name;
     }
 
-    public static final Source DEFAULT = JDK1_5;
+    public static final Source DEFAULT = JDK1_7;
 
     public static Source lookup(String name) {
         return tab.get(name);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Mon Jul 06 11:42:37 2009 -0700
@@ -1008,11 +1008,10 @@
         @Override
         public String toString() {
             return "capture#"
-                + (hashCode() & 0xFFFFFFFFL) % PRIME
+                + (hashCode() & 0xFFFFFFFFL) % Printer.PRIME
                 + " of "
                 + wildcard;
         }
-        static final int PRIME = 997;  // largest prime less than 1000
     }
 
     public static abstract class DelegatedType extends Type {
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java	Mon Jul 06 11:42:37 2009 -0700
@@ -66,7 +66,7 @@
      *  @param context the context
      *  @return the Paths instance for this context
      */
-    public static Paths instance(Context context) {
+    static Paths instance(Context context) {
         Paths instance = context.get(pathsKey);
         if (instance == null)
             instance = new Paths(context);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Mon Jul 06 11:42:37 2009 -0700
@@ -108,7 +108,7 @@
         this.minorVersion = minorVersion;
     }
 
-    public static final Target DEFAULT = JDK1_6;
+    public static final Target DEFAULT = JDK1_7;
 
     public static Target lookup(String name) {
         return tab.get(name);
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Jul 06 11:42:37 2009 -0700
@@ -391,6 +391,8 @@
             (options.get("shouldStopPolicy") != null)
             ? CompileState.valueOf(options.get("shouldStopPolicy"))
             : null;
+        if (options.get("oldDiags") == null)
+            log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context));
     }
 
     /* Switches:
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Jul 06 11:42:37 2009 -0700
@@ -55,7 +55,6 @@
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.file.Paths;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.main.JavaCompiler;
@@ -180,7 +179,6 @@
     }
 
     private void initProcessorIterator(Context context, Iterable<? extends Processor> processors) {
-        Paths paths = Paths.instance(context);
         Log   log   = Log.instance(context);
         Iterator<? extends Processor> processorIterator;
 
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jul 06 11:42:37 2009 -0700
@@ -1165,3 +1165,64 @@
 compiler.err.enums.not.supported.in.source=\
     enums are not supported in -source {0}\n\
 (use -source 5 or higher to enable enums)
+
+########################################
+# Diagnostics for where clause implementation
+# used by the RichDiagnosticFormatter.
+########################################
+
+compiler.misc.type.null=\
+    <null>
+
+# X#n (where n is an int id) is disambiguated tvar name
+compiler.misc.type.var=\
+    {0}#{1}
+
+# CAP#n (where n is an int id) is an abbreviation for 'captured type'
+compiler.misc.captured.type=\
+    CAP#{0}
+
+# <INT#n> (where n is an int id) is an abbreviation for 'intersection type'
+compiler.misc.intersection.type=\
+    INT#{0}
+
+# where clause for captured type: contains upper ('extends {1}') and lower
+# ('super {2}') bound along with the wildcard that generated this captured type ({3})
+compiler.misc.where.captured=\
+    {0} extends {1} super: {2} from capture of {3}
+
+# compact where clause for captured type: contains upper ('extends {1}') along
+# with the wildcard that generated this captured type ({3})
+compiler.misc.where.captured.1=\
+    {0} extends {1} from capture of {3}
+
+# where clause for type variable: contains upper bound(s) ('extends {1}') along with
+# the kindname ({2}) and location ({3}) in which the typevar has been declared
+compiler.misc.where.typevar=\
+    {0} extends {1} declared in {2} {3}
+
+# compact where clause for type variable: contains the kindname ({2}) and location ({3})
+# in which the typevar has been declared
+compiler.misc.where.typevar.1=\
+    {0} declared in {2} {3}
+
+# where clause for type variable: contains all the upper bound(s) ('extends {1}')
+# of this intersection type
+compiler.misc.where.intersection=\
+    {0} extends {1}
+
+### Where clause headers ###
+compiler.misc.where.description.captured=\
+    where {0} is a fresh type-variable:
+compiler.misc.where.description.typevar=\
+    where {0} is a type-variable:
+compiler.misc.where.description.intersection=\
+    where {0} is an intersection type:
+compiler.misc.where.description.captured.1=\
+    where {0} are fresh type-variables:
+compiler.misc.where.description.typevar.1=\
+    where {0} are type-variables:
+compiler.misc.where.description.intersection.1=\
+    where {0} are intersection types:
+
+
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -77,9 +77,11 @@
     protected int depth = 0;
 
     /**
-     * Printer instance to be used for formatting types/symbol
+     * All captured types that have been encountered during diagnostic formatting.
+     * This info is used by the FormatterPrinter in order to print friendly unique
+     * ids for captured types
      */
-    protected Printer printer;
+    private List<Type> allCaptured = List.nil();
 
     /**
      * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object.
@@ -88,7 +90,6 @@
     protected AbstractDiagnosticFormatter(JavacMessages messages, SimpleConfiguration config) {
         this.messages = messages;
         this.config = config;
-        this.printer = new FormatterPrinter();
     }
 
     public String formatKind(JCDiagnostic d, Locale l) {
@@ -104,7 +105,7 @@
 
     @Override
     public String format(JCDiagnostic d, Locale locale) {
-        printer = new FormatterPrinter();
+        allCaptured = List.nil();
         return formatDiagnostic(d, locale);
     }
 
@@ -171,6 +172,9 @@
             return formatIterable(d, (Iterable<?>)arg, l);
         }
         else if (arg instanceof Type) {
+            if (!allCaptured.contains(arg)) {
+                allCaptured = allCaptured.append((Type)arg);
+            }
             return printer.visit((Type)arg, l);
         }
         else if (arg instanceof Symbol) {
@@ -291,6 +295,10 @@
                 d.getIntPosition() != Position.NOPOS;
     }
 
+    public boolean isRaw() {
+        return false;
+    }
+
     /**
      * Creates a string with a given amount of empty spaces. Useful for
      * indenting the text of a diagnostic message.
@@ -355,26 +363,26 @@
             String showSource = null;
             if ((showSource = options.get("showSource")) != null) {
                 if (showSource.equals("true"))
-                    visibleParts.add(DiagnosticPart.SOURCE);
+                    setVisiblePart(DiagnosticPart.SOURCE, true);
                 else if (showSource.equals("false"))
-                    visibleParts.remove(DiagnosticPart.SOURCE);
+                    setVisiblePart(DiagnosticPart.SOURCE, false);
             }
             String diagOpts = options.get("diags");
             if (diagOpts != null) {//override -XDshowSource
                 Collection<String> args = Arrays.asList(diagOpts.split(","));
                 if (args.contains("short")) {
-                    visibleParts.remove(DiagnosticPart.DETAILS);
-                    visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
+                    setVisiblePart(DiagnosticPart.DETAILS, false);
+                    setVisiblePart(DiagnosticPart.SUBDIAGNOSTICS, false);
                 }
                 if (args.contains("source"))
-                    visibleParts.add(DiagnosticPart.SOURCE);
+                    setVisiblePart(DiagnosticPart.SOURCE, true);
                 if (args.contains("-source"))
-                    visibleParts.remove(DiagnosticPart.SOURCE);
+                    setVisiblePart(DiagnosticPart.SOURCE, false);
             }
             String multiPolicy = null;
             if ((multiPolicy = options.get("multilinePolicy")) != null) {
                 if (multiPolicy.equals("disabled"))
-                    visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
+                    setVisiblePart(DiagnosticPart.SUBDIAGNOSTICS, false);
                 else if (multiPolicy.startsWith("limit:")) {
                     String limitString = multiPolicy.substring("limit:".length());
                     String[] limits = limitString.split(":");
@@ -421,6 +429,13 @@
             visibleParts = EnumSet.copyOf(diagParts);
         }
 
+        public void setVisiblePart(DiagnosticPart diagParts, boolean enabled) {
+            if (enabled)
+                visibleParts.add(diagParts);
+            else
+                visibleParts.remove(diagParts);
+        }
+
         /**
          * Shows a '^' sign under the source line displayed by the formatter
          * (if applicable).
@@ -441,6 +456,14 @@
         }
     }
 
+    public Printer getPrinter() {
+        return printer;
+    }
+
+    public void setPrinter(Printer printer) {
+        this.printer = printer;
+    }
+
     /**
      * An enhanced printer for formatting types/symbols used by
      * AbstractDiagnosticFormatter. Provides alternate numbering of captured
@@ -450,33 +473,14 @@
      * type referred by a given captured type C contains C itself) which might
      * lead to infinite loops.
      */
-    protected class FormatterPrinter extends Printer {
-
-        List<Type> allCaptured = List.nil();
-        List<Type> seenCaptured = List.nil();
-
+    protected Printer printer = new Printer() {
         @Override
         protected String localize(Locale locale, String key, Object... args) {
             return AbstractDiagnosticFormatter.this.localize(locale, key, args);
         }
-
         @Override
-        public String visitCapturedType(CapturedType t, Locale locale) {
-            if (seenCaptured.contains(t))
-                return localize(locale, "compiler.misc.type.captureof.1",
-                    allCaptured.indexOf(t) + 1);
-            else {
-                try {
-                    seenCaptured = seenCaptured.prepend(t);
-                    allCaptured = allCaptured.append(t);
-                    return localize(locale, "compiler.misc.type.captureof",
-                        allCaptured.indexOf(t) + 1,
-                        visit(t.wildcard, locale));
-                }
-                finally {
-                    seenCaptured = seenCaptured.tail;
-                }
-            }
+        protected String capturedVarId(CapturedType t, Locale locale) {
+            return "" + (allCaptured.indexOf(t) + 1);
         }
-    }
+    };
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -209,6 +209,7 @@
 
     @Override
     public BasicConfiguration getConfiguration() {
+        //the following cast is always safe - see init
         return (BasicConfiguration)super.getConfiguration();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ForwardingDiagnosticFormatter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.tools.javac.util;
+
+import java.util.Set;
+import java.util.Locale;
+import javax.tools.Diagnostic;
+
+import com.sun.tools.javac.api.DiagnosticFormatter;
+import com.sun.tools.javac.api.DiagnosticFormatter.Configuration;
+import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.DiagnosticPart;
+import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.MultilineLimit;
+import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind;
+
+/**
+ * A delegated diagnostic formatter delegates all formatting
+ * actions to an underlying formatter (aka the delegated formatter).
+ */
+public class ForwardingDiagnosticFormatter<D extends Diagnostic<?>, F extends DiagnosticFormatter<D>>
+        implements DiagnosticFormatter<D> {
+
+    /**
+     * The delegated formatter
+     */
+    protected F formatter;
+
+    /*
+     * configuration object used by this formatter
+     */
+    protected ForwardingConfiguration configuration;
+
+    public ForwardingDiagnosticFormatter(F formatter) {
+        this.formatter = formatter;
+        this.configuration = new ForwardingConfiguration(formatter.getConfiguration());
+    }
+
+    /**
+     * Returns the underlying delegated formatter
+     * @return delegate formatter
+     */
+    public F getDelegatedFormatter() {
+        return formatter;
+    }
+
+    public Configuration getConfiguration() {
+        return configuration;
+    }
+
+    public boolean displaySource(D diag) {
+        return formatter.displaySource(diag);
+    }
+
+    public String format(D diag, Locale l) {
+        return formatter.format(diag, l);
+    }
+
+    public String formatKind(D diag, Locale l) {
+        return formatter.formatKind(diag, l);
+    }
+
+    public String formatMessage(D diag, Locale l) {
+        return formatter.formatMessage(diag, l);
+    }
+
+    public String formatPosition(D diag, PositionKind pk, Locale l) {
+        return formatter.formatPosition(diag, pk, l);
+    }
+
+    public String formatSource(D diag, boolean fullname, Locale l) {
+        return formatter.formatSource(diag, fullname, l);
+    }
+
+    /**
+     * A delegated formatter configuration delegates all configurations settings
+     * to an underlying configuration object (aka the delegated configuration).
+     */
+    public static class ForwardingConfiguration implements DiagnosticFormatter.Configuration {
+
+        /** The configurationr object to which the forwarding configuration delegates some settings */
+        protected Configuration configuration;
+
+        public ForwardingConfiguration(Configuration configuration) {
+            this.configuration = configuration;
+        }
+
+        /**
+         * Returns the underlying delegated configuration.
+         * @return delegated configuration
+         */
+        public Configuration getDelegatedConfiguration() {
+            return configuration;
+        }
+
+        public int getMultilineLimit(MultilineLimit limit) {
+            return configuration.getMultilineLimit(limit);
+        }
+
+        public Set<DiagnosticPart> getVisible() {
+            return configuration.getVisible();
+        }
+
+        public void setMultilineLimit(MultilineLimit limit, int value) {
+            configuration.setMultilineLimit(limit, value);
+        }
+
+        public void setVisible(Set<DiagnosticPart> diagParts) {
+            configuration.setVisible(diagParts);
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -124,4 +124,9 @@
         }
         return buf.toString();
     }
+
+    @Override
+    public boolean isRaw() {
+        return true;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,648 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.tools.javac.util;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Printer;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.Types;
+
+import static com.sun.tools.javac.code.TypeTags.*;
+import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.util.LayoutCharacters.*;
+import static com.sun.tools.javac.util.RichDiagnosticFormatter.RichConfiguration.*;
+
+/**
+ * A rich diagnostic formatter is a formatter that provides better integration
+ * with javac's type system. A diagostic is first preprocessed in order to keep
+ * track of each types/symbols in it; after these informations are collected,
+ * the diagnostic is rendered using a standard formatter, whose type/symbol printer
+ * has been replaced by a more refined version provided by this rich formatter.
+ * The rich formatter currently enables three different features: (i) simple class
+ * names - that is class names are displayed used a non qualified name (thus
+ * omitting package info) whenever possible - (ii) where clause list - a list of
+ * additional subdiagnostics that provide specific info about type-variables,
+ * captured types, intersection types that occur in the diagnostic that is to be
+ * formatted and (iii) type-variable disambiguation - when the diagnostic refers
+ * to two different type-variables with the same name, their representation is
+ * disambiguated by appending an index to the type variable name.
+ */
+public class RichDiagnosticFormatter extends
+        ForwardingDiagnosticFormatter<JCDiagnostic, AbstractDiagnosticFormatter> {
+
+    final Symtab syms;
+    final Types types;
+    final JCDiagnostic.Factory diags;
+    final JavacMessages messages;
+
+    /* name simplifier used by this formatter */
+    ClassNameSimplifier nameSimplifier;
+
+    /* map for keeping track of a where clause associated to a given type */
+    Map<WhereClauseKind, Map<Type, JCDiagnostic>> whereClauses;
+
+    /** Get the DiagnosticFormatter instance for this context. */
+    public static RichDiagnosticFormatter instance(Context context) {
+        RichDiagnosticFormatter instance = context.get(RichDiagnosticFormatter.class);
+        if (instance == null)
+            instance = new RichDiagnosticFormatter(context);
+        return instance;
+    }
+
+    protected RichDiagnosticFormatter(Context context) {
+        super((AbstractDiagnosticFormatter)Log.instance(context).getDiagnosticFormatter());
+        this.formatter.setPrinter(printer);
+        this.syms = Symtab.instance(context);
+        this.diags = JCDiagnostic.Factory.instance(context);
+        this.types = Types.instance(context);
+        this.messages = JavacMessages.instance(context);
+        whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>();
+        configuration = new RichConfiguration(Options.instance(context), formatter);
+        for (WhereClauseKind kind : WhereClauseKind.values())
+            whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
+    }
+
+    @Override
+    public String format(JCDiagnostic diag, Locale l) {
+        StringBuilder sb = new StringBuilder();
+        nameSimplifier = new ClassNameSimplifier();
+        for (WhereClauseKind kind : WhereClauseKind.values())
+            whereClauses.get(kind).clear();
+        preprocessDiagnostic(diag);
+        sb.append(formatter.format(diag, l));
+        if (getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
+            List<JCDiagnostic> clauses = getWhereClauses();
+            String indent = formatter.isRaw() ? "" :
+                formatter.indentString(DetailsInc);
+            for (JCDiagnostic d : clauses) {
+                String whereClause = formatter.format(d, l);
+                if (whereClause.length() > 0) {
+                    sb.append('\n' + indent + whereClause);
+                }
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Preprocess a given diagnostic by looking both into its arguments and into
+     * its subdiagnostics (if any). This preprocessing is responsible for
+     * generating info corresponding to features like where clauses, name
+     * simplification, etc.
+     *
+     * @param diag the diagnostic to be preprocessed
+     */
+    protected void preprocessDiagnostic(JCDiagnostic diag) {
+        for (Object o : diag.getArgs()) {
+            if (o != null) {
+                preprocessArgument(o);
+            }
+        }
+        if (diag.isMultiline()) {
+            for (JCDiagnostic d : diag.getSubdiagnostics())
+                preprocessDiagnostic(d);
+        }
+    }
+
+    /**
+     * Preprocess a diagnostic argument. A type/symbol argument is
+     * preprocessed by specialized type/symbol preprocessors.
+     *
+     * @param arg the argument to be translated
+     */
+    protected void preprocessArgument(Object arg) {
+        if (arg instanceof Type) {
+            preprocessType((Type)arg);
+        }
+        else if (arg instanceof Symbol) {
+            preprocessSymbol((Symbol)arg);
+        }
+        else if (arg instanceof JCDiagnostic) {
+            preprocessDiagnostic((JCDiagnostic)arg);
+        }
+        else if (arg instanceof Iterable<?>) {
+            for (Object o : (Iterable<?>)arg) {
+                preprocessArgument(o);
+            }
+        }
+    }
+
+    /**
+     * Build a list of multiline diagnostics containing detailed info about
+     * type-variables, captured types, and intersection types
+     *
+     * @return where clause list
+     */
+    protected List<JCDiagnostic> getWhereClauses() {
+        List<JCDiagnostic> clauses = List.nil();
+        for (WhereClauseKind kind : WhereClauseKind.values()) {
+            List<JCDiagnostic> lines = List.nil();
+            for (Map.Entry<Type, JCDiagnostic> entry : whereClauses.get(kind).entrySet()) {
+                lines = lines.prepend(entry.getValue());
+            }
+            if (!lines.isEmpty()) {
+                String key = kind.key();
+                if (lines.size() > 1)
+                    key += ".1";
+                JCDiagnostic d = diags.fragment(key, whereClauses.get(kind).keySet());
+                d = new JCDiagnostic.MultilineDiagnostic(d, lines.reverse());
+                clauses = clauses.prepend(d);
+            }
+        }
+        return clauses.reverse();
+    }
+    //where
+    /**
+     * This enum defines all posssible kinds of where clauses that can be
+     * attached by a rich diagnostic formatter to a given diagnostic
+     */
+    enum WhereClauseKind {
+
+        /** where clause regarding a type variable */
+        TYPEVAR("where.description.typevar"),
+        /** where clause regarding a captured type */
+        CAPTURED("where.description.captured"),
+        /** where clause regarding an intersection type */
+        INTERSECTION("where.description.intersection");
+
+        /** resource key for this where clause kind */
+        private String key;
+
+        WhereClauseKind(String key) {
+            this.key = key;
+        }
+
+        String key() {
+            return key;
+        }
+    }
+
+    // <editor-fold defaultstate="collapsed" desc="name simplifier">
+    /**
+     * A name simplifier keeps track of class names usages in order to determine
+     * whether a class name can be compacted or not. Short names are not used
+     * if a conflict is detected, e.g. when two classes with the same simple
+     * name belong to different packages - in this case the formatter reverts
+     * to fullnames as compact names might lead to a confusing diagnostic.
+     */
+    class ClassNameSimplifier {
+
+        /* table for keeping track of all short name usages */
+        Map<Name, List<Symbol>> nameClashes = new HashMap<Name, List<Symbol>>();
+
+        /**
+         * Add a name usage to the simplifier's internal cache
+         */
+        protected void addUsage(Symbol sym) {
+            Name n = sym.getSimpleName();
+            List<Symbol> conflicts = nameClashes.get(n);
+            if (conflicts == null) {
+                conflicts = List.nil();
+            }
+            if (!conflicts.contains(sym))
+                nameClashes.put(n, conflicts.append(sym));
+        }
+
+        public String simplify(Symbol s) {
+            String name = s.getQualifiedName().toString();
+            if (!s.type.isCompound()) {
+                List<Symbol> conflicts = nameClashes.get(s.getSimpleName());
+                if (conflicts == null ||
+                    (conflicts.size() == 1 &&
+                    conflicts.contains(s))) {
+                    List<Name> l = List.nil();
+                    Symbol s2 = s;
+                    while (s2.type.getEnclosingType().tag == CLASS
+                            && s2.owner.kind == Kinds.TYP) {
+                        l = l.prepend(s2.getSimpleName());
+                        s2 = s2.owner;
+                    }
+                    l = l.prepend(s2.getSimpleName());
+                    StringBuilder buf = new StringBuilder();
+                    String sep = "";
+                    for (Name n2 : l) {
+                        buf.append(sep);
+                        buf.append(n2);
+                        sep = ".";
+                    }
+                    name = buf.toString();
+                }
+            }
+            return name;
+        }
+    };
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="rich printer">
+    /**
+     * Enhanced type/symbol printer that provides support for features like simple names
+     * and type variable disambiguation. This enriched printer exploits the info
+     * discovered during type/symbol preprocessing. This printer is set on the delegate
+     * formatter so that rich type/symbol info can be properly rendered.
+     */
+    protected Printer printer = new Printer() {
+
+        @Override
+        public String localize(Locale locale, String key, Object... args) {
+            return formatter.localize(locale, key, args);
+        }
+
+        @Override
+        public String capturedVarId(CapturedType t, Locale locale) {
+            return indexOf(t, WhereClauseKind.CAPTURED) + "";
+        }
+
+        @Override
+        public String visitType(Type t, Locale locale) {
+            String s = super.visitType(t, locale);
+            if (t == syms.botType)
+                s = localize(locale, "compiler.misc.type.null");
+            return s;
+        }
+
+        @Override
+        public String visitCapturedType(CapturedType t, Locale locale) {
+            if (getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
+                return localize(locale,
+                    "compiler.misc.captured.type",
+                    indexOf(t, WhereClauseKind.CAPTURED));
+            }
+            else
+                return super.visitCapturedType(t, locale);
+        }
+
+        @Override
+        public String visitClassType(ClassType t, Locale locale) {
+            if (t.isCompound() &&
+                    getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
+                return localize(locale,
+                        "compiler.misc.intersection.type",
+                        indexOf(t, WhereClauseKind.INTERSECTION));
+            }
+            else
+                return super.visitClassType(t, locale);
+        }
+
+        @Override
+        protected String className(ClassType t, boolean longform, Locale locale) {
+            Symbol sym = t.tsym;
+            if (sym.name.length() == 0 ||
+                    !getConfiguration().isEnabled(RichFormatterFeature.SIMPLE_NAMES)) {
+                return super.className(t, longform, locale);
+            }
+            else if (longform)
+                return nameSimplifier.simplify(sym).toString();
+            else
+                return sym.name.toString();
+        }
+
+        @Override
+        public String visitTypeVar(TypeVar t, Locale locale) {
+            if (unique(t) ||
+                    !getConfiguration().isEnabled(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES)) {
+                return t.toString();
+            }
+            else {
+                return localize(locale,
+                        "compiler.misc.type.var",
+                        t.toString(), indexOf(t, WhereClauseKind.TYPEVAR));
+            }
+        }
+
+        private int indexOf(Type type, WhereClauseKind kind) {
+            int index = 0;
+            boolean found = false;
+            for (Type t : whereClauses.get(kind).keySet()) {
+                if (t == type) {
+                    found = true;
+                    break;
+                }
+                index++;
+            }
+            if (!found)
+                throw new AssertionError("Missing symbol in where clause " + type);
+            return index + 1;
+        }
+
+        private boolean unique(TypeVar typevar) {
+            int found = 0;
+            for (Type t : whereClauses.get(WhereClauseKind.TYPEVAR).keySet()) {
+                if (t.toString().equals(typevar.toString())) {
+                    found++;
+                }
+            }
+            if (found < 1)
+                throw new AssertionError("Missing type variable in where clause " + typevar);
+            return found == 1;
+        }
+
+        @Override
+        protected String printMethodArgs(List<Type> args, boolean varArgs, Locale locale) {
+            return super.printMethodArgs(args, varArgs, locale);
+        }
+
+        @Override
+        public String visitClassSymbol(ClassSymbol s, Locale locale) {
+            String name = nameSimplifier.simplify(s);
+            if (name.length() == 0 ||
+                    !getConfiguration().isEnabled(RichFormatterFeature.SIMPLE_NAMES)) {
+                return super.visitClassSymbol(s, locale);
+            }
+            else {
+                return name;
+            }
+        }
+
+        @Override
+        public String visitMethodSymbol(MethodSymbol s, Locale locale) {
+            String ownerName = visit(s.owner, locale);
+            if ((s.flags() & BLOCK) != 0) {
+               return ownerName;
+            } else {
+                String ms = (s.name == s.name.table.names.init)
+                    ? ownerName
+                    : s.name.toString();
+                if (s.type != null) {
+                    if (s.type.tag == FORALL) {
+                        ms = "<" + visitTypes(s.type.getTypeArguments(), locale) + ">" + ms;
+                    }
+                    ms += "(" + printMethodArgs(
+                            s.type.getParameterTypes(),
+                            (s.flags() & VARARGS) != 0,
+                            locale) + ")";
+                }
+                return ms;
+            }
+        }
+    };
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="type scanner">
+    /**
+     * Preprocess a given type looking for (i) additional info (where clauses) to be
+     * added to the main diagnostic (ii) names to be compacted.
+     */
+    protected void preprocessType(Type t) {
+        typePreprocessor.visit(t);
+    }
+    //where
+    protected Types.UnaryVisitor<Void> typePreprocessor =
+            new Types.UnaryVisitor<Void>() {
+
+        public Void visit(List<Type> ts) {
+            for (Type t : ts)
+                visit(t);
+            return null;
+        }
+
+        @Override
+        public Void visitForAll(ForAll t, Void ignored) {
+            visit(t.tvars);
+            visit(t.qtype);
+            return null;
+        }
+
+        @Override
+        public Void visitMethodType(MethodType t, Void ignored) {
+            visit(t.argtypes);
+            visit(t.restype);
+            return null;
+        }
+
+        @Override
+        public Void visitErrorType(ErrorType t, Void ignored) {
+            Type ot = t.getOriginalType();
+            if (ot != null)
+                visit(ot);
+            return null;
+        }
+
+        @Override
+        public Void visitArrayType(ArrayType t, Void ignored) {
+            visit(t.elemtype);
+            return null;
+        }
+
+        @Override
+        public Void visitWildcardType(WildcardType t, Void ignored) {
+            visit(t.type);
+            return null;
+        }
+
+        public Void visitType(Type t, Void ignored) {
+            return null;
+        }
+
+        @Override
+        public Void visitCapturedType(CapturedType t, Void ignored) {
+            if (!whereClauses.get(WhereClauseKind.CAPTURED).containsKey(t)) {
+                String suffix = t.lower == syms.botType ? ".1" : "";
+                JCDiagnostic d = diags.fragment("where.captured"+ suffix, t, t.bound, t.lower, t.wildcard);
+                whereClauses.get(WhereClauseKind.CAPTURED).put(t, d);
+                visit(t.wildcard);
+                visit(t.lower);
+                visit(t.bound);
+            }
+            return null;
+        }
+
+        @Override
+        public Void visitClassType(ClassType t, Void ignored) {
+            if (t.isCompound()) {
+                if (!whereClauses.get(WhereClauseKind.INTERSECTION).containsKey(t)) {
+                    Type supertype = types.supertype(t);
+                    List<Type> interfaces = types.interfaces(t);
+                    JCDiagnostic d = diags.fragment("where.intersection", t, interfaces.prepend(supertype));
+                    whereClauses.get(WhereClauseKind.INTERSECTION).put(t, d);
+                    visit(supertype);
+                    visit(interfaces);
+                }
+            }
+            nameSimplifier.addUsage(t.tsym);
+            visit(t.getTypeArguments());
+            if (t.getEnclosingType() != Type.noType)
+                visit(t.getEnclosingType());
+            return null;
+        }
+
+        @Override
+        public Void visitTypeVar(TypeVar t, Void ignored) {
+            if (!whereClauses.get(WhereClauseKind.TYPEVAR).containsKey(t)) {
+                Type bound = t.bound;
+                while ((bound instanceof ErrorType))
+                    bound = ((ErrorType)bound).getOriginalType();
+                List<Type> bounds  = types.getBounds(t);
+                nameSimplifier.addUsage(t.tsym);
+
+                boolean boundErroneous = bounds.head == null ||
+                                         bounds.head.tag == NONE ||
+                                         bounds.head.tag == ERROR;
+
+
+                JCDiagnostic d = diags.fragment("where.typevar" +
+                        (boundErroneous ? ".1" : ""), t, bounds,
+                        Kinds.kindName(t.tsym.location()), t.tsym.location());
+                whereClauses.get(WhereClauseKind.TYPEVAR).put(t, d);
+                symbolPreprocessor.visit(t.tsym.location(), null);
+                visit(bounds);
+            }
+            return null;
+        }
+    };
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="symbol scanner">
+    /**
+     * Preprocess a given symbol looking for (i) additional info (where clauses) to be
+     * asdded to the main diagnostic (ii) names to be compacted
+     */
+    protected void preprocessSymbol(Symbol s) {
+        symbolPreprocessor.visit(s, null);
+    }
+    //where
+    protected Types.DefaultSymbolVisitor<Void, Void> symbolPreprocessor =
+            new Types.DefaultSymbolVisitor<Void, Void>() {
+
+        @Override
+        public Void visitClassSymbol(ClassSymbol s, Void ignored) {
+            nameSimplifier.addUsage(s);
+            return null;
+        }
+
+        @Override
+        public Void visitSymbol(Symbol s, Void ignored) {
+            return null;
+        }
+
+        @Override
+        public Void visitMethodSymbol(MethodSymbol s, Void ignored) {
+            visit(s.owner, null);
+            typePreprocessor.visit(s.type);
+            return null;
+        }
+    };
+    // </editor-fold>
+
+    @Override
+    public RichConfiguration getConfiguration() {
+        //the following cast is always safe - see init
+        return (RichConfiguration)configuration;
+    }
+
+    /**
+     * Configuration object provided by the rich formatter.
+     */
+    public static class RichConfiguration extends ForwardingDiagnosticFormatter.ForwardingConfiguration {
+
+        /** set of enabled rich formatter's features */
+        protected java.util.EnumSet<RichFormatterFeature> features;
+
+        @SuppressWarnings("fallthrough")
+        public RichConfiguration(Options options, AbstractDiagnosticFormatter formatter) {
+            super(formatter.getConfiguration());
+            features = formatter.isRaw() ? EnumSet.noneOf(RichFormatterFeature.class) :
+                EnumSet.of(RichFormatterFeature.SIMPLE_NAMES,
+                    RichFormatterFeature.WHERE_CLAUSES,
+                    RichFormatterFeature.UNIQUE_TYPEVAR_NAMES);
+            String diagOpts = options.get("diags");
+            if (diagOpts != null) {
+                for (String args: diagOpts.split(",")) {
+                    if (args.equals("-where")) {
+                        features.remove(RichFormatterFeature.WHERE_CLAUSES);
+                    }
+                    else if (args.equals("where")) {
+                        features.add(RichFormatterFeature.WHERE_CLAUSES);
+                    }
+                    if (args.equals("-simpleNames")) {
+                        features.remove(RichFormatterFeature.SIMPLE_NAMES);
+                    }
+                    else if (args.equals("simpleNames")) {
+                        features.add(RichFormatterFeature.SIMPLE_NAMES);
+                    }
+                    if (args.equals("-disambiguateTvars")) {
+                        features.remove(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES);
+                    }
+                    else if (args.equals("disambiguateTvars")) {
+                        features.add(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES);
+                    }
+                }
+            }
+        }
+
+        /**
+         * Returns a list of all the features supported by the rich formatter.
+         * @return list of supported features
+         */
+        public RichFormatterFeature[] getAvailableFeatures() {
+            return RichFormatterFeature.values();
+        }
+
+        /**
+         * Enable a specific feature on this rich formatter.
+         * @param feature feature to be enabled
+         */
+        public void enable(RichFormatterFeature feature) {
+            features.add(feature);
+        }
+
+        /**
+         * Disable a specific feature on this rich formatter.
+         * @param feature feature to be disabled
+         */
+        public void disable(RichFormatterFeature feature) {
+            features.remove(feature);
+        }
+
+        /**
+         * Is a given feature enabled on this formatter?
+         * @param feature feature to be tested
+         */
+        public boolean isEnabled(RichFormatterFeature feature) {
+            return features.contains(feature);
+        }
+
+        /**
+         * The advanced formatting features provided by the rich formatter
+         */
+        public enum RichFormatterFeature {
+            /** a list of additional info regarding a given type/symbol */
+            WHERE_CLAUSES,
+            /** full class names simplification (where possible) */
+            SIMPLE_NAMES,
+            /** type-variable names disambiguation */
+            UNIQUE_TYPEVAR_NAMES;
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/javap/BasicWriter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/BasicWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -44,6 +44,9 @@
     protected BasicWriter(Context context) {
         lineWriter = LineWriter.instance(context);
         out = context.get(PrintWriter.class);
+        messages = context.get(Messages.class);
+        if (messages == null)
+            throw new AssertionError();
     }
 
     protected void print(String s) {
@@ -88,8 +91,26 @@
         return "???";
     }
 
+    protected String space(int w) {
+        if (w < spaces.length && spaces[w] != null)
+            return spaces[w];
+
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < w; i++)
+            sb.append(" ");
+
+        String s = sb.toString();
+        if (w < spaces.length)
+            spaces[w] = s;
+
+        return s;
+    }
+
+    private String[] spaces = new String[80];
+
     private LineWriter lineWriter;
     private PrintWriter out;
+    protected Messages messages;
 
     private static class LineWriter {
         static LineWriter instance(Context context) {
--- a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,9 @@
 package com.sun.tools.javap;
 
 import java.net.URI;
+import java.text.DateFormat;
 import java.util.Collection;
+import java.util.Date;
 import java.util.List;
 
 import com.sun.tools.classfile.AccessFlags;
@@ -47,8 +49,6 @@
 import com.sun.tools.classfile.SourceFile_attribute;
 import com.sun.tools.classfile.Type;
 
-import java.text.DateFormat;
-import java.util.Date;
 import static com.sun.tools.classfile.AccessFlags.*;
 
 /*
--- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,6 +25,9 @@
 
 package com.sun.tools.javap;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import com.sun.tools.classfile.AccessFlags;
 import com.sun.tools.classfile.Code_attribute;
 import com.sun.tools.classfile.ConstantPool;
@@ -33,9 +36,6 @@
 import com.sun.tools.classfile.Instruction;
 import com.sun.tools.classfile.Instruction.TypeKind;
 import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.Opcode;
-
-//import static com.sun.tools.classfile.OpCodes.*;
 
 /*
  *  Write the contents of a Code attribute.
@@ -59,6 +59,12 @@
         attrWriter = AttributeWriter.instance(context);
         classWriter = ClassWriter.instance(context);
         constantWriter = ConstantWriter.instance(context);
+        sourceWriter = SourceWriter.instance(context);
+        tryBlockWriter = TryBlockWriter.instance(context);
+        stackMapWriter = StackMapWriter.instance(context);
+        localVariableTableWriter = LocalVariableTableWriter.instance(context);
+        localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
+        options = Options.instance(context);
     }
 
     void write(Code_attribute attr, ConstantPool constant_pool) {
@@ -90,14 +96,21 @@
     }
 
     public void writeInstrs(Code_attribute attr) {
+        List<InstructionDetailWriter> detailWriters = getDetailWriters(attr);
+
         for (Instruction instr: attr.getInstructions()) {
             try {
+                for (InstructionDetailWriter w: detailWriters)
+                    w.writeDetails(instr);
                 writeInstr(instr);
             } catch (ArrayIndexOutOfBoundsException e) {
                 println(report("error at or after byte " + instr.getPC()));
                 break;
             }
         }
+
+        for (InstructionDetailWriter w: detailWriters)
+            w.flush();
     }
 
     public void writeInstr(Instruction instr) {
@@ -211,11 +224,45 @@
         print(s);
     }
 
-    private static int align(int n) {
-        return (n + 3) & ~3;
+    private List<InstructionDetailWriter> getDetailWriters(Code_attribute attr) {
+        List<InstructionDetailWriter> detailWriters =
+                new ArrayList<InstructionDetailWriter>();
+        if (options.details.contains(InstructionDetailWriter.Kind.SOURCE)) {
+            sourceWriter.reset(classWriter.getClassFile(), attr);
+            detailWriters.add(sourceWriter);
+        }
+
+        if (options.details.contains(InstructionDetailWriter.Kind.LOCAL_VARS)) {
+            localVariableTableWriter.reset(attr);
+            detailWriters.add(localVariableTableWriter);
+        }
+
+        if (options.details.contains(InstructionDetailWriter.Kind.LOCAL_VAR_TYPES)) {
+            localVariableTypeTableWriter.reset(attr);
+            detailWriters.add(localVariableTypeTableWriter);
+        }
+
+        if (options.details.contains(InstructionDetailWriter.Kind.STACKMAPS)) {
+            stackMapWriter.reset(attr);
+            stackMapWriter.writeInitialDetails();
+            detailWriters.add(stackMapWriter);
+        }
+
+        if (options.details.contains(InstructionDetailWriter.Kind.TRY_BLOCKS)) {
+            tryBlockWriter.reset(attr);
+            detailWriters.add(tryBlockWriter);
+        }
+
+        return detailWriters;
     }
 
     private AttributeWriter attrWriter;
     private ClassWriter classWriter;
     private ConstantWriter constantWriter;
+    private LocalVariableTableWriter localVariableTableWriter;
+    private LocalVariableTypeTableWriter localVariableTypeTableWriter;
+    private SourceWriter sourceWriter;
+    private StackMapWriter stackMapWriter;
+    private TryBlockWriter tryBlockWriter;
+    private Options options;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Instruction;
+
+
+/*
+ *  Write additional details for an instruction.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public abstract class InstructionDetailWriter extends BasicWriter {
+    public enum Kind {
+        LOCAL_VARS("localVariables"),
+        LOCAL_VAR_TYPES("localVariableTypes"),
+        SOURCE("source"),
+        STACKMAPS("stackMaps"),
+        TRY_BLOCKS("tryBlocks");
+        Kind(String option) {
+            this.option = option;
+        }
+        final String option;
+    }
+    InstructionDetailWriter(Context context) {
+        super(context);
+    }
+
+    abstract void writeDetails(Instruction instr);
+    void flush() { }
+}
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Mon Jul 06 11:42:37 2009 -0700
@@ -39,6 +39,7 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -65,7 +66,7 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class JavapTask implements DisassemblerTool.DisassemblerTask {
+public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
     public class BadArgs extends Exception {
         static final long serialVersionUID = 8765093759964640721L;
         BadArgs(String key, Object... args) {
@@ -211,9 +212,7 @@
 
         new Option(false, "-Xold") {
             void process(JavapTask task, String opt, String arg) throws BadArgs {
-                // -Xold is only supported as first arg when invoked from
-                // command line; this is handled in Main,main
-                throw task.new BadArgs("err.Xold.not.supported.here");
+                task.log.println(task.getMessage("warn.Xold.not.supported"));
             }
         },
 
@@ -241,6 +240,56 @@
             }
         },
 
+        new Option(false, "-XDdetails") {
+            void process(JavapTask task, String opt, String arg) {
+                task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
+            }
+
+        },
+
+        new Option(false, "-XDdetails:") {
+            @Override
+            boolean matches(String opt) {
+                int sep = opt.indexOf(":");
+                return sep != -1 && super.matches(opt.substring(0, sep + 1));
+            }
+
+            void process(JavapTask task, String opt, String arg) throws BadArgs {
+                int sep = opt.indexOf(":");
+                for (String v: opt.substring(sep + 1).split("[,: ]+")) {
+                    if (!handleArg(task, v))
+                        throw task.new BadArgs("err.invalid.arg.for.option", v);
+                }
+            }
+
+            boolean handleArg(JavapTask task, String arg) {
+                if (arg.length() == 0)
+                    return true;
+
+                if (arg.equals("all")) {
+                    task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
+                    return true;
+                }
+
+                boolean on = true;
+                if (arg.startsWith("-")) {
+                    on = false;
+                    arg = arg.substring(1);
+                }
+
+                for (InstructionDetailWriter.Kind k: InstructionDetailWriter.Kind.values()) {
+                    if (arg.equalsIgnoreCase(k.option)) {
+                        if (on)
+                            task.options.details.add(k);
+                        else
+                            task.options.details.remove(k);
+                        return true;
+                    }
+                }
+                return false;
+            }
+        },
+
         new Option(false, "-constants") {
             void process(JavapTask task, String opt, String arg) {
                 task.options.showConstants = true;
@@ -251,6 +300,7 @@
 
     JavapTask() {
         context = new Context();
+        context.put(Messages.class, this);
         options = Options.instance(context);
     }
 
@@ -469,6 +519,8 @@
 
         context.put(PrintWriter.class, log);
         ClassWriter classWriter = ClassWriter.instance(context);
+        SourceWriter sourceWriter = SourceWriter.instance(context);
+        sourceWriter.setFileManager(fileManager);
 
         boolean ok = true;
 
@@ -651,11 +703,11 @@
 
     }
 
-    private String getMessage(String key, Object... args) {
+    public String getMessage(String key, Object... args) {
         return getMessage(task_locale, key, args);
     }
 
-    private String getMessage(Locale locale, String key, Object... args) {
+    public String getMessage(Locale locale, String key, Object... args) {
         if (bundles == null) {
             // could make this a HashMap<Locale,SoftReference<ResourceBundle>>
             // and for efficiency, keep a hard reference to the bundle for the task
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.LocalVariableTable_attribute;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * Annotate instructions with details about local variables.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class LocalVariableTableWriter extends  InstructionDetailWriter {
+    public enum NoteKind {
+        START("start") {
+            public boolean match(LocalVariableTable_attribute.Entry entry, int pc) {
+                return (pc == entry.start_pc);
+            }
+        },
+        END("end") {
+            public boolean match(LocalVariableTable_attribute.Entry entry, int pc) {
+                return (pc == entry.start_pc + entry.length);
+            }
+        };
+        NoteKind(String text) {
+            this.text = text;
+        }
+        public abstract boolean match(LocalVariableTable_attribute.Entry entry, int pc);
+        public final String text;
+    };
+
+    static LocalVariableTableWriter instance(Context context) {
+        LocalVariableTableWriter instance = context.get(LocalVariableTableWriter.class);
+        if (instance == null)
+            instance = new LocalVariableTableWriter(context);
+        return instance;
+    }
+
+    protected LocalVariableTableWriter(Context context) {
+        super(context);
+        context.put(LocalVariableTableWriter.class, this);
+        classWriter = ClassWriter.instance(context);
+    }
+
+    public void reset(Code_attribute attr) {
+        codeAttr = attr;
+        pcMap = new HashMap<Integer, List<LocalVariableTable_attribute.Entry>>();
+        LocalVariableTable_attribute lvt =
+                (LocalVariableTable_attribute) (attr.attributes.get(Attribute.LocalVariableTable));
+        if (lvt == null)
+            return;
+
+        for (int i = 0; i < lvt.local_variable_table.length; i++) {
+            LocalVariableTable_attribute.Entry entry = lvt.local_variable_table[i];
+            put(entry.start_pc, entry);
+            put(entry.start_pc + entry.length, entry);
+        }
+    }
+
+    public void writeDetails(Instruction instr) {
+        int pc = instr.getPC();
+        writeLocalVariables(pc, NoteKind.END);
+        writeLocalVariables(pc, NoteKind.START);
+    }
+
+    @Override
+    public void flush() {
+        int pc = codeAttr.code_length;
+        writeLocalVariables(pc, NoteKind.END);
+    }
+
+    public void writeLocalVariables(int pc, NoteKind kind) {
+        ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
+        String indent = space(2); // get from Options?
+        List<LocalVariableTable_attribute.Entry> entries = pcMap.get(pc);
+        if (entries != null) {
+            for (ListIterator<LocalVariableTable_attribute.Entry> iter =
+                    entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
+                    kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
+                LocalVariableTable_attribute.Entry entry =
+                        kind == NoteKind.END ? iter.previous() : iter.next();
+                if (kind.match(entry, pc)) {
+                    print(indent);
+                    print(kind.text);
+                    print(" local ");
+                    print(entry.index);
+                    print(" // ");
+                    Descriptor d = new Descriptor(entry.descriptor_index);
+                    try {
+                        print(d.getFieldType(constant_pool));
+                    } catch (InvalidDescriptor e) {
+                        print(report(e));
+                    } catch (ConstantPoolException e) {
+                        print(report(e));
+                    }
+                    print(" ");
+                    try {
+                        print(constant_pool.getUTF8Value(entry.name_index));
+                    } catch (ConstantPoolException e) {
+                        print(report(e));
+                    }
+                    println();
+                }
+            }
+        }
+    }
+
+    private void put(int pc, LocalVariableTable_attribute.Entry entry) {
+        List<LocalVariableTable_attribute.Entry> list = pcMap.get(pc);
+        if (list == null) {
+            list = new ArrayList<LocalVariableTable_attribute.Entry>();
+            pcMap.put(pc, list);
+        }
+        if (!list.contains(entry))
+            list.add(entry);
+    }
+
+    private ClassWriter classWriter;
+    private Code_attribute codeAttr;
+    private Map<Integer, List<LocalVariableTable_attribute.Entry>> pcMap;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
+import com.sun.tools.classfile.Signature;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * Annotate instructions with details about local variables.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class LocalVariableTypeTableWriter extends  InstructionDetailWriter {
+    public enum NoteKind {
+        START("start") {
+            public boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc) {
+                return (pc == entry.start_pc);
+            }
+        },
+        END("end") {
+            public boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc) {
+                return (pc == entry.start_pc + entry.length);
+            }
+        };
+        NoteKind(String text) {
+            this.text = text;
+        }
+        public abstract boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc);
+        public final String text;
+    };
+
+    static LocalVariableTypeTableWriter instance(Context context) {
+        LocalVariableTypeTableWriter instance = context.get(LocalVariableTypeTableWriter.class);
+        if (instance == null)
+            instance = new LocalVariableTypeTableWriter(context);
+        return instance;
+    }
+
+    protected LocalVariableTypeTableWriter(Context context) {
+        super(context);
+        context.put(LocalVariableTypeTableWriter.class, this);
+        classWriter = ClassWriter.instance(context);
+    }
+
+    public void reset(Code_attribute attr) {
+        codeAttr = attr;
+        pcMap = new HashMap<Integer, List<LocalVariableTypeTable_attribute.Entry>>();
+        LocalVariableTypeTable_attribute lvt =
+                (LocalVariableTypeTable_attribute) (attr.attributes.get(Attribute.LocalVariableTypeTable));
+        if (lvt == null)
+            return;
+
+        for (int i = 0; i < lvt.local_variable_table.length; i++) {
+            LocalVariableTypeTable_attribute.Entry entry = lvt.local_variable_table[i];
+            put(entry.start_pc, entry);
+            put(entry.start_pc + entry.length, entry);
+        }
+    }
+
+    public void writeDetails(Instruction instr) {
+        int pc = instr.getPC();
+        writeLocalVariables(pc, NoteKind.END);
+        writeLocalVariables(pc, NoteKind.START);
+    }
+
+    @Override
+    public void flush() {
+        int pc = codeAttr.code_length;
+        writeLocalVariables(pc, NoteKind.END);
+    }
+
+    public void writeLocalVariables(int pc, NoteKind kind) {
+        ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
+        String indent = space(2); // get from Options?
+        List<LocalVariableTypeTable_attribute.Entry> entries = pcMap.get(pc);
+        if (entries != null) {
+            for (ListIterator<LocalVariableTypeTable_attribute.Entry> iter =
+                    entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
+                    kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
+                LocalVariableTypeTable_attribute.Entry entry =
+                        kind == NoteKind.END ? iter.previous() : iter.next();
+                if (kind.match(entry, pc)) {
+                    print(indent);
+                    print(kind.text);
+                    print(" generic local ");
+                    print(entry.index);
+                    print(" // ");
+                    Descriptor d = new Signature(entry.signature_index);
+                    try {
+                        print(d.getFieldType(constant_pool));
+                    } catch (InvalidDescriptor e) {
+                        print(report(e));
+                    } catch (ConstantPoolException e) {
+                        print(report(e));
+                    }
+                    print(" ");
+                    try {
+                        print(constant_pool.getUTF8Value(entry.name_index));
+                    } catch (ConstantPoolException e) {
+                        print(report(e));
+                    }
+                    println();
+                }
+            }
+        }
+    }
+
+    private void put(int pc, LocalVariableTypeTable_attribute.Entry entry) {
+        List<LocalVariableTypeTable_attribute.Entry> list = pcMap.get(pc);
+        if (list == null) {
+            list = new ArrayList<LocalVariableTypeTable_attribute.Entry>();
+            pcMap.put(pc, list);
+        }
+        if (!list.contains(entry))
+            list.add(entry);
+    }
+
+    private ClassWriter classWriter;
+    private Code_attribute codeAttr;
+    private Map<Integer, List<LocalVariableTypeTable_attribute.Entry>> pcMap;
+}
--- a/langtools/src/share/classes/com/sun/tools/javap/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -42,13 +42,6 @@
      * @param args command line arguments
      */
     public static void main(String[] args) {
-        if (args.length >= 1 && args[0].equals("-Xold")) {
-            String[] nArgs = new String[args.length - 1];
-            System.arraycopy(args, 1, nArgs, 0, nArgs.length);
-            sun.tools.javap.Main.main(args);  // calls System.exit
-            System.exit(1);
-        }
-
         JavapTask t = new JavapTask();
         int rc = t.run(args);
         System.exit(rc);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/Messages.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2007-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javap;
+
+import java.util.Locale;
+
+/**
+ *  Access to javap messages.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public interface Messages {
+    String getMessage(String key, Object... args);
+
+    String getMessage(Locale locale, String key, Object... args);
+}
--- a/langtools/src/share/classes/com/sun/tools/javap/Options.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/Options.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,8 +25,10 @@
 
 package com.sun.tools.javap;
 
+import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
+
 import com.sun.tools.classfile.AccessFlags;
 
 /*
@@ -77,6 +79,7 @@
     public boolean showLineAndLocalVariableTables;
     public int showAccess;
     public Set<String> accessOptions = new HashSet<String>();
+    public Set<InstructionDetailWriter.Kind> details = EnumSet.noneOf(InstructionDetailWriter.Kind.class);
     public boolean showDisassembled;
     public boolean showInternalSignatures;
     public boolean showAllAttrs;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/SourceWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javap;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.LineNumberTable_attribute;
+import com.sun.tools.classfile.SourceFile_attribute;
+
+
+/**
+ * Annotate instructions with source code.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class SourceWriter extends InstructionDetailWriter {
+    static SourceWriter instance(Context context) {
+        SourceWriter instance = context.get(SourceWriter.class);
+        if (instance == null)
+            instance = new SourceWriter(context);
+        return instance;
+    }
+
+    protected SourceWriter(Context context) {
+        super(context);
+        context.put(SourceWriter.class, this);
+    }
+
+    void setFileManager(JavaFileManager fileManager) {
+        this.fileManager = fileManager;
+    }
+
+    public void reset(ClassFile cf, Code_attribute attr) {
+        setSource(cf);
+        setLineMap(attr);
+    }
+
+    public void writeDetails(Instruction instr) {
+        String indent = space(40); // could get from Options?
+        Set<Integer> lines = lineMap.get(instr.getPC());
+        if (lines != null) {
+            for (int line: lines) {
+                print(indent);
+                print(String.format(" %4d ", line));
+                if (line < sourceLines.length)
+                    print(sourceLines[line]);
+                println();
+                int nextLine = nextLine(line);
+                for (int i = line + 1; i < nextLine; i++) {
+                    print(indent);
+                    print(String.format("(%4d)", i));
+                    if (i < sourceLines.length)
+                        print(sourceLines[i]);
+                    println();
+                }
+            }
+        }
+
+    }
+
+    private void setLineMap(Code_attribute attr) {
+        SortedMap<Integer, SortedSet<Integer>> map =
+                new TreeMap<Integer, SortedSet<Integer>>();
+        SortedSet<Integer> allLines = new TreeSet<Integer>();
+        for (Attribute a: attr.attributes) {
+            if (a instanceof LineNumberTable_attribute) {
+                LineNumberTable_attribute t = (LineNumberTable_attribute) a;
+                for (LineNumberTable_attribute.Entry e: t.line_number_table) {
+                    int start_pc = e.start_pc;
+                    int line = e.line_number;
+                    SortedSet<Integer> pcLines = map.get(start_pc);
+                    if (pcLines == null) {
+                        pcLines = new TreeSet<Integer>();
+                        map.put(start_pc, pcLines);
+                    }
+                    pcLines.add(line);
+                    allLines.add(line);
+                }
+            }
+        }
+        lineMap = map;
+        lineList = new ArrayList<Integer>(allLines);
+    }
+
+    private void setSource(ClassFile cf) {
+        if (cf != classFile) {
+            classFile = cf;
+            sourceLines = splitLines(readSource(cf));
+        }
+    }
+
+    private String readSource(ClassFile cf) {
+        Location location;
+        if (fileManager.hasLocation((StandardLocation.SOURCE_PATH)))
+            location = StandardLocation.SOURCE_PATH;
+        else
+            location = StandardLocation.CLASS_PATH;
+
+        // Guess the source file for a class from the package name for this
+        // class and the base of the source file. This avoids having to read
+        // additional classes to determine the outmost class from any
+        // InnerClasses and EnclosingMethod attributes.
+        try {
+            String className = cf.getName();
+            SourceFile_attribute sf =
+                    (SourceFile_attribute) cf.attributes.get(Attribute.SourceFile);
+            if (sf == null) {
+                report(messages.getMessage("err.no.SourceFile.attribute"));
+                return null;
+            }
+            String sourceFile = sf.getSourceFile(cf.constant_pool);
+            String fileBase = sourceFile.endsWith(".java")
+                ? sourceFile.substring(0, sourceFile.length() - 5) : sourceFile;
+            int sep = className.lastIndexOf("/");
+            String pkgName = (sep == -1 ? "" : className.substring(0, sep+1));
+            String topClassName = (pkgName + fileBase).replace('/', '.');
+            JavaFileObject fo =
+                    fileManager.getJavaFileForInput(location,
+                    topClassName,
+                    JavaFileObject.Kind.SOURCE);
+            if (fo == null) {
+                report(messages.getMessage("err.source.file.not.found"));
+                return null;
+            }
+            return fo.getCharContent(true).toString();
+        } catch (ConstantPoolException e) {
+            report(e);
+            return null;
+        } catch (IOException e) {
+            report(e.getLocalizedMessage());
+            return null;
+        }
+    }
+
+    private static String[] splitLines(String text) {
+        if (text == null)
+            return new String[0];
+
+        List<String> lines = new ArrayList<String>();
+        lines.add(""); // dummy line 0
+        try {
+            BufferedReader r = new BufferedReader(new StringReader(text));
+            String line;
+            while ((line = r.readLine()) != null)
+                lines.add(line);
+        } catch (IOException ignore) {
+        }
+        return lines.toArray(new String[lines.size()]);
+    }
+
+    private int nextLine(int line) {
+        int i = lineList.indexOf(line);
+        if (i == -1 || i == lineList.size() - 1)
+            return - 1;
+        return lineList.get(i + 1);
+    }
+
+    private JavaFileManager fileManager;
+    private ClassFile classFile;
+    private SortedMap<Integer, SortedSet<Integer>> lineMap;
+    private List<Integer> lineList;
+    private String[] sourceLines;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.AccessFlags;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.StackMapTable_attribute;
+import com.sun.tools.classfile.StackMapTable_attribute.*;
+
+import static com.sun.tools.classfile.StackMapTable_attribute.verification_type_info.*;
+
+/**
+ * Annotate instructions with stack map.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class StackMapWriter extends InstructionDetailWriter {
+    static StackMapWriter instance(Context context) {
+        StackMapWriter instance = context.get(StackMapWriter.class);
+        if (instance == null)
+            instance = new StackMapWriter(context);
+        return instance;
+    }
+
+    protected StackMapWriter(Context context) {
+        super(context);
+        context.put(StackMapWriter.class, this);
+        classWriter = ClassWriter.instance(context);
+    }
+
+    public void reset(Code_attribute attr) {
+        setStackMap((StackMapTable_attribute) attr.attributes.get(Attribute.StackMapTable));
+    }
+
+    void setStackMap(StackMapTable_attribute attr) {
+        if (attr == null) {
+            map = null;
+            return;
+        }
+
+        Method m = classWriter.getMethod();
+        Descriptor d = m.descriptor;
+        String[] args;
+        try {
+            ConstantPool cp = classWriter.getClassFile().constant_pool;
+            String argString = d.getParameterTypes(cp);
+            args = argString.substring(1, argString.length() - 1).split("[, ]+");
+        } catch (ConstantPoolException e) {
+            return;
+        } catch (InvalidDescriptor e) {
+            return;
+        }
+        boolean isStatic = m.access_flags.is(AccessFlags.ACC_STATIC);
+
+        verification_type_info[] initialLocals = new verification_type_info[(isStatic ? 0 : 1) + args.length];
+        if (!isStatic)
+            initialLocals[0] = new CustomVerificationTypeInfo("this");
+        for (int i = 0; i < args.length; i++) {
+            initialLocals[(isStatic ? 0 : 1) + i] =
+                    new CustomVerificationTypeInfo(args[i].replace(".", "/"));
+        }
+
+        map = new HashMap<Integer, StackMap>();
+        StackMapBuilder builder = new StackMapBuilder();
+
+        // using -1 as the pc for the initial frame effectively compensates for
+        // the difference in behavior for the first stack map frame (where the
+        // pc offset is just offset_delta) compared to subsequent frames (where
+        // the pc offset is always offset_delta+1).
+        int pc = -1;
+
+        map.put(pc, new StackMap(initialLocals, empty));
+
+        for (int i = 0; i < attr.entries.length; i++)
+            pc = attr.entries[i].accept(builder, pc);
+    }
+
+    public void writeInitialDetails() {
+        writeDetails(-1);
+    }
+
+    public void writeDetails(Instruction instr) {
+        writeDetails(instr.getPC());
+    }
+
+    private void writeDetails(int pc) {
+        if (map == null)
+            return;
+
+        StackMap m = map.get(pc);
+        if (m != null) {
+            print("StackMap locals: ", m.locals);
+            print("StackMap stack: ", m.stack);
+        }
+
+    }
+
+    void print(String label, verification_type_info[] entries) {
+        print(label);
+        for (int i = 0; i < entries.length; i++) {
+            print(" ");
+            print(entries[i]);
+        }
+        println();
+    }
+
+    void print(verification_type_info entry) {
+        if (entry == null) {
+            print("ERROR");
+            return;
+        }
+
+        switch (entry.tag) {
+            case -1:
+                print(((CustomVerificationTypeInfo) entry).text);
+                break;
+
+            case ITEM_Top:
+                print("top");
+                break;
+
+            case ITEM_Integer:
+                print("int");
+                break;
+
+            case ITEM_Float:
+                print("float");
+                break;
+
+            case ITEM_Long:
+                print("long");
+                break;
+
+            case ITEM_Double:
+                print("double");
+                break;
+
+            case ITEM_Null:
+                print("null");
+                break;
+
+            case ITEM_UninitializedThis:
+                print("uninit_this");
+                break;
+
+            case ITEM_Object:
+                try {
+                    ConstantPool cp = classWriter.getClassFile().constant_pool;
+                    ConstantPool.CONSTANT_Class_info class_info = cp.getClassInfo(((Object_variable_info) entry).cpool_index);
+                    print(cp.getUTF8Value(class_info.name_index));
+                } catch (ConstantPoolException e) {
+                    print("??");
+                }
+                break;
+
+            case ITEM_Uninitialized:
+                print(((Uninitialized_variable_info) entry).offset);
+                break;
+        }
+
+    }
+
+    private Map<Integer, StackMap> map;
+    private ClassWriter classWriter;
+
+    class StackMapBuilder
+            implements StackMapTable_attribute.stack_map_frame.Visitor<Integer, Integer> {
+
+        public Integer visit_same_frame(same_frame frame, Integer pc) {
+            int new_pc = pc + frame.getOffsetDelta() + 1;
+            StackMap m = map.get(pc);
+            assert (m != null);
+            map.put(new_pc, m);
+            return new_pc;
+        }
+
+        public Integer visit_same_locals_1_stack_item_frame(same_locals_1_stack_item_frame frame, Integer pc) {
+            int new_pc = pc + frame.getOffsetDelta() + 1;
+            StackMap prev = map.get(pc);
+            assert (prev != null);
+            StackMap m = new StackMap(prev.locals, frame.stack);
+            map.put(new_pc, m);
+            return new_pc;
+        }
+
+        public Integer visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended frame, Integer pc) {
+            int new_pc = pc + frame.getOffsetDelta() + 1;
+            StackMap prev = map.get(pc);
+            assert (prev != null);
+            StackMap m = new StackMap(prev.locals, frame.stack);
+            map.put(new_pc, m);
+            return new_pc;
+        }
+
+        public Integer visit_chop_frame(chop_frame frame, Integer pc) {
+            int new_pc = pc + frame.getOffsetDelta() + 1;
+            StackMap prev = map.get(pc);
+            assert (prev != null);
+            int k = 251 - frame.frame_type;
+            verification_type_info[] new_locals = new verification_type_info[prev.locals.length - k];
+            System.arraycopy(prev.locals, 0, new_locals, 0, new_locals.length);
+            StackMap m = new StackMap(new_locals, empty);
+            map.put(new_pc, m);
+            return new_pc;
+        }
+
+        public Integer visit_same_frame_extended(same_frame_extended frame, Integer pc) {
+            int new_pc = pc + frame.getOffsetDelta();
+            StackMap m = map.get(pc);
+            assert (m != null);
+            map.put(new_pc, m);
+            return new_pc;
+        }
+
+        public Integer visit_append_frame(append_frame frame, Integer pc) {
+            int new_pc = pc + frame.getOffsetDelta() + 1;
+            StackMap prev = map.get(pc);
+            assert (prev != null);
+            verification_type_info[] new_locals = new verification_type_info[prev.locals.length + frame.locals.length];
+            System.arraycopy(prev.locals, 0, new_locals, 0, prev.locals.length);
+            System.arraycopy(frame.locals, 0, new_locals, prev.locals.length, frame.locals.length);
+            StackMap m = new StackMap(new_locals, empty);
+            map.put(new_pc, m);
+            return new_pc;
+        }
+
+        public Integer visit_full_frame(full_frame frame, Integer pc) {
+            int new_pc = pc + frame.getOffsetDelta() + 1;
+            StackMap m = new StackMap(frame.locals, frame.stack);
+            map.put(new_pc, m);
+            return new_pc;
+        }
+
+    }
+
+    class StackMap {
+        StackMap(verification_type_info[] locals, verification_type_info[] stack) {
+            this.locals = locals;
+            this.stack = stack;
+        }
+
+        private final verification_type_info[] locals;
+        private final verification_type_info[] stack;
+    }
+
+    class CustomVerificationTypeInfo extends verification_type_info {
+        public CustomVerificationTypeInfo(String text) {
+            super(-1);
+            this.text = text;
+        }
+        private String text;
+    }
+
+    private final verification_type_info[] empty = { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/TryBlockWriter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.Code_attribute.Exception_data;
+import com.sun.tools.classfile.Instruction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * Annotate instructions with details about try blocks.
+ *
+ *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class TryBlockWriter extends InstructionDetailWriter {
+    public enum NoteKind {
+        START("try") {
+            public boolean match(Exception_data entry, int pc) {
+                return (pc == entry.start_pc);
+            }
+        },
+        END("end try") {
+            public boolean match(Exception_data entry, int pc) {
+                return (pc == entry.end_pc);
+            }
+        },
+        HANDLER("catch") {
+            public boolean match(Exception_data entry, int pc) {
+                return (pc == entry.handler_pc);
+            }
+        };
+        NoteKind(String text) {
+            this.text = text;
+        }
+        public abstract boolean match(Exception_data entry, int pc);
+        public final String text;
+    };
+
+    static TryBlockWriter instance(Context context) {
+        TryBlockWriter instance = context.get(TryBlockWriter.class);
+        if (instance == null)
+            instance = new TryBlockWriter(context);
+        return instance;
+    }
+
+    protected TryBlockWriter(Context context) {
+        super(context);
+        context.put(TryBlockWriter.class, this);
+        constantWriter = ConstantWriter.instance(context);
+    }
+
+    public void reset(Code_attribute attr) {
+        indexMap = new HashMap<Exception_data, Integer>();
+        pcMap = new HashMap<Integer, List<Exception_data>>();
+        for (int i = 0; i < attr.exception_table.length; i++) {
+            Exception_data entry = attr.exception_table[i];
+            indexMap.put(entry, i);
+            put(entry.start_pc, entry);
+            put(entry.end_pc, entry);
+            put(entry.handler_pc, entry);
+        }
+    }
+
+    public void writeDetails(Instruction instr) {
+        writeTrys(instr, NoteKind.END);
+        writeTrys(instr, NoteKind.START);
+        writeTrys(instr, NoteKind.HANDLER);
+    }
+
+    public void writeTrys(Instruction instr, NoteKind kind) {
+        String indent = space(2); // get from Options?
+        int pc = instr.getPC();
+        List<Exception_data> entries = pcMap.get(pc);
+        if (entries != null) {
+            for (ListIterator<Exception_data> iter =
+                    entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
+                    kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
+                Exception_data entry =
+                        kind == NoteKind.END ? iter.previous() : iter.next();
+                if (kind.match(entry, pc)) {
+                    print(indent);
+                    print(kind.text);
+                    print("[");
+                    print(indexMap.get(entry));
+                    print("] ");
+                    if (entry.catch_type == 0)
+                        print("finally");
+                    else {
+                        print("#" + entry.catch_type);
+                        print(" // ");
+                        constantWriter.write(entry.catch_type);
+                    }
+                    println();
+                }
+            }
+        }
+    }
+
+    private void put(int pc, Exception_data entry) {
+        List<Exception_data> list = pcMap.get(pc);
+        if (list == null) {
+            list = new ArrayList<Exception_data>();
+            pcMap.put(pc, list);
+        }
+        if (!list.contains(entry))
+            list.add(entry);
+    }
+
+    private Map<Integer, List<Exception_data>> pcMap;
+    private Map<Exception_data, Integer> indexMap;
+    private ConstantWriter constantWriter;
+}
--- a/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties	Mon Jul 06 11:42:37 2009 -0700
@@ -9,13 +9,16 @@
 err.h.not.supported=-h is no longer available - use the 'javah' program
 err.incompatible.options=bad combination of options: {0}
 err.internal.error=internal error: {0} {1} {2}
+err.invalid.arg.for.option=invalid argument for option: {0}
 err.ioerror=IO error reading {0}: {1}
 err.missing.arg=no value given for {0}
 err.no.classes.specified=no classes specified
 err.not.standard.file.manager=can only specify class files when using a standard file manager
 err.unknown.option=unknown option: {0}
 err.verify.not.supported=-verify not supported
-err.Xold.not.supported.here=-Xold must be given as the first option
+err.no.SourceFile.attribute=no SourceFile attribute
+err.source.file.not.found=source file not found
+warn.Xold.not.supported=-Xold is no longer available
 
 main.usage.summary=\
 Usage: {0} <options> <classes>\n\
--- a/langtools/src/share/classes/sun/tools/javap/AttrData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-
-package sun.tools.javap;
-
-import java.io.*;
-
-/**
- * Reads and stores attribute information.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-class AttrData {
-    ClassData cls;
-    int name_cpx;
-    int datalen;
-    byte data[];
-
-    public AttrData (ClassData cls) {
-        this.cls=cls;
-    }
-
-    /**
-     * Reads unknown attribute.
-     */
-    public void read(int name_cpx, DataInputStream in) throws IOException {
-        this.name_cpx=name_cpx;
-        datalen=in.readInt();
-        data=new byte[datalen];
-        in.readFully(data);
-    }
-
-    /**
-     * Reads just the name of known attribute.
-     */
-    public void read(int name_cpx){
-        this.name_cpx=name_cpx;
-    }
-
-    /**
-     * Returns attribute name.
-     */
-    public String getAttrName(){
-        return cls.getString(name_cpx);
-    }
-
-    /**
-     * Returns attribute data.
-     */
-    public byte[] getData(){
-        return data;
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/CPX.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-/**
- * Stores constant pool entry information with one field.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-class CPX {
-    int cpx;
-
-    CPX (int cpx) {
-        this.cpx=cpx;
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/CPX2.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-/**
- *  Stores constant pool entry information with two fields.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-class CPX2 {
-    int cpx1,cpx2;
-
-    CPX2 (int cpx1, int cpx2) {
-        this.cpx1=cpx1;
-        this.cpx2=cpx2;
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/ClassData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,663 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Central data repository of the Java Disassembler.
- * Stores all the information in java class file.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-public class ClassData implements RuntimeConstants {
-
-    private int magic;
-    private int minor_version;
-    private int major_version;
-    private int cpool_count;
-    private Object cpool[];
-    private int access;
-    private int this_class = 0;;
-    private int super_class;
-    private int interfaces_count;
-    private int[] interfaces = new int[0];;
-    private int fields_count;
-    private FieldData[] fields;
-    private int methods_count;
-    private MethodData[] methods;
-    private InnerClassData[] innerClasses;
-    private int attributes_count;
-    private AttrData[] attrs;
-    private String classname;
-    private String superclassname;
-    private int source_cpx=0;
-    private byte tags[];
-    private Hashtable<Object,Integer> indexHashAscii = new Hashtable<Object,Integer>();
-    private String pkgPrefix="";
-    private int pkgPrefixLen=0;
-
-    /**
-     * Read classfile to disassemble.
-     */
-    public ClassData(InputStream infile){
-        try{
-            this.read(new DataInputStream(infile));
-        }catch (FileNotFoundException ee) {
-            error("cant read file");
-        }catch (Error ee) {
-            ee.printStackTrace();
-            error("fatal error");
-        } catch (Exception ee) {
-            ee.printStackTrace();
-            error("fatal exception");
-        }
-    }
-
-    /**
-     * Reads and stores class file information.
-     */
-    public void read(DataInputStream in) throws IOException {
-        // Read the header
-        magic = in.readInt();
-        if (magic != JAVA_MAGIC) {
-            throw new ClassFormatError("wrong magic: " +
-                                       toHex(magic) + ", expected " +
-                                       toHex(JAVA_MAGIC));
-        }
-        minor_version = in.readShort();
-        major_version = in.readShort();
-        if (major_version != JAVA_VERSION) {
-        }
-
-        // Read the constant pool
-        readCP(in);
-        access = in.readUnsignedShort();
-        this_class = in.readUnsignedShort();
-        super_class = in.readUnsignedShort();
-
-        //Read interfaces.
-        interfaces_count = in.readUnsignedShort();
-        if(interfaces_count > 0){
-            interfaces = new int[interfaces_count];
-        }
-        for (int i = 0; i < interfaces_count; i++) {
-            interfaces[i]=in.readShort();
-        }
-
-        // Read the fields
-        readFields(in);
-
-        // Read the methods
-        readMethods(in);
-
-        // Read the attributes
-        attributes_count = in.readUnsignedShort();
-        attrs=new AttrData[attributes_count];
-        for (int k = 0; k < attributes_count; k++) {
-            int name_cpx=in.readUnsignedShort();
-            if (getTag(name_cpx)==CONSTANT_UTF8
-                && getString(name_cpx).equals("SourceFile")
-                ){      if (in.readInt()!=2)
-                    throw new ClassFormatError("invalid attr length");
-                source_cpx=in.readUnsignedShort();
-                AttrData attr=new AttrData(this);
-                attr.read(name_cpx);
-                attrs[k]=attr;
-
-            } else if (getTag(name_cpx)==CONSTANT_UTF8
-                       && getString(name_cpx).equals("InnerClasses")
-                       ){       int length=in.readInt();
-                       int num=in.readUnsignedShort();
-                       if (2+num*8 != length)
-                           throw new ClassFormatError("invalid attr length");
-                       innerClasses=new InnerClassData[num];
-                       for (int j = 0; j < num; j++) {
-                           InnerClassData innerClass=new InnerClassData(this);
-                           innerClass.read(in);
-                           innerClasses[j]=innerClass;
-                       }
-                       AttrData attr=new AttrData(this);
-                       attr.read(name_cpx);
-                       attrs[k]=attr;
-            } else {
-                AttrData attr=new AttrData(this);
-                attr.read(name_cpx, in);
-                attrs[k]=attr;
-            }
-        }
-        in.close();
-    } // end ClassData.read()
-
-    /**
-     * Reads and stores constant pool info.
-     */
-    void readCP(DataInputStream in) throws IOException {
-        cpool_count = in.readUnsignedShort();
-        tags = new byte[cpool_count];
-        cpool = new Object[cpool_count];
-        for (int i = 1; i < cpool_count; i++) {
-            byte tag = in.readByte();
-
-            switch(tags[i] = tag) {
-            case CONSTANT_UTF8:
-                String str=in.readUTF();
-                indexHashAscii.put(cpool[i] = str, i);
-                break;
-            case CONSTANT_INTEGER:
-                cpool[i] = Integer.valueOf(in.readInt());
-                break;
-            case CONSTANT_FLOAT:
-                cpool[i] = Float.valueOf(in.readFloat());
-                break;
-            case CONSTANT_LONG:
-                cpool[i++] = Long.valueOf(in.readLong());
-                break;
-            case CONSTANT_DOUBLE:
-                cpool[i++] = Double.valueOf(in.readDouble());
-                break;
-            case CONSTANT_CLASS:
-            case CONSTANT_STRING:
-                cpool[i] = new CPX(in.readUnsignedShort());
-                break;
-
-            case CONSTANT_FIELD:
-            case CONSTANT_METHOD:
-            case CONSTANT_INTERFACEMETHOD:
-            case CONSTANT_NAMEANDTYPE:
-                cpool[i] = new CPX2(in.readUnsignedShort(), in.readUnsignedShort());
-                break;
-
-            case 0:
-            default:
-                throw new ClassFormatError("invalid constant type: " + (int)tags[i]);
-            }
-        }
-    }
-
-    /**
-     * Reads and strores field info.
-     */
-    protected void readFields(DataInputStream in) throws IOException {
-        int fields_count = in.readUnsignedShort();
-        fields=new FieldData[fields_count];
-        for (int k = 0; k < fields_count; k++) {
-            FieldData field=new FieldData(this);
-            field.read(in);
-            fields[k]=field;
-        }
-    }
-
-    /**
-     * Reads and strores Method info.
-     */
-    protected void readMethods(DataInputStream in) throws IOException {
-        int methods_count = in.readUnsignedShort();
-        methods=new MethodData[methods_count];
-        for (int k = 0; k < methods_count ; k++) {
-            MethodData method=new MethodData(this);
-            method.read(in);
-            methods[k]=method;
-        }
-    }
-
-    /**
-     * get a string
-     */
-    public String getString(int n) {
-        return (n == 0) ? null : (String)cpool[n];
-    }
-
-    /**
-     * get the type of constant given an index
-     */
-    public byte getTag(int n) {
-        try{
-            return tags[n];
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return (byte)100;
-        }
-    }
-
-    static final String hexString="0123456789ABCDEF";
-
-    public static char hexTable[]=hexString.toCharArray();
-
-    static String toHex(long val, int width) {
-        StringBuffer s = new StringBuffer();
-        for (int i=width-1; i>=0; i--)
-            s.append(hexTable[((int)(val>>(4*i)))&0xF]);
-        return "0x"+s.toString();
-    }
-
-    static String toHex(long val) {
-        int width;
-        for (width=16; width>0; width--) {
-            if ((val>>(width-1)*4)!=0) break;
-        }
-        return toHex(val, width);
-    }
-
-    static String toHex(int val) {
-        int width;
-        for (width=8; width>0; width--) {
-            if ((val>>(width-1)*4)!=0) break;
-        }
-        return toHex(val, width);
-    }
-
-    public void error(String msg) {
-        System.err.println("ERROR:" +msg);
-    }
-
-    /**
-     * Returns the name of this class.
-     */
-    public String getClassName() {
-        String res=null;
-        if (this_class==0) {
-            return res;
-        }
-        int tcpx;
-        try {
-            if (tags[this_class]!=CONSTANT_CLASS) {
-                return res; //"<CP["+cpx+"] is not a Class> ";
-            }
-            tcpx=((CPX)cpool[this_class]).cpx;
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return res; // "#"+cpx+"// invalid constant pool index";
-        } catch (Throwable e) {
-            return res; // "#"+cpx+"// ERROR IN DISASSEMBLER";
-        }
-
-        try {
-            return (String)(cpool[tcpx]);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return  res; // "class #"+scpx+"// invalid constant pool index";
-        } catch (ClassCastException e) {
-            return  res; // "class #"+scpx+"// invalid constant pool reference";
-        } catch (Throwable e) {
-            return res; // "#"+cpx+"// ERROR IN DISASSEMBLER";
-        }
-
-    }
-
-    /**
-     * Returns the name of class at perticular index.
-     */
-    public String getClassName(int cpx) {
-        String res="#"+cpx;
-        if (cpx==0) {
-            return res;
-        }
-        int scpx;
-        try {
-            if (tags[cpx]!=CONSTANT_CLASS) {
-                return res; //"<CP["+cpx+"] is not a Class> ";
-            }
-            scpx=((CPX)cpool[cpx]).cpx;
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return res; // "#"+cpx+"// invalid constant pool index";
-        } catch (Throwable e) {
-            return res; // "#"+cpx+"// ERROR IN DISASSEMBLER";
-        }
-        res="#"+scpx;
-        try {
-            return (String)(cpool[scpx]);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return  res; // "class #"+scpx+"// invalid constant pool index";
-        } catch (ClassCastException e) {
-            return  res; // "class #"+scpx+"// invalid constant pool reference";
-        } catch (Throwable e) {
-            return res; // "#"+cpx+"// ERROR IN DISASSEMBLER";
-        }
-    }
-
-    /**
-     * Returns true if it is a class
-     */
-    public boolean isClass() {
-        if((access & ACC_INTERFACE) == 0) return true;
-        return false;
-    }
-
-    /**
-     * Returns true if it is a interface.
-     */
-    public boolean isInterface(){
-        if((access & ACC_INTERFACE) != 0) return true;
-        return false;
-    }
-
-    /**
-     * Returns true if this member is public, false otherwise.
-     */
-    public boolean isPublic(){
-        return (access & ACC_PUBLIC) != 0;
-    }
-
-    /**
-     * Returns the access of this class or interface.
-     */
-    public String[] getAccess(){
-        Vector<String> v = new Vector<String>();
-        if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
-        if ((access & ACC_FINAL)    !=0) v.addElement("final");
-        if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract");
-        String[] accflags = new String[v.size()];
-        v.copyInto(accflags);
-        return accflags;
-    }
-
-    /**
-     * Returns list of innerclasses.
-     */
-    public InnerClassData[] getInnerClasses(){
-        return innerClasses;
-    }
-
-    /**
-     * Returns list of attributes.
-     */
-    public AttrData[] getAttributes(){
-        return attrs;
-    }
-
-    /**
-     * Returns true if superbit is set.
-     */
-    public boolean isSuperSet(){
-        if ((access & ACC_SUPER)   !=0) return true;
-        return false;
-    }
-
-    /**
-     * Returns super class name.
-     */
-    public String getSuperClassName(){
-        String res=null;
-        if (super_class==0) {
-            return res;
-        }
-        int scpx;
-        try {
-            if (tags[super_class]!=CONSTANT_CLASS) {
-                return res; //"<CP["+cpx+"] is not a Class> ";
-            }
-            scpx=((CPX)cpool[super_class]).cpx;
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return res; // "#"+cpx+"// invalid constant pool index";
-        } catch (Throwable e) {
-            return res; // "#"+cpx+"// ERROR IN DISASSEMBLER";
-        }
-
-        try {
-            return (String)(cpool[scpx]);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return  res; // "class #"+scpx+"// invalid constant pool index";
-        } catch (ClassCastException e) {
-            return  res; // "class #"+scpx+"// invalid constant pool reference";
-        } catch (Throwable e) {
-            return res; // "#"+cpx+"// ERROR IN DISASSEMBLER";
-        }
-    }
-
-    /**
-     * Returns list of super interfaces.
-     */
-    public String[] getSuperInterfaces(){
-        String interfacenames[] = new String[interfaces.length];
-        int interfacecpx = -1;
-        for(int i = 0; i < interfaces.length; i++){
-            interfacecpx=((CPX)cpool[interfaces[i]]).cpx;
-            interfacenames[i] = (String)(cpool[interfacecpx]);
-        }
-        return interfacenames;
-    }
-
-    /**
-     * Returns string at prticular constant pool index.
-     */
-    public String getStringValue(int cpoolx) {
-        try {
-            return ((String)cpool[cpoolx]);
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return "//invalid constant pool index:"+cpoolx;
-        } catch (ClassCastException e) {
-            return "//invalid constant pool ref:"+cpoolx;
-        }
-    }
-
-    /**
-     * Returns list of field info.
-     */
-    public  FieldData[] getFields(){
-        return fields;
-    }
-
-    /**
-     * Returns list of method info.
-     */
-    public  MethodData[] getMethods(){
-        return methods;
-    }
-
-    /**
-     * Returns constant pool entry at that index.
-     */
-    public CPX2 getCpoolEntry(int cpx){
-        return ((CPX2)(cpool[cpx]));
-    }
-
-    public Object getCpoolEntryobj(int cpx){
-        return (cpool[cpx]);
-    }
-
-    /**
-     * Returns index of this class.
-     */
-    public int getthis_cpx(){
-        return this_class;
-    }
-
-    public String TagString (int tag) {
-        String res=Tables.tagName(tag);
-        if (res==null)  return "BOGUS_TAG:"+tag;
-        return res;
-    }
-
-    /**
-     * Returns string at that index.
-     */
-    public String StringValue(int cpx) {
-        if (cpx==0) return "#0";
-        int tag;
-        Object x;
-        String suffix="";
-        try {
-            tag=tags[cpx];
-            x=cpool[cpx];
-        } catch (IndexOutOfBoundsException e) {
-            return "<Incorrect CP index:"+cpx+">";
-        }
-
-        if (x==null) return "<NULL>";
-        switch (tag) {
-        case CONSTANT_UTF8: {
-            StringBuffer sb=new StringBuffer();
-            String s=(String)x;
-            for (int k=0; k<s.length(); k++) {
-                char c=s.charAt(k);
-                switch (c) {
-                case '\t': sb.append('\\').append('t'); break;
-                case '\n': sb.append('\\').append('n'); break;
-                case '\r': sb.append('\\').append('r'); break;
-                case '\"': sb.append('\\').append('\"'); break;
-                default: sb.append(c);
-                }
-            }
-            return sb.toString();
-        }
-        case CONSTANT_DOUBLE: {
-            Double d=(Double)x;
-            String sd=d.toString();
-            return sd+"d";
-        }
-        case CONSTANT_FLOAT: {
-            Float f=(Float)x;
-            String sf=(f).toString();
-            return sf+"f";
-        }
-        case CONSTANT_LONG: {
-            Long ln = (Long)x;
-            return ln.toString()+'l';
-        }
-        case CONSTANT_INTEGER: {
-            Integer in = (Integer)x;
-            return in.toString();
-        }
-        case CONSTANT_CLASS:
-            return javaName(getClassName(cpx));
-        case CONSTANT_STRING:
-            return StringValue(((CPX)x).cpx);
-        case CONSTANT_FIELD:
-        case CONSTANT_METHOD:
-        case CONSTANT_INTERFACEMETHOD:
-            //return getShortClassName(((CPX2)x).cpx1)+"."+StringValue(((CPX2)x).cpx2);
-             return javaName(getClassName(((CPX2)x).cpx1))+"."+StringValue(((CPX2)x).cpx2);
-
-        case CONSTANT_NAMEANDTYPE:
-            return getName(((CPX2)x).cpx1)+":"+StringValue(((CPX2)x).cpx2);
-        default:
-            return "UnknownTag"; //TBD
-        }
-    }
-
-    /**
-     * Returns resolved java type name.
-     */
-    public String javaName(String name) {
-        if( name==null) return "null";
-        int len=name.length();
-        if (len==0) return "\"\"";
-        int cc='/';
-    fullname: { // xxx/yyy/zzz
-            int cp;
-            for (int k=0; k<len; k += Character.charCount(cp)) {
-                cp=name.codePointAt(k);
-                if (cc=='/') {
-                    if (!Character.isJavaIdentifierStart(cp)) break fullname;
-                } else if (cp!='/') {
-                    if (!Character.isJavaIdentifierPart(cp)) break fullname;
-                }
-                cc=cp;
-            }
-            return name;
-        }
-        return "\""+name+"\"";
-    }
-
-    public String getName(int cpx) {
-        String res;
-        try {
-            return javaName((String)cpool[cpx]); //.replace('/','.');
-        } catch (ArrayIndexOutOfBoundsException e) {
-            return "<invalid constant pool index:"+cpx+">";
-        } catch (ClassCastException e) {
-            return "<invalid constant pool ref:"+cpx+">";
-        }
-    }
-
-    /**
-     * Returns unqualified class name.
-     */
-    public String getShortClassName(int cpx) {
-        String classname=javaName(getClassName(cpx));
-        pkgPrefixLen=classname.lastIndexOf("/")+1;
-        if (pkgPrefixLen!=0) {
-            pkgPrefix=classname.substring(0,pkgPrefixLen);
-            if (classname.startsWith(pkgPrefix)) {
-                return classname.substring(pkgPrefixLen);
-            }
-        }
-        return classname;
-    }
-
-    /**
-     * Returns source file name.
-     */
-    public String getSourceName(){
-        return getName(source_cpx);
-    }
-
-    /**
-     * Returns package name.
-     */
-    public String getPkgName(){
-        String classname=getClassName(this_class);
-        pkgPrefixLen=classname.lastIndexOf("/")+1;
-        if (pkgPrefixLen!=0) {
-            pkgPrefix=classname.substring(0,pkgPrefixLen);
-            return("package  "+pkgPrefix.substring(0,pkgPrefixLen-1)+";\n");
-        }else return null;
-    }
-
-    /**
-     * Returns total constant pool entry count.
-     */
-    public int getCpoolCount(){
-        return cpool_count;
-    }
-
-    public String StringTag(int cpx) {
-        byte tag=0;
-        String str=null;
-        try {
-            if (cpx==0) throw new IndexOutOfBoundsException();
-            tag=tags[cpx];
-            return      TagString(tag);
-        } catch (IndexOutOfBoundsException e) {
-            str="Incorrect CP index:"+cpx;
-        }
-        return str;
-    }
-
-    /**
-     * Returns minor version of class file.
-     */
-    public int getMinor_version(){
-        return minor_version;
-    }
-
-    /**
-     * Returns major version of class file.
-     */
-    public int getMajor_version(){
-        return major_version;
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/Constants.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,372 +0,0 @@
-/*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-
-package sun.tools.javap;
-
-/**
- * This interface defines constant that are used
- * throughout the compiler. It inherits from RuntimeConstants,
- * which is an autogenerated class that contains contstants
- * defined in the interpreter.
- */
-
-public
-interface Constants extends RuntimeConstants {
-
-     /**
-     * End of input
-     */
-    public static final int EOF = -1;
-
-   /*
-     * Flags
-     */
-    public static final int F_VERBOSE           = 1 << 0;
-    public static final int F_DUMP              = 1 << 1;
-    public static final int F_WARNINGS          = 1 << 2;
-    public static final int F_DEBUG             = 1 << 3;
-    public static final int F_OPTIMIZE          = 1 << 4;
-    public static final int F_DEPENDENCIES      = 1 << 5;
-
-    /*
-     * Type codes
-     */
-    public static final int TC_BOOLEAN   = 0;
-    public static final int TC_BYTE      = 1;
-    public static final int TC_CHAR      = 2;
-    public static final int TC_SHORT     = 3;
-    public static final int TC_INT       = 4;
-    public static final int TC_LONG      = 5;
-    public static final int TC_FLOAT     = 6;
-    public static final int TC_DOUBLE    = 7;
-    public static final int TC_NULL      = 8;
-    public static final int TC_ARRAY     = 9;
-    public static final int TC_CLASS     = 10;
-    public static final int TC_VOID      = 11;
-    public static final int TC_METHOD    = 12;
-    public static final int TC_ERROR     = 13;
-
-    /*
-     * Type Masks
-     */
-    public static final int TM_NULL      = 1 << TC_NULL;
-    public static final int TM_VOID      = 1 << TC_VOID;
-    public static final int TM_BOOLEAN   = 1 << TC_BOOLEAN;
-    public static final int TM_BYTE      = 1 << TC_BYTE;
-    public static final int TM_CHAR      = 1 << TC_CHAR;
-    public static final int TM_SHORT     = 1 << TC_SHORT;
-    public static final int TM_INT       = 1 << TC_INT;
-    public static final int TM_LONG      = 1 << TC_LONG;
-    public static final int TM_FLOAT     = 1 << TC_FLOAT;
-    public static final int TM_DOUBLE    = 1 << TC_DOUBLE;
-    public static final int TM_ARRAY     = 1 << TC_ARRAY;
-    public static final int TM_CLASS     = 1 << TC_CLASS;
-    public static final int TM_METHOD    = 1 << TC_METHOD;
-    public static final int TM_ERROR     = 1 << TC_ERROR;
-
-    public static final int TM_INT32     = TM_BYTE | TM_SHORT | TM_CHAR | TM_INT;
-    public static final int TM_NUM32     = TM_INT32 | TM_FLOAT;
-    public static final int TM_NUM64     = TM_LONG | TM_DOUBLE;
-    public static final int TM_INTEGER   = TM_INT32 | TM_LONG;
-    public static final int TM_REAL      = TM_FLOAT | TM_DOUBLE;
-    public static final int TM_NUMBER    = TM_INTEGER | TM_REAL;
-    public static final int TM_REFERENCE = TM_ARRAY | TM_CLASS | TM_NULL;
-
-    /*
-     * Class status
-     */
-    public static final int CS_UNDEFINED        = 0;
-    public static final int CS_UNDECIDED        = 1;
-    public static final int CS_BINARY           = 2;
-    public static final int CS_SOURCE           = 3;
-    public static final int CS_PARSED           = 4;
-    public static final int CS_COMPILED         = 5;
-    public static final int CS_NOTFOUND         = 6;
-
-    /*
-     * Attributes
-     */
-    public static final int ATT_ALL             = -1;
-    public static final int ATT_CODE            = 1;
-
-    /*
-     * Number of bits used in file offsets
-     */
-    public static final int OFFSETBITS          = 19;
-    public static final int MAXFILESIZE         = (1 << OFFSETBITS) - 1;
-    public static final int MAXLINENUMBER       = (1 << (32 - OFFSETBITS)) - 1;
-
-    /*
-     * Operators
-     */
-    public final int COMMA              = 0;
-    public final int ASSIGN             = 1;
-
-    public final int ASGMUL             = 2;
-    public final int ASGDIV             = 3;
-    public final int ASGREM             = 4;
-    public final int ASGADD             = 5;
-    public final int ASGSUB             = 6;
-    public final int ASGLSHIFT          = 7;
-    public final int ASGRSHIFT          = 8;
-    public final int ASGURSHIFT         = 9;
-    public final int ASGBITAND          = 10;
-    public final int ASGBITOR           = 11;
-    public final int ASGBITXOR          = 12;
-
-    public final int COND               = 13;
-    public final int OR                 = 14;
-    public final int AND                = 15;
-    public final int BITOR              = 16;
-    public final int BITXOR             = 17;
-    public final int BITAND             = 18;
-    public final int NE                 = 19;
-    public final int EQ                 = 20;
-    public final int GE                 = 21;
-    public final int GT                 = 22;
-    public final int LE                 = 23;
-    public final int LT                 = 24;
-    public final int INSTANCEOF         = 25;
-    public final int LSHIFT             = 26;
-    public final int RSHIFT             = 27;
-    public final int URSHIFT            = 28;
-    public final int ADD                = 29;
-    public final int SUB                = 30;
-    public final int DIV                = 31;
-    public final int REM                = 32;
-    public final int MUL                = 33;
-    public final int CAST               = 34;           // (x)y
-    public final int POS                = 35;           // +x
-    public final int NEG                = 36;           // -x
-    public final int NOT                = 37;
-    public final int BITNOT             = 38;
-    public final int PREINC             = 39;           // ++x
-    public final int PREDEC             = 40;           // --x
-    public final int NEWARRAY           = 41;
-    public final int NEWINSTANCE        = 42;
-    public final int NEWFROMNAME        = 43;
-    public final int POSTINC            = 44;           // x++
-    public final int POSTDEC            = 45;           // x--
-    public final int FIELD              = 46;
-    public final int METHOD             = 47;           // x(y)
-    public final int ARRAYACCESS        = 48;           // x[y]
-    public final int NEW                = 49;
-    public final int INC                = 50;
-    public final int DEC                = 51;
-
-    public final int CONVERT            = 55;           // implicit conversion
-    public final int EXPR               = 56;           // (x)
-    public final int ARRAY              = 57;           // {x, y, ...}
-    public final int GOTO               = 58;
-
-    /*
-     * Value tokens
-     */
-    public final int IDENT              = 60;
-    public final int BOOLEANVAL         = 61;
-    public final int BYTEVAL            = 62;
-    public final int CHARVAL            = 63;
-    public final int SHORTVAL           = 64;
-    public final int INTVAL                     = 65;
-    public final int LONGVAL            = 66;
-    public final int FLOATVAL           = 67;
-    public final int DOUBLEVAL          = 68;
-    public final int STRINGVAL          = 69;
-
-    /*
-     * Type keywords
-     */
-    public final int BYTE               = 70;
-    public final int CHAR               = 71;
-    public final int SHORT              = 72;
-    public final int INT                = 73;
-    public final int LONG               = 74;
-    public final int FLOAT              = 75;
-    public final int DOUBLE             = 76;
-    public final int VOID               = 77;
-    public final int BOOLEAN            = 78;
-
-    /*
-     * Expression keywords
-     */
-    public final int TRUE               = 80;
-    public final int FALSE              = 81;
-    public final int THIS               = 82;
-    public final int SUPER              = 83;
-    public final int NULL               = 84;
-
-    /*
-     * Statement keywords
-     */
-    public final int IF                 = 90;
-    public final int ELSE               = 91;
-    public final int FOR                = 92;
-    public final int WHILE              = 93;
-    public final int DO                 = 94;
-    public final int SWITCH             = 95;
-    public final int CASE               = 96;
-    public final int DEFAULT            = 97;
-    public final int BREAK              = 98;
-    public final int CONTINUE           = 99;
-    public final int RETURN             = 100;
-    public final int TRY                = 101;
-    public final int CATCH              = 102;
-    public final int FINALLY            = 103;
-    public final int THROW              = 104;
-    public final int STAT               = 105;
-    public final int EXPRESSION         = 106;
-    public final int DECLARATION        = 107;
-    public final int VARDECLARATION     = 108;
-
-    /*
-     * Declaration keywords
-     */
-    public final int IMPORT             = 110;
-    public final int CLASS              = 111;
-    public final int EXTENDS            = 112;
-    public final int IMPLEMENTS         = 113;
-    public final int INTERFACE          = 114;
-    public final int PACKAGE            = 115;
-
-    /*
-     * Modifier keywords
-     */
-    public final int PRIVATE    = 120;
-    public final int PUBLIC             = 121;
-    public final int PROTECTED  = 122;
-    public final int CONST              = 123;
-    public final int STATIC             = 124;
-    public final int TRANSIENT          = 125;
-    public final int SYNCHRONIZED       = 126;
-    public final int NATIVE             = 127;
-    public final int FINAL              = 128;
-    public final int VOLATILE   = 129;
-    public final int ABSTRACT   = 130;
-    public final int STRICT             = 165;
-
-    /*
-     * Punctuation
-     */
-    public final int SEMICOLON  = 135;
-    public final int COLON              = 136;
-    public final int QUESTIONMARK       = 137;
-    public final int LBRACE             = 138;
-    public final int RBRACE             = 139;
-    public final int LPAREN             = 140;
-    public final int RPAREN             = 141;
-    public final int LSQBRACKET = 142;
-    public final int RSQBRACKET = 143;
-    public final int THROWS     = 144;
-
-    /*
-     * Special tokens
-     */
-    public final int ERROR              = 145;          // an error
-    public final int COMMENT    = 146;          // not used anymore.
-    public final int TYPE               = 147;
-    public final int LENGTH             = 148;
-    public final int INLINERETURN       = 149;
-    public final int INLINEMETHOD       = 150;
-    public final int INLINENEWINSTANCE  = 151;
-
-    /*
-     * Added for jasm
-     */
-        public final int METHODREF      = 152;
-        public final int FIELDREF       = 153;
-    public final int STACK              = 154;
-    public final int LOCAL              = 155;
-    public final int CPINDEX    = 156;
-    public final int CPNAME             = 157;
-    public final int SIGN               = 158;
-    public final int BITS               = 159;
-    public final int INF                = 160;
-    public final int NAN                = 161;
-    public final int INNERCLASS = 162;
-    public final int OF         = 163;
-    public final int SYNTHETIC          = 164;
-// last used=165;
-
-   /*
-     * Operator precedence
-     */
-    public static final int opPrecedence[] = {
-        10,     11,     11,     11,     11,     11,     11,     11,     11,     11,
-        11,     11,     11,     12,     13,     14,     15,     16,     17,     18,
-        18,     19,     19,     19,     19,     19,     20,     20,     20,     21,
-        21,     22,     22,     22,     23,     24,     24,     24,     24,     24,
-        24,     25,     25,     26,     26,     26,     26,     26,     26
-    };
-
-    /*
-     * Operator names
-     */
-    public static final String opNames[] = {
-        ",",            "=",            "*=",           "/=",           "%=",
-        "+=",           "-=",           "<<=",          ">>=",          "<<<=",
-        "&=",           "|=",           "^=",           "?:",           "||",
-        "&&",           "|",            "^",            "&",            "!=",
-        "==",           ">=",           ">",            "<=",           "<",
-        "instanceof",   "<<",           ">>",           "<<<",          "+",
-        "-",            "/",            "%",            "*",            "cast",
-        "+",            "-",            "!",            "~",            "++",
-        "--",           "new",          "new",          "new",          "++",
-        "--",           "field",        "method",       "[]",           "new",
-        "++",           "--",           null,           null,           null,
-
-        "convert",      "expr",         "array",        "goto",         null,
-
-        "Identifier",   "Boolean",      "Byte",         "Char",         "Short",
-        "Integer",              "Long",         "Float",        "Double",       "String",
-
-        "byte",         "char",         "short",        "int",          "long",
-        "float",        "double",       "void",         "boolean",      null,
-
-        "true",         "false",        "this",         "super",        "null",
-        null,           null,           null,           null,           null,
-
-        "if",           "else",         "for",          "while",        "do",
-        "switch",       "case",         "default",      "break",        "continue",
-        "return",       "try",          "catch",        "finally",      "throw",
-        "stat",         "expression",   "declaration",  "declaration",  null,
-
-        "import",       "class",        "extends",      "implements",   "interface",
-        "package",      null,           null,           null,           null,
-
-        "private",      "public",       "protected",    "const",        "static",
-        "transient",    "synchronized", "native",       "final",        "volatile",
-        "abstract",     null,           null,           null,           null,
-
-        ";",            ":",            "?",            "{",            "}",
-        "(",            ")",            "[",            "]",            "throws",
-        "error",        "comment",      "type",         "length",       "inline-return",
-        "inline-method", "inline-new",
-        "method", "field", "stack", "locals", "CPINDEX", "CPName", "SIGN",
-        "bits", "INF", "NaN", "InnerClass", "of", "synthetic"
-    };
-
-}
--- a/langtools/src/share/classes/sun/tools/javap/FieldData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Strores field data informastion.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-
-public class FieldData implements RuntimeConstants  {
-
-    ClassData cls;
-    int access;
-    int name_index;
-    int descriptor_index;
-    int attributes_count;
-    int value_cpx=0;
-    boolean isSynthetic=false;
-    boolean isDeprecated=false;
-    Vector<AttrData> attrs;
-
-    public FieldData(ClassData cls){
-        this.cls=cls;
-    }
-
-    /**
-     * Read and store field info.
-     */
-    public void read(DataInputStream in) throws IOException {
-        access = in.readUnsignedShort();
-        name_index = in.readUnsignedShort();
-        descriptor_index = in.readUnsignedShort();
-        // Read the attributes
-        int attributes_count = in.readUnsignedShort();
-        attrs=new Vector<AttrData>(attributes_count);
-        for (int i = 0; i < attributes_count; i++) {
-            int attr_name_index=in.readUnsignedShort();
-            if (cls.getTag(attr_name_index)!=CONSTANT_UTF8) continue;
-            String attr_name=cls.getString(attr_name_index);
-            if (attr_name.equals("ConstantValue")){
-                if (in.readInt()!=2)
-                    throw new ClassFormatError("invalid ConstantValue attr length");
-                value_cpx=in.readUnsignedShort();
-                AttrData attr=new AttrData(cls);
-                attr.read(attr_name_index);
-                attrs.addElement(attr);
-            } else if (attr_name.equals("Synthetic")){
-                if (in.readInt()!=0)
-                    throw new ClassFormatError("invalid Synthetic attr length");
-                isSynthetic=true;
-                AttrData attr=new AttrData(cls);
-                attr.read(attr_name_index);
-                attrs.addElement(attr);
-            } else if (attr_name.equals("Deprecated")){
-                if (in.readInt()!=0)
-                    throw new ClassFormatError("invalid Synthetic attr length");
-                isDeprecated = true;
-                AttrData attr=new AttrData(cls);
-                attr.read(attr_name_index);
-                attrs.addElement(attr);
-            } else {
-                AttrData attr=new AttrData(cls);
-                attr.read(attr_name_index, in);
-                attrs.addElement(attr);
-            }
-        }
-
-    }  // end read
-
-    /**
-     * Returns access of a field.
-     */
-    public String[] getAccess(){
-        Vector<String> v = new Vector<String>();
-        if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
-        if ((access & ACC_PRIVATE)   !=0) v.addElement("private");
-        if ((access & ACC_PROTECTED)   !=0) v.addElement("protected");
-        if ((access & ACC_STATIC)   !=0) v.addElement("static");
-        if ((access & ACC_FINAL)    !=0) v.addElement("final");
-        if ((access & ACC_VOLATILE) !=0) v.addElement("volatile");
-        if ((access & ACC_TRANSIENT) !=0) v.addElement("transient");
-        String[] accflags = new String[v.size()];
-        v.copyInto(accflags);
-        return accflags;
-    }
-
-    /**
-     * Returns name of a field.
-     */
-    public String getName(){
-        return cls.getStringValue(name_index);
-    }
-
-    /**
-     * Returns internal signature of a field
-     */
-    public String getInternalSig(){
-        return cls.getStringValue(descriptor_index);
-    }
-
-    /**
-     * Returns java type signature of a field.
-     */
-    public String getType(){
-        return new TypeSignature(getInternalSig()).getFieldType();
-    }
-
-    /**
-     * Returns true if field is synthetic.
-     */
-    public boolean isSynthetic(){
-        return isSynthetic;
-    }
-
-    /**
-     * Returns true if field is deprecated.
-     */
-    public boolean isDeprecated(){
-        return isDeprecated;
-    }
-
-    /**
-     * Returns index of constant value in cpool.
-     */
-    public int getConstantValueIndex(){
-        return (value_cpx);
-    }
-
-    /**
-     * Returns list of attributes of field.
-     */
-    public Vector<?> getAttributes(){
-        return attrs;
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/InnerClassData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Strores InnerClass data informastion.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-class InnerClassData  implements RuntimeConstants {
-    ClassData cls;
-
-
-    int inner_class_info_index
-        ,outer_class_info_index
-        ,inner_name_index
-        ,access
-        ;
-
-    public InnerClassData(ClassData cls) {
-        this.cls=cls;
-
-    }
-
-    /**
-     * Read Innerclass attribute data.
-     */
-    public void read(DataInputStream in) throws IOException {
-        inner_class_info_index = in.readUnsignedShort();
-        outer_class_info_index = in.readUnsignedShort();
-        inner_name_index = in.readUnsignedShort();
-        access = in.readUnsignedShort();
-    }  // end read
-
-    /**
-     * Returns the access of this class or interface.
-     */
-    public String[] getAccess(){
-        Vector<String> v = new Vector<String>();
-        if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
-        if ((access & ACC_FINAL)    !=0) v.addElement("final");
-        if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract");
-        String[] accflags = new String[v.size()];
-        v.copyInto(accflags);
-        return accflags;
-    }
-
-} // end InnerClassData
--- a/langtools/src/share/classes/sun/tools/javap/JavapEnvironment.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,355 +0,0 @@
-/*
- * Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-import java.util.jar.*;
-
-
-/**
- * Strores flag values according to command line options
- * and sets path where to find classes.
- *
- * @author  Sucheta Dambalkar
- */
-public class JavapEnvironment {
-
-    //Access flags
-    public static final int PRIVATE = 0;
-    public static final int PROTECTED  = 1;
-    public static final int PACKAGE = 2;
-    public static final int PUBLIC  = 3;
-
-    //search path flags.
-    private static final int start = 0;
-    private static final int  cmdboot= 1;
-    private static final int sunboot = 2;
-    private static final int  javaclass= 3;
-    private static final int  cmdextdir= 4;
-    private static final int  javaext= 5;
-    private static final int  cmdclasspath= 6;
-    private static final int  envclasspath= 7;
-    private static final int  javaclasspath= 8;
-    private static final int  currentdir = 9;
-
-
-    // JavapEnvironment flag settings
-    boolean showLineAndLocal = false;
-    int showAccess = PACKAGE;
-    boolean showDisassembled = false;
-    boolean showVerbose = false;
-    boolean showInternalSigs = false;
-    String classPathString = null;
-    String bootClassPathString = null;
-    String extDirsString = null;
-    boolean extDirflag = false;
-    boolean nothingToDo = true;
-    boolean showallAttr = false;
-    String classpath = null;
-    int searchpath = start;
-
-    /**
-     *  According to which flags are set,
-     *  returns file input stream for classfile to disassemble.
-     */
-
-    public InputStream getFileInputStream(String Name){
-        InputStream fileInStream = null;
-        searchpath = cmdboot;
-        try{
-            if(searchpath == cmdboot){
-                if(bootClassPathString != null){
-                    //search in specified bootclasspath.
-                    classpath = bootClassPathString;
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path.
-                    else searchpath = cmdextdir;
-                }
-                else searchpath = sunboot;
-            }
-
-            if(searchpath == sunboot){
-                if(System.getProperty("sun.boot.class.path") != null){
-                    //search in sun.boot.class.path
-                    classpath = System.getProperty("sun.boot.class.path");
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path
-                    else searchpath = cmdextdir;
-                }
-                else searchpath = javaclass;
-            }
-
-            if(searchpath == javaclass){
-                if(System.getProperty("java.class.path") != null){
-                    //search in java.class.path
-                    classpath =System.getProperty("java.class.path");
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path
-                    else searchpath = cmdextdir;
-                }
-                else searchpath = cmdextdir;
-            }
-
-            if(searchpath == cmdextdir){
-                if(extDirsString != null){
-                    //search in specified extdir.
-                    classpath = extDirsString;
-                    extDirflag = true;
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path
-                    else {
-                        searchpath = cmdclasspath;
-                        extDirflag = false;
-                    }
-                }
-                else searchpath = javaext;
-            }
-
-            if(searchpath == javaext){
-                if(System.getProperty("java.ext.dirs") != null){
-                    //search in java.ext.dirs
-                    classpath = System.getProperty("java.ext.dirs");
-                    extDirflag = true;
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path
-                    else {
-                        searchpath = cmdclasspath;
-                        extDirflag = false;
-                    }
-                }
-                else searchpath = cmdclasspath;
-            }
-            if(searchpath == cmdclasspath){
-                if(classPathString != null){
-                    //search in specified classpath.
-                    classpath = classPathString;
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path
-                    else searchpath = 8;
-                }
-                else searchpath = envclasspath;
-            }
-
-            if(searchpath == envclasspath){
-                if(System.getProperty("env.class.path")!= null){
-                    //search in env.class.path
-                    classpath = System.getProperty("env.class.path");
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path.
-                    else searchpath = javaclasspath;
-                }
-                else searchpath = javaclasspath;
-            }
-
-            if(searchpath == javaclasspath){
-                if(("application.home") == null){
-                    //search in java.class.path
-                    classpath = System.getProperty("java.class.path");
-                    if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                    //no classes found in search path.
-                    else searchpath = currentdir;
-                }
-                else searchpath = currentdir;
-            }
-
-            if(searchpath == currentdir){
-                classpath = ".";
-                //search in current dir.
-                if((fileInStream = resolvefilename(Name)) != null) return fileInStream;
-                else {
-                    //no classes found in search path.
-                    error("Could not find "+ Name);
-                    System.exit(1);
-                }
-            }
-        }catch(SecurityException excsec){
-            excsec.printStackTrace();
-            error("fatal exception");
-        }catch(NullPointerException excnull){
-            excnull.printStackTrace();
-            error("fatal exception");
-        }catch(IllegalArgumentException excill){
-            excill.printStackTrace();
-            error("fatal exception");
-        }
-
-        return null;
-    }
-
-
-    public void error(String msg) {
-        System.err.println("ERROR:" +msg);
-    }
-
-    /**
-     * Resolves file name for classfile to disassemble.
-     */
-    public InputStream resolvefilename(String name){
-        String classname = name.replace('.', '/') + ".class";
-        while (true) {
-            InputStream instream = extDirflag
-                ? resolveExdirFilename(classname)
-                : resolveclasspath(classname);
-            if (instream != null)
-                return instream;
-            int lastindex = classname.lastIndexOf('/');
-            if (lastindex == -1) return null;
-            classname = classname.substring(0, lastindex) + "$" +
-                classname.substring(lastindex + 1);
-        }
-    }
-
-    /**
-     * Resolves file name for classfile to disassemble if flag exdir is set.
-     */
-    public InputStream resolveExdirFilename(String classname){
-        if(classpath.indexOf(File.pathSeparator) != -1){
-            //separates path
-            StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator);
-            while(st.hasMoreTokens()){
-                String path = st.nextToken();
-                InputStream in = resolveExdirFilenamehelper(path, classname);
-                if (in != null)
-                    return in;
-            }
-        }else return (resolveExdirFilenamehelper(classpath, classname));
-
-        return null;
-    }
-
-    /**
-     * Resolves file name for classfile to disassemble.
-     */
-    public InputStream resolveclasspath(String classname){
-        if(classpath.indexOf(File.pathSeparator) != -1){
-            StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator);
-            //separates path.
-            while(st.hasMoreTokens()){
-                String path = (st.nextToken()).trim();
-                InputStream in = resolveclasspathhelper(path, classname);
-                if(in != null) return in;
-
-            }
-            return null;
-        }
-        else return (resolveclasspathhelper(classpath, classname));
-    }
-
-
-    /**
-     * Returns file input stream for classfile to disassemble if exdir is set.
-     */
-    public InputStream resolveExdirFilenamehelper(String path, String classname){
-        File fileobj = new File(path);
-        if(fileobj.isDirectory()){
-            // gets list of files in that directory.
-            File[] filelist = fileobj.listFiles();
-            for(int i = 0; i < filelist.length; i++){
-                try{
-                    //file is a jar file.
-                    if(filelist[i].toString().endsWith(".jar")){
-                        JarFile jfile = new JarFile(filelist[i]);
-                        if((jfile.getEntry(classname)) != null){
-
-                            InputStream filein = jfile.getInputStream(jfile.getEntry(classname));
-                            int bytearraysize = filein.available();
-                            byte []b =  new byte[bytearraysize];
-                            int totalread = 0;
-                            while(totalread < bytearraysize){
-                                totalread += filein.read(b, totalread, bytearraysize-totalread);
-                            }
-                            InputStream inbyte = new ByteArrayInputStream(b);
-                            filein.close();
-                            return inbyte;
-                        }
-                    } else {
-                        //not a jar file.
-                        String filename = path+"/"+ classname;
-                        File file = new File(filename);
-                        if(file.isFile()){
-                            return (new FileInputStream(file));
-                        }
-                    }
-                }catch(FileNotFoundException fnexce){
-                    fnexce.printStackTrace();
-                    error("cant read file");
-                    error("fatal exception");
-                }catch(IOException ioexc){
-                    ioexc.printStackTrace();
-                    error("fatal exception");
-                }
-            }
-        }
-
-        return null;
-    }
-
-
-    /**
-     * Returns file input stream for classfile to disassemble.
-     */
-    public InputStream resolveclasspathhelper(String path, String classname){
-        File fileobj = new File(path);
-        try{
-            if(fileobj.isDirectory()){
-                //is a directory.
-                String filename = path+"/"+ classname;
-                File file = new File(filename);
-                if(file.isFile()){
-                    return (new FileInputStream(file));
-                }
-
-            }else if(fileobj.isFile()){
-                if(fileobj.toString().endsWith(".jar")){
-                    //is a jar file.
-                    JarFile jfile = new JarFile(fileobj);
-                    if((jfile.getEntry(classname)) != null){
-                        InputStream filein = jfile.getInputStream(jfile.getEntry(classname));
-                        int bytearraysize = filein.available();
-                        byte []b =  new byte[bytearraysize];
-                        int totalread = 0;
-                        while(totalread < bytearraysize){
-                                totalread += filein.read(b, totalread, bytearraysize-totalread);
-                        }
-                        InputStream inbyte = new ByteArrayInputStream(b);
-                        filein.close();
-                         return inbyte;
-                    }
-                }
-            }
-        }catch(FileNotFoundException fnexce){
-            fnexce.printStackTrace();
-            error("cant read file");
-            error("fatal exception");
-        }catch(IOException ioexce){
-            ioexce.printStackTrace();
-            error("fatal exception");
-        }
-        return null;
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/JavapPrinter.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,919 +0,0 @@
-/*
- * Copyright 2002-2009 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-import static sun.tools.javap.RuntimeConstants.*;
-
-/**
- * Program to print information about class files
- *
- * @author  Sucheta Dambalkar
- */
-public class JavapPrinter {
-    JavapEnvironment env;
-    ClassData cls;
-    byte[] code;
-    String lP= "";
-    PrintWriter out;
-
-    public JavapPrinter(InputStream cname, PrintWriter out, JavapEnvironment env){
-        this.out = out;
-        this.cls =  new ClassData(cname);
-        this.env = env;
-    }
-
-    /**
-     *  Entry point to print class file information.
-     */
-    public void print(){
-        printclassHeader();
-        printfields();
-        printMethods();
-        printend();
-    }
-
-    /**
-     * Print a description of the class (not members).
-     */
-    public void printclassHeader(){
-        String srcName="";
-        if ((srcName = cls.getSourceName()) != "null") // requires debug info
-            out.println("Compiled from " + javaclassname(srcName));
-
-        if(cls.isInterface())   {
-            // The only useful access modifier of an interface is
-            // public; interfaces are always marked as abstract and
-            // cannot be final.
-            out.print((cls.isPublic()?"public ":"") +
-                      "interface "+ javaclassname(cls.getClassName()));
-        }
-        else if(cls.isClass()) {
-            String []accflags =  cls.getAccess();
-            printAccess(accflags);
-            out.print("class "+ javaclassname(cls.getClassName()));
-
-            if(cls.getSuperClassName() != null){
-                out.print(" extends " + javaclassname(cls.getSuperClassName()));
-            }
-        }
-
-        String []interfacelist =  cls.getSuperInterfaces();
-        if(interfacelist.length > 0){
-            if(cls.isClass()) {
-                out.print(" implements ");
-            }
-            else if(cls.isInterface()){
-                out.print(" extends ");
-            }
-
-            for(int j = 0; j < interfacelist.length; j++){
-                out.print(javaclassname(interfacelist[j]));
-
-                if((j+1) < interfacelist.length) {
-                    out.print(",");
-                }
-            }
-        }
-
-        // Print class attribute information.
-        if((env.showallAttr) || (env.showVerbose)){
-            printClassAttributes();
-        }
-        // Print verbose output.
-        if(env.showVerbose){
-            printverbosecls();
-        }
-        out.println("{");
-    }
-
-    /**
-     * Print verbose output.
-     */
-    public void printverbosecls(){
-        out.println("  minor version: "+cls.getMinor_version());
-        out.println("  major version: "+cls.getMajor_version());
-        out.println("  Constant pool:");
-        printcp();
-        env.showallAttr = true;
-    }
-
-    /**
-     * Print class attribute information.
-     */
-    public void printClassAttributes(){
-        out.println();
-        AttrData[] clsattrs = cls.getAttributes();
-        for(int i = 0; i < clsattrs.length; i++){
-            String clsattrname = clsattrs[i].getAttrName();
-            if(clsattrname.equals("SourceFile")){
-                out.println("  SourceFile: "+ cls.getSourceName());
-            }else if(clsattrname.equals("InnerClasses")){
-                printInnerClasses();
-            }else {
-                printAttrData(clsattrs[i]);
-            }
-        }
-    }
-
-    /**
-     * Print the fields
-     */
-    public void printfields(){
-        FieldData[] fields = cls.getFields();
-        for(int f = 0; f < fields.length; f++){
-            String[] accflags = fields[f].getAccess();
-            if(checkAccess(accflags)){
-                if(!(env. showLineAndLocal || env.showDisassembled || env.showVerbose
-                     ||  env.showInternalSigs || env.showallAttr)){
-                    out.print("    ");
-                }
-                printAccess(accflags);
-                out.println(fields[f].getType()+" " +fields[f].getName()+";");
-                if (env.showInternalSigs) {
-                    out.println("  Signature: " + (fields[f].getInternalSig()));
-                }
-
-                // print field attribute information.
-                if (env.showallAttr){
-                    printFieldAttributes(fields[f]);
-
-                }
-                if((env.showDisassembled) || (env.showLineAndLocal)){
-                    out.println();
-                }
-            }
-        }
-    }
-
-
-    /* print field attribute information. */
-    public void printFieldAttributes(FieldData field){
-        Vector<?> fieldattrs = field.getAttributes();
-        for(int j = 0; j < fieldattrs.size(); j++){
-            String fieldattrname = ((AttrData)fieldattrs.elementAt(j)).getAttrName();
-            if(fieldattrname.equals("ConstantValue")){
-                printConstantValue(field);
-            }else if (fieldattrname.equals("Deprecated")){
-                out.println("Deprecated: "+ field.isDeprecated());
-            }else if (fieldattrname.equals("Synthetic")){
-                out.println("  Synthetic: "+ field.isSynthetic());
-            }else {
-                printAttrData((AttrData)fieldattrs.elementAt(j));
-            }
-        }
-        out.println();
-    }
-
-    /**
-     * Print the methods
-     */
-    public void printMethods(){
-        MethodData[] methods = cls.getMethods();
-        for(int m = 0; m < methods.length; m++){
-            String[] accflags = methods[m].getAccess();
-            if(checkAccess(accflags)){
-                if(!(env. showLineAndLocal || env.showDisassembled || env.showVerbose
-                     ||  env.showInternalSigs || env.showallAttr)){
-                    out.print("    ");
-                }
-                printMethodSignature(methods[m], accflags);
-                printExceptions(methods[m]);
-                out.println(";");
-
-                // Print internal signature of method.
-                if (env.showInternalSigs){
-                    out.println("  Signature: " + (methods[m].getInternalSig()));
-                }
-
-                //Print disassembled code.
-                if(env.showDisassembled && ! env.showallAttr) {
-                    printcodeSequence(methods[m]);
-                    printExceptionTable(methods[m]);
-                    out.println();
-                }
-
-                // Print line and local variable attribute information.
-                if (env.showLineAndLocal) {
-                    printLineNumTable(methods[m]);
-                    printLocVarTable(methods[m]);
-                    out.println();
-                }
-
-                // Print  method attribute information.
-                if (env.showallAttr){
-                    printMethodAttributes(methods[m]);
-                }
-            }
-        }
-    }
-
-    /**
-     * Print method signature.
-     */
-    public void printMethodSignature(MethodData method, String[] accflags){
-        printAccess(accflags);
-
-        if((method.getName()).equals("<init>")){
-            out.print(javaclassname(cls.getClassName()));
-            out.print(method.getParameters());
-        }else if((method.getName()).equals("<clinit>")){
-            out.print("{}");
-        }else{
-            out.print(method.getReturnType()+" ");
-            out.print(method.getName());
-            out.print(method.getParameters());
-        }
-    }
-
-    /**
-     * print method attribute information.
-     */
-    public void printMethodAttributes(MethodData method){
-        Vector<?> methodattrs = method.getAttributes();
-        Vector<?> codeattrs =  method.getCodeAttributes();
-        for(int k = 0; k < methodattrs.size(); k++){
-            String methodattrname = ((AttrData)methodattrs.elementAt(k)).getAttrName();
-            if(methodattrname.equals("Code")){
-                printcodeSequence(method);
-                printExceptionTable(method);
-                for(int c = 0; c < codeattrs.size(); c++){
-                    String codeattrname = ((AttrData)codeattrs.elementAt(c)).getAttrName();
-                    if(codeattrname.equals("LineNumberTable")){
-                        printLineNumTable(method);
-                    }else if(codeattrname.equals("LocalVariableTable")){
-                        printLocVarTable(method);
-                    }else if(codeattrname.equals("StackMapTable")) {
-                        // Java SE JSR 202 stack map tables
-                        printStackMapTable(method);
-                    }else if(codeattrname.equals("StackMap")) {
-                        // Java ME CLDC stack maps
-                        printStackMap(method);
-                    } else {
-                        printAttrData((AttrData)codeattrs.elementAt(c));
-                    }
-                }
-            }else if(methodattrname.equals("Exceptions")){
-                out.println("  Exceptions: ");
-                printExceptions(method);
-            }else if (methodattrname.equals("Deprecated")){
-                out.println("  Deprecated: "+ method.isDeprecated());
-            }else if (methodattrname.equals("Synthetic")){
-                out.println("  Synthetic: "+ method.isSynthetic());
-            }else {
-                printAttrData((AttrData)methodattrs.elementAt(k));
-            }
-        }
-        out.println();
-    }
-
-    /**
-     * Print exceptions.
-     */
-    public void printExceptions(MethodData method){
-        int []exc_index_table = method.get_exc_index_table();
-        if (exc_index_table != null) {
-            if(!(env. showLineAndLocal || env.showDisassembled || env.showVerbose
-                 ||  env.showInternalSigs || env.showallAttr)){
-                out.print("    ");
-            }
-            out.print("   throws ");
-            int k;
-            int l = exc_index_table.length;
-
-            for (k=0; k<l; k++) {
-                out.print(javaclassname(cls.getClassName(exc_index_table[k])));
-                if (k<l-1) out.print(", ");
-            }
-        }
-    }
-
-    /**
-     * Print code sequence.
-     */
-    public void  printcodeSequence(MethodData method){
-        code = method.getCode();
-        if(code != null){
-            out.println("  Code:");
-            if(env.showVerbose){
-                printVerboseHeader(method);
-            }
-
-            for (int pc=0; pc < code.length; ) {
-                out.print("   "+pc+":\t");
-                pc=pc+printInstr(pc);
-                out.println();
-            }
-        }
-    }
-
-    /**
-     * Print instructions.
-     */
-    public int printInstr(int pc){
-        int opcode = getUbyte(pc);
-        int opcode2;
-        String mnem;
-        switch (opcode) {
-        case opc_nonpriv:
-        case opc_priv:
-            opcode2 = getUbyte(pc+1);
-            mnem=Tables.opcName((opcode<<8)+opcode2);
-            if (mnem==null)
-                // assume all (even nonexistent) priv and nonpriv instructions
-                // are 2 bytes long
-                mnem=Tables.opcName(opcode)+" "+opcode2;
-            out.print(mnem);
-            return 2;
-        case opc_wide: {
-            opcode2 = getUbyte(pc+1);
-            mnem=Tables.opcName((opcode<<8)+opcode2);
-            if (mnem==null) {
-                // nonexistent opcode - but we have to print something
-                out.print("bytecode "+opcode);
-                return 1;
-            }
-            out.print(mnem+" "+getUShort(pc+2));
-            if (opcode2==opc_iinc) {
-                out.print(", "+getShort(pc+4));
-                return 6;
-            }
-            return 4;
-        }
-        }
-        mnem=Tables.opcName(opcode);
-        if (mnem==null) {
-            // nonexistent opcode - but we have to print something
-            out.print("bytecode "+opcode);
-            return 1;
-        }
-        if (opcode>opc_jsr_w) {
-            // pseudo opcodes should be printed as bytecodes
-            out.print("bytecode "+opcode);
-            return 1;
-        }
-        out.print(Tables.opcName(opcode));
-        switch (opcode) {
-        case opc_aload: case opc_astore:
-        case opc_fload: case opc_fstore:
-        case opc_iload: case opc_istore:
-        case opc_lload: case opc_lstore:
-        case opc_dload: case opc_dstore:
-        case opc_ret:
-            out.print("\t"+getUbyte(pc+1));
-            return  2;
-        case opc_iinc:
-            out.print("\t"+getUbyte(pc+1)+", "+getbyte(pc+2));
-            return  3;
-        case opc_tableswitch:{
-            int tb=align(pc+1);
-            int default_skip = getInt(tb); /* default skip pamount */
-            int low = getInt(tb+4);
-            int high = getInt(tb+8);
-            int count = high - low;
-            out.print("{ //"+low+" to "+high);
-            for (int i = 0; i <= count; i++)
-                out.print( "\n\t\t" + (i+low) + ": "+lP+(pc+getInt(tb+12+4*i))+";");
-            out.print("\n\t\tdefault: "+lP+(default_skip + pc) + " }");
-            return tb-pc+16+count*4;
-        }
-
-        case opc_lookupswitch:{
-            int tb=align(pc+1);
-            int default_skip = getInt(tb);
-            int npairs = getInt(tb+4);
-            out.print("{ //"+npairs);
-            for (int i = 1; i <= npairs; i++)
-                out.print("\n\t\t"+getInt(tb+i*8)
-                                 +": "+lP+(pc+getInt(tb+4+i*8))+";"
-                                 );
-            out.print("\n\t\tdefault: "+lP+(default_skip + pc) + " }");
-            return tb-pc+(npairs+1)*8;
-        }
-        case opc_newarray:
-            int type=getUbyte(pc+1);
-            switch (type) {
-            case T_BOOLEAN:out.print(" boolean");break;
-            case T_BYTE:   out.print(" byte");   break;
-            case T_CHAR:   out.print(" char");   break;
-            case T_SHORT:  out.print(" short");  break;
-            case T_INT:    out.print(" int");    break;
-            case T_LONG:   out.print(" long");   break;
-            case T_FLOAT:  out.print(" float");  break;
-            case T_DOUBLE: out.print(" double"); break;
-            case T_CLASS:  out.print(" class"); break;
-            default:       out.print(" BOGUS TYPE:"+type);
-            }
-            return 2;
-
-        case opc_anewarray: {
-            int index =  getUShort(pc+1);
-            out.print("\t#"+index+"; //");
-            PrintConstant(index);
-            return 3;
-        }
-
-        case opc_sipush:
-            out.print("\t"+getShort(pc+1));
-            return 3;
-
-        case opc_bipush:
-            out.print("\t"+getbyte(pc+1));
-            return 2;
-
-        case opc_ldc: {
-            int index = getUbyte(pc+1);
-            out.print("\t#"+index+"; //");
-            PrintConstant(index);
-            return 2;
-        }
-
-        case opc_ldc_w: case opc_ldc2_w:
-        case opc_instanceof: case opc_checkcast:
-        case opc_new:
-        case opc_putstatic: case opc_getstatic:
-        case opc_putfield: case opc_getfield:
-        case opc_invokevirtual:
-        case opc_invokespecial:
-        case opc_invokestatic: {
-            int index = getUShort(pc+1);
-            out.print("\t#"+index+"; //");
-            PrintConstant(index);
-            return 3;
-        }
-
-        case opc_invokeinterface: {
-            int index = getUShort(pc+1), nargs=getUbyte(pc+3);
-            out.print("\t#"+index+",  "+nargs+"; //");
-            PrintConstant(index);
-            return 5;
-        }
-
-        case opc_invokedynamic: {
-            int index = getUShort(pc+1);
-            out.print("\t#"+index+"; //");
-            PrintConstant(index);
-            return 5;
-        }
-
-        case opc_multianewarray: {
-            int index = getUShort(pc+1), dimensions=getUbyte(pc+3);
-            out.print("\t#"+index+",  "+dimensions+"; //");
-            PrintConstant(index);
-            return 4;
-        }
-        case opc_jsr: case opc_goto:
-        case opc_ifeq: case opc_ifge: case opc_ifgt:
-        case opc_ifle: case opc_iflt: case opc_ifne:
-        case opc_if_icmpeq: case opc_if_icmpne: case opc_if_icmpge:
-        case opc_if_icmpgt: case opc_if_icmple: case opc_if_icmplt:
-        case opc_if_acmpeq: case opc_if_acmpne:
-        case opc_ifnull: case opc_ifnonnull:
-            out.print("\t"+lP+(pc + getShort(pc+1)) );
-            return 3;
-
-        case opc_jsr_w:
-        case opc_goto_w:
-            out.print("\t"+lP+(pc + getInt(pc+1)));
-            return 5;
-
-        default:
-            return 1;
-        }
-    }
-    /**
-     * Print code attribute details.
-     */
-    public void printVerboseHeader(MethodData method) {
-        int argCount = method.getArgumentlength();
-        if (!method.isStatic())
-            ++argCount;  // for 'this'
-
-        out.println("   Stack=" + method.getMaxStack()
-                           + ", Locals=" + method.getMaxLocals()
-                           + ", Args_size=" + argCount);
-
-    }
-
-
-    /**
-     * Print the exception table for this method code
-     */
-    void printExceptionTable(MethodData method){//throws IOException
-        Vector<?> exception_table = method.getexception_table();
-        if (exception_table.size() > 0) {
-            out.println("  Exception table:");
-            out.println("   from   to  target type");
-            for (int idx = 0; idx < exception_table.size(); ++idx) {
-                TrapData handler = (TrapData)exception_table.elementAt(idx);
-                printFixedWidthInt(handler.start_pc, 6);
-                printFixedWidthInt(handler.end_pc, 6);
-                printFixedWidthInt(handler.handler_pc, 6);
-                out.print("   ");
-                int catch_cpx = handler.catch_cpx;
-                if (catch_cpx == 0) {
-                    out.println("any");
-                }else {
-                    out.print("Class ");
-                    out.println(cls.getClassName(catch_cpx));
-                    out.println("");
-                }
-            }
-        }
-    }
-
-    /**
-     * Print LineNumberTable attribute information.
-     */
-    public void printLineNumTable(MethodData method) {
-        int numlines = method.getnumlines();
-        Vector<?> lin_num_tb = method.getlin_num_tb();
-        if( lin_num_tb.size() > 0){
-            out.println("  LineNumberTable: ");
-            for (int i=0; i<numlines; i++) {
-                LineNumData linnumtb_entry=(LineNumData)lin_num_tb.elementAt(i);
-                out.println("   line " + linnumtb_entry.line_number + ": "
-                               + linnumtb_entry.start_pc);
-            }
-        }
-        out.println();
-    }
-
-    /**
-     * Print LocalVariableTable attribute information.
-     */
-    public void printLocVarTable(MethodData method){
-        int siz = method.getloc_var_tbsize();
-        if(siz > 0){
-            out.println("  LocalVariableTable: ");
-            out.print("   ");
-            out.println("Start  Length  Slot  Name   Signature");
-        }
-        Vector<?> loc_var_tb = method.getloc_var_tb();
-
-        for (int i=0; i<siz; i++) {
-            LocVarData entry=(LocVarData)loc_var_tb.elementAt(i);
-
-            out.println("   "+entry.start_pc+"      "+entry.length+"      "+
-                               entry.slot+"    "+cls.StringValue(entry.name_cpx)  +
-                               "       "+cls.StringValue(entry.sig_cpx));
-        }
-        out.println();
-    }
-
-    /**
-     * Print StackMap attribute information.
-     */
-    public void printStackMap(MethodData method) {
-        StackMapData[] stack_map_tb = method.getStackMap();
-        int number_of_entries = stack_map_tb.length;
-        if (number_of_entries > 0) {
-            out.println("  StackMap: number_of_entries = " + number_of_entries);
-
-            for (StackMapData frame : stack_map_tb) {
-                frame.print(this);
-            }
-        }
-       out.println();
-    }
-
-    /**
-     * Print StackMapTable attribute information.
-     */
-    public void printStackMapTable(MethodData method) {
-        StackMapTableData[] stack_map_tb = method.getStackMapTable();
-        int number_of_entries = stack_map_tb.length;
-        if (number_of_entries > 0) {
-            out.println("  StackMapTable: number_of_entries = " + number_of_entries);
-
-            for (StackMapTableData frame : stack_map_tb) {
-                frame.print(this);
-            }
-        }
-        out.println();
-    }
-
-    void printMap(String name, int[] map) {
-        out.print(name);
-        for (int i=0; i<map.length; i++) {
-            int fulltype = map[i];
-            int type = fulltype & 0xFF;
-            int argument = fulltype >> 8;
-            switch (type) {
-                case ITEM_Object:
-                    out.print(" ");
-                    PrintConstant(argument);
-                    break;
-                case ITEM_NewObject:
-                    out.print(" " + Tables.mapTypeName(type));
-                    out.print(" " + argument);
-                    break;
-                default:
-                    out.print(" " + Tables.mapTypeName(type));
-            }
-            out.print( (i==(map.length-1)? ' ' : ','));
-        }
-        out.println("]");
-    }
-
-    /**
-     * Print ConstantValue attribute information.
-     */
-    public void printConstantValue(FieldData field){
-        out.print("  Constant value: ");
-        int cpx = (field.getConstantValueIndex());
-        byte tag=0;
-        try {
-            tag=cls.getTag(cpx);
-
-        } catch (IndexOutOfBoundsException e) {
-            out.print("Error:");
-            return;
-        }
-        switch (tag) {
-        case CONSTANT_METHOD:
-        case CONSTANT_INTERFACEMETHOD:
-        case CONSTANT_FIELD: {
-            CPX2 x = cls.getCpoolEntry(cpx);
-            if (x.cpx1 == cls.getthis_cpx()) {
-                // don't print class part for local references
-                cpx=x.cpx2;
-            }
-        }
-        }
-        out.print(cls.TagString(tag)+" "+ cls.StringValue(cpx));
-    }
-
-    /**
-     * Print InnerClass attribute information.
-     */
-    public void printInnerClasses(){//throws ioexception
-
-        InnerClassData[] innerClasses = cls.getInnerClasses();
-        if(innerClasses != null){
-            if(innerClasses.length > 0){
-                out.print("  ");
-                out.println("InnerClass: ");
-                for(int i = 0 ; i < innerClasses.length; i++){
-                    out.print("   ");
-                    //access
-                    String[] accflags = innerClasses[i].getAccess();
-                    if(checkAccess(accflags)){
-                        printAccess(accflags);
-                        if (innerClasses[i].inner_name_index!=0) {
-                            out.print("#"+innerClasses[i].inner_name_index+"= ");
-                        }
-                        out.print("#"+innerClasses[i].inner_class_info_index);
-                        if (innerClasses[i].outer_class_info_index!=0) {
-                            out.print(" of #"+innerClasses[i].outer_class_info_index);
-                        }
-                        out.print("; //");
-                        if (innerClasses[i].inner_name_index!=0) {
-                            out.print(cls.getName(innerClasses[i].inner_name_index)+"=");
-                        }
-                        PrintConstant(innerClasses[i].inner_class_info_index);
-                        if (innerClasses[i].outer_class_info_index!=0) {
-                            out.print(" of ");
-                            PrintConstant(innerClasses[i].outer_class_info_index);
-                        }
-                        out.println();
-                    }
-                }
-
-            }
-        }
-    }
-
-    /**
-     * Print constant pool information.
-     */
-    public void printcp(){
-        int cpx = 1 ;
-
-        while (cpx < cls.getCpoolCount()) {
-            out.print("const #"+cpx+" = ");
-            cpx+=PrintlnConstantEntry(cpx);
-        }
-        out.println();
-    }
-
-    /**
-     * Print constant pool entry information.
-     */
-    @SuppressWarnings("fallthrough")
-    public int PrintlnConstantEntry(int cpx) {
-        int size=1;
-        byte tag=0;
-        try {
-            tag=cls.getTag(cpx);
-        } catch (IndexOutOfBoundsException e) {
-            out.println("  <Incorrect CP index>");
-            return 1;
-        }
-        out.print(cls.StringTag(cpx)+"\t");
-        Object x=cls.getCpoolEntryobj(cpx);
-        if (x==null) {
-            switch (tag) {
-            case CONSTANT_LONG:
-            case CONSTANT_DOUBLE:
-                size=2;
-            }
-            out.println("null;");
-            return size;
-        }
-        String str=cls.StringValue(cpx);
-
-        switch (tag) {
-        case CONSTANT_CLASS:
-        case CONSTANT_STRING:
-            out.println("#"+(((CPX)x).cpx)+";\t//  "+str);
-            break;
-        case CONSTANT_FIELD:
-        case CONSTANT_METHOD:
-        case CONSTANT_INTERFACEMETHOD:
-            out.println("#"+((CPX2)x).cpx1+".#"+((CPX2)x).cpx2+";\t//  "+str);
-            break;
-        case CONSTANT_NAMEANDTYPE:
-            out.println("#"+((CPX2)x).cpx1+":#"+((CPX2)x).cpx2+";//  "+str);
-            break;
-        case CONSTANT_LONG:
-        case CONSTANT_DOUBLE:
-            size=2;
-            // fall through
-        default:
-            out.println(str+";");
-        }
-        return size;
-    }
-
-    /**
-     * Checks access of class, field or method.
-     */
-    public boolean checkAccess(String accflags[]){
-
-        boolean ispublic = false;
-        boolean isprotected = false;
-        boolean isprivate = false;
-        boolean ispackage = false;
-
-        for(int i= 0; i < accflags.length; i++){
-            if(accflags[i].equals("public")) ispublic = true;
-            else if (accflags[i].equals("protected")) isprotected = true;
-            else if (accflags[i].equals("private")) isprivate = true;
-        }
-
-        if(!(ispublic || isprotected || isprivate)) ispackage = true;
-
-        if((env.showAccess == env.PUBLIC) && (isprotected || isprivate || ispackage)) return false;
-        else if((env.showAccess == env.PROTECTED) && (isprivate || ispackage)) return false;
-        else if((env.showAccess == env.PACKAGE) && (isprivate)) return false;
-        else return true;
-    }
-
-    /**
-     * Prints access of class, field or method.
-     */
-    public void printAccess(String []accflags){
-        for(int j = 0; j < accflags.length; j++){
-            out.print(accflags[j]+" ");
-        }
-    }
-
-    /**
-     * Print an integer so that it takes 'length' characters in
-     * the output.  Temporary until formatting code is stable.
-     */
-    public void printFixedWidthInt(long x, int length) {
-        CharArrayWriter baStream = new CharArrayWriter();
-        PrintWriter pStream = new PrintWriter(baStream);
-        pStream.print(x);
-        String str = baStream.toString();
-        for (int cnt = length - str.length(); cnt > 0; --cnt)
-            out.print(' ');
-        out.print(str);
-    }
-
-    protected int getbyte (int pc) {
-        return code[pc];
-    }
-
-    protected int getUbyte (int pc) {
-        return code[pc]&0xFF;
-    }
-
-    int getShort (int pc) {
-        return (code[pc]<<8) | (code[pc+1]&0xFF);
-    }
-
-    int getUShort (int pc) {
-        return ((code[pc]<<8) | (code[pc+1]&0xFF))&0xFFFF;
-    }
-
-    protected int getInt (int pc) {
-        return (getShort(pc)<<16) | (getShort(pc+2)&0xFFFF);
-    }
-
-    /**
-     * Print constant value at that index.
-     */
-    void PrintConstant(int cpx) {
-        if (cpx==0) {
-            out.print("#0");
-            return;
-        }
-        byte tag=0;
-        try {
-            tag=cls.getTag(cpx);
-
-        } catch (IndexOutOfBoundsException e) {
-            out.print("#"+cpx);
-            return;
-        }
-        switch (tag) {
-        case CONSTANT_METHOD:
-        case CONSTANT_INTERFACEMETHOD:
-        case CONSTANT_FIELD: {
-            // CPX2 x=(CPX2)(cpool[cpx]);
-            CPX2 x = cls.getCpoolEntry(cpx);
-            if (x.cpx1 == cls.getthis_cpx()) {
-                // don't print class part for local references
-                cpx=x.cpx2;
-            }
-        }
-        }
-        out.print(cls.TagString(tag)+" "+ cls.StringValue(cpx));
-    }
-
-    protected static int  align (int n) {
-        return (n+3) & ~3 ;
-    }
-
-    public void printend(){
-        out.println("}");
-        out.println();
-    }
-
-    public String javaclassname(String name){
-        return name.replace('/','.');
-    }
-
-    /**
-     * Print attribute data in hex.
-     */
-    public void printAttrData(AttrData attr){
-        byte []data = attr.getData();
-        int i = 0;
-        int j = 0;
-        out.print("  "+attr.getAttrName()+": ");
-        out.println("length = " + cls.toHex(attr.datalen));
-
-        out.print("   ");
-
-
-        while (i < data.length){
-            String databytestring = cls.toHex(data[i]);
-            if(databytestring.equals("0x")) out.print("00");
-            else if(databytestring.substring(2).length() == 1){
-                out.print("0"+databytestring.substring(2));
-            } else{
-                out.print(databytestring.substring(2));
-            }
-
-             j++;
-            if(j == 16) {
-                out.println();
-                out.print("   ");
-                j = 0;
-            }
-            else out.print(" ");
-            i++;
-        }
-        out.println();
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/LineNumData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Strores LineNumberTable data information.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-class LineNumData {
-    short start_pc, line_number;
-
-    public LineNumData() {}
-
-    /**
-     * Read LineNumberTable attribute.
-     */
-    public LineNumData(DataInputStream in) throws IOException {
-        start_pc = in.readShort();
-        line_number=in.readShort();
-
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/LocVarData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Strores LocalVariableTable data information.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-class LocVarData {
-    short start_pc, length, name_cpx, sig_cpx, slot;
-
-    public LocVarData() {
-    }
-
-    /**
-     * Read LocalVariableTable attribute.
-     */
-    public LocVarData(DataInputStream in) throws IOException {
-        start_pc = in.readShort();
-        length=in.readShort();
-        name_cpx=in.readShort();
-        sig_cpx=in.readShort();
-        slot=in.readShort();
-
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Entry point for javap, class file disassembler.
- *
- * @author  Sucheta Dambalkar (Adopted code from old javap)
- */
-public class Main {
-
-    private Vector<String> classList = new Vector<String>();
-    private PrintWriter out;
-    JavapEnvironment env = new JavapEnvironment();
-    private static boolean errorOccurred = false;
-    private static final String progname = "javap";
-
-
-    public Main(PrintWriter out){
-        this.out = out;
-    }
-
-    public static void main(String argv[]) {
-        // unless first arg is -Xold, use new javap
-        if (!(argv.length >= 1 && argv[0].equals("-Xold"))) {
-            com.sun.tools.javap.Main.main(argv);
-            return;
-        }
-
-        entry(argv);
-        if (errorOccurred) {
-            System.exit(1);
-        }
-    }
-
-
-    /**
-     * Entry point for tool if you don't want System.exit() called.
-     */
-    public static void entry(String argv[]) {
-        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
-        try {
-
-            Main jpmain = new Main(out);
-            jpmain.perform(argv);
-
-        } finally {
-            out.close();
-        }
-    }
-
-    /**
-     * Process the arguments and perform the desired action
-     */
-    private void perform(String argv[]) {
-        if (parseArguments(argv)) {
-            displayResults();
-
-        }
-    }
-
-    private void error(String msg) {
-        errorOccurred = true;
-        System.err.println(msg);
-        System.err.flush();
-    }
-
-    /**
-     * Print usage information
-     */
-    private void usage() {
-        java.io.PrintStream out = System.out;
-        out.println("Usage: " + progname + " <options> <classes>...");
-        out.println();
-        out.println("where options include:");
-        out.println("   -c                        Disassemble the code");
-        out.println("   -classpath <pathlist>     Specify where to find user class files");
-        out.println("   -extdirs <dirs>           Override location of installed extensions");
-        out.println("   -help                     Print this usage message");
-        out.println("   -J<flag>                  Pass <flag> directly to the runtime system");
-        out.println("   -l                        Print line number and local variable tables");
-        out.println("   -public                   Show only public classes and members");
-        out.println("   -protected                Show protected/public classes and members");
-        out.println("   -package                  Show package/protected/public classes");
-        out.println("                             and members (default)");
-        out.println("   -private                  Show all classes and members");
-        out.println("   -s                        Print internal type signatures");
-        out.println("   -bootclasspath <pathlist> Override location of class files loaded");
-        out.println("                             by the bootstrap class loader");
-        out.println("   -verbose                  Print stack size, number of locals and args for methods");
-        out.println("                             If verifying, print reasons for failure");
-        out.println();
-    }
-
-    /**
-     * Parse the command line arguments.
-     * Set flags, construct the class list and create environment.
-     */
-    private boolean parseArguments(String argv[]) {
-        for (int i = 0 ; i < argv.length ; i++) {
-            String arg = argv[i];
-            if (arg.startsWith("-")) {
-                if (arg.equals("-l")) {
-                    env.showLineAndLocal = true;
-                } else if (arg.equals("-private") || arg.equals("-p")) {
-                    env.showAccess = env.PRIVATE;
-                } else if (arg.equals("-package")) {
-                    env.showAccess = env.PACKAGE;
-                } else if (arg.equals("-protected")) {
-                    env.showAccess = env.PROTECTED;
-                } else if (arg.equals("-public")) {
-                    env.showAccess = env.PUBLIC;
-                } else if (arg.equals("-c")) {
-                    env.showDisassembled = true;
-                } else if (arg.equals("-s")) {
-                    env.showInternalSigs = true;
-                } else if (arg.equals("-verbose"))  {
-                    env.showVerbose = true;
-                } else if (arg.equals("-v")) {
-                    env.showVerbose = true;
-                } else if (arg.equals("-h")) {
-                    error("-h is no longer available - use the 'javah' program");
-                    return false;
-                } else if (arg.equals("-verify")) {
-                    error("-verify is no longer available - use 'java -verify'");
-                    return false;
-                } else if (arg.equals("-verify-verbose")) {
-                    error("-verify is no longer available - use 'java -verify'");
-                    return false;
-                } else if (arg.equals("-help")) {
-                    usage();
-                    return false;
-                } else if (arg.equals("-classpath")) {
-                    if ((i + 1) < argv.length) {
-                        env.classPathString = argv[++i];
-                    } else {
-                        error("-classpath requires argument");
-                        usage();
-                        return false;
-                    }
-                } else if (arg.equals("-bootclasspath")) {
-                    if ((i + 1) < argv.length) {
-                        env.bootClassPathString = argv[++i];
-                    } else {
-                        error("-bootclasspath requires argument");
-                        usage();
-                        return false;
-                    }
-                } else if (arg.equals("-extdirs")) {
-                    if ((i + 1) < argv.length) {
-                        env.extDirsString = argv[++i];
-                    } else {
-                        error("-extdirs requires argument");
-                        usage();
-                        return false;
-                    }
-                } else if (arg.equals("-all")) {
-                    env.showallAttr = true;
-                } else if (arg.equals("-Xold")) {
-                    // ignore: this is old javap
-                } else {
-                    error("invalid flag: " + arg);
-                    usage();
-                    return false;
-                }
-            } else {
-                classList.addElement(arg);
-                env.nothingToDo = false;
-            }
-        }
-        if (env.nothingToDo) {
-            System.out.println("No classes were specified on the command line.  Try -help.");
-            errorOccurred = true;
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Display results
-     */
-    private void displayResults() {
-        for (int i = 0; i < classList.size() ; i++ ) {
-            String Name = classList.elementAt(i);
-            InputStream classin = env.getFileInputStream(Name);
-
-            try {
-                JavapPrinter printer = new JavapPrinter(classin, out, env);
-                printer.print();                // actual do display
-
-            } catch (IllegalArgumentException exc) {
-                error(exc.getMessage());
-            }
-        }
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/MethodData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,416 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-import static sun.tools.javap.RuntimeConstants.*;
-
-/**
- * Strores method data informastion.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-public class MethodData {
-
-    ClassData cls;
-    int access;
-    int name_index;
-    int descriptor_index;
-    int attributes_count;
-    byte[] code;
-    Vector<TrapData> exception_table = new Vector<TrapData>(0);
-    Vector<LineNumData> lin_num_tb = new Vector<LineNumData>(0);
-    Vector<LocVarData> loc_var_tb = new Vector<LocVarData>(0);
-    StackMapTableData[] stackMapTable;
-    StackMapData[] stackMap;
-    int[] exc_index_table=null;
-    Vector<AttrData> attrs=new Vector<AttrData>(0);
-    Vector<AttrData> code_attrs=new Vector<AttrData>(0);
-    int max_stack,  max_locals;
-    boolean isSynthetic=false;
-    boolean isDeprecated=false;
-
-    public MethodData(ClassData cls){
-        this.cls=cls;
-    }
-
-    /**
-     * Read method info.
-     */
-    public void read(DataInputStream in) throws IOException {
-        access = in.readUnsignedShort();
-        name_index=in.readUnsignedShort();
-        descriptor_index =in.readUnsignedShort();
-        int attributes_count = in.readUnsignedShort();
-        for (int i = 0; i < attributes_count; i++) {
-            int attr_name_index=in.readUnsignedShort();
-
-        readAttr: {
-                if (cls.getTag(attr_name_index)==CONSTANT_UTF8) {
-                    String  attr_name=cls.getString(attr_name_index);
-                    if ( attr_name.equals("Code")){
-                        readCode (in);
-                        AttrData attr=new AttrData(cls);
-                        attr.read(attr_name_index);
-                        attrs.addElement(attr);
-                        break readAttr;
-                    } else if ( attr_name.equals("Exceptions")){
-                        readExceptions(in);
-                        AttrData attr=new AttrData(cls);
-                        attr.read(attr_name_index);
-                        attrs.addElement(attr);
-                        break readAttr;
-                    } else if (attr_name.equals("Synthetic")){
-                        if (in.readInt()!=0)
-                            throw new ClassFormatError("invalid Synthetic attr length");
-                        isSynthetic=true;
-                        AttrData attr=new AttrData(cls);
-                        attr.read(attr_name_index);
-                        attrs.addElement(attr);
-                        break readAttr;
-                    } else if (attr_name.equals("Deprecated")){
-                        if (in.readInt()!=0)
-                            throw new ClassFormatError("invalid Synthetic attr length");
-                        isDeprecated = true;
-                        AttrData attr=new AttrData(cls);
-                        attr.read(attr_name_index);
-                        attrs.addElement(attr);
-                        break readAttr;
-                    }
-                }
-                AttrData attr=new AttrData(cls);
-                attr.read(attr_name_index, in);
-                attrs.addElement(attr);
-            }
-        }
-    }
-
-    /**
-     * Read code attribute info.
-     */
-    public void readCode(DataInputStream in) throws IOException {
-
-        int attr_length = in.readInt();
-        max_stack=in.readUnsignedShort();
-        max_locals=in.readUnsignedShort();
-        int codelen=in.readInt();
-
-        code=new byte[codelen];
-        int totalread = 0;
-        while(totalread < codelen){
-            totalread += in.read(code, totalread, codelen-totalread);
-        }
-        //      in.read(code, 0, codelen);
-        int clen = 0;
-        readExceptionTable(in);
-        int code_attributes_count = in.readUnsignedShort();
-
-        for (int k = 0 ; k < code_attributes_count ; k++) {
-            int table_name_index=in.readUnsignedShort();
-            int table_name_tag=cls.getTag(table_name_index);
-            AttrData attr=new AttrData(cls);
-            if (table_name_tag==CONSTANT_UTF8) {
-                String table_name_tstr=cls.getString(table_name_index);
-                if (table_name_tstr.equals("LineNumberTable")) {
-                    readLineNumTable(in);
-                    attr.read(table_name_index);
-                } else if (table_name_tstr.equals("LocalVariableTable")) {
-                    readLocVarTable(in);
-                    attr.read(table_name_index);
-                } else if (table_name_tstr.equals("StackMapTable")) {
-                    readStackMapTable(in);
-                    attr.read(table_name_index);
-                } else if (table_name_tstr.equals("StackMap")) {
-                    readStackMap(in);
-                    attr.read(table_name_index);
-                } else {
-                    attr.read(table_name_index, in);
-                }
-                code_attrs.addElement(attr);
-                continue;
-            }
-
-            attr.read(table_name_index, in);
-            code_attrs.addElement(attr);
-        }
-    }
-
-    /**
-     * Read exception table info.
-     */
-    void readExceptionTable (DataInputStream in) throws IOException {
-        int exception_table_len=in.readUnsignedShort();
-        exception_table=new Vector<TrapData>(exception_table_len);
-        for (int l = 0; l < exception_table_len; l++) {
-            exception_table.addElement(new TrapData(in, l));
-        }
-    }
-
-    /**
-     * Read LineNumberTable attribute info.
-     */
-    void readLineNumTable (DataInputStream in) throws IOException {
-        int attr_len = in.readInt(); // attr_length
-        int lin_num_tb_len = in.readUnsignedShort();
-        lin_num_tb=new Vector<LineNumData>(lin_num_tb_len);
-        for (int l = 0; l < lin_num_tb_len; l++) {
-            lin_num_tb.addElement(new LineNumData(in));
-        }
-    }
-
-    /**
-     * Read LocalVariableTable attribute info.
-     */
-    void readLocVarTable (DataInputStream in) throws IOException {
-        int attr_len=in.readInt(); // attr_length
-        int loc_var_tb_len = in.readUnsignedShort();
-        loc_var_tb = new Vector<LocVarData>(loc_var_tb_len);
-        for (int l = 0; l < loc_var_tb_len; l++) {
-            loc_var_tb.addElement(new LocVarData(in));
-        }
-    }
-
-    /**
-     * Read Exception attribute info.
-     */
-    public void readExceptions(DataInputStream in) throws IOException {
-        int attr_len=in.readInt(); // attr_length in prog
-        int num_exceptions = in.readUnsignedShort();
-        exc_index_table=new int[num_exceptions];
-        for (int l = 0; l < num_exceptions; l++) {
-            int exc=in.readShort();
-            exc_index_table[l]=exc;
-        }
-    }
-
-    /**
-     * Read StackMapTable attribute info.
-     */
-    void readStackMapTable(DataInputStream in) throws IOException {
-        int attr_len = in.readInt();  //attr_length
-        int stack_map_tb_len = in.readUnsignedShort();
-        stackMapTable = new StackMapTableData[stack_map_tb_len];
-        for (int i=0; i<stack_map_tb_len; i++) {
-            stackMapTable[i] = StackMapTableData.getInstance(in, this);
-        }
-    }
-
-    /**
-     * Read StackMap attribute info.
-     */
-    void readStackMap(DataInputStream in) throws IOException {
-        int attr_len = in.readInt();  //attr_length
-        int stack_map_len = in.readUnsignedShort();
-        stackMap = new StackMapData[stack_map_len];
-        for (int i = 0; i<stack_map_len; i++) {
-            stackMap[i] = new StackMapData(in, this);
-        }
-    }
-
-    /**
-     * Return access of the method.
-     */
-    public String[] getAccess(){
-
-        Vector<String> v = new Vector<String>();
-        if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
-        if ((access & ACC_PRIVATE)   !=0) v.addElement("private");
-        if ((access & ACC_PROTECTED)   !=0) v.addElement("protected");
-        if ((access & ACC_STATIC)   !=0) v.addElement("static");
-        if ((access & ACC_FINAL)    !=0) v.addElement("final");
-        if ((access & ACC_SYNCHRONIZED) !=0) v.addElement("synchronized");
-        if ((access & ACC_NATIVE) !=0) v.addElement("native");
-        if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract");
-        if ((access & ACC_STRICT) !=0) v.addElement("strictfp");
-
-        String[] accflags = new String[v.size()];
-        v.copyInto(accflags);
-        return accflags;
-    }
-
-    /**
-     * Return name of the method.
-     */
-    public String getName(){
-        return cls.getStringValue(name_index);
-    }
-
-    /**
-     * Return internal siganature of the method.
-     */
-    public String getInternalSig(){
-        return cls.getStringValue(descriptor_index);
-    }
-
-    /**
-     * Return java return type signature of method.
-     */
-    public String getReturnType(){
-
-        String rttype = (new TypeSignature(getInternalSig())).getReturnType();
-        return rttype;
-    }
-
-    /**
-     * Return java type parameter signature.
-     */
-    public String getParameters(){
-        String ptype = (new TypeSignature(getInternalSig())).getParameters();
-
-        return ptype;
-    }
-
-    /**
-     * Return code attribute data of a method.
-     */
-    public byte[] getCode(){
-        return code;
-    }
-
-    /**
-     * Return LineNumberTable size.
-     */
-    public int getnumlines(){
-        return lin_num_tb.size();
-    }
-
-    /**
-     * Return LineNumberTable
-     */
-    public Vector<?> getlin_num_tb(){
-        return lin_num_tb;
-    }
-
-    /**
-     * Return LocalVariableTable size.
-     */
-    public int getloc_var_tbsize(){
-        return loc_var_tb.size();
-    }
-
-
-    /**
-     * Return LocalVariableTable.
-     */
-    public Vector<?> getloc_var_tb(){
-        return loc_var_tb;
-    }
-
-    /**
-     * Return StackMap.
-     */
-    public StackMapData[] getStackMap() {
-        return stackMap;
-    }
-
-    /**
-     * Return StackMapTable.
-     */
-    public StackMapTableData[] getStackMapTable() {
-        return stackMapTable;
-    }
-
-    /**
-     * Return number of arguments of that method.
-     */
-    public int getArgumentlength(){
-        return new TypeSignature(getInternalSig()).getArgumentlength();
-    }
-
-    /**
-     * Return true if method is static
-     */
-    public boolean isStatic(){
-        if ((access & ACC_STATIC)   !=0) return true;
-        return false;
-    }
-
-
-    /**
-     * Return max depth of operand stack.
-     */
-    public int getMaxStack(){
-        return  max_stack;
-    }
-
-
-    /**
-     * Return number of local variables.
-     */
-    public int getMaxLocals(){
-        return max_locals;
-    }
-
-
-    /**
-     * Return exception index table in Exception attribute.
-     */
-    public int []get_exc_index_table(){
-        return  exc_index_table;
-    }
-
-
-    /**
-     * Return exception table in code attributre.
-     */
-    public Vector<?> getexception_table(){
-        return exception_table;
-    }
-
-
-    /**
-     * Return method attributes.
-     */
-    public Vector<?> getAttributes(){
-        return attrs;
-    }
-
-
-    /**
-     * Return code attributes.
-     */
-    public Vector<?> getCodeAttributes(){
-        return code_attrs;
-    }
-
-
-    /**
-     * Return true if method id synthetic.
-     */
-    public boolean isSynthetic(){
-        return isSynthetic;
-    }
-
-
-    /**
-     * Return true if method is deprecated.
-     */
-    public boolean isDeprecated(){
-        return isDeprecated;
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/RuntimeConstants.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,787 +0,0 @@
-/*
- * Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-public interface RuntimeConstants {
-
-    /* Signature Characters */
-    public static final char   SIGC_VOID                  = 'V';
-    public static final String SIG_VOID                   = "V";
-    public static final char   SIGC_BOOLEAN               = 'Z';
-    public static final String SIG_BOOLEAN                = "Z";
-    public static final char   SIGC_BYTE                  = 'B';
-    public static final String SIG_BYTE                   = "B";
-    public static final char   SIGC_CHAR                  = 'C';
-    public static final String SIG_CHAR                   = "C";
-    public static final char   SIGC_SHORT                 = 'S';
-    public static final String SIG_SHORT                  = "S";
-    public static final char   SIGC_INT                   = 'I';
-    public static final String SIG_INT                    = "I";
-    public static final char   SIGC_LONG                  = 'J';
-    public static final String SIG_LONG                   = "J";
-    public static final char   SIGC_FLOAT                 = 'F';
-    public static final String SIG_FLOAT                  = "F";
-    public static final char   SIGC_DOUBLE                = 'D';
-    public static final String SIG_DOUBLE                 = "D";
-    public static final char   SIGC_ARRAY                 = '[';
-    public static final String SIG_ARRAY                  = "[";
-    public static final char   SIGC_CLASS                 = 'L';
-    public static final String SIG_CLASS                  = "L";
-    public static final char   SIGC_METHOD                = '(';
-    public static final String SIG_METHOD                 = "(";
-    public static final char   SIGC_ENDCLASS              = ';';
-    public static final String SIG_ENDCLASS               = ";";
-    public static final char   SIGC_ENDMETHOD             = ')';
-    public static final String SIG_ENDMETHOD              = ")";
-    public static final char   SIGC_PACKAGE               = '/';
-    public static final String SIG_PACKAGE                = "/";
-
-    /* Class File Constants */
-    public static final int JAVA_MAGIC                   = 0xcafebabe;
-    public static final int JAVA_VERSION                 = 45;
-    public static final int JAVA_MINOR_VERSION           = 3;
-
-    /* Constant table */
-    public static final int CONSTANT_UTF8                = 1;
-    public static final int CONSTANT_UNICODE             = 2;
-    public static final int CONSTANT_INTEGER             = 3;
-    public static final int CONSTANT_FLOAT               = 4;
-    public static final int CONSTANT_LONG                = 5;
-    public static final int CONSTANT_DOUBLE              = 6;
-    public static final int CONSTANT_CLASS               = 7;
-    public static final int CONSTANT_STRING              = 8;
-    public static final int CONSTANT_FIELD               = 9;
-    public static final int CONSTANT_METHOD              = 10;
-    public static final int CONSTANT_INTERFACEMETHOD     = 11;
-    public static final int CONSTANT_NAMEANDTYPE         = 12;
-
-    /* Access Flags */
-    public static final int ACC_PUBLIC                   = 0x00000001;
-    public static final int ACC_PRIVATE                  = 0x00000002;
-    public static final int ACC_PROTECTED                = 0x00000004;
-    public static final int ACC_STATIC                   = 0x00000008;
-    public static final int ACC_FINAL                    = 0x00000010;
-    public static final int ACC_SYNCHRONIZED             = 0x00000020;
-    public static final int ACC_SUPER                        = 0x00000020;
-    public static final int ACC_VOLATILE                 = 0x00000040;
-    public static final int ACC_TRANSIENT                = 0x00000080;
-    public static final int ACC_NATIVE                   = 0x00000100;
-    public static final int ACC_INTERFACE                = 0x00000200;
-    public static final int ACC_ABSTRACT                 = 0x00000400;
-    public static final int ACC_STRICT                   = 0x00000800;
-    public static final int ACC_EXPLICIT                 = 0x00001000;
-    public static final int ACC_SYNTHETIC                = 0x00010000; // actually, this is an attribute
-
-    /* Type codes */
-    public static final int T_CLASS                      = 0x00000002;
-    public static final int T_BOOLEAN                    = 0x00000004;
-    public static final int T_CHAR                       = 0x00000005;
-    public static final int T_FLOAT                      = 0x00000006;
-    public static final int T_DOUBLE                     = 0x00000007;
-    public static final int T_BYTE                       = 0x00000008;
-    public static final int T_SHORT                      = 0x00000009;
-    public static final int T_INT                        = 0x0000000a;
-    public static final int T_LONG                       = 0x0000000b;
-
-    /* Type codes for StackMap attribute */
-    public static final int ITEM_Bogus      =0; // an unknown or uninitialized value
-    public static final int ITEM_Integer    =1; // a 32-bit integer
-    public static final int ITEM_Float      =2; // not used
-    public static final int ITEM_Double     =3; // not used
-    public static final int ITEM_Long       =4; // a 64-bit integer
-    public static final int ITEM_Null       =5; // the type of null
-    public static final int ITEM_InitObject =6; // "this" in constructor
-    public static final int ITEM_Object     =7; // followed by 2-byte index of class name
-    public static final int ITEM_NewObject  =8; // followed by 2-byte ref to "new"
-
-    /* Constants used in StackMapTable attribute */
-    public static final int SAME_FRAME_BOUND                  = 64;
-    public static final int SAME_LOCALS_1_STACK_ITEM_BOUND    = 128;
-    public static final int SAME_LOCALS_1_STACK_ITEM_EXTENDED = 247;
-    public static final int SAME_FRAME_EXTENDED               = 251;
-    public static final int FULL_FRAME                        = 255;
-
-    /* Opcodes */
-    public static final int opc_dead                     = -2;
-    public static final int opc_label                    = -1;
-    public static final int opc_nop                      = 0;
-    public static final int opc_aconst_null              = 1;
-    public static final int opc_iconst_m1                = 2;
-    public static final int opc_iconst_0                 = 3;
-    public static final int opc_iconst_1                 = 4;
-    public static final int opc_iconst_2                 = 5;
-    public static final int opc_iconst_3                 = 6;
-    public static final int opc_iconst_4                 = 7;
-    public static final int opc_iconst_5                 = 8;
-    public static final int opc_lconst_0                 = 9;
-    public static final int opc_lconst_1                 = 10;
-    public static final int opc_fconst_0                 = 11;
-    public static final int opc_fconst_1                 = 12;
-    public static final int opc_fconst_2                 = 13;
-    public static final int opc_dconst_0                 = 14;
-    public static final int opc_dconst_1                 = 15;
-    public static final int opc_bipush                   = 16;
-    public static final int opc_sipush                   = 17;
-    public static final int opc_ldc                      = 18;
-    public static final int opc_ldc_w                    = 19;
-    public static final int opc_ldc2_w                   = 20;
-    public static final int opc_iload                    = 21;
-    public static final int opc_lload                    = 22;
-    public static final int opc_fload                    = 23;
-    public static final int opc_dload                    = 24;
-    public static final int opc_aload                    = 25;
-    public static final int opc_iload_0                  = 26;
-    public static final int opc_iload_1                  = 27;
-    public static final int opc_iload_2                  = 28;
-    public static final int opc_iload_3                  = 29;
-    public static final int opc_lload_0                  = 30;
-    public static final int opc_lload_1                  = 31;
-    public static final int opc_lload_2                  = 32;
-    public static final int opc_lload_3                  = 33;
-    public static final int opc_fload_0                  = 34;
-    public static final int opc_fload_1                  = 35;
-    public static final int opc_fload_2                  = 36;
-    public static final int opc_fload_3                  = 37;
-    public static final int opc_dload_0                  = 38;
-    public static final int opc_dload_1                  = 39;
-    public static final int opc_dload_2                  = 40;
-    public static final int opc_dload_3                  = 41;
-    public static final int opc_aload_0                  = 42;
-    public static final int opc_aload_1                  = 43;
-    public static final int opc_aload_2                  = 44;
-    public static final int opc_aload_3                  = 45;
-    public static final int opc_iaload                   = 46;
-    public static final int opc_laload                   = 47;
-    public static final int opc_faload                   = 48;
-    public static final int opc_daload                   = 49;
-    public static final int opc_aaload                   = 50;
-    public static final int opc_baload                   = 51;
-    public static final int opc_caload                   = 52;
-    public static final int opc_saload                   = 53;
-    public static final int opc_istore                   = 54;
-    public static final int opc_lstore                   = 55;
-    public static final int opc_fstore                   = 56;
-    public static final int opc_dstore                   = 57;
-    public static final int opc_astore                   = 58;
-    public static final int opc_istore_0                 = 59;
-    public static final int opc_istore_1                 = 60;
-    public static final int opc_istore_2                 = 61;
-    public static final int opc_istore_3                 = 62;
-    public static final int opc_lstore_0                 = 63;
-    public static final int opc_lstore_1                 = 64;
-    public static final int opc_lstore_2                 = 65;
-    public static final int opc_lstore_3                 = 66;
-    public static final int opc_fstore_0                 = 67;
-    public static final int opc_fstore_1                 = 68;
-    public static final int opc_fstore_2                 = 69;
-    public static final int opc_fstore_3                 = 70;
-    public static final int opc_dstore_0                 = 71;
-    public static final int opc_dstore_1                 = 72;
-    public static final int opc_dstore_2                 = 73;
-    public static final int opc_dstore_3                 = 74;
-    public static final int opc_astore_0                 = 75;
-    public static final int opc_astore_1                 = 76;
-    public static final int opc_astore_2                 = 77;
-    public static final int opc_astore_3                 = 78;
-    public static final int opc_iastore                  = 79;
-    public static final int opc_lastore                  = 80;
-    public static final int opc_fastore                  = 81;
-    public static final int opc_dastore                  = 82;
-    public static final int opc_aastore                  = 83;
-    public static final int opc_bastore                  = 84;
-    public static final int opc_castore                  = 85;
-    public static final int opc_sastore                  = 86;
-    public static final int opc_pop                      = 87;
-    public static final int opc_pop2                     = 88;
-    public static final int opc_dup                      = 89;
-    public static final int opc_dup_x1                   = 90;
-    public static final int opc_dup_x2                   = 91;
-    public static final int opc_dup2                     = 92;
-    public static final int opc_dup2_x1                  = 93;
-    public static final int opc_dup2_x2                  = 94;
-    public static final int opc_swap                     = 95;
-    public static final int opc_iadd                     = 96;
-    public static final int opc_ladd                     = 97;
-    public static final int opc_fadd                     = 98;
-    public static final int opc_dadd                     = 99;
-    public static final int opc_isub                     = 100;
-    public static final int opc_lsub                     = 101;
-    public static final int opc_fsub                     = 102;
-    public static final int opc_dsub                     = 103;
-    public static final int opc_imul                     = 104;
-    public static final int opc_lmul                     = 105;
-    public static final int opc_fmul                     = 106;
-    public static final int opc_dmul                     = 107;
-    public static final int opc_idiv                     = 108;
-    public static final int opc_ldiv                     = 109;
-    public static final int opc_fdiv                     = 110;
-    public static final int opc_ddiv                     = 111;
-    public static final int opc_irem                     = 112;
-    public static final int opc_lrem                     = 113;
-    public static final int opc_frem                     = 114;
-    public static final int opc_drem                     = 115;
-    public static final int opc_ineg                     = 116;
-    public static final int opc_lneg                     = 117;
-    public static final int opc_fneg                     = 118;
-    public static final int opc_dneg                     = 119;
-    public static final int opc_ishl                     = 120;
-    public static final int opc_lshl                     = 121;
-    public static final int opc_ishr                     = 122;
-    public static final int opc_lshr                     = 123;
-    public static final int opc_iushr                    = 124;
-    public static final int opc_lushr                    = 125;
-    public static final int opc_iand                     = 126;
-    public static final int opc_land                     = 127;
-    public static final int opc_ior                      = 128;
-    public static final int opc_lor                      = 129;
-    public static final int opc_ixor                     = 130;
-    public static final int opc_lxor                     = 131;
-    public static final int opc_iinc                     = 132;
-    public static final int opc_i2l                      = 133;
-    public static final int opc_i2f                      = 134;
-    public static final int opc_i2d                      = 135;
-    public static final int opc_l2i                      = 136;
-    public static final int opc_l2f                      = 137;
-    public static final int opc_l2d                      = 138;
-    public static final int opc_f2i                      = 139;
-    public static final int opc_f2l                      = 140;
-    public static final int opc_f2d                      = 141;
-    public static final int opc_d2i                      = 142;
-    public static final int opc_d2l                      = 143;
-    public static final int opc_d2f                      = 144;
-    public static final int opc_i2b                      = 145;
-    public static final int opc_int2byte                 = 145;
-    public static final int opc_i2c                      = 146;
-    public static final int opc_int2char                 = 146;
-    public static final int opc_i2s                      = 147;
-    public static final int opc_int2short                = 147;
-    public static final int opc_lcmp                     = 148;
-    public static final int opc_fcmpl                    = 149;
-    public static final int opc_fcmpg                    = 150;
-    public static final int opc_dcmpl                    = 151;
-    public static final int opc_dcmpg                    = 152;
-    public static final int opc_ifeq                     = 153;
-    public static final int opc_ifne                     = 154;
-    public static final int opc_iflt                     = 155;
-    public static final int opc_ifge                     = 156;
-    public static final int opc_ifgt                     = 157;
-    public static final int opc_ifle                     = 158;
-    public static final int opc_if_icmpeq                = 159;
-    public static final int opc_if_icmpne                = 160;
-    public static final int opc_if_icmplt                = 161;
-    public static final int opc_if_icmpge                = 162;
-    public static final int opc_if_icmpgt                = 163;
-    public static final int opc_if_icmple                = 164;
-    public static final int opc_if_acmpeq                = 165;
-    public static final int opc_if_acmpne                = 166;
-    public static final int opc_goto                     = 167;
-    public static final int opc_jsr                      = 168;
-    public static final int opc_ret                      = 169;
-    public static final int opc_tableswitch              = 170;
-    public static final int opc_lookupswitch             = 171;
-    public static final int opc_ireturn                  = 172;
-    public static final int opc_lreturn                  = 173;
-    public static final int opc_freturn                  = 174;
-    public static final int opc_dreturn                  = 175;
-    public static final int opc_areturn                  = 176;
-    public static final int opc_return                   = 177;
-    public static final int opc_getstatic                = 178;
-    public static final int opc_putstatic                = 179;
-    public static final int opc_getfield                 = 180;
-    public static final int opc_putfield                 = 181;
-    public static final int opc_invokevirtual            = 182;
-    public static final int opc_invokenonvirtual         = 183;
-    public static final int opc_invokespecial            = 183;
-    public static final int opc_invokestatic             = 184;
-    public static final int opc_invokeinterface          = 185;
-    public static final int opc_invokedynamic            = 186;
-    public static final int opc_new                      = 187;
-    public static final int opc_newarray                 = 188;
-    public static final int opc_anewarray                = 189;
-    public static final int opc_arraylength              = 190;
-    public static final int opc_athrow                   = 191;
-    public static final int opc_checkcast                = 192;
-    public static final int opc_instanceof               = 193;
-    public static final int opc_monitorenter             = 194;
-    public static final int opc_monitorexit              = 195;
-    public static final int opc_wide                     = 196;
-    public static final int opc_multianewarray           = 197;
-    public static final int opc_ifnull                   = 198;
-    public static final int opc_ifnonnull                = 199;
-    public static final int opc_goto_w                   = 200;
-    public static final int opc_jsr_w                    = 201;
-        /* Pseudo-instructions */
-    public static final int opc_bytecode                 = 203;
-    public static final int opc_try                      = 204;
-    public static final int opc_endtry                   = 205;
-    public static final int opc_catch                    = 206;
-    public static final int opc_var                      = 207;
-    public static final int opc_endvar                   = 208;
-    public static final int opc_localsmap                = 209;
-    public static final int opc_stackmap                 = 210;
-        /* PicoJava prefixes */
-    public static final int opc_nonpriv                  = 254;
-    public static final int opc_priv                     = 255;
-
-        /* Wide instructions */
-    public static final int opc_iload_w         = (opc_wide<<8)|opc_iload;
-    public static final int opc_lload_w         = (opc_wide<<8)|opc_lload;
-    public static final int opc_fload_w         = (opc_wide<<8)|opc_fload;
-    public static final int opc_dload_w         = (opc_wide<<8)|opc_dload;
-    public static final int opc_aload_w         = (opc_wide<<8)|opc_aload;
-    public static final int opc_istore_w        = (opc_wide<<8)|opc_istore;
-    public static final int opc_lstore_w        = (opc_wide<<8)|opc_lstore;
-    public static final int opc_fstore_w        = (opc_wide<<8)|opc_fstore;
-    public static final int opc_dstore_w        = (opc_wide<<8)|opc_dstore;
-    public static final int opc_astore_w        = (opc_wide<<8)|opc_astore;
-    public static final int opc_ret_w           = (opc_wide<<8)|opc_ret;
-    public static final int opc_iinc_w          = (opc_wide<<8)|opc_iinc;
-
-    /* Opcode Names */
-  public static final String opcNamesTab[] = {
-        "nop",
-        "aconst_null",
-        "iconst_m1",
-        "iconst_0",
-        "iconst_1",
-        "iconst_2",
-        "iconst_3",
-        "iconst_4",
-        "iconst_5",
-        "lconst_0",
-        "lconst_1",
-        "fconst_0",
-        "fconst_1",
-        "fconst_2",
-        "dconst_0",
-        "dconst_1",
-        "bipush",
-        "sipush",
-        "ldc",
-        "ldc_w",
-        "ldc2_w",
-        "iload",
-        "lload",
-        "fload",
-        "dload",
-        "aload",
-        "iload_0",
-        "iload_1",
-        "iload_2",
-        "iload_3",
-        "lload_0",
-        "lload_1",
-        "lload_2",
-        "lload_3",
-        "fload_0",
-        "fload_1",
-        "fload_2",
-        "fload_3",
-        "dload_0",
-        "dload_1",
-        "dload_2",
-        "dload_3",
-        "aload_0",
-        "aload_1",
-        "aload_2",
-        "aload_3",
-        "iaload",
-        "laload",
-        "faload",
-        "daload",
-        "aaload",
-        "baload",
-        "caload",
-        "saload",
-        "istore",
-        "lstore",
-        "fstore",
-        "dstore",
-        "astore",
-        "istore_0",
-        "istore_1",
-        "istore_2",
-        "istore_3",
-        "lstore_0",
-        "lstore_1",
-        "lstore_2",
-        "lstore_3",
-        "fstore_0",
-        "fstore_1",
-        "fstore_2",
-        "fstore_3",
-        "dstore_0",
-        "dstore_1",
-        "dstore_2",
-        "dstore_3",
-        "astore_0",
-        "astore_1",
-        "astore_2",
-        "astore_3",
-        "iastore",
-        "lastore",
-        "fastore",
-        "dastore",
-        "aastore",
-        "bastore",
-        "castore",
-        "sastore",
-        "pop",
-        "pop2",
-        "dup",
-        "dup_x1",
-        "dup_x2",
-        "dup2",
-        "dup2_x1",
-        "dup2_x2",
-        "swap",
-        "iadd",
-        "ladd",
-        "fadd",
-        "dadd",
-        "isub",
-        "lsub",
-        "fsub",
-        "dsub",
-        "imul",
-        "lmul",
-        "fmul",
-        "dmul",
-        "idiv",
-        "ldiv",
-        "fdiv",
-        "ddiv",
-        "irem",
-        "lrem",
-        "frem",
-        "drem",
-        "ineg",
-        "lneg",
-        "fneg",
-        "dneg",
-        "ishl",
-        "lshl",
-        "ishr",
-        "lshr",
-        "iushr",
-        "lushr",
-        "iand",
-        "land",
-        "ior",
-        "lor",
-        "ixor",
-        "lxor",
-        "iinc",
-        "i2l",
-        "i2f",
-        "i2d",
-        "l2i",
-        "l2f",
-        "l2d",
-        "f2i",
-        "f2l",
-        "f2d",
-        "d2i",
-        "d2l",
-        "d2f",
-        "i2b",
-        "i2c",
-        "i2s",
-        "lcmp",
-        "fcmpl",
-        "fcmpg",
-        "dcmpl",
-        "dcmpg",
-        "ifeq",
-        "ifne",
-        "iflt",
-        "ifge",
-        "ifgt",
-        "ifle",
-        "if_icmpeq",
-        "if_icmpne",
-        "if_icmplt",
-        "if_icmpge",
-        "if_icmpgt",
-        "if_icmple",
-        "if_acmpeq",
-        "if_acmpne",
-        "goto",
-        "jsr",
-        "ret",
-        "tableswitch",
-        "lookupswitch",
-        "ireturn",
-        "lreturn",
-        "freturn",
-        "dreturn",
-        "areturn",
-        "return",
-        "getstatic",
-        "putstatic",
-        "getfield",
-        "putfield",
-        "invokevirtual",
-        "invokespecial", //     was "invokenonvirtual",
-        "invokestatic",
-        "invokeinterface",
-        "invokedynamic",
-        "new",
-        "newarray",
-        "anewarray",
-        "arraylength",
-        "athrow",
-        "checkcast",
-        "instanceof",
-        "monitorenter",
-        "monitorexit",
-         null, // "wide",
-        "multianewarray",
-        "ifnull",
-        "ifnonnull",
-        "goto_w",
-        "jsr_w",
-        "bytecode 202", // "breakpoint",
-        "bytecode",
-        "try",
-        "endtry",
-        "catch",
-        "var",
-        "endvar",
-        "locals_map",
-        "stack_map"
-  };
-
-    /* Opcode Lengths */
-  public static final int opcLengthsTab[] = {
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        2,
-        3,
-        2,
-        3,
-        3,
-        2,
-        2,
-        2,
-        2,
-        2,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        2,
-        2,
-        2,
-        2,
-        2,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        3,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        2,
-        99,
-        99,
-        1,
-        1,
-        1,
-        1,
-        1,
-        1,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        3,
-        5,
-        0,
-        3,
-        2,
-        3,
-        1,
-        1,
-        3,
-        3,
-        1,
-        1,
-        0, // wide
-        4,
-        3,
-        3,
-        5,
-        5,
-        1,
-        1, 0, 0, 0, 0, 0 // pseudo
-  };
-
-}
--- a/langtools/src/share/classes/sun/tools/javap/StackMapData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-import static sun.tools.javap.RuntimeConstants.*;
-
-/* represents one entry of StackMap attribute
- */
-class StackMapData {
-    final int offset;
-    final int[] locals;
-    final int[] stack;
-
-    StackMapData(int offset, int[] locals, int[] stack) {
-        this.offset = offset;
-        this.locals = locals;
-        this.stack = stack;
-    }
-
-    StackMapData(DataInputStream in, MethodData method) throws IOException {
-        offset = in.readUnsignedShort();
-        int local_size = in.readUnsignedShort();
-        locals = readTypeArray(in, local_size, method);
-        int stack_size = in.readUnsignedShort();
-        stack = readTypeArray(in, stack_size, method);
-    }
-
-    static final int[] readTypeArray(DataInputStream in, int length, MethodData method) throws IOException {
-        int[] types = new int[length];
-        for (int i=0; i<length; i++) {
-            types[i] = readType(in, method);
-        }
-        return types;
-    }
-
-    static final int readType(DataInputStream in, MethodData method) throws IOException {
-        int type = in.readUnsignedByte();
-        if (type == ITEM_Object || type == ITEM_NewObject) {
-            type = type | (in.readUnsignedShort()<<8);
-        }
-        return type;
-    }
-
-    void print(JavapPrinter p) {
-        p.out.println("   " + offset + ":");
-        p.printMap("    locals = [", locals);
-        p.printMap("    stack = [", stack);
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/StackMapTableData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-import static sun.tools.javap.RuntimeConstants.*;
-
-/* represents one entry of StackMapTable attribute
- */
-class StackMapTableData {
-    final int frameType;
-    int offsetDelta;
-
-    StackMapTableData(int frameType) {
-        this.frameType = frameType;
-    }
-
-    void print(JavapPrinter p) {
-        p.out.print("   frame_type = " + frameType);
-    }
-
-    static class SameFrame extends StackMapTableData {
-        SameFrame(int frameType, int offsetDelta) {
-            super(frameType);
-            this.offsetDelta = offsetDelta;
-        }
-        void print(JavapPrinter p) {
-            super.print(p);
-            if (frameType < SAME_FRAME_BOUND) {
-                p.out.println(" /* same */");
-            } else {
-                p.out.println(" /* same_frame_extended */");
-                p.out.println("     offset_delta = " + offsetDelta);
-            }
-        }
-    }
-
-    static class SameLocals1StackItem extends StackMapTableData {
-        final int[] stack;
-        SameLocals1StackItem(int frameType, int offsetDelta, int[] stack) {
-            super(frameType);
-            this.offsetDelta = offsetDelta;
-            this.stack = stack;
-        }
-        void print(JavapPrinter p) {
-            super.print(p);
-            if (frameType == SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
-                p.out.println(" /* same_locals_1_stack_item_frame_extended */");
-                p.out.println("     offset_delta = " + offsetDelta);
-            } else {
-                p.out.println(" /* same_locals_1_stack_item */");
-            }
-            p.printMap("     stack = [", stack);
-        }
-    }
-
-    static class ChopFrame extends StackMapTableData {
-        ChopFrame(int frameType, int offsetDelta) {
-            super(frameType);
-            this.offsetDelta = offsetDelta;
-        }
-        void print(JavapPrinter p) {
-            super.print(p);
-            p.out.println(" /* chop */");
-            p.out.println("     offset_delta = " + offsetDelta);
-        }
-    }
-
-    static class AppendFrame extends StackMapTableData {
-        final int[] locals;
-        AppendFrame(int frameType, int offsetDelta, int[] locals) {
-            super(frameType);
-            this.offsetDelta = offsetDelta;
-            this.locals = locals;
-        }
-        void print(JavapPrinter p) {
-            super.print(p);
-            p.out.println(" /* append */");
-            p.out.println("     offset_delta = " + offsetDelta);
-            p.printMap("     locals = [", locals);
-        }
-    }
-
-    static class FullFrame extends StackMapTableData {
-        final int[] locals;
-        final int[] stack;
-        FullFrame(int offsetDelta, int[] locals, int[] stack) {
-            super(FULL_FRAME);
-            this.offsetDelta = offsetDelta;
-            this.locals = locals;
-            this.stack = stack;
-        }
-        void print(JavapPrinter p) {
-            super.print(p);
-            p.out.println(" /* full_frame */");
-            p.out.println("     offset_delta = " + offsetDelta);
-            p.printMap("     locals = [", locals);
-            p.printMap("     stack = [", stack);
-        }
-    }
-
-    static StackMapTableData getInstance(DataInputStream in, MethodData method)
-                  throws IOException {
-        int frameType = in.readUnsignedByte();
-
-        if (frameType < SAME_FRAME_BOUND) {
-            // same_frame
-            return new SameFrame(frameType, frameType);
-        } else if (SAME_FRAME_BOUND <= frameType && frameType < SAME_LOCALS_1_STACK_ITEM_BOUND) {
-            // same_locals_1_stack_item_frame
-            // read additional single stack element
-            return new SameLocals1StackItem(frameType,
-                                            (frameType - SAME_FRAME_BOUND),
-                                            StackMapData.readTypeArray(in, 1, method));
-        } else if (frameType == SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
-            // same_locals_1_stack_item_extended
-            return new SameLocals1StackItem(frameType,
-                                            in.readUnsignedShort(),
-                                            StackMapData.readTypeArray(in, 1, method));
-        } else if (SAME_LOCALS_1_STACK_ITEM_EXTENDED < frameType  && frameType < SAME_FRAME_EXTENDED) {
-            // chop_frame or same_frame_extended
-            return new ChopFrame(frameType, in.readUnsignedShort());
-        } else if (frameType == SAME_FRAME_EXTENDED) {
-            // chop_frame or same_frame_extended
-            return new SameFrame(frameType, in.readUnsignedShort());
-        } else if (SAME_FRAME_EXTENDED < frameType  && frameType < FULL_FRAME) {
-            // append_frame
-            return new AppendFrame(frameType, in.readUnsignedShort(),
-                                   StackMapData.readTypeArray(in, frameType - SAME_FRAME_EXTENDED, method));
-        } else if (frameType == FULL_FRAME) {
-            // full_frame
-            int offsetDelta = in.readUnsignedShort();
-            int locals_size = in.readUnsignedShort();
-            int[] locals = StackMapData.readTypeArray(in, locals_size, method);
-            int stack_size = in.readUnsignedShort();
-            int[] stack = StackMapData.readTypeArray(in, stack_size, method);
-            return new FullFrame(offsetDelta, locals, stack);
-        } else {
-            throw new ClassFormatError("unrecognized frame_type in StackMapTable");
-        }
-    }
-}
--- a/langtools/src/share/classes/sun/tools/javap/Tables.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,375 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.Hashtable;
-import java.util.Vector;
-
-
-public class Tables implements Constants {
-    /**
-     * Define mnemocodes table.
-     */
-  static  Hashtable<String,Integer> mnemocodes = new Hashtable<String,Integer>(301, 0.5f);
-  static  String opcExtNamesTab[]=new String[128];
-  static  String opcPrivExtNamesTab[]=new String[128];
-  static  void defineNonPriv(int opc, String mnem) {
-        mnemocodes.put(opcExtNamesTab[opc]=mnem, opc_nonpriv*256+opc);
-  }
-  static  void definePriv(int opc, String mnem) {
-        mnemocodes.put(opcPrivExtNamesTab[opc]="priv_"+mnem, opc_priv*256+opc);
-  }
-  static  void defineExt(int opc, String mnem) {
-        defineNonPriv(opc, mnem);
-        definePriv(opc, mnem);
-  }
-  static { int k;
-        for (k=0; k<opc_wide; k++) {
-                mnemocodes.put(opcNamesTab[k], k);
-        }
-        for (k=opc_wide+1; k<opcNamesTab.length; k++) {
-                mnemocodes.put(opcNamesTab[k], k);
-        }
-        mnemocodes.put("invokenonvirtual", opc_invokespecial);
-
-        mnemocodes.put("iload_w", opc_iload_w);
-        mnemocodes.put("lload_w", opc_lload_w);
-        mnemocodes.put("fload_w", opc_fload_w);
-        mnemocodes.put("dload_w", opc_dload_w);
-        mnemocodes.put("aload_w", opc_aload_w);
-        mnemocodes.put("istore_w", opc_istore_w);
-        mnemocodes.put("lstore_w", opc_lstore_w);
-        mnemocodes.put("fstore_w", opc_fstore_w);
-        mnemocodes.put("dstore_w", opc_dstore_w);
-        mnemocodes.put("astore_w", opc_astore_w);
-        mnemocodes.put("ret_w", opc_ret_w);
-        mnemocodes.put("iinc_w", opc_iinc_w);
-
-        mnemocodes.put("nonpriv", opc_nonpriv);
-        mnemocodes.put("priv", opc_priv);
-
-        defineExt(0, "load_ubyte");
-        defineExt(1, "load_byte");
-        defineExt(2, "load_char");
-        defineExt(3, "load_short");
-        defineExt(4, "load_word");
-        defineExt(10, "load_char_oe");
-        defineExt(11, "load_short_oe");
-        defineExt(12, "load_word_oe");
-        defineExt(16, "ncload_ubyte");
-        defineExt(17, "ncload_byte");
-        defineExt(18, "ncload_char");
-        defineExt(19, "ncload_short");
-        defineExt(20, "ncload_word");
-        defineExt(26, "ncload_char_oe");
-        defineExt(27, "ncload_short_oe");
-        defineExt(28, "ncload_word_oe");
-        defineExt(30, "cache_flush");
-        defineExt(32, "store_byte");
-        defineExt(34, "store_short");
-        defineExt(36, "store_word");
-        defineExt(42, "store_short_oe");
-        defineExt(44, "store_word_oe");
-        defineExt(48, "ncstore_byte");
-        defineExt(50, "ncstore_short");
-        defineExt(52, "ncstore_word");
-        defineExt(58, "ncstore_short_oe");
-        defineExt(60, "ncstore_word_oe");
-        defineExt(62, "zero_line");
-        defineNonPriv(5, "ret_from_sub");
-        defineNonPriv(63, "enter_sync_method");
-        definePriv(5, "ret_from_trap");
-        definePriv(6, "read_dcache_tag");
-        definePriv(7, "read_dcache_data");
-        definePriv(14, "read_icache_tag");
-        definePriv(15, "read_icache_data");
-        definePriv(22, "powerdown");
-        definePriv(23, "read_scache_data");
-        definePriv(31, "cache_index_flush");
-        definePriv(38, "write_dcache_tag");
-        definePriv(39, "write_dcache_data");
-        definePriv(46, "write_icache_tag");
-        definePriv(47, "write_icache_data");
-        definePriv(54, "reset");
-        definePriv(55, "write_scache_data");
-        for (k=0; k<32; k++) {
-                definePriv(k+64, "read_reg_"+k);
-        }
-        for (k=0; k<32; k++) {
-                definePriv(k+96, "write_reg_"+k);
-        }
- }
-
-  public static int opcLength(int opc) throws ArrayIndexOutOfBoundsException {
-        switch (opc>>8) {
-          case 0:
-                return opcLengthsTab[opc];
-          case opc_wide:
-                switch (opc&0xFF) {
-                  case opc_aload: case opc_astore:
-                  case opc_fload: case opc_fstore:
-                  case opc_iload: case opc_istore:
-                  case opc_lload: case opc_lstore:
-                  case opc_dload: case opc_dstore:
-                  case opc_ret:
-                        return  4;
-                  case opc_iinc:
-                        return  6;
-                  default:
-                        throw new ArrayIndexOutOfBoundsException();
-                }
-          case opc_nonpriv:
-          case opc_priv:
-                return 2;
-          default:
-                throw new ArrayIndexOutOfBoundsException();
-        }
-  }
-
-  public static String opcName(int opc) {
-        try {
-                switch (opc>>8) {
-                  case 0:
-                        return opcNamesTab[opc];
-                  case opc_wide: {
-                        String mnem=opcNamesTab[opc&0xFF]+"_w";
-                        if (mnemocodes.get(mnem) == null)
-                                return null; // non-existent opcode
-                        return mnem;
-                  }
-                  case opc_nonpriv:
-                        return opcExtNamesTab[opc&0xFF];
-                  case opc_priv:
-                        return opcPrivExtNamesTab[opc&0xFF];
-                  default:
-                        return null;
-                }
-        } catch (ArrayIndexOutOfBoundsException e) {
-                switch (opc) {
-                  case opc_nonpriv:
-                        return "nonpriv";
-                  case opc_priv:
-                        return "priv";
-                  default:
-                        return null;
-                }
-        }
-  }
-
-  public static int opcode(String mnem) {
-        Integer Val=mnemocodes.get(mnem);
-        if (Val == null) return -1;
-        return Val.intValue();
-  }
-
-    /**
-     * Initialized keyword and token Hashtables
-     */
-  static Vector<String> keywordNames = new Vector<String>(40);
-  private static void defineKeywordName(String id, int token) {
-
-        if (token>=keywordNames.size()) {
-                keywordNames.setSize(token+1);
-        }
-        keywordNames.setElementAt(id, token);
-  }
-  public static String keywordName(int token) {
-        if (token==-1) return "EOF";
-        if (token>=keywordNames.size()) return null;
-        return keywordNames.elementAt(token);
-  }
-  static {
-        defineKeywordName("ident", IDENT);
-        defineKeywordName("STRINGVAL", STRINGVAL);
-        defineKeywordName("intVal", INTVAL);
-        defineKeywordName("longVal", LONGVAL);
-        defineKeywordName("floatVal", FLOATVAL);
-        defineKeywordName("doubleVal", DOUBLEVAL);
-        defineKeywordName("SEMICOLON", SEMICOLON);
-        defineKeywordName("COLON", COLON);
-        defineKeywordName("LBRACE", LBRACE);
-        defineKeywordName("RBRACE", RBRACE);
-  }
-
-  static Hashtable<String,Integer> keywords = new Hashtable<String,Integer>(40);
-  public static int keyword(String idValue) {
-        Integer val=keywords.get(idValue);
-        if (val == null) return IDENT;
-        return val.intValue();
-  }
-
-  private static void defineKeyword(String id, int token) {
-        keywords.put(id, token);
-        defineKeywordName(id, token);
-  }
-  static {
-        // Modifier keywords
-        defineKeyword("private", PRIVATE);
-        defineKeyword("public", PUBLIC);
-        defineKeyword("protected",      PROTECTED);
-        defineKeyword("static", STATIC);
-        defineKeyword("transient",      TRANSIENT);
-        defineKeyword("synchronized",   SYNCHRONIZED);
-        defineKeyword("super",  SUPER);
-        defineKeyword("native", NATIVE);
-        defineKeyword("abstract",       ABSTRACT);
-        defineKeyword("volatile", VOLATILE);
-        defineKeyword("final",  FINAL);
-        defineKeyword("interface",INTERFACE);
-        defineKeyword("synthetic",SYNTHETIC);
-        defineKeyword("strict",STRICT);
-
-        // Declaration keywords
-        defineKeyword("package",PACKAGE);
-        defineKeyword("class",CLASS);
-        defineKeyword("extends",EXTENDS);
-        defineKeyword("implements",IMPLEMENTS);
-        defineKeyword("const",  CONST);
-        defineKeyword("throws",THROWS);
-        defineKeyword("interface",INTERFACE);
-        defineKeyword("Method",METHODREF);
-        defineKeyword("Field",FIELDREF);
-        defineKeyword("stack",STACK);
-        defineKeyword("locals",LOCAL);
-
-        // used in switchtables
-        defineKeyword("default",        DEFAULT);
-
-        // used in inner class declarations
-        defineKeyword("InnerClass",     INNERCLASS);
-        defineKeyword("of",     OF);
-
-        // misc
-        defineKeyword("bits",BITS);
-        defineKeyword("Infinity",INF);
-        defineKeyword("Inf",INF);
-        defineKeyword("NaN",NAN);
-  }
-
-   /**
-     * Define tag table.
-     */
-  private static Vector<String> tagNames = new Vector<String>(10);
-  private static Hashtable<String,Integer> Tags = new Hashtable<String,Integer>(10);
-  static {
-        defineTag("Asciz",CONSTANT_UTF8);
-        defineTag("int",CONSTANT_INTEGER);
-        defineTag("float",CONSTANT_FLOAT);
-        defineTag("long",CONSTANT_LONG);
-        defineTag("double",CONSTANT_DOUBLE);
-        defineTag("class",CONSTANT_CLASS);
-        defineTag("String",CONSTANT_STRING);
-        defineTag("Field",CONSTANT_FIELD);
-        defineTag("Method",CONSTANT_METHOD);
-        defineTag("InterfaceMethod",CONSTANT_INTERFACEMETHOD);
-        defineTag("NameAndType",CONSTANT_NAMEANDTYPE);
-  }
-  private static void defineTag(String id, int val) {
-        Tags.put(id, val);
-        if (val>=tagNames.size()) {
-                tagNames.setSize(val+1);
-        }
-        tagNames.setElementAt(id, val);
-  }
-  public static String tagName(int tag) {
-        if (tag>=tagNames.size()) return null;
-        return tagNames.elementAt(tag);
-  }
-  public static int tagValue(String idValue) {
-        Integer Val=Tags.get(idValue);
-        if (Val == null) return 0;
-        return Val.intValue();
-  }
-
-   /**
-     * Define type table. These types used in "newarray" instruction only.
-     */
-  private static Vector<String> typeNames = new Vector<String>(10);
-  private static Hashtable<String,Integer> Types = new Hashtable<String,Integer>(10);
-  static {
-        defineType("int",T_INT);
-        defineType("long",T_LONG);
-        defineType("float",T_FLOAT);
-        defineType("double",T_DOUBLE);
-        defineType("class",T_CLASS);
-        defineType("boolean",T_BOOLEAN);
-        defineType("char",T_CHAR);
-        defineType("byte",T_BYTE);
-        defineType("short",T_SHORT);
-  }
-  private static void defineType(String id, int val) {
-        Types.put(id, val);
-        if (val>=typeNames.size()) {
-                typeNames.setSize(val+1);
-        }
-        typeNames.setElementAt(id, val);
-  }
-  public static int typeValue(String idValue) {
-        Integer Val=Types.get(idValue);
-        if (Val == null) return -1;
-        return Val.intValue();
-  }
-  public static String typeName(int type) {
-        if (type>=typeNames.size()) return null;
-        return typeNames.elementAt(type);
-  }
-
-   /**
-     * Define MapTypes table.
-     * These constants used in stackmap tables only.
-     */
-  private static Vector<String> mapTypeNames = new Vector<String>(10);
-  private static Hashtable<String,Integer> MapTypes = new Hashtable<String,Integer>(10);
-  static {
-        defineMapType("bogus",             ITEM_Bogus);
-        defineMapType("int",               ITEM_Integer);
-        defineMapType("float",             ITEM_Float);
-        defineMapType("double",            ITEM_Double);
-        defineMapType("long",              ITEM_Long);
-        defineMapType("null",              ITEM_Null);
-        defineMapType("this",              ITEM_InitObject);
-        defineMapType("CP",                ITEM_Object);
-        defineMapType("uninitialized",     ITEM_NewObject);
-  }
-  private static void defineMapType(String id, int val) {
-        MapTypes.put(id, val);
-        if (val>=mapTypeNames.size()) {
-                mapTypeNames.setSize(val+1);
-        }
-        mapTypeNames.setElementAt(id, val);
-  }
-  public static int mapTypeValue(String idValue) {
-        Integer Val=MapTypes.get(idValue);
-        if (Val == null) return -1;
-        return Val.intValue();
-  }
-  public static String mapTypeName(int type) {
-        if (type>=mapTypeNames.size()) return null;
-        return mapTypeNames.elementAt(type);
-  }
-
-}
--- a/langtools/src/share/classes/sun/tools/javap/TrapData.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Stores exception table data in code attribute.
- *
- * @author  Sucheta Dambalkar (Adopted code from jdis)
- */
-class TrapData {
-    short start_pc, end_pc, handler_pc, catch_cpx;
-  int num;
-
-
-    /**
-     * Read and store exception table data in code attribute.
-     */
-    public TrapData(DataInputStream in, int num) throws IOException {
-        this.num=num;
-        start_pc = in.readShort();
-        end_pc=in.readShort();
-        handler_pc=in.readShort();
-        catch_cpx=in.readShort();
-    }
-
-    /**
-     * returns recommended identifier
-     */
-    public String ident() {
-        return "t"+num;
-    }
-
-}
--- a/langtools/src/share/classes/sun/tools/javap/TypeSignature.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-package sun.tools.javap;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Returns java type signature.
- *
- * @author  Sucheta Dambalkar
- */
-public class TypeSignature {
-
-    String parameters = null;
-    String returntype = null;
-    String fieldtype = null;
-    int argumentlength = 0;
-
-    public TypeSignature(String JVMSignature){
-
-        if(JVMSignature != null){
-            if(JVMSignature.indexOf("(") == -1){
-                //This is a field type.
-                this.fieldtype = getFieldTypeSignature(JVMSignature);
-            }else {
-                String parameterdes = null;
-                if((JVMSignature.indexOf(")")-1) > (JVMSignature.indexOf("("))){
-                    //Get parameter signature.
-                    parameterdes =
-                        JVMSignature.substring(JVMSignature.indexOf("(")+1,
-                                               JVMSignature.indexOf(")"));
-                    this.parameters = getParametersHelper(parameterdes);
-                }else this.parameters = "()";
-                //Get return type signature.
-                String returndes = JVMSignature.substring(JVMSignature.lastIndexOf(")")+1);
-                this.returntype = getReturnTypeHelper(returndes);
-            }
-        }
-    }
-
-    /**
-     * Returns java type signature of a field.
-     */
-    public String getFieldTypeSignature(String fielddes){
-        if(fielddes.startsWith("L")){
-            return(getObjectType(fielddes));
-        }else if(fielddes.startsWith("[")){
-            return(getArrayType(fielddes));
-        }else
-            return(getBaseType(fielddes));
-    }
-
-    /**
-     * Returns java type signature of a parameter.
-     */
-    public String getParametersHelper(String parameterdes){
-        Vector<String> parameters = new Vector<String>();
-        int startindex = -1;
-        int endindex = -1;
-        String param = "";
-
-        while(parameterdes != null){
-
-            if(parameterdes.startsWith("L")){
-                //parameter is a object.
-                startindex = parameterdes.indexOf("L");
-                endindex = parameterdes.indexOf(";");
-                if(startindex < parameterdes.length()) {
-                    if(endindex == parameterdes.length()-1) {
-                        //last parameter
-                        param = parameterdes.substring(startindex);
-                        parameterdes = null;
-                    }else if(endindex+1 < parameterdes.length()){
-                        //rest parameters
-                        param = parameterdes.substring(startindex, endindex+1);
-                        parameterdes = parameterdes.substring(endindex+1);
-
-                    }
-                    parameters.add(getObjectType(param));
-                }
-            }else if(parameterdes.startsWith("[")){
-                //parameter is an array.
-                String componentType = "";
-                int enddim = -1;
-                int st = 0;
-                while(true){
-                    if(st < parameterdes.length()){
-                        if(parameterdes.charAt(st) == '['){
-
-                            enddim = st;
-                            st++;
-                        }
-                        else break;
-                    }
-                    else break;
-                }
-
-                if(enddim+1 < parameterdes.length()){
-                    /* Array dimension.*/
-                    param = parameterdes.substring(0,enddim+1);
-
-                }
-
-                int stotherparam = param.lastIndexOf("[")+1;
-
-                if(stotherparam < parameterdes.length()){
-                    componentType =  parameterdes.substring(stotherparam);
-                }
-
-                if(componentType.startsWith("L")){
-                    //parameter is array of objects.
-                    startindex = parameterdes.indexOf("L");
-                    endindex = parameterdes.indexOf(";");
-
-                    if(endindex ==  parameterdes.length()-1){
-                        //last parameter
-                        param += parameterdes.substring(startindex);
-                        parameterdes = null;
-                    }else if(endindex+1 <  parameterdes.length()){
-                        //rest parameters
-                        param += parameterdes.substring(startindex, endindex+1);
-                        parameterdes = parameterdes.substring(endindex+1);
-                    }
-                }else{
-                    //parameter is array of base type.
-                    if(componentType.length() == 1){
-                        //last parameter.
-                        param += componentType;
-                        parameterdes = null;
-                    }
-                    else if (componentType.length() > 1) {
-                        //rest parameters.
-                        param += componentType.substring(0,1);
-                        parameterdes = componentType.substring(1);
-                    }
-                }
-                parameters.add(getArrayType(param));
-
-
-            }else {
-
-                //parameter is of base type.
-                if(parameterdes.length() == 1){
-                    //last parameter
-                    param = parameterdes;
-                    parameterdes = null;
-                }
-                else if (parameterdes.length() > 1) {
-                    //rest parameters.
-                    param = parameterdes.substring(0,1);
-                    parameterdes = parameterdes.substring(1);
-                }
-                parameters.add(getBaseType(param));
-            }
-        }
-
-        /* number of arguments of a method.*/
-        argumentlength =  parameters.size();
-
-        /* java type signature.*/
-        String parametersignature = "(";
-        int i;
-
-        for(i = 0; i < parameters.size(); i++){
-            parametersignature += parameters.elementAt(i);
-            if(i != parameters.size()-1){
-                parametersignature += ", ";
-            }
-        }
-        parametersignature += ")";
-        return parametersignature;
-    }
-
-    /**
-     * Returns java type signature for a return type.
-     */
-    public String getReturnTypeHelper(String returndes){
-        return getFieldTypeSignature(returndes);
-    }
-
-    /**
-     * Returns java type signature for a base type.
-     */
-    public String getBaseType(String baseType){
-        if(baseType != null){
-            if(baseType.equals("B")) return "byte";
-            else if(baseType.equals("C")) return "char";
-            else if(baseType.equals("D")) return "double";
-            else if(baseType.equals("F")) return "float";
-            else if(baseType.equals("I")) return "int";
-            else if(baseType.equals("J")) return "long";
-            else if(baseType.equals("S")) return "short";
-            else if(baseType.equals("Z")) return "boolean";
-            else if(baseType.equals("V")) return "void";
-        }
-        return null;
-    }
-
-    /**
-     * Returns java type signature for a object type.
-     */
-    public String getObjectType(String JVMobjectType) {
-        String objectType = "";
-        int startindex = JVMobjectType.indexOf("L")+1;
-        int endindex =  JVMobjectType.indexOf(";");
-        if((startindex != -1) && (endindex != -1)){
-            if((startindex < JVMobjectType.length()) && (endindex < JVMobjectType.length())){
-                objectType = JVMobjectType.substring(startindex, endindex);
-            }
-            objectType = objectType.replace('/','.');
-            return objectType;
-        }
-        return null;
-    }
-
-    /**
-     * Returns java type signature for array type.
-     */
-    public String getArrayType(String arrayType) {
-        if(arrayType != null){
-            String dimention = "";
-
-            while(arrayType.indexOf("[") != -1){
-                dimention += "[]";
-
-                int startindex = arrayType.indexOf("[")+1;
-                if(startindex <= arrayType.length()){
-                arrayType = arrayType.substring(startindex);
-                }
-            }
-
-            String componentType = "";
-            if(arrayType.startsWith("L")){
-                componentType = getObjectType(arrayType);
-            }else {
-                componentType = getBaseType(arrayType);
-            }
-            return componentType+dimention;
-        }
-        return null;
-    }
-
-    /**
-     * Returns java type signature for parameters.
-     */
-     public String getParameters(){
-        return parameters;
-    }
-
-    /**
-     * Returns java type signature for return type.
-     */
-    public String getReturnType(){
-        return returntype;
-    }
-
-    /**
-     * Returns java type signature for field type.
-     */
-    public String getFieldType(){
-        return fieldtype;
-    }
-
-    /**
-     * Return number of arguments of a method.
-     */
-    public int getArgumentlength(){
-        return argumentlength;
-    }
-}
--- a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java	Mon Jul 06 11:42:37 2009 -0700
@@ -41,7 +41,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, "pkg", SRC_DIR + FS + "NoPackage.java"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", SRC_DIR + FS + "NoPackage.java"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java	Mon Jul 06 11:42:37 2009 -0700
@@ -42,7 +42,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-source", "1.5", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java	Mon Jul 06 11:42:37 2009 -0700
@@ -40,7 +40,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-source", "1.5", "pkg"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java	Mon Jul 06 11:42:37 2009 -0700
@@ -36,7 +36,7 @@
 
     private static final String BUG_ID = "4496223-4496270-4618686-4720974-4812240-6253614-6253604";
     private static final String[] ARGS = new String[] {
-        "-source", "1.5", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "firstSentence", "firstSentence2"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "firstSentence", "firstSentence2"
     };
 
     /**
--- a/langtools/test/tools/javac/5005368.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/5005368.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary com/sun/tools/javac/comp/Check.java refers to the undefined resource
  * @author gafter
  *
- * @compile      -source 1.5 -Werror                  5005368.java
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked 5005368.java
+ * @compile      -Werror                  5005368.java
+ * @compile/fail -Werror -Xlint:unchecked 5005368.java
  */
 
 package p5005368;
--- a/langtools/test/tools/javac/6304921/T6304921.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/6304921/T6304921.java	Mon Jul 06 11:42:37 2009 -0700
@@ -1,7 +1,7 @@
 /*
  * @test (important: no SCCS keywords to affect offsets in golden file.)  /nodynamiccopyright/
  * @bug 6304921
- * @compile/fail/ref=T6304921.out -XDstdout -XDcompilePolicy=bytodo -XDdiags=%b:%s/%o/%e:%_%t%m|%p%m -Xjcov -Xlint:all,-path -Werror T6304921.java
+ * @compile/fail/ref=T6304921.out -XDstdout -XDcompilePolicy=bytodo -XDrawDiagnostics -Xjcov -Xlint:all,-path -Werror T6304921.java
  */
 
 import java.util.ArrayList;
--- a/langtools/test/tools/javac/6304921/T6304921.out	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/6304921/T6304921.out	Mon Jul 06 11:42:37 2009 -0700
@@ -1,20 +1,7 @@
-T6304921.java:671/671/680: warning: [rawtypes] found raw type: java.util.ArrayList
-        List<Integer> list = new ArrayList();
-                                 ^
-  missing type parameters for generic class java.util.ArrayList<E>
-T6304921.java:667/667/682: warning: [unchecked] unchecked conversion
-        List<Integer> list = new ArrayList();
-                             ^
-  required: java.util.List<java.lang.Integer>
-  found:    java.util.ArrayList
-error: warnings found and -Werror specified
-T6304921.java:727/733/737: cannot find symbol
-        System.orr.println("abc"); // name not found
-              ^
-  symbol:   variable orr
-  location: class java.lang.System
-T6304921.java:812/816/822: operator + cannot be applied to int,boolean
-        return 123 + true; // bad binary expression
-                   ^
+T6304921.java:29:34: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>
+T6304921.java:29:30: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.ArrayList, java.util.List<java.lang.Integer>
+- compiler.err.warnings.and.werror
+T6304921.java:35:15: compiler.err.cant.resolve.location: kindname.variable, orr, , , kindname.class, java.lang.System
+T6304921.java:38:20: compiler.err.operator.cant.be.applied: +, int,boolean
 3 errors
 2 warnings
--- a/langtools/test/tools/javac/6341866/Anno.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/6341866/Anno.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
 import javax.lang.model.element.*;
 
 @SupportedAnnotationTypes("*")
-    @SupportedSourceVersion(SourceVersion.RELEASE_6)
+    @SupportedSourceVersion(SourceVersion.RELEASE_7)
 public class Anno extends AbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                                     RoundEnvironment roundEnv) {
--- a/langtools/test/tools/javac/6464451/BigFinally.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/6464451/BigFinally.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug     6464451
  * @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
  * @author  Wei Tao
- * @compile -target 5 BigFinally.java
+ * @compile -source 5 -target 5 BigFinally.java
  * @clean BigFinally
  * @compile/fail BigFinally.java
  */
--- a/langtools/test/tools/javac/6464451/DeepNestedFinally.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/6464451/DeepNestedFinally.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug     6464451
  * @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
  * @author  Wei Tao
- * @compile -target 5 DeepNestedFinally.java
+ * @compile -source 5 -target 5 DeepNestedFinally.java
  * @clean DeepNestedFinally
  * @compile/fail DeepNestedFinally.java
  */
--- a/langtools/test/tools/javac/6464451/ManyExitsInTry.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/6464451/ManyExitsInTry.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug     6464451
  * @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
  * @author  Wei Tao
- * @compile -target 5 ManyExitsInTry.java
+ * @compile -source 5 -target 5 ManyExitsInTry.java
  * @clean ManyExitsInTry
  * @compile/fail ManyExitsInTry.java
  */
--- a/langtools/test/tools/javac/6491592/T6491592.out	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/6491592/T6491592.out	Mon Jul 06 11:42:37 2009 -0700
@@ -1,2 +1,2 @@
-T6491592.java:12:11: compiler.err.operator.cant.be.applied: +, java.lang.Object,<nulltype>
+T6491592.java:12:11: compiler.err.operator.cant.be.applied: +, java.lang.Object,compiler.misc.type.null
 1 error
--- a/langtools/test/tools/javac/Ambig3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/Ambig3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Missing ambiguity error when two methods are equally specific
  * @author gafter
  *
- * @compile/fail -source 1.5 Ambig3.java
+ * @compile/fail Ambig3.java
  */
 
 class Test<T,E> {
--- a/langtools/test/tools/javac/ArrayCast.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ArrayCast.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
  *          compilation.  This was fixed in 1.2beta2.
  * @author turnidge
  *
- * @compile -source 1.4 ArrayCast.java
+ * @compile ArrayCast.java
  */
 
 public class ArrayCast {
--- a/langtools/test/tools/javac/BadCovar.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/BadCovar.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Compiler allows inheritance of multiple methods with unrelated return types
  * @author gafter
  *
- * @compile/fail -source 1.5 BadCovar.java
+ * @compile/fail BadCovar.java
  */
 
 package bad.covar;
--- a/langtools/test/tools/javac/ClassLit.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ClassLit.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Use ldc instruction for class literals
  * @author gafter
  *
- * @compile -target 1.5 ClassLit.java
+ * @compile -source 1.5 -target 1.5 ClassLit.java
  * @run main ClassLit
  */
 
--- a/langtools/test/tools/javac/ClassLiterals/InitializeOuter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ClassLiterals/InitializeOuter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Using a class literal causes outermost class to be initialized early
  * @author gafter
  *
- * @compile -source 1.4 -target 1.4.2 InitializeOuter.java
+ * @compile InitializeOuter.java
  * @run main InitializeOuter
  */
 
--- a/langtools/test/tools/javac/ClassLiterals/InitializeTarget.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ClassLiterals/InitializeTarget.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary class literal causes the referenced class to be initialized
  * @author gafter
  *
- * @compile -source 1.4 -target 1.4.2 InitializeTarget.java
+ * @compile InitializeTarget.java
  * @run main InitializeTarget
  */
 
--- a/langtools/test/tools/javac/ClassToTypeParm.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ClassToTypeParm.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Generics: assignment of Class to type parm's default should elicit error
  * @author never
  *
- * @compile/fail -source 1.5 ClassToTypeParm.java
+ * @compile/fail ClassToTypeParm.java
  */
 
 class ClassToTypeParm<T> {
--- a/langtools/test/tools/javac/Closure1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/Closure1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Initialization of up-level links, immediately after super(), occurs too late.
  * @author gafter
  *
- * @compile -source 1.4 -target 1.4 Closure1.java
+ * @compile Closure1.java
  * @run main Closure1
  */
 
--- a/langtools/test/tools/javac/Closure2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/Closure2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Initialization of up-level links, immediately after super(), occurs too late.
  * @author gafter
  *
- * @compile -source 1.4 -target 1.4 Closure2.java
+ * @compile Closure2.java
  * @run main Closure2
  */
 
--- a/langtools/test/tools/javac/Closure3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/Closure3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Initialization of up-level links, immediately after super(), occurs too late.
  * @author gafter
  *
- * @compile -source 1.4 -target 1.4 Closure3.java
+ * @compile Closure3.java
  * @run main Closure3
  */
 
--- a/langtools/test/tools/javac/Closure4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/Closure4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Initialization of up-level links, immediately after super(), occurs too late.
  * @author gafter
  *
- * @compile -source 1.4 -target 1.4 Closure4.java
+ * @compile Closure4.java
  * @run main Closure4
  */
 
--- a/langtools/test/tools/javac/Closure5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/Closure5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Incorrect order for initializers in nested class
  * @author gafter
  *
- * @compile -source 1.4 -target 1.4 Closure5.java
+ * @compile Closure5.java
  * @run main Closure5
  */
 
--- a/langtools/test/tools/javac/CompoundBox.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/CompoundBox.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary drop compound boxing operations
  * @author gafter
  *
- * @compile/fail -source 1.5 CompoundBox.java
+ * @compile/fail CompoundBox.java
  */
 
 class CompoundBox {
--- a/langtools/test/tools/javac/ConditionalArgTypes_1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ConditionalArgTypes_1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
  * @author maddox
  *
  * @compile/fail -source 1.4 ConditionalArgTypes_1.java
- * @compile -source 1.5 ConditionalArgTypes_1.java
+ * @compile                  ConditionalArgTypes_1.java
  */
 
 // This is the problematic case -- the controlling expression is a boolean constant.
--- a/langtools/test/tools/javac/ConditionalArgTypes_2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ConditionalArgTypes_2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
  * @author maddox
  *
  * @compile/fail -source 1.4 ConditionalArgTypes_2.java
- * @compile -source 1.5 ConditionalArgTypes_2.java
+ * @compile                  ConditionalArgTypes_2.java
  */
 
 // This case was working before -- controlling expression is not a constant.
--- a/langtools/test/tools/javac/DefiniteAssignment/DUAssert.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/DefiniteAssignment/DUAssert.java	Mon Jul 06 11:42:37 2009 -0700
@@ -22,12 +22,12 @@
  */
 
 /*
- * @test %E
+ * @test
  * @bug 4478838 4533580
  * @summary Check correct handling of DU in assert statements
  * @author Neal Gafter (gafter)
  *
- * @run compile -source 1.4 DUAssert.java
+ * @run compile DUAssert.java
  */
 
 class DUSwitch {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234a.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     6722234
+ * @summary javac diagnostics need better integration with the type-system
+ * @author  mcimadamore
+ * @compile/fail/ref=T6722234a_1.out -XDrawDiagnostics -XDdiags=disambiguateTvars T6722234a.java
+ * @compile/fail/ref=T6722234a_2.out -XDrawDiagnostics -XDdiags=disambiguateTvars,where T6722234a.java
+ */
+
+class T6722234a<T extends String> {
+    <T extends Integer> void test(T t) {
+        m(t);
+    }
+    void m(T t) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234a_1.out	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,2 @@
+T6722234a.java:35:9: compiler.err.cant.apply.symbol: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a<compiler.misc.type.var: T, 1>, null
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234a_2.out	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,3 @@
+T6722234a.java:35:9: compiler.err.cant.apply.symbol: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a<compiler.misc.type.var: T, 1>, null
+- compiler.misc.where.description.typevar.1: compiler.misc.type.var: T, 1,compiler.misc.type.var: T, 2,{(compiler.misc.where.typevar: compiler.misc.type.var: T, 1, java.lang.String, kindname.class, T6722234a),(compiler.misc.where.typevar: compiler.misc.type.var: T, 2, java.lang.Integer, kindname.method, <compiler.misc.type.var: T, 2>test(compiler.misc.type.var: T, 2))}
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234b.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     6722234
+ * @summary javac diagnostics need better integration with the type-system
+ * @author  mcimadamore
+ * @compile/fail/ref=T6722234b_1.out -XDrawDiagnostics -XDdiags=simpleNames T6722234b.java
+ * @compile/fail/ref=T6722234b_2.out -XDrawDiagnostics -XDdiags=simpleNames,where T6722234b.java
+ */
+
+import java.util.*;
+
+class T6722234b {
+    <T> void m(List<T> l1, List<T> l2) {}
+
+    void test(List<? extends T6722234b> list) {
+        m(list, list);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234b_1.out	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,2 @@
+T6722234b.java:39:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.type.captureof: 1, ? extends T6722234b>,List<compiler.misc.type.captureof: 2, ? extends T6722234b>, kindname.class, T6722234b, null
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234b_2.out	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,4 @@
+T6722234b.java:39:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.captured.type: 1>,List<compiler.misc.captured.type: 2>, kindname.class, T6722234b, null
+- compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, Object, kindname.method, <T>m(List<T>,List<T>))}
+- compiler.misc.where.description.captured.1: compiler.misc.captured.type: 1,compiler.misc.captured.type: 2,{(compiler.misc.where.captured.1: compiler.misc.captured.type: 1, T6722234b, compiler.misc.type.null, ? extends T6722234b),(compiler.misc.where.captured.1: compiler.misc.captured.type: 2, T6722234b, compiler.misc.type.null, ? extends T6722234b)}
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234c.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     6722234
+ * @summary javac diagnostics need better integration with the type-system
+ * @author  mcimadamore
+ * @compile/fail/ref=T6722234c.out -XDrawDiagnostics -XDdiags=simpleNames T6722234c.java
+ */
+
+class T6722234c {
+    static class String {}
+    <T> void m(String s2) {}
+
+    void test() {
+        m("");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234c.out	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,2 @@
+T6722234c.java:37:9: compiler.err.cant.apply.symbol: kindname.method, m, T6722234c.String, java.lang.String, kindname.class, T6722234c, null
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234d.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug     6722234
+ * @summary javac diagnostics need better integration with the type-system
+ * @author  mcimadamore
+ * @compile/fail/ref=T6722234d_1.out -XDrawDiagnostics -XDdiags=where T6722234d.java
+ * @compile/fail/ref=T6722234d_2.out -XDrawDiagnostics -XDdiags=where,simpleNames T6722234d.java
+ */
+
+class T6722234d {
+    interface I1 {}
+    interface I2 {}
+    class A implements I1, I2 {}
+    class B implements I1, I2 {}
+    class Test {
+        <Z> Z m(Z z1, Z z2) { return null; }
+        void main(){
+            A a = m(new A(), new B());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234d_1.out	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,3 @@
+T6722234d.java:41:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.intersection.type: 1, T6722234d.A
+- compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, java.lang.Object,T6722234d.I1,T6722234d.I2)}
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Diagnostics/6722234/T6722234d_2.out	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,3 @@
+T6722234d.java:41:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.intersection.type: 1, T6722234d.A
+- compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, Object,I1,I2)}
+1 error
--- a/langtools/test/tools/javac/EarlyAssert.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/EarlyAssert.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,9 +27,6 @@
  * @summary Verify that assertions are enabled before the class is initialized
  * and not thereafter
  * @author gafter
- *
- * @compile -source 1.4 EarlyAssert.java
- * @run main EarlyAssert
  */
 
 /*
--- a/langtools/test/tools/javac/Enum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/Enum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4934060
  * @summary private enum ctor versus specialized enum constant crashes javac
  * @author gafter
- *
- * @compile -source 1.5 Enum1.java
- * @run main Enum1
  */
 
 public enum Enum1 {
--- a/langtools/test/tools/javac/ExtendArray.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ExtendArray.java	Mon Jul 06 11:42:37 2009 -0700
@@ -3,7 +3,7 @@
  * @bug 4336282 4785453
  * @summary Verify that extending an erray class does not crash the compiler.
  *
- * @compile/fail/ref=ExtendArray.out -XDstdout -XDdiags=%b:%l:%_%m ExtendArray.java
+ * @compile/fail/ref=ExtendArray.out -XDstdout -XDrawDiagnostics ExtendArray.java
  */
 
 // Note that an error is expected, but not a crash.
--- a/langtools/test/tools/javac/ExtendArray.out	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ExtendArray.out	Mon Jul 06 11:42:37 2009 -0700
@@ -1,6 +1,2 @@
-ExtendArray.java:11: unexpected type
-public class ExtendArray extends Object[] {}
-                                       ^
-  required: class
-  found:    java.lang.Object[]
+ExtendArray.java:11:40: compiler.err.type.found.req: java.lang.Object[], (compiler.misc.type.req.class)
 1 error
--- a/langtools/test/tools/javac/GoodCovar.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/GoodCovar.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary multiple methods inheritence
  * @author gafter
  *
- * @compile -source 1.5 GoodCovar.java
+ * @compile GoodCovar.java
  */
 
 package good.covar;
--- a/langtools/test/tools/javac/HexFloatLiterals.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/HexFloatLiterals.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4920023
  * @summary add "hexadecimal floating-point literal" support to javac as per 4896828
  * @author gafter
- *
- * @compile -source 1.5 HexFloatLiterals.java
- * @run main HexFloatLiterals
  */
 
 public class HexFloatLiterals {
--- a/langtools/test/tools/javac/HexThree.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/HexThree.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4920023
  * @summary Test hex floating-point literals
  * @author darcy
- *
- * @compile -source 1.5 HexThree.java
- * @run main HexThree
  */
 
 public class HexThree {
--- a/langtools/test/tools/javac/InterfaceAssert.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/InterfaceAssert.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4399129
  * @summary Check that assertions compile properly when nested in an interface
  * @author gafter
- *
- * @compile -source 1.4 InterfaceAssert.java
- * @run main InterfaceAssert
  */
 
 /*
--- a/langtools/test/tools/javac/InvalidIntfCast.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/InvalidIntfCast.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary The compiler should detect an invalid cast between interfaces.
  * @author turnidge
  *
- * @compile -source 1.5 InvalidIntfCast.java
+ * @compile InvalidIntfCast.java
  */
 
 interface I {
--- a/langtools/test/tools/javac/NewGeneric.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/NewGeneric.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary unclear diagnostic for "new T()"
  * @author never
  *
- * @compile/fail -source 1.5 NewGeneric.java
+ * @compile/fail NewGeneric.java
  */
 
 
--- a/langtools/test/tools/javac/ObjectMethodRefFromInterface.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/ObjectMethodRefFromInterface.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,9 +27,6 @@
  * @summary Verify that access to member of java.lang.Object via qualification of
  * object of an interface type is handled successfully.
  * @author maddox
- *
- * @run compile -source 1.3 -target 1.2 -g ObjectMethodRefFromInterface.java
- * @run main/othervm ObjectMethodRefFromInterface
  */
 
 public class ObjectMethodRefFromInterface {
--- a/langtools/test/tools/javac/OverridePosition.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/OverridePosition.java	Mon Jul 06 11:42:37 2009 -0700
@@ -4,7 +4,7 @@
  * @summary "attemping to assign weaker access" message doesn't give method line number
  * @author Neal Gafter
  *
- * @compile/fail/ref=OverridePosition.out -XDstdout -XDdiags=%b:%l:%_%m OverridePosition.java
+ * @compile/fail/ref=OverridePosition.out -XDstdout -XDrawDiagnostics OverridePosition.java
  */
 
 package T4524388;
--- a/langtools/test/tools/javac/OverridePosition.out	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/OverridePosition.out	Mon Jul 06 11:42:37 2009 -0700
@@ -1,7 +1,3 @@
-OverridePosition.java:17: method() in T4524388.Testa cannot implement method() in T4524388.Interface; attempting to assign weaker access privileges; was public
-    void method() {}
-         ^
-OverridePosition.java:24: method() in T4524388.A cannot implement method() in T4524388.Interface; attempting to assign weaker access privileges; was public
-class B extends A implements Interface {
-^
+OverridePosition.java:17:10: compiler.err.override.weaker.access: (compiler.misc.cant.implement: method(), T4524388.Testa, method(), T4524388.Interface), public
+OverridePosition.java:24:1: compiler.err.override.weaker.access: (compiler.misc.cant.implement: method(), T4524388.A, method(), T4524388.Interface), public
 2 errors
--- a/langtools/test/tools/javac/PrivateLocalConstructor.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/PrivateLocalConstructor.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4365809
  * @summary Incorrect access method for private constructor in local class.
  * @author gafter
- *
- * @compile -source 1.4 -target 1.4 PrivateLocalConstructor.java
- * @run main PrivateLocalConstructor
  */
 
 public class PrivateLocalConstructor {
--- a/langtools/test/tools/javac/RawCrash.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/RawCrash.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash with raw instantiation of generic inner class
  * @author gafter
  *
- * @compile -source 1.5 RawCrash.java
+ * @compile RawCrash.java
  */
 
 class A<E> {
--- a/langtools/test/tools/javac/SynthName2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/SynthName2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary using of synthetic names in local class causes ClassFormatError
  * @author gafter
  *
- * @compile/fail -source 1.4 -target 1.4 SynthName2.java
+ * @compile/fail SynthName2.java
  */
 
 import java.io.PrintStream;
--- a/langtools/test/tools/javac/T4093617/T4093617.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T4093617/T4093617.java	Mon Jul 06 11:42:37 2009 -0700
@@ -3,7 +3,7 @@
  * @bug     4093617
  * @summary Object has no superclass
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T4093617.out -XDstdout -XDdiags=%b:%l:%_%m T4093617.java
+ * @compile/fail/ref=T4093617.out -XDstdout -XDrawDiagnostics T4093617.java
  */
 
 package java.lang;
--- a/langtools/test/tools/javac/T4093617/T4093617.out	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T4093617/T4093617.out	Mon Jul 06 11:42:37 2009 -0700
@@ -1,4 +1,2 @@
-T4093617.java:12: java.lang.Object has no superclass
-    Object() { super(); }
-               ^
+T4093617.java:12:16: compiler.err.no.superclass: java.lang.Object
 1 error
--- a/langtools/test/tools/javac/T5003235/T5003235c.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T5003235/T5003235c.java	Mon Jul 06 11:42:37 2009 -0700
@@ -3,7 +3,7 @@
  * @bug     5003235
  * @summary Access to private inner classes
  * @author  Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235c.out -XDstdout -XDdiags=%b:%l:%_%m T5003235c.java
+ * @compile/fail/ref=T5003235c.out -XDstdout -XDrawDiagnostics T5003235c.java
  */
 
 class T5003235c {
--- a/langtools/test/tools/javac/T5003235/T5003235c.out	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T5003235/T5003235c.out	Mon Jul 06 11:42:37 2009 -0700
@@ -1,4 +1,2 @@
-T5003235c.java:15: T5003235c.B has private access in T5003235c
-class C extends T5003235c.B.Inner {}
-                         ^
+T5003235c.java:15:26: compiler.err.report.access: T5003235c.B, private, T5003235c
 1 error
--- a/langtools/test/tools/javac/T5090006/compiler.sh	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T5090006/compiler.sh	Mon Jul 06 11:42:37 2009 -0700
@@ -63,7 +63,7 @@
     ;;
 esac
 
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -verbose -source 5 -d "${TESTCLASSES}" -cp "${TESTSRC}${FS}broken.jar" "${TESTSRC}${FS}$1"
+"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -verbose -d "${TESTCLASSES}" -cp "${TESTSRC}${FS}broken.jar" "${TESTSRC}${FS}$1"
 
 result=$?
 
--- a/langtools/test/tools/javac/T5092545.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T5092545.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,8 +26,6 @@
  * @bug 5092545
  * @summary Assertion failed in javac (ClassWriter.java:513)
  * @author Peter von der Ah\u00e9
- * @compile -source 5 T5092545.java
- * @run main T5092545
  */
 
 interface A { void g(); }
--- a/langtools/test/tools/javac/T5105890.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T5105890.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,8 +26,6 @@
  * @bug 5105890
  * @summary (codegen) constant folding broken for conditional operator
  * @author Peter von der Ah\u00e9
- * @compile -source 5 T5105890.java
- * @run main T5105890
  */
 
 public class T5105890 {
--- a/langtools/test/tools/javac/T6405099.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T6405099.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,20 +25,39 @@
  * @test
  * @bug 6405099
  * @summary Compiler crashes when javac encounters /usr/jdk/packges/lib/ext with no 777 permissions
- *
- * @ignore causes NPE in Java Test
- * @run main T6405099
- * @compile -extdirs bad T6405099.java
  */
 
-import java.io.File;
+import java.io.*;
 
 public class T6405099
 {
     public static void main(String[] args) {
         File bad = new File("bad");
-        bad.mkdir();
-        bad.setReadable(false);
-        bad.setExecutable(false);
+        try {
+            bad.mkdir();
+            bad.setReadable(false);
+            bad.setExecutable(false);
+
+            test(bad);
+
+        } finally {
+            bad.setExecutable(true);
+            bad.setReadable(true);
+        }
+    }
+
+    static void test(File dir) {
+        String[] args = {
+            "-extdirs", dir.getPath(), "-d", ".",
+            new File(System.getProperty("test.src", "."), "T6405099.java").getPath()
+        };
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args, pw);
+        if (rc != 0)
+            throw new Error("compilation failed");
+
+        System.out.println(sw);
     }
 }
--- a/langtools/test/tools/javac/T6557865.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/T6557865.java	Mon Jul 06 11:42:37 2009 -0700
@@ -24,10 +24,10 @@
 /*
  * @test
  * @bug 6557865
- * @summary -target 5 should not put ACC_SYNTHETIC on package-info
+ * @summary -source 5 -target 5 should not put ACC_SYNTHETIC on package-info
  * @author Wei Tao
  * @compile T6557865.java
- * @compile -target 5 T6232928/package-info.java
+ * @compile -source 5 -target 5 T6232928/package-info.java
  * @run main T6557865
  */
 
--- a/langtools/test/tools/javac/annotations/default/A.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/default/A.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,11 +27,11 @@
  * @summary Constraints regarding annotation defaults
  * @author gafter
  *
- * @compile -source 1.5 A.java
- * @compile -source 1.5 B.java
- * @compile -source 1.5 C.java
- * @compile/fail -source 1.5 Derr.java
- * @compile/fail -source 1.5 Eerr.java
+ * @compile A.java
+ * @compile B.java
+ * @compile C.java
+ * @compile/fail Derr.java
+ * @compile/fail Eerr.java
  */
 
 public @interface A {
--- a/langtools/test/tools/javac/annotations/neg/AnnComma.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/AnnComma.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary annotation syntax allows extra ',' in parameter list.
  * @author gafter
  *
- * @compile/fail -source 1.5 AnnComma.java
+ * @compile/fail AnnComma.java
  */
 
 package annComma;
--- a/langtools/test/tools/javac/annotations/neg/ArrayLit.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/ArrayLit.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175 (4): don't allow "new" in annotations
  * @author gafter
  *
- * @compile/fail -source 1.5 ArrayLit.java
+ * @compile/fail ArrayLit.java
  */
 
 @ArrayLit(new int[] {1, 2, 3})
--- a/langtools/test/tools/javac/annotations/neg/Constant.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Constant.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175 (5): annotations must be "constants"
  * @author gafter
  *
- * @compile/fail -source 1.5 Constant.java
+ * @compile/fail Constant.java
  */
 
 package test.tools.javac.annotation.Constant;
--- a/langtools/test/tools/javac/annotations/neg/Cycle1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Cycle1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary (JSR175) compiler allows self-containing annotation types
  * @author gafter
  *
- * @compile/fail -source 1.5 Cycle1.java
+ * @compile/fail Cycle1.java
  */
 
 package cycle1;
--- a/langtools/test/tools/javac/annotations/neg/Cycle2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Cycle2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary (JSR175) compiler allows self-containing annotation types
  * @author gafter
  *
- * @compile/fail -source 1.5 Cycle2.java
+ * @compile/fail Cycle2.java
  */
 
 package cycle2;
--- a/langtools/test/tools/javac/annotations/neg/Cycle3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Cycle3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac allows cyclic annotation interfaces with arrays
  * @author gafter
  *
- * @compile/fail -source 1.5 Cycle3.java
+ * @compile/fail Cycle3.java
  */
 
 package cycle3;
--- a/langtools/test/tools/javac/annotations/neg/Dep.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Dep.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,8 +28,8 @@
  * @author gafter
  *
  * @compile      -source 1.4 -Xlint:dep-ann -Werror Dep.java
- * @compile/fail -source 1.5 -Xlint:dep-ann -Werror Dep.java
- * @compile      -source 1.5 -Xlint:dep-ann         Dep.java
+ * @compile/fail             -Xlint:dep-ann -Werror Dep.java
+ * @compile                  -Xlint:dep-ann         Dep.java
  */
 
 /** @deprecated */
--- a/langtools/test/tools/javac/annotations/neg/Dup.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Dup.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175 (3): don't allow repeated annotations
  * @author gafter
  *
- * @compile/fail -source 1.5 Dup.java
+ * @compile/fail Dup.java
  */
 
 @Dup
--- a/langtools/test/tools/javac/annotations/neg/DupTarget.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/DupTarget.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary <at>Target
  * @author gafter
  *
- * @compile/fail -source 1.5 DupTarget.java
+ * @compile/fail DupTarget.java
  */
 
 @java.lang.annotation.Target({TYPE, FIELD, PACKAGE, FIELD})
--- a/langtools/test/tools/javac/annotations/neg/MemberOver.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/MemberOver.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Annotation members must not have same signature as Object or Annotation members
  * @author gafter
  *
- * @compile/fail -source 1.5 MemberOver.java
+ * @compile/fail MemberOver.java
  */
 
 package memberOver;
--- a/langtools/test/tools/javac/annotations/neg/ObjectMembers.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/ObjectMembers.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175 (2): don't allow annotating members from Object
  * @author gafter
  *
- * @compile/fail -source 1.5 ObjectMembers.java
+ * @compile/fail ObjectMembers.java
  */
 
 @ObjectMembers(hashCode = 23)
--- a/langtools/test/tools/javac/annotations/neg/OverrideNo.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/OverrideNo.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175 (7): implement <at>Overrides
  * @author gafter
  *
- * @compile/fail -source 1.5 OverrideNo.java
+ * @compile/fail OverrideNo.java
  */
 
 package overrideNo;
--- a/langtools/test/tools/javac/annotations/neg/Package.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Package.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Package annotations
  * @author gafter
  *
- * @compile/fail -source 1.5 Package.java
+ * @compile/fail Package.java
  */
 
 @java.lang.annotation.Documented
--- a/langtools/test/tools/javac/annotations/neg/Recovery.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Recovery.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash with malformed annotations
  * @author gafter
  *
- * @compile/fail -source 1.5 Recovery.java
+ * @compile/fail Recovery.java
  */
 
 import java.lang.annotation.*;
--- a/langtools/test/tools/javac/annotations/neg/Recovery1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Recovery1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Assertion error is thrown when an annotation class cannot be found.
  * @author gafter
  *
- * @compile/fail -source 1.5 Recovery1.java
+ * @compile/fail Recovery1.java
  */
 
 package recovery1;
--- a/langtools/test/tools/javac/annotations/neg/Scope.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Scope.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary name lookup scope for annotations
  * @author gafter
  *
- * @compile/fail -source 1.5 Scope.java
+ * @compile/fail Scope.java
  */
 
 package annotation.scope;
--- a/langtools/test/tools/javac/annotations/neg/Syntax1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Syntax1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash with ill-formed annotation
  * @author gafter
  *
- * @compile/fail -source 1.5 Syntax1.java
+ * @compile/fail Syntax1.java
  */
 
 package syntax1;
--- a/langtools/test/tools/javac/annotations/neg/WrongTarget.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/WrongTarget.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary java.lang.annotation.Target
  * @author gafter
  *
- * @compile/fail -source 1.5 WrongTarget.java
+ * @compile/fail WrongTarget.java
  */
 
 @java.lang.annotation.Target({FIELD})
--- a/langtools/test/tools/javac/annotations/neg/WrongTarget2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/WrongTarget2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Compiler allows Inherited meta-attribute on local variable declaration.
  * @author gafter
  *
- * @compile/fail -source 1.5 WrongTarget2.java
+ * @compile/fail WrongTarget2.java
  */
 
 import java.lang.annotation.Inherited;
--- a/langtools/test/tools/javac/annotations/neg/WrongValue.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/WrongValue.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler: crashes when attributes with same elements are used in place of other
  * @author gafter
  *
- * @compile/fail -source 1.5 WrongValue.java
+ * @compile/fail WrongValue.java
  */
 
 @interface TestM2 {
--- a/langtools/test/tools/javac/annotations/neg/Z1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z1.java
+ * @compile/fail Z1.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z10.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z10.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z10.java
+ * @compile/fail Z10.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z11.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z11.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z11.java
+ * @compile/fail Z11.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z12.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z12.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z12.java
+ * @compile/fail Z12.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z13.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z13.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z13.java
+ * @compile/fail Z13.java
  */
 
 @interface An {
--- a/langtools/test/tools/javac/annotations/neg/Z14.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z14.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z14.java
+ * @compile/fail Z14.java
  */
 
 @interface An<T> {
--- a/langtools/test/tools/javac/annotations/neg/Z15.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z15.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z15.java
+ * @compile/fail Z15.java
  */
 
 @interface An {
--- a/langtools/test/tools/javac/annotations/neg/Z16.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z16.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z16.java
+ * @compile/fail Z16.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z2.java
+ * @compile/fail Z2.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z3.java
+ * @compile/fail Z3.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z4.java
+ * @compile/fail Z4.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/neg/Z5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z5.java
+ * @compile/fail Z5.java
  */
 
 interface Foo {}
--- a/langtools/test/tools/javac/annotations/neg/Z8.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z8.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z8.java
+ * @compile/fail Z8.java
  */
 
 @interface An {
--- a/langtools/test/tools/javac/annotations/neg/Z9.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/neg/Z9.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile/fail -source 1.5 Z9.java
+ * @compile/fail Z9.java
  */
 
 @interface An {
--- a/langtools/test/tools/javac/annotations/pos/AnnoteElideBraces.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/AnnoteElideBraces.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175 (15): single element array annotation value
  * @author gafter
  *
- * @compile -source 1.5 AnnoteElideBraces.java
+ * @compile AnnoteElideBraces.java
  */
 
 @interface D {
--- a/langtools/test/tools/javac/annotations/pos/ClassA.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/ClassA.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary javac crash loading class files containing Class-valued annotation fields
  * @author gafter
  *
- * @compile -source 1.5 ClassA.java ClassB.java
- * @compile -source 1.5 ClassB.java
+ * @compile ClassA.java ClassB.java
+ * @compile ClassB.java
  */
 
 @interface ClassA {
--- a/langtools/test/tools/javac/annotations/pos/Dep.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Dep.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Please add annotation <at>Deprecated to supplant the javadoc tag
  * @author gafter
  *
- * @compile -source 1.5 -Xlint:dep-ann -Werror Dep.java
+ * @compile -Xlint:dep-ann -Werror Dep.java
  */
 
 /** @deprecated */
--- a/langtools/test/tools/javac/annotations/pos/Enum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Enum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175: annotations on enum constant
  * @author gafter
  *
- * @compile -source 1.5 Enum1.java
+ * @compile Enum1.java
  */
 
 package annotation.enums;
--- a/langtools/test/tools/javac/annotations/pos/Local.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Local.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary local variable annotations
  * @author gafter
  *
- * @compile -source 1.5 Local.java
+ * @compile Local.java
  */
 
 class Local {
--- a/langtools/test/tools/javac/annotations/pos/Members.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Members.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary annotation types may contain constants, types
  * @author gafter
  *
- * @compile -source 1.5 Members.java
+ * @compile Members.java
  */
 
 package members;
--- a/langtools/test/tools/javac/annotations/pos/NType.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/NType.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash if annotation using an enum type defined inside the annotation
  * @author gafter
  *
- * @compile -source 1.5 NType.java
+ * @compile NType.java
  */
 
 package ntype;
--- a/langtools/test/tools/javac/annotations/pos/OverrideCheck.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/OverrideCheck.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary crash in annotation class file reader
  * @author gafter
  *
- * @compile -source 1.5 OverrideCheck.java
+ * @compile OverrideCheck.java
  */
 
 class OverrideCheck {
--- a/langtools/test/tools/javac/annotations/pos/OverrideOK.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/OverrideOK.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175 (7): implement <at>Overrides
  * @author gafter
  *
- * @compile -source 1.5 OverrideOK.java
+ * @compile OverrideOK.java
  */
 
 package overrideOK;
--- a/langtools/test/tools/javac/annotations/pos/Parameter.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Parameter.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary JSR175: Parameter annotations
  * @author gafter
  *
- * @compile -source 1.5 Parameter.java
+ * @compile Parameter.java
  */
 
 package annotation.parameter;
--- a/langtools/test/tools/javac/annotations/pos/Primitives.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Primitives.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 5034991 5040842 5040853
  * @summary Modify class-file representation of Class-valued annotation elements
  * @author gafter
- *
- * @compile -source 1.5 Primitives.java
- * @run main Primitives
  */
 
 public class Primitives {
--- a/langtools/test/tools/javac/annotations/pos/RightTarget.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/RightTarget.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary java.lang.annotation.Target
  * @author gafter
  *
- * @compile -source 1.5 RightTarget.java
+ * @compile RightTarget.java
  */
 
 import java.lang.annotation.ElementType;
--- a/langtools/test/tools/javac/annotations/pos/Z1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Z1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile -source 1.5 Z1.java
+ * @compile Z1.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/pos/Z2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Z2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile -source 1.5 Z2.java
+ * @compile Z2.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/pos/Z3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Z3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile -source 1.5 Z3.java
+ * @compile Z3.java
  */
 
 enum Color { red, green, blue }
--- a/langtools/test/tools/javac/annotations/pos/Z4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/Z4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary implement "metadata" (attribute interfaces and program annotations)
  * @author gafter
  *
- * @compile -source 1.5 Z4.java
+ * @compile Z4.java
  */
 
 @interface An {
--- a/langtools/test/tools/javac/annotations/pos/package-info.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/annotations/pos/package-info.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Package annotations
  * @author gafter
  *
- * @compile -source 1.5 package-info.java
+ * @compile package-info.java
  */
 
 @java.lang.annotation.Documented
--- a/langtools/test/tools/javac/api/6431257/T6431257.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/api/6431257/T6431257.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,6 @@
  * @summary JSR 199: Changes to JavaFileManager to support JSR 269 Filer API
  * @author  Peter von der Ah\u00e9
  * @library ../lib
- * @ignore  Need to fix this test when 6508981 is fixed.
  * @compile T6431257.java package-info.java
  * @run main T6431257 foo.bar.baz foo/bar/baz
  */
--- a/langtools/test/tools/javac/api/TestJavacTaskScanner.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/api/TestJavacTaskScanner.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug     4813736
  * @summary Additional functionality test of task and JSR 269
  * @author  Peter von der Ah\u00e9
- * @ignore "misuse" of context breaks with 6358786
+ * @library ./lib
  * @run main TestJavacTaskScanner TestJavacTaskScanner.java
  */
 
@@ -42,16 +42,23 @@
 import javax.lang.model.util.Elements;
 import javax.lang.model.util.Types;
 import javax.tools.*;
-import javax.tools.JavaFileManager;
 
-public class TestJavacTaskScanner implements Runnable {
+public class TestJavacTaskScanner extends ToolTester {
 
     final JavacTaskImpl task;
     final Elements elements;
     final Types types;
 
-    TestJavacTaskScanner(JavacTaskImpl task) {
-        this.task = task;
+    int numTokens;
+    int numParseTypeElements;
+    int numAllMembers;
+
+    TestJavacTaskScanner(File file) {
+        final Iterable<? extends JavaFileObject> compilationUnits =
+            fm.getJavaFileObjects(new File[] {file});
+        task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, compilationUnits);
+        task.getContext().put(Scanner.Factory.scannerFactoryKey,
+                new MyScanner.Factory(task.getContext(), this));
         elements = task.getElements();
         types = task.getTypes();
     }
@@ -71,6 +78,23 @@
             System.out.println();
             System.out.println();
         }
+
+        System.out.println("#tokens: " + numTokens);
+        System.out.println("#parseTypeElements: " + numParseTypeElements);
+        System.out.println("#allMembers: " + numAllMembers);
+
+        check(numTokens, "#Tokens", 891);
+        check(numParseTypeElements, "#parseTypeElements", 136);
+        check(numAllMembers, "#allMembers", 67);
+    }
+
+    void check(int value, String name, int expected) {
+        // allow some slop in the comparison to allow for minor edits in the
+        // test and in the platform
+        if (value < expected * 9 / 10)
+            throw new Error(name + " lower than expected; expected " + expected + "; found: " + value);
+        if (value > expected * 11 / 10)
+            throw new Error(name + " higher than expected; expected " + expected + "; found: " + value);
     }
 
     void testParseType(TypeElement clazz) {
@@ -78,23 +102,19 @@
         for (Element member : elements.getAllMembers((TypeElement)type.asElement())) {
             TypeMirror mt = types.asMemberOf(type, member);
             System.out.format("%s : %s -> %s%n", member.getSimpleName(), member.asType(), mt);
+            numParseTypeElements++;
         }
     }
 
     public static void main(String... args) throws IOException {
-        JavaCompilerTool tool = ToolProvider.defaultJavaCompiler();
-        JavaFileManager fm = tool.getStandardFileManager();
         String srcdir = System.getProperty("test.src");
-        File file = new File(srcdir, args[0]);
-        JavacTaskImpl task = (JavacTaskImpl)tool.run(null, fm.getFileForInput(file.toString()));
-        MyScanner.Factory.preRegister(task.getContext());
-        TestJavacTaskScanner tester = new TestJavacTaskScanner(task);
-        tester.run();
+        new TestJavacTaskScanner(new File(srcdir, args[0])).run();
     }
 
     private void testGetAllMembers(TypeElement clazz) {
         for (Element member : elements.getAllMembers(clazz)) {
-            System.out.format("%s : %s", member.getSimpleName(), member.asType());
+            System.out.format("%s : %s%n", member.getSimpleName(), member.asType());
+            numAllMembers++;
         }
     }
 }
@@ -102,21 +122,15 @@
 class MyScanner extends Scanner {
 
     public static class Factory extends Scanner.Factory {
-        public static void preRegister(final Context context) {
-            context.put(scannerFactoryKey, new Context.Factory<Scanner.Factory>() {
-                public Factory make() {
-                    return new Factory(context);
-                }
-            });
-        }
-        public Factory(Context context) {
+        public Factory(Context context, TestJavacTaskScanner test) {
             super(context);
+            this.test = test;
         }
 
         @Override
         public Scanner newScanner(CharSequence input) {
             if (input instanceof CharBuffer) {
-                return new MyScanner(this, (CharBuffer)input);
+                return new MyScanner(this, (CharBuffer)input, test);
             } else {
                 char[] array = input.toString().toCharArray();
                 return newScanner(array, array.length);
@@ -125,18 +139,26 @@
 
         @Override
         public Scanner newScanner(char[] input, int inputLength) {
-            return new MyScanner(this, input, inputLength);
+            return new MyScanner(this, input, inputLength, test);
         }
+
+        private TestJavacTaskScanner test;
     }
-    protected MyScanner(Factory fac, CharBuffer buffer) {
+    protected MyScanner(Factory fac, CharBuffer buffer, TestJavacTaskScanner test) {
         super(fac, buffer);
+        this.test = test;
     }
-    protected MyScanner(Factory fac, char[] input, int inputLength) {
+    protected MyScanner(Factory fac, char[] input, int inputLength, TestJavacTaskScanner test) {
         super(fac, input, inputLength);
+        this.test = test;
     }
 
     public void nextToken() {
         super.nextToken();
         System.err.format("Saw token %s (%s)%n", token(), name());
+        test.numTokens++;
     }
+
+    private TestJavacTaskScanner test;
+
 }
--- a/langtools/test/tools/javac/assert/Attach.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/assert/Attach.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4478095
  * @summary assertion flag attached to wrong class
  * @author gafter
- *
- * @compile -source 1.4 Attach.java
- * @run main Attach
  */
 
 public class Attach {
--- a/langtools/test/tools/javac/assert/DU1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/assert/DU1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Check correct DU computation for assertions.
  * @author gafter
  *
- * @compile/fail -source 1.4 DU1.java
+ * @compile/fail DU1.java
  */
 
 class DU1 {
--- a/langtools/test/tools/javac/assert/DU2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/assert/DU2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Check correct DU computation for assertions.
  * @author gafter
  *
- * @compile/fail -source 1.4 DU2.java
+ * @compile/fail DU2.java
  */
 
 class DU2 {
--- a/langtools/test/tools/javac/assert/Position.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/assert/Position.java	Mon Jul 06 11:42:37 2009 -0700
@@ -3,17 +3,17 @@
  * @bug 4469737
  * @summary Verify the source position for assertions.
  * @author gafter
- *
- * @compile -source 1.4 Position.java
- * @run main Position
  */
 
+
 public class Position {
     static public void main(String[] args) {
         Position.class.getClassLoader().setClassAssertionStatus("U", true);
         new U().main();
     }
 }
+
+
 class U {
     void main() {
         try {
--- a/langtools/test/tools/javac/boxing/BoxedForeach.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/boxing/BoxedForeach.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary boxing/unboxing versus foreach crashes javac
  * @author gafter
  *
- * @compile -source 1.5 BoxedForeach.java
+ * @compile BoxedForeach.java
  * @run main BoxedForeach
  */
 
--- a/langtools/test/tools/javac/boxing/Boxing1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/boxing/Boxing1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4869233 4872709 4868735 4921949 4921209 4965701 4934916 4975565 4974939
  * @summary Boxing/unboxing positive unit and regression tests
  * @author gafter
- *
- * @compile -source 1.5 Boxing1.java
- * @run main Boxing1
  */
 
 public class Boxing1 {
--- a/langtools/test/tools/javac/boxing/Boxing2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/boxing/Boxing2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Boxing/unboxing negative unit and regression tests
  * @author gafter
  *
- * @compile/fail -source 1.5 Boxing2.java
+ * @compile/fail Boxing2.java
  */
 
 public class Boxing2 {
--- a/langtools/test/tools/javac/boxing/Boxing4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/boxing/Boxing4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4999689
  * @summary Compiler incorrectly create Integer in "Character c = 95"
  * @author gafter
- *
- * @compile -source 1.5 Boxing4.java
- * @run main Boxing4
  */
 
 public class Boxing4 {
--- a/langtools/test/tools/javac/boxing/BoxingCaching.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/boxing/BoxingCaching.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4990346
  * @summary Verify autoboxed values are cached as required.
  * @author Joseph D. Darcy
- *
- * @compile -source 1.5 BoxingCaching.java
- * @run main BoxingCaching
  */
 
 public class BoxingCaching {
--- a/langtools/test/tools/javac/capture/Capture1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/capture/Capture1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary wildcard capture (snapshotting)
  * @author gafter
  *
- * @compile -Xlint:unchecked -Werror -source 1.5 Capture1.java
+ * @compile -Xlint:unchecked -Werror Capture1.java
  */
 
 package capture1;
--- a/langtools/test/tools/javac/capture/Capture2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/capture/Capture2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary soundness problem with failure to subsitute wildcard as type formal argument
  * @author gafter
  *
- * @compile/fail -source 1.5 Capture2.java
+ * @compile/fail Capture2.java
  */
 
 package capture2;
--- a/langtools/test/tools/javac/capture/Capture3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/capture/Capture3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary new wildcard subst scheme breaks java.lang.ref
  * @author gafter
  *
- * @compile -source 1.5 Capture3.java
+ * @compile Capture3.java
  */
 
 package capture3;
--- a/langtools/test/tools/javac/capture/Capture5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/capture/Capture5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary wildcards versus recursive F-bounds
  * @author Peter von der Ahe
  *
- * @compile -source 1.5 Capture5.java
+ * @compile Capture5.java
  */
 
 package capture5;
--- a/langtools/test/tools/javac/cast/BoxedArray.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/cast/BoxedArray.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary REGRESSION: compiler allows cast from Integer[] to int[]
  * @author gafter
  *
- * @compile/fail -source 1.5 BoxedArray.java
+ * @compile/fail BoxedArray.java
  */
 
 public class BoxedArray {
--- a/langtools/test/tools/javac/code/ArrayClone.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/code/ArrayClone.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,15 +25,38 @@
  * @test
  * @bug 4329886
  * @summary Clone() on arrays compiled incorrectly
- * @author gafter
- *
- * @ignore Waiting for javap bug 4650860 to be fixed.
- *
- * @run shell ArrayClone.sh
+ * @author gafter jjg
  */
 
+import java.io.*;
+
 /** The qualifying type in the code for array.clone() should be the array type. */
-class ArrayClone {
+public class ArrayClone {
+    public static void main(String[] args) {
+        new ArrayClone().run();
+    }
+
+    public void run() {
+        String[] args = { "-classpath", System.getProperty("test.classes", "."), "-v", "Test" };
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        if (rc != 0)
+            throw new Error("javap failed; exit " + rc);
+
+        String out = sw.toString();
+        System.out.println(out);
+
+        for (String line: out.split("\n")) {
+            String match = "[ \t]+[0-9]+:[ \t]+invokevirtual[ \t]+#[0-9]+; //Method \"\\[Ljava/lang/String;\".clone:\\(\\)Ljava/lang/Object;";
+            if (line.matches(match))
+                return;
+        }
+        throw new Error("expected string not found in javap output");
+    }
+}
+
+class Test {
     public static void main(String[] args) {
         args.clone();
     }
--- a/langtools/test/tools/javac/code/ArrayClone.sh	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-# CA 95054 USA or visit www.sun.com if you need additional information or
-# have any questions.
-#
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux )
-    NULL=/dev/null
-    PS=":"
-    FS="/"
-    ;;
-  Windows_95 | Windows_98 | Windows_NT )
-    NULL=NUL
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-TMP1=OUTPUT.txt
-
-cp "${TESTSRC}${FS}ArrayClone.java" .
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -target 1.5 ArrayClone.java
-result=$?
-if [ $result -ne 0 ]
-then
-    exit $result
-fi
-
-"${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -c ArrayClone > ${TMP1}
-grep WHAT_SHOULD_WE_LOOK_FOR ${TMP1}
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- a/langtools/test/tools/javac/enum/AbstractEmptyEnum.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/AbstractEmptyEnum.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary empty enum cannot be abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 AbstractEmptyEnum.java
+ * @compile/fail AbstractEmptyEnum.java
  */
 
 public enum AbstractEmptyEnum {
--- a/langtools/test/tools/javac/enum/AbstractEnum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/AbstractEnum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 5054976
  * @summary compiler fails to flag an enum abstract
  * @author gafter
- *
- * @compile -source 1.5 AbstractEnum1.java
- * @run main AbstractEnum1
  */
 
 import java.lang.reflect.Modifier;
--- a/langtools/test/tools/javac/enum/DA1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/DA1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary One can refer static, const static variables from instance initializers of enum
  * @author gafter
  *
- * @compile/fail -source 1.5 DA1.java
+ * @compile/fail DA1.java
  */
 
 package da1;
--- a/langtools/test/tools/javac/enum/DA2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/DA2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary One can refer static, const static variables from instance initializers of enum
  * @author gafter
  *
- * @compile/fail -source 1.5 DA2.java
+ * @compile/fail DA2.java
  */
 
 package da2;
--- a/langtools/test/tools/javac/enum/DA3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/DA3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary One can refer static, const static variables from instance initializers of enum
  * @author gafter
  *
- * @compile/fail -source 1.5 DA3.java
+ * @compile/fail DA3.java
  */
 
 package da3;
--- a/langtools/test/tools/javac/enum/Def.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/Def.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary constant static fields cannot be referenced from const, instance initializers
  * @author gafter
  *
- * @compile -source 1.5 Def.java
+ * @compile Def.java
  */
 
 package _enum.def;
--- a/langtools/test/tools/javac/enum/Enum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/Enum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4945532
  * @summary enums: test output of values().toString()
  * @author gafter
- *
- * @compile -source 1.5 Enum1.java
- * @run main Enum1
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/enum/Enum2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/Enum2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @summary enums: an enumeration type may not be extended
  * @author gafter
  *
- * @compile/fail -source 1.5 Enum2.java
+ * @compile/fail Enum2.java
  */
 
 public class Enum2 {
--- a/langtools/test/tools/javac/enum/Enum3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/Enum3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4945532
  * @summary enums: test switch
  * @author gafter
- *
- * @compile -source 1.5 Enum3.java
- * @run main Enum3
  */
 
 public enum Enum3 {
--- a/langtools/test/tools/javac/enum/EnumImplicitPrivateConstructor.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumImplicitPrivateConstructor.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 5009601 5010455 5005748
  * @summary enum constructors can be declared private
  * @author Joseph D. Darcy
- *
- * @compile -source 1.5 EnumImplicitPrivateConstructor.java
- * @run main EnumImplicitPrivateConstructor
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/enum/EnumInit.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumInit.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiling annatations with nested enums issuing *.java leads to crash
  * @author gafter
  *
- * @compile -source 1.5 EnumInit.java
+ * @compile EnumInit.java
  */
 
 package enum_init_;
--- a/langtools/test/tools/javac/enum/EnumPrivateConstructor.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumPrivateConstructor.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum constructors can be declared private
  * @author Joseph D. Darcy
  *
- * @compile -source 1.5 EnumPrivateConstructor.java
+ * @compile EnumPrivateConstructor.java
  */
 
 enum EnumPrivateConstructor {
--- a/langtools/test/tools/javac/enum/EnumProtectedConstructor.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumProtectedConstructor.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum constructors cannot be declared public or protected
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 EnumProtectedConstructor.java
+ * @compile/fail EnumProtectedConstructor.java
  */
 
 enum EnumProtectedConstructor {
--- a/langtools/test/tools/javac/enum/EnumPublicConstructor.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumPublicConstructor.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum constructors cannot be declared public or protected
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 EnumPublicConstructor.java
+ * @compile/fail EnumPublicConstructor.java
  */
 
 enum EnumPublicConstructor {
--- a/langtools/test/tools/javac/enum/EnumSwitch1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumSwitch1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum switch case labels required to be unqualified.
  * @author gafter
  *
- * @compile -source 1.5 EnumSwitch1.java
+ * @compile EnumSwitch1.java
  */
 
 package enumswitch1;
--- a/langtools/test/tools/javac/enum/EnumSwitch2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumSwitch2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum switch case labels required to be unqualified.
  * @author gafter
  *
- * @compile/fail -source 1.5 EnumSwitch2.java
+ * @compile/fail EnumSwitch2.java
  */
 
 package enumswitch2;
--- a/langtools/test/tools/javac/enum/EnumSwitch3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumSwitch3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac crash when enum defined after use
  * @author gafter
  *
- * @compile -source 1.5 EnumSwitch3.java
+ * @compile EnumSwitch3.java
  */
 
 package enumswitch3;
--- a/langtools/test/tools/javac/enum/EnumSwitch4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/EnumSwitch4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 5006662
  * @summary enum switch on null fails to throw NullPointerException
  * @author gafter
- *
- * @compile -source 1.5 EnumSwitch4.java
- * @run main EnumSwitch4
  */
 
 public enum EnumSwitch4 {
--- a/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum's cannot be explicitly declared abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 ExplicitlyAbstractEnum1.java
+ * @compile/fail ExplicitlyAbstractEnum1.java
  */
 
 abstract enum ExplicitlyAbstractEnum1 {
--- a/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum's cannot be explicitly declared abstract even if they are abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 ExplicitlyAbstractEnum2.java
+ * @compile/fail ExplicitlyAbstractEnum2.java
  */
 
 abstract enum ExplicitlyAbstractEnum2 {
--- a/langtools/test/tools/javac/enum/ExplicitlyFinalEnum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/ExplicitlyFinalEnum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum's cannot be explicitly declared final even if they are
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 ExplicitlyFinalEnum1.java
+ * @compile/fail ExplicitlyFinalEnum1.java
  */
 
 final enum ExplicitlyFinalEnum1 {
--- a/langtools/test/tools/javac/enum/ExplicitlyFinalEnum2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/ExplicitlyFinalEnum2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum's cannot be explicitly declared final
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 ExplicitlyFinalEnum2.java
+ * @compile/fail ExplicitlyFinalEnum2.java
  */
 
 final enum ExplicitlyFinalEnum2 {
--- a/langtools/test/tools/javac/enum/FauxEnum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/FauxEnum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary verify java.lang.Enum can't be directly subclassed
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 FauxEnum1.java
+ * @compile/fail FauxEnum1.java
  */
 
 public class FauxEnum1 extends java.lang.Enum {
--- a/langtools/test/tools/javac/enum/FauxEnum3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/FauxEnum3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary verify an enum type can't be directly subclassed
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 FauxEnum3.java
+ * @compile/fail FauxEnum3.java
  */
 
 public class FauxEnum3 extends SpecializedEnum {
--- a/langtools/test/tools/javac/enum/FauxSpecialEnum1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/FauxSpecialEnum1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary verify specialized enum classes can't be abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 FauxSpecialEnum1.java
+ * @compile/fail FauxSpecialEnum1.java
  */
 
 public enum FauxSpecialEnum1 {
--- a/langtools/test/tools/javac/enum/FauxSpecialEnum2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/FauxSpecialEnum2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary verify specialized enum classes can't be abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail -source 1.5 FauxSpecialEnum2.java
+ * @compile/fail FauxSpecialEnum2.java
  */
 
 public enum FauxSpecialEnum2 {
--- a/langtools/test/tools/javac/enum/LocalEnum.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/LocalEnum.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac fails to reject local enums
  * @author gafter
  *
- * @compile/fail -source 1.5 LocalEnum.java
+ * @compile/fail LocalEnum.java
  */
 
 public class LocalEnum {
--- a/langtools/test/tools/javac/enum/NoFinal.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/NoFinal.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail -source 5 NoFinal.java
+ * @compile/fail NoFinal.java
  */
 
 enum NoFinal {
--- a/langtools/test/tools/javac/enum/NoFinal2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/NoFinal2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail -source 5 NoFinal2.java
+ * @compile/fail NoFinal2.java
  */
 
 enum NoFinal2 {
--- a/langtools/test/tools/javac/enum/NoFinal3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/NoFinal3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail -source 5 NoFinal3.java
+ * @compile/fail NoFinal3.java
  */
 
 enum NoFinal3 {
--- a/langtools/test/tools/javac/enum/NoFinal4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/NoFinal4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail -source 5 NoFinal4.java
+ * @compile/fail NoFinal4.java
  */
 
 enum NoFinal4 {
--- a/langtools/test/tools/javac/enum/NoFinal5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/NoFinal5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail -source 5 NoFinal5.java
+ * @compile/fail NoFinal5.java
  */
 
 enum NoFinal5 {
--- a/langtools/test/tools/javac/enum/OkFinal.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/OkFinal.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,8 +26,6 @@
  * @bug 5097250
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile -source 5 OkFinal.java
- * @run main OkFinal
  */
 
 public enum OkFinal {
--- a/langtools/test/tools/javac/enum/SynthValues.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/SynthValues.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4984627
  * @summary Enums: +VALUES field has no synthetic attribute
  * @author gafter
- *
- * @compile -source 1.5 SynthValues.java
- * @run main SynthValues
  */
 
 public enum SynthValues {
--- a/langtools/test/tools/javac/enum/T5075242.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/T5075242.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Cannot make compound type involving Enums
  * @author Peter von der Ah\u00e9
  *
- * @compile -source 5 T5075242.java
+ * @compile T5075242.java
  */
 
 interface Iface {
--- a/langtools/test/tools/javac/enum/T5081785.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/T5081785.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,10 +28,10 @@
  * @summary Empty Enums allowed in non-static contexts
  * @author Peter von der Ah\u00e9
  *
- * @compile/fail -source 1.5 T5081785.java
- * @compile/fail -source 1.5 T5081785a.java
- * @compile/fail -source 1.5 T5081785b.java
- * @compile/fail -source 1.5 T5081785c.java
+ * @compile/fail T5081785.java
+ * @compile/fail T5081785a.java
+ * @compile/fail T5081785b.java
+ * @compile/fail T5081785c.java
  */
 
 class A {
--- a/langtools/test/tools/javac/enum/TrailingComma.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/TrailingComma.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary enum spec allows trailing comma on enum constant list
  * @author gafter
  *
- * @compile -source 1.5 TrailingComma.java
+ * @compile TrailingComma.java
  */
 
 class TrailingComma {
--- a/langtools/test/tools/javac/enum/UserValue.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/UserValue.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash on user-defined valueOf in enum
  * @author gafter
  *
- * @compile -source 1.5 UserValue.java
+ * @compile UserValue.java
  */
 
 public enum UserValue {
--- a/langtools/test/tools/javac/enum/ValueOf.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/ValueOf.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4872708 5058132
  * @summary Improper signature for valueOf
  * @author gafter
- *
- * @compile -source 1.5 ValueOf.java
- * @run main ValueOf
  */
 
 public enum ValueOf {
--- a/langtools/test/tools/javac/enum/enumSwitch/EnumSwitch.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/enum/enumSwitch/EnumSwitch.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary javac-generated code doesn't obey binary compatibility for enums
  * @author gafter
  *
- * @compile -source 1.5 EnumSwitch.java
- * @compile -source 1.5 Color2.java
+ * @compile EnumSwitch.java
+ * @compile Color2.java
  * @run main EnumSwitch
  */
 
--- a/langtools/test/tools/javac/foreach/Foreach.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/Foreach.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4855355
  * @summary implement "foreach" loops as specified in JSR 201
  * @author gafter
- *
- * @compile -source 1.5 Foreach.java
- * @run main Foreach
  */
 
 import java.util.Iterator;
--- a/langtools/test/tools/javac/foreach/GenericIterator.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/GenericIterator.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary extended 'for' with generic collections causes the compiler to crash
  * @author gafter
  *
- * @compile -source 1.5 GenericIterator.java
+ * @compile GenericIterator.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/foreach/IntersectIterator.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/IntersectIterator.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 5003207
  * @summary new "for" statement  fails to cast to second upper bound
  * @author gafter
- *
- * @compile -source 1.5 IntersectIterator.java
- * @run main IntersectIterator
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/foreach/ListOfListTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/ListOfListTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4915435
  * @summary NullPointerError in Resolve.findMethod() with foreach vs generics
  * @author gafter
- *
- * @compile -source 1.5 ListOfListTest.java
- * @run main ListOfListTest
  */
 
 import java.util.List;
--- a/langtools/test/tools/javac/foreach/SpecIterable.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/SpecIterable.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4911157
  * @summary Runtime error because of missing method in iterator
  * @author gafter
- *
- * @compile -source 1.5 SpecIterable.java
- * @run main SpecIterable
  */
 
 import java.util.Iterator;
--- a/langtools/test/tools/javac/foreach/StaticBlock.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/StaticBlock.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash (NullPointerException) with foreach in static context
  * @author gafter
  *
- * @compile -source 1.5 StaticBlock.java
+ * @compile StaticBlock.java
  */
 
 public class StaticBlock {
--- a/langtools/test/tools/javac/foreach/SuperfluousAbstract.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/SuperfluousAbstract.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4912795
  * @summary AbstractMethodError throws if not redeclare abstract iterator() method
  * @author gafter
- *
- * @compile -source 1.5 SuperfluousAbstract.java
- * @run main SuperfluousAbstract
  */
 
 import java.util.AbstractCollection;
--- a/langtools/test/tools/javac/foreach/T6682380.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/foreach/T6682380.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 6682380 6679509
  * @summary Foreach loop with generics inside finally block crashes javac with -target 1.5
  * @author Jan Lahoda, Maurizio Cimadamore
- * @compile -target 1.5 T6682380.java
+ * @compile -source 1.5 -target 1.5 T6682380.java
  */
 
 import java.util.List;
--- a/langtools/test/tools/javac/generics/ArrayClone.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ArrayClone.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary The clone method on arrays should be strongly typed
  * @author gafter
  *
- * @compile -source 1.5 ArrayClone.java
+ * @compile  ArrayClone.java
  * @run main ArrayClone
  */
 
--- a/langtools/test/tools/javac/generics/ArrayTypearg.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ArrayTypearg.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: array as generic argument type fails
  * @author gafter
  *
- * @compile -source 1.5 ArrayTypearg.java
+ * @compile  ArrayTypearg.java
  */
 
 import java.util.List;
--- a/langtools/test/tools/javac/generics/BridgeClash.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/BridgeClash.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: incorrect erasure clash reported
  * @author gafter
  *
- * @compile -source 1.5 BridgeClash.java
+ * @compile  BridgeClash.java
  */
 
 interface I<T> {
--- a/langtools/test/tools/javac/generics/BridgeOrder.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/BridgeOrder.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: overridden method gets invoked (bridge method problem)
  * @author gafter
  *
- * @compile -source 1.5 BridgeOrder.java
+ * @compile  BridgeOrder.java
  * @run main BridgeOrder
  */
 
--- a/langtools/test/tools/javac/generics/CastCrash.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/CastCrash.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Crash on cast
  * @author gafter
  *
- * @compile/fail -source 1.5 CastCrash.java
+ * @compile/fail  CastCrash.java
  */
 
 package cast.crash;
--- a/langtools/test/tools/javac/generics/Casting.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Casting.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics problem with casting
  * @author gafter
  *
- * @compile -source 1.5 Casting.java
+ * @compile  Casting.java
  */
 
 package test.tools.javac.generics.Casting;
--- a/langtools/test/tools/javac/generics/Casting2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Casting2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary stack overflow error compiling EnumSet.java
  * @author gafter
  *
- * @compile -source 1.5 Casting2.java
+ * @compile  Casting2.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/Casting3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Casting3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash with stack overflow on unchecked cast
  * @author gafter
  *
- * @compile -source 1.5 Casting3.java
+ * @compile  Casting3.java
  */
 
 package test.tools.javac.generics.Casting3;
--- a/langtools/test/tools/javac/generics/Casting4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Casting4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Cannot cast Comparable<?>s
  * @author gafter
  *
- * @compile -Werror -Xlint:unchecked -source 1.5 Casting4.java
+ * @compile -Werror -Xlint:unchecked  Casting4.java
  */
 
 package test.tools.javac.generics.Casting4;
--- a/langtools/test/tools/javac/generics/Conditional.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Conditional.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Rule for semantics of ?: in the presence of generics and generic class Class
  * @author gafter
  *
- * @compile -source 1.5 Conditional.java
+ * @compile  Conditional.java
  */
 
 package conditional;
--- a/langtools/test/tools/javac/generics/Covar2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Covar2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Additional unit tests for covariant returns
  * @author gafter
  *
- * @compile -source 1.5 Covar2.java
+ * @compile  Covar2.java
  * @run main Covar2
  */
 
--- a/langtools/test/tools/javac/generics/Covar3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Covar3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary missing ambiguity error
  * @author gafter
  *
- * @compile/fail -source 1.5 Covar3.java
+ * @compile/fail  Covar3.java
  */
 
 package covar3;
--- a/langtools/test/tools/javac/generics/Covar4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Covar4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary no covariant returns involving primitives
  * @author gafter
  *
- * @compile/fail -source 1.5 Covar4.java
+ * @compile/fail  Covar4.java
  */
 
 public class Covar4 {
--- a/langtools/test/tools/javac/generics/Crash01.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Crash01.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: crash when using class in bound defined after usage
  * @author gafter
  *
- * @compile -source 1.5 Crash01.java
+ * @compile  Crash01.java
  */
 
 public class Crash01<A extends TestClass1 & IA> {
--- a/langtools/test/tools/javac/generics/Crash02.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Crash02.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash in class writer
  * @author gafter
  *
- * @compile -source 1.5 Crash02.java
+ * @compile  Crash02.java
  */
 
 import java.util.ArrayList;
--- a/langtools/test/tools/javac/generics/CyclicInheritance3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/CyclicInheritance3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4861743
  * @summary generics: incorrect cyclic inheritance error with type parameters
  *
- * @compile -source 1.5 CyclicInheritance3.java
+ * @compile  CyclicInheritance3.java
  */
 
 class Cycle {
--- a/langtools/test/tools/javac/generics/CyclicInheritance5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/CyclicInheritance5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4862621
  * @summary generics: incorrect cyclic inheritance error
  *
- * @compile -source 1.5 CyclicInheritance5.java
+ * @compile  CyclicInheritance5.java
  */
 
 class G<N extends G.Node<N>> {
--- a/langtools/test/tools/javac/generics/ErasureClashCrash.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ErasureClashCrash.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac crash with improper overrider
  * @author gafter
  *
- * @compile/fail -source 1.5 ErasureClashCrash.java
+ * @compile/fail  ErasureClashCrash.java
  */
 
 interface Compar<T> {
--- a/langtools/test/tools/javac/generics/ExtendedRaw1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ExtendedRaw1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: extension of raw not treated as raw.
  * @author gafter
  *
- * @compile -source 1.5 ExtendedRaw1.java
+ * @compile  ExtendedRaw1.java
  */
 
 class Comparator<T> {}
--- a/langtools/test/tools/javac/generics/ExtendedRaw2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ExtendedRaw2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: extension of raw not treated as raw.
  * @author gafter
  *
- * @compile -source 1.5 ExtendedRaw2.java
+ * @compile  ExtendedRaw2.java
  */
 
 // from library
--- a/langtools/test/tools/javac/generics/ExtendedRaw3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ExtendedRaw3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: bridge method not considered to fulfil interface in abstract class
  * @author gafter
  *
- * @compile -source 1.5 ExtendedRaw3.java
+ * @compile  ExtendedRaw3.java
  */
 
 interface MyComparable<T extends MyComparable<T>> {
--- a/langtools/test/tools/javac/generics/ExtendedRaw4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ExtendedRaw4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary REGRESSION: compatibility problem inheriting raw type
  * @author gafter
  *
- * @compile -source 1.5 ExtendedRaw4.java
+ * @compile  ExtendedRaw4.java
  */
 
 class ExtendedRaw4 extends java.util.TreeSet {}
--- a/langtools/test/tools/javac/generics/FinalBridge.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/FinalBridge.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: bridge for inherited final method can cause verify error
  * @author gafter
  *
- * @compile -source 1.5 FinalBridge.java
+ * @compile  FinalBridge.java
  * @run main FinalBridge
  */
 
--- a/langtools/test/tools/javac/generics/GenLit1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GenLit1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler crash with ill-formed annotation
  * @author gafter
  *
- * @compile/fail -source 1.5 GenLit1.java
+ * @compile/fail  GenLit1.java
  */
 
 package genLit1;
--- a/langtools/test/tools/javac/generics/GenLit2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GenLit2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary java allows class literal on generic type parameter array
  * @author gafter
  *
- * @compile/fail -source 1.5 GenLit2.java
+ * @compile/fail  GenLit2.java
  */
 
 package genLit2;
--- a/langtools/test/tools/javac/generics/GenericAnonCtor.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GenericAnonCtor.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac crash on parameterized anonymous constructor invocation
  * @author gafter
  *
- * @compile -source 1.5 GenericAnonCtor.java
+ * @compile  GenericAnonCtor.java
  * @run main GenericAnonCtor
  */
 
--- a/langtools/test/tools/javac/generics/GenericMerge.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GenericMerge.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: compiler crash merging signatures of generic methods
  * @author gafter
  *
- * @compile -source 1.5 GenericMerge.java
+ * @compile  GenericMerge.java
  */
 
 class Box<T> {}
--- a/langtools/test/tools/javac/generics/GenericOverride.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GenericOverride.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Cannot override non-trivial generic method
  * @author gafter
  *
- * @compile -source 1.5 GenericOverride.java
+ * @compile  GenericOverride.java
  */
 
 package generic.override;
--- a/langtools/test/tools/javac/generics/GenericThrowable.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GenericThrowable.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary java.lang.Throwable inheritance in parameterized type
  * @author gafter
  *
- * @compile/fail -source 1.5 GenericThrowable.java
+ * @compile/fail  GenericThrowable.java
  */
 
 class GenericThrowable<T> extends NullPointerException {
--- a/langtools/test/tools/javac/generics/GetClass.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GetClass.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary the type of x.getClass() is no longer Class<? extends X>
  * @author gafter
  *
- * @compile/fail -source 1.5 GetClass.java
+ * @compile/fail  GetClass.java
  */
 
 public class GetClass {
--- a/langtools/test/tools/javac/generics/GetClass2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/GetClass2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary the type of x.getClass() is Class<? extends |X|>
  * @author seligman
  *
- * @compile -source 1.5 GetClass2.java
+ * @compile  GetClass2.java
  * @run main GetClass2
  */
 
--- a/langtools/test/tools/javac/generics/InheritanceConflict.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InheritanceConflict.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary two inherited methods with same signature
  * @author gafter, Maurizio Cimadamore
  *
- * @compile/fail -source 1.5 InheritanceConflict.java
+ * @compile/fail  InheritanceConflict.java
  */
 
 package inheritance.conflict;
--- a/langtools/test/tools/javac/generics/InheritanceConflict2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InheritanceConflict2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary two inherited methods with same signature
  * @author gafter, Maurizio Cimadamore
  *
- * @compile -source 1.5 InheritanceConflict2.java
+ * @compile  InheritanceConflict2.java
  */
 
 package inheritance.conflict2;
--- a/langtools/test/tools/javac/generics/InheritanceConflict3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InheritanceConflict3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary two inherited methods with same signature
  * @author darcy
  *
- * @compile/fail -source 1.5 InheritanceConflict3.java
+ * @compile/fail  InheritanceConflict3.java
  */
 
 package inheritance.conflict3;
--- a/langtools/test/tools/javac/generics/InnerInterface1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InnerInterface1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Inner interfaces are not treated as static
  * @author gafter
  *
- * @compile -source 1.5 InnerInterface1.java
+ * @compile  InnerInterface1.java
  */
 
 package test.tools.javac.generics.InnerInterface1;
--- a/langtools/test/tools/javac/generics/InnerInterface2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InnerInterface2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary inner interface causes "not within bounds"
  * @author gafter
  *
- * @compile -source 1.5 InnerInterface2.java
+ * @compile  InnerInterface2.java
  */
 
 package test.tools.javac.generics.InnerInterface2;
--- a/langtools/test/tools/javac/generics/InstanceOf1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InstanceOf1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary the type in an instanceof expression must be reifiable
  * @author seligman
  *
- * @compile -source 1.5 InstanceOf1.java
+ * @compile  InstanceOf1.java
  */
 
 public class InstanceOf1 {
--- a/langtools/test/tools/javac/generics/InstanceOf2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InstanceOf2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary the type in an instanceof expression must be reifiable
  * @author seligman
  *
- * @compile/fail -source 1.5 InstanceOf2.java
+ * @compile/fail  InstanceOf2.java
  */
 
 public class InstanceOf2 {
--- a/langtools/test/tools/javac/generics/InstanceOf3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InstanceOf3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary the type in an instanceof expression must be reifiable
  * @author seligman
  *
- * @compile/fail -source 1.5 InstanceOf3.java
+ * @compile/fail  InstanceOf3.java
  */
 
 public class InstanceOf3 {
--- a/langtools/test/tools/javac/generics/InterfaceCast1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/InterfaceCast1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary overridden interface method causes the compiler to reject cast
  * @author gafter
  *
- * @compile -source 1.5 InterfaceCast1.java
+ * @compile  InterfaceCast1.java
  */
 
 public class InterfaceCast1 {
--- a/langtools/test/tools/javac/generics/LoadOrder.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/LoadOrder.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: generic class files can cause recursive class loading (crashing javac)
  * @author gafter
  *
- * @compile -source 1.5 LoadOrder.java
+ * @compile  LoadOrder.java
  */
 
 import java.util.Collections;
--- a/langtools/test/tools/javac/generics/MissingBridge.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/MissingBridge.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Calling inherited generics method via interface causes AbstractMethodError
  * @author gafter
  *
- * @compile -source 1.5 MissingBridge.java
+ * @compile  MissingBridge.java
  * @run main MissingBridge
  */
 
--- a/langtools/test/tools/javac/generics/MissingCast.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/MissingCast.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary redundant cast with generified APIs causes verify error
  * @author gafter
  *
- * @compile -source 1.5 MissingCast.java
+ * @compile  MissingCast.java
  * @run main MissingCast
  */
 
--- a/langtools/test/tools/javac/generics/Multibound1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Multibound1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac failed to check second bound
  * @author gafter
  *
- * @compile/fail -source 1.5 Multibound1.java
+ * @compile/fail  Multibound1.java
  */
 
 package test.tools.javac.generics.Multibound1;
--- a/langtools/test/tools/javac/generics/MultipleInheritance.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/MultipleInheritance.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics problem with multiple interface extension
  * @author gafter
  *
- * @compile -source 1.5 MultipleInheritance.java
+ * @compile  MultipleInheritance.java
  */
 
 package test.tools.javac.generics.MultipleInheritance;
--- a/langtools/test/tools/javac/generics/NameOrder.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/NameOrder.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: type inference failure due to a bug in ClassSymbol.isLess
  * @author gafter
  *
- * @compile -source 1.5 NameOrder.java
+ * @compile  NameOrder.java
  */
 
 package test.tools.javac.generics.NameOrder;
--- a/langtools/test/tools/javac/generics/Nonlinear.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Nonlinear.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary A bug in the original JSR14 generics specification
  *          created a loophole in the type system.
  *
- * @compile/fail -source 1.5 Nonlinear.java
+ * @compile/fail  Nonlinear.java
  */
 
 
--- a/langtools/test/tools/javac/generics/ParametricException.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ParametricException.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: parametric exception type versus overriding
  * @author gafter
  *
- * @compile -source 1.5 ParametricException.java
+ * @compile  ParametricException.java
  */
 
 import java.io.*;
--- a/langtools/test/tools/javac/generics/ParenVerify.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ParenVerify.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: verify error when redundant parens used!
  * @author gafter
  *
- * @compile -source 1.5 ParenVerify.java
+ * @compile  ParenVerify.java
  * @run main ParenVerify
  */
 
--- a/langtools/test/tools/javac/generics/PermuteBound.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/PermuteBound.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: subtyping problem when type parameters permuted
  * @author gafter
  *
- * @compile -source 1.5 PermuteBound.java
+ * @compile  PermuteBound.java
  */
 
 package test.tools.javac.generics.PermuteBound;
--- a/langtools/test/tools/javac/generics/PrimitiveClass.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/PrimitiveClass.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary int.class and ilk have wrong type (5028351 rejected)
  * @author gafter
  *
- * @compile -source 1.5 PrimitiveClass.java
+ * @compile  PrimitiveClass.java
  */
 
 package primitive._class;
--- a/langtools/test/tools/javac/generics/PrimitiveVariant.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/PrimitiveVariant.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler allows overriding with different primitive return type
  * @author gafter
  *
- * @compile/fail -source 1.5 PrimitiveVariant.java
+ * @compile/fail  PrimitiveVariant.java
  */
 
 package test.tools.javac.generics.PrimitiveVariant;
--- a/langtools/test/tools/javac/generics/RawClient.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/RawClient.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac should implement JLS3 three-pass overload resolution
  * @author gafter
  *
- * @compile -source 1.5 RawClient.java
+ * @compile  RawClient.java
  */
 
 package rawClient;
--- a/langtools/test/tools/javac/generics/RefEqual.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/RefEqual.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
  * @author gafter
  *
  * @compile -source 1.4 RefEqual.java
- * @compile/fail -source 1.5 RefEqual.java
+ * @compile/fail  RefEqual.java
  */
 
 class RefEqual {
--- a/langtools/test/tools/javac/generics/RelaxedArrays.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/RelaxedArrays.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary relaxed rules for array of generic type and varargs.
  * @author gafter
  *
- * @compile -source 1.5 RelaxedArrays.java
+ * @compile  RelaxedArrays.java
  * @run main RelaxedArrays
  */
 
--- a/langtools/test/tools/javac/generics/ReverseOrder.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/ReverseOrder.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary problem with generic signature for reverseOrder
  * @author gafter
  *
- * @compile -source 1.5 ReverseOrder.java
+ * @compile  ReverseOrder.java
  */
 
 package test.reverseOrder;
--- a/langtools/test/tools/javac/generics/SelfImplement.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/SelfImplement.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: reject implementation with incorrect return type
  * @author gafter
  *
- * @compile/fail -source 1.5 SelfImplement.java
+ * @compile/fail  SelfImplement.java
  */
 
 class SelfImplement {
--- a/langtools/test/tools/javac/generics/SilentUnchecked.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/SilentUnchecked.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary unchecked conversion from raw to reifiable generic requires no warning
  * @author gafter
  *
- * @compile -Xlint:unchecked -Werror -source 1.5 SilentUnchecked.java
+ * @compile -Xlint:unchecked -Werror  SilentUnchecked.java
  */
 
 package silent.unchecked;
--- a/langtools/test/tools/javac/generics/SuperTypeargs.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/SuperTypeargs.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compilation error for super.<T,E>f() and ClassName.super.<T,E>f()
  * @author gafter
  *
- * @compile -source 1.5 SuperTypeargs.java
+ * @compile  SuperTypeargs.java
  */
 
 package superTypeargs;
--- a/langtools/test/tools/javac/generics/T4661029.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4661029.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @summary generics: assertion error using Arrays.fill
  * @author gafter
  *
- * @compile -source 1.5 T4661029.java
+ * @compile  T4661029.java
  */
 
 public class T4661029 {
--- a/langtools/test/tools/javac/generics/T4683314.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4683314.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: overload resolution error in non-generic code
  * @author gafter
  *
- * @compile -source 1.5 T4683314.java
+ * @compile  T4683314.java
  */
 
 class T4683314a {
--- a/langtools/test/tools/javac/generics/T4684378.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4684378.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: verify error in generated bytecode
  * @author gafter
  *
- * @compile -source 1.5 T4684378.java
+ * @compile  T4684378.java
  * @run main T4684378
  */
 
--- a/langtools/test/tools/javac/generics/T4695348.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4695348.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: compiler allows ref to type bounds in static members
  * @author gafter
  *
- * @compile/fail -source 1.5 T4695348.java
+ * @compile/fail  T4695348.java
  */
 
 class T4695348<T> {
--- a/langtools/test/tools/javac/generics/T4695415.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4695415.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: bug in type inference when method result used as an argument
  * @author gafter
  *
- * @compile -source 1.5 T4695415.java
+ * @compile  T4695415.java
  */
 
 class X<T extends Number> {
--- a/langtools/test/tools/javac/generics/T4695847.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4695847.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: problem with inference of primitive return values
  * @author gafter
  *
- * @compile -source 1.5 T4695847.java
+ * @compile  T4695847.java
  */
 
 public class T4695847<T> {
--- a/langtools/test/tools/javac/generics/T4711570.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4711570.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: problem with methods when type parameter doesn't appear in signature
  * @author gafter
  *
- * @compile -source 1.5 T4711570.java
+ * @compile  T4711570.java
  */
 
 class T4711570 {
--- a/langtools/test/tools/javac/generics/T4711572.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4711572.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: problem with type inference for recursive methods
  * @author gafter
  *
- * @compile -source 1.5 T4683314.java
+ * @compile  T4683314.java
  */
 
 class T4711572 {
--- a/langtools/test/tools/javac/generics/T4711694.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4711694.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: missing bridge method for inherited implementation
  * @author gafter
  *
- * @compile -source 1.5 T4711694.java
+ * @compile  T4711694.java
  * @run main T4711694
  */
 
--- a/langtools/test/tools/javac/generics/T4738171.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4738171.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: problem with equivalence of generic types
  * @author gafter
  *
- * @compile/fail -source 1.5 T4738171.java
+ * @compile/fail  T4738171.java
  */
 
 interface If<T> {
--- a/langtools/test/tools/javac/generics/T4739399.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4739399.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: crash after error regarding bounds on type variable
  * @author gafter
  *
- * @compile/fail -source 1.5 T4739399.java
+ * @compile/fail  T4739399.java
  */
 
 class T4739399 {
--- a/langtools/test/tools/javac/generics/T4757416.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4757416.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: erasure clash not detected
  * @author gafter
  *
- * @compile/fail -source 1.5 T4757416.java
+ * @compile/fail  T4757416.java
  */
 
 class T4756416 {
--- a/langtools/test/tools/javac/generics/T4784207a.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4784207a.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary generics: method overriding missed with separate compilation
  * @author gafter
  *
- * @compile -source 1.5 T4784207a.java
- * @compile -source 1.5 T4784207b.java
+ * @compile  T4784207a.java
+ * @compile  T4784207b.java
  */
 
 interface T4784207a_i extends Comparable<T4784207a_i>{
--- a/langtools/test/tools/javac/generics/T4784219.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T4784219.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: compiler crash after diagnostic
  * @author gafter
  *
- * @compile -source 1.5 T4683314.java
+ * @compile  T4683314.java
  */
 
 public class T4784219 {
--- a/langtools/test/tools/javac/generics/T5011073.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T5011073.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac should implement JLS3 three-pass overload resolution
  * @author gafter
  *
- * @compile/fail -source 1.5 T5011073.java
+ * @compile/fail  T5011073.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/T5094318.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/T5094318.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
  *
  * @compile -source 1.4 T5094318.java
  * @run main T5094318
- * @compile -source 1.5 T5094318.java
+ * @compile  T5094318.java
  * @run main/fail T5094318
  */
 
--- a/langtools/test/tools/javac/generics/TyparamLit.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/TyparamLit.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: compiler allows T.class for type variable T
  * @author gafter
  *
- * @compile/fail -source 1.5 TyparamLit.java
+ * @compile/fail  TyparamLit.java
  */
 
 class TyparamLit<T> {
--- a/langtools/test/tools/javac/generics/TyparamStaticScope.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/TyparamStaticScope.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac mistakenly reports static use error for enclosing type parameter
  * @author gafter
  *
- * @compile -source 1.5 TyparamStaticScope.java
+ * @compile  TyparamStaticScope.java
  */
 
 package typaram.static_.scope;
--- a/langtools/test/tools/javac/generics/TyparamStaticScope2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/TyparamStaticScope2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary type parameter referenced in static inner class improperly allowed!
  * @author gafter
  *
- * @compile/fail -source 1.5 TyparamStaticScope2.java
+ * @compile/fail  TyparamStaticScope2.java
  */
 
 package typaram.static_.scope2;
--- a/langtools/test/tools/javac/generics/UncheckedArray.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/UncheckedArray.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler allows new array of array of type parameter
  * @author gafter
  *
- * @compile/fail -source 1.5 UncheckedArray.java
+ * @compile/fail  UncheckedArray.java
  */
 
 package unchecked.array;
--- a/langtools/test/tools/javac/generics/UncheckedConstructor.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/UncheckedConstructor.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary compiler disallows raw call to generic constructor
  * @author gafter
  *
- * @compile      -source 1.5 -Werror                  UncheckedConstructor.java
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked UncheckedConstructor.java
+ * @compile       -Werror                  UncheckedConstructor.java
+ * @compile/fail  -Werror -Xlint:unchecked UncheckedConstructor.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/UncheckedCovariance.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/UncheckedCovariance.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary A method returning a raw type cannot override a method returning a generic type
  * @author gafter
  *
- * @compile -source 1.5 UncheckedCovariance.java
- * @compile/fail -Xlint:unchecked -Werror -source 1.5 UncheckedCovariance.java
+ * @compile  UncheckedCovariance.java
+ * @compile/fail -Xlint:unchecked -Werror  UncheckedCovariance.java
  */
 
 class UncheckedCovariance {
--- a/langtools/test/tools/javac/generics/UnsoundInference.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/UnsoundInference.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Generic method allowing passing of types that don't match collection types
  * @author gafter
  *
- * @compile/fail -source 1.5 UnsoundInference.java
+ * @compile/fail  UnsoundInference.java
  */
 
 import java.util.ArrayList;
--- a/langtools/test/tools/javac/generics/Varargs.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Varargs.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary varargs doesn't work for generic methods
  * @author gafter
  *
- * @compile -source 1.5 Varargs.java
+ * @compile  Varargs.java
  */
 
 package varargs.versus.generics;
--- a/langtools/test/tools/javac/generics/Varargs2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/Varargs2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics + varargs API changes
  * @author gafter
  *
- * @compile -source 1.5 Varargs2.java
+ * @compile  Varargs2.java
  * @run main Varargs2
  */
 
--- a/langtools/test/tools/javac/generics/WrongNew.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/WrongNew.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: javac generares "new" of wrong class
  * @author gafter
  *
- * @compile -source 1.5 WrongNew.java
+ * @compile  WrongNew.java
  * @run main WrongNew
  */
 
--- a/langtools/test/tools/javac/generics/abstract/T4717181c.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/abstract/T4717181c.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary javac treats inherited abstract method as an overrider
  * @author gafter
  *
- * @compile/fail -source 1.5 T4717181c.java
+ * @compile/fail  T4717181c.java
  */
 
 class T4717181c {
--- a/langtools/test/tools/javac/generics/bridge1/D.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/bridge1/D.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: missing bridge method
  * @author gafter
  *
- * @compile -source 1.5 A.java C.java D.java E.java
+ * @compile  A.java C.java D.java E.java
  * @run main D
  */
 
--- a/langtools/test/tools/javac/generics/classreader/HArrayMethod.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/classreader/HArrayMethod.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary generics: override checks break when using separate compilation
  * @author gafter
  *
- * @compile -source 1.5 HArrayMethod.java HMember.java HMethod.java HMethodImpl.java
- * @compile -source 1.5 HArrayMethod.java
+ * @compile  HArrayMethod.java HMember.java HMethod.java HMethodImpl.java
+ * @compile  HArrayMethod.java
  */
 
 class HArrayMethod extends HMethodImpl {
--- a/langtools/test/tools/javac/generics/compat/CovariantCompat1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/compat/CovariantCompat1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: non-generic code should be able to call covariant method
  * @author gafter
  *
- * @compile -source 1.5 CovariantCompat1.java
+ * @compile  CovariantCompat1.java
  * @compile -source 1.4 CovariantCompat2.java
  */
 
--- a/langtools/test/tools/javac/generics/compat/OverrideBridge1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/compat/OverrideBridge1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,10 +27,10 @@
  * @summary generics: compiler allows 1.4 code to override a bridge method
  * @author gafter
  *
- * @compile -source 1.5 OverrideBridge1.java
+ * @compile  OverrideBridge1.java
  * @compile/fail -Werror -source 1.4 OverrideBridge2.java
  * @compile -source 1.4 OverrideBridge2.java
- * @compile -source 1.5 OverrideBridge3.java
+ * @compile  OverrideBridge3.java
  */
 
 // ALLOW users to override bridge methods.
--- a/langtools/test/tools/javac/generics/forwardSeparateBound/ForwardSeparateBound2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/forwardSeparateBound/ForwardSeparateBound2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary generics: forward referenced bounds vs separate compilation
  * @author gafter
  *
- * @compile -source 1.5 ForwardSeparateBound1.java ForwardSeparateBound2.java
- * @compile -source 1.5 ForwardSeparateBound2.java
+ * @compile  ForwardSeparateBound1.java ForwardSeparateBound2.java
+ * @compile  ForwardSeparateBound2.java
  */
 
 class Z {}
--- a/langtools/test/tools/javac/generics/genericAbstract/A.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/genericAbstract/A.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: generic interface method not implemented in abstract class causes err
  * @author gafter
  *
- * @compile -source 1.5 A.java B.java
+ * @compile  A.java B.java
  */
 
 interface A {
--- a/langtools/test/tools/javac/generics/inference/6365166/NewTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/inference/6365166/NewTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,6 @@
  * @test
  * @bug     6365166
  * @summary javac (generic) unable to resolve methods
- * @ignore  waiting for 6365166
  * @compile NewTest.java
  */
 
--- a/langtools/test/tools/javac/generics/odersky/BadTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/BadTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Negative regression test from odersky
  * @author odersky
  *
- * @compile/fail -source 1.5 BadTest.java
+ * @compile/fail  BadTest.java
  */
 
 class BadTest {
--- a/langtools/test/tools/javac/generics/odersky/BadTest2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/BadTest2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Regression test from odersky
  * @author odersky
  *
- * @compile -source 1.5 BadTest2.java
+ * @compile  BadTest2.java
  */
 
 // this used to be a negative regression test, but when we
--- a/langtools/test/tools/javac/generics/odersky/BadTest3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/BadTest3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Negative regression test from odersky
  * @author odersky
  *
- * @compile/fail -source 1.5 BadTest3.java
+ * @compile/fail  BadTest3.java
  */
 
 class BadTest3 {
--- a/langtools/test/tools/javac/generics/odersky/BadTest4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/BadTest4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Negative regression test from odersky
  * @author odersky
  *
- * @compile/fail -source 1.5 BadTest4.java
+ * @compile/fail  BadTest4.java
  */
 
 class BadTest4 {
--- a/langtools/test/tools/javac/generics/odersky/Test.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/Test.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Positive regression test from odersky
  * @author odersky
  *
- * @compile -source 1.5 Test.java
+ * @compile  Test.java
  */
 
 class Test {
--- a/langtools/test/tools/javac/generics/odersky/Test2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/Test2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Positive regression test from odersky
  * @author odersky
  *
- * @compile -source 1.5 Test2.java
+ * @compile  Test2.java
  */
 
 class Test2 {
--- a/langtools/test/tools/javac/generics/odersky/Test3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/Test3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Positive regression test from odersky
  * @author odersky
  *
- * @compile -source 1.5 Test3.java
+ * @compile  Test3.java
  */
 
 class Test3 {
--- a/langtools/test/tools/javac/generics/odersky/Test4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/odersky/Test4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Positive regression test from odersky
  * @author odersky
  *
- * @compile -source 1.5 Test4.java
+ * @compile  Test4.java
  */
 
 class Test4 {
--- a/langtools/test/tools/javac/generics/parametricException/J.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/parametricException/J.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary javac appears to omit throws portion of generic signature attribute
  * @author gafter
  *
- * @compile -source 1.5 J.java
- * @compile -source 1.5 K.java
+ * @compile  J.java
+ * @compile  K.java
  */
 
 class J<T extends Exception> {
--- a/langtools/test/tools/javac/generics/rare/Rare1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile -source 1.5 Rare1.java
+ * @compile  Rare1.java
  */
 
 package rare1;
--- a/langtools/test/tools/javac/generics/rare/Rare10.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare10.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile -source 1.5 Rare10.java
+ * @compile  Rare10.java
  */
 
 package rare10;
--- a/langtools/test/tools/javac/generics/rare/Rare11.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare11.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile -source 1.5 Rare11.java
+ * @compile  Rare11.java
  */
 
 package rare11;
--- a/langtools/test/tools/javac/generics/rare/Rare2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile/fail -source 1.5 Rare2.java
+ * @compile/fail  Rare2.java
  */
 
 package rare2;
--- a/langtools/test/tools/javac/generics/rare/Rare3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile/fail -source 1.5 Rare3.java
+ * @compile/fail  Rare3.java
  */
 
 package rare3;
--- a/langtools/test/tools/javac/generics/rare/Rare4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile/fail -source 1.5 Rare4.java
+ * @compile/fail  Rare4.java
  */
 
 package rare4;
--- a/langtools/test/tools/javac/generics/rare/Rare5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile/fail -source 1.5 Rare5.java
+ * @compile/fail  Rare5.java
  */
 
 package rare5;
--- a/langtools/test/tools/javac/generics/rare/Rare6.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare6.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile/fail -source 1.5 Rare6.java
+ * @compile/fail  Rare6.java
  */
 
 package rare6;
--- a/langtools/test/tools/javac/generics/rare/Rare7.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare7.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile/fail -source 1.5 Rare7.java
+ * @compile/fail  Rare7.java
  */
 
 package rare7;
--- a/langtools/test/tools/javac/generics/rare/Rare8.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare8.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile -source 1.5 Rare8.java
+ * @compile  Rare8.java
  */
 
 package rare8;
--- a/langtools/test/tools/javac/generics/rare/Rare9.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rare/Rare9.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary "rare" types
  * @author gafter
  *
- * @compile -source 1.5 Rare9.java
+ * @compile  Rare9.java
  */
 
 package rare9;
--- a/langtools/test/tools/javac/generics/rawSeparate/RetroLexer.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/rawSeparate/RetroLexer.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,9 +27,9 @@
  * @summary raw types versus separate compilation causes type error
  * @author gafter
  *
- * @compile -source 1.5 Hashtable.java
- * @compile -source 1.5 CharScanner.java
- * @compile -source 1.5 RetroLexer.java
+ * @compile  Hashtable.java
+ * @compile  CharScanner.java
+ * @compile  RetroLexer.java
  */
 
 package parser;
--- a/langtools/test/tools/javac/generics/typeargs/Basic.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Basic.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile -source 1.5 Basic.java
+ * @compile  Basic.java
  */
 
 // Test all of the basic forms for explicit type arguments
--- a/langtools/test/tools/javac/generics/typeargs/Metharg1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Metharg1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile/fail -source 1.5 Metharg1.java
+ * @compile/fail  Metharg1.java
  */
 
 // Test type mismatch on type argument for method call
--- a/langtools/test/tools/javac/generics/typeargs/Metharg2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Metharg2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile/fail -source 1.5 Metharg2.java
+ * @compile/fail  Metharg2.java
  */
 
 // Test type mismatch on type argument for qualified method call
--- a/langtools/test/tools/javac/generics/typeargs/Newarg1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Newarg1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile/fail -source 1.5 Newarg1.java
+ * @compile/fail  Newarg1.java
  */
 
 // Test type mismatch on type argument for constructor
--- a/langtools/test/tools/javac/generics/typeargs/Newarg2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Newarg2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile/fail -source 1.5 Newarg2.java
+ * @compile/fail  Newarg2.java
  */
 
 // Test type mismatch on type argument for inner constructor
--- a/langtools/test/tools/javac/generics/typeargs/Superarg1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Superarg1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile/fail -source 1.5 Superarg1.java
+ * @compile/fail  Superarg1.java
  */
 
 // Test type mismatch on type argument for super constructor
--- a/langtools/test/tools/javac/generics/typeargs/Superarg2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Superarg2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile/fail -source 1.5 Superarg2.java
+ * @compile/fail  Superarg2.java
  */
 
 // Test type mismatch on type argument for inner super constructor
--- a/langtools/test/tools/javac/generics/typeargs/ThisArg.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/ThisArg.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary explicit type arguments
  * @author gafter
  *
- * @compile/fail -source 1.5 ThisArg.java
+ * @compile/fail  ThisArg.java
  */
 
 // Test type mismatch on type argument for this constructor
--- a/langtools/test/tools/javac/generics/typevars/4856983/T4856983.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
  * @author Peter von der Ah\u00e9
  *
- * @compile -source 5 T4856983.java
+ * @compile  T4856983.java
  */
 
 import java.lang.Comparable;
--- a/langtools/test/tools/javac/generics/typevars/4856983/T4856983a.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983a.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4856983
  * @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
  * @author Peter von der Ah\u00e9
- * @compile/fail -source 5 T4856983a.java
+ * @compile/fail  T4856983a.java
  */
 
 interface I1 { Number m(); }
--- a/langtools/test/tools/javac/generics/typevars/4856983/T4856983b.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983b.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4856983
  * @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
  * @author Peter von der Ah\u00e9
- * @compile/fail -source 5 T4856983b.java
+ * @compile/fail  T4856983b.java
  */
 
 interface I1 { Number m(); }
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile -source 1.5 AssignmentDifferentTypes1.java
+ * @compile  AssignmentDifferentTypes1.java
  */
 
 public class AssignmentDifferentTypes1 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes2.java
+ * @compile/fail  AssignmentDifferentTypes2.java
  */
 
 public class AssignmentDifferentTypes2 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes3.java
+ * @compile/fail  AssignmentDifferentTypes3.java
  */
 
 public class AssignmentDifferentTypes3 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes4.java
+ * @compile/fail  AssignmentDifferentTypes4.java
  */
 
 public class AssignmentDifferentTypes4 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes5.java
+ * @compile/fail  AssignmentDifferentTypes5.java
  */
 
 public class AssignmentDifferentTypes5 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes6.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes6.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes6.java
+ * @compile/fail  AssignmentDifferentTypes6.java
  */
 
 public class AssignmentDifferentTypes6 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes7.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes7.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes7.java
+ * @compile/fail  AssignmentDifferentTypes7.java
  */
 
 public class AssignmentDifferentTypes7 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes8.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes8.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes8.java
+ * @compile/fail  AssignmentDifferentTypes8.java
  */
 
 public class AssignmentDifferentTypes8 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes9.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentDifferentTypes9.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with related type bounds.
  *
- * @compile/fail -source 1.5 AssignmentDifferentTypes9.java
+ * @compile/fail  AssignmentDifferentTypes9.java
  */
 
 public class AssignmentDifferentTypes9 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile -source 1.5 AssignmentSameType1.java
+ * @compile  AssignmentSameType1.java
  */
 
 public class AssignmentSameType1 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile/fail -source 1.5 AssignmentSameType2.java
+ * @compile/fail  AssignmentSameType2.java
  */
 
 public class AssignmentSameType2 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile/fail -source 1.5 AssignmentSameType3.java
+ * @compile/fail  AssignmentSameType3.java
  */
 
 public class AssignmentSameType3 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile/fail -source 1.5 AssignmentSameType4.java
+ * @compile/fail  AssignmentSameType4.java
  */
 
 public class AssignmentSameType4 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile/fail -source 1.5 AssignmentSameType5.java
+ * @compile/fail  AssignmentSameType5.java
  */
 
 public class AssignmentSameType5 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType6.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType6.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile/fail -source 1.5 AssignmentSameType6.java
+ * @compile/fail  AssignmentSameType6.java
  */
 
 public class AssignmentSameType6 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType7.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType7.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile/fail -source 1.5 AssignmentSameType7.java
+ * @compile/fail  AssignmentSameType7.java
  */
 
 public class AssignmentSameType7 {
--- a/langtools/test/tools/javac/generics/wildcards/AssignmentSameType8.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/AssignmentSameType8.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test subtyping for wildcards with the same type bound.
  *
- * @compile/fail -source 1.5 AssignmentSameType8.java
+ * @compile/fail  AssignmentSameType8.java
  */
 
 public class AssignmentSameType8 {
--- a/langtools/test/tools/javac/generics/wildcards/BoundBug.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/BoundBug.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: used of ? get bound error
  * @author gafter
  *
- * @compile -source 1.5 BoundBug.java
+ * @compile  BoundBug.java
  */
 
 class BoundBug {
--- a/langtools/test/tools/javac/generics/wildcards/ContraArg.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/ContraArg.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: incorrect ambiguity error with super-bouded wildcards
  * @author gafter
  *
- * @compile -source 1.5 ContraArg.java
+ * @compile  ContraArg.java
  */
 
 class ContraArg {
--- a/langtools/test/tools/javac/generics/wildcards/T5097548.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/T5097548.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5097548
  * @summary (crash) Stack overflow in capture conversion
  * @author Peter von der Ah\u00e9
- * @compile -source 5 T5097548.java
+ * @compile  T5097548.java
  * @run main T5097548
  */
 
--- a/langtools/test/tools/javac/generics/wildcards/T5097548b.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/T5097548b.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5097548
  * @summary Stack overflow in capture conversion
  * @author Peter von der Ah\u00e9
- * @compile -source 5 T5097548b.java
+ * @compile  T5097548b.java
  */
 
 interface Edge<N extends Node<? extends Edge<N>>> {
--- a/langtools/test/tools/javac/generics/wildcards/UnboundArray.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/UnboundArray.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: allow arrays of unbounded generic types
  * @author gafter
  *
- * @compile -source 1.5 UnboundArray.java
+ * @compile  UnboundArray.java
  */
 
 class C<E> {
--- a/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/AmbiguousCast.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary cast to parameterized type is accepted although it should be rejected
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked AmbiguousCast.java
+ * @compile/fail  -Werror -Xlint:unchecked AmbiguousCast.java
  */
 
 class Test {
--- a/langtools/test/tools/javac/generics/wildcards/neg/Capture.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/Capture.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Wildcard capture
  * @author gafter
  *
- * @compile/fail -source 1.5 Capture.java
+ * @compile/fail  Capture.java
  */
 
 class X<T> {}
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail1.java
+ * @compile/fail  CastFail1.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail10.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail10.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail10.java
+ * @compile/fail  CastFail10.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail11.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail11.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail11.java
+ * @compile/fail  CastFail11.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail12.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail12.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail12.java
+ * @compile/fail  CastFail12.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail13.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail13.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail13.java
+ * @compile/fail  CastFail13.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail14.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail14.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail14.java
+ * @compile/fail  CastFail14.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail15.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail15.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail15.java
+ * @compile/fail  CastFail15.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail16.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail16.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail16.java
+ * @compile/fail  CastFail16.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail17.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail17.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail17.java
+ * @compile/fail  CastFail17.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail18.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail18.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail18.java
+ * @compile/fail  CastFail18.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail19.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail19.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail19.java
+ * @compile/fail  CastFail19.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail2.java
+ * @compile/fail  CastFail2.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail20.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail20.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail20.java
+ * @compile/fail  CastFail20.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail21.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail21.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail20.java
+ * @compile/fail  CastFail20.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail3.java
+ * @compile/fail  CastFail3.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail4.java
+ * @compile/fail  CastFail4.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail5.java
+ * @compile/fail  CastFail5.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail6.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail6.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail6.java
+ * @compile/fail  CastFail6.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail7.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail7.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail7.java
+ * @compile/fail  CastFail7.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail8.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail8.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail8.java
+ * @compile/fail  CastFail8.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastFail9.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastFail9.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 CastFail9.java
+ * @compile/fail  CastFail9.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn10.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn10.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn10.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn10.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn11.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn11.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn11.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn11.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn12.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn12.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn12.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn12.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn13.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn13.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn13.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn13.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn14.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn14.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn14.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn14.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn2.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn2.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn3.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn3.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn4.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn4.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn5.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn5.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn5.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn5.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn6.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn6.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn6.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn6.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn7.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn7.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn7.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn7.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn8.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn8.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn8.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn8.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/CastWarn9.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/CastWarn9.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile/fail -source 1.5 -Werror -Xlint:unchecked CastWarn9.java
+ * @compile/fail  -Werror -Xlint:unchecked CastWarn9.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/ParamCast.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Description
  * @author gafter
  *
- * @compile/fail -source 1.5 ParamCast.java
+ * @compile/fail  ParamCast.java
  */
 
 class A<T> {}
--- a/langtools/test/tools/javac/generics/wildcards/neg/Readonly.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/Readonly.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary an extends-bound (covariant) wildcard is like readonly
  * @author gafter
  *
- * @compile/fail -source 1.5 Readonly.java
+ * @compile/fail  Readonly.java
  */
 
 class Err<T> {
--- a/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/Unbounded.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary an unbounded (bivariant) wildcard doesn't allow reading
  * @author gafter
  *
- * @compile/fail -source 1.5 Unbounded.java
+ * @compile/fail  Unbounded.java
  */
 
 import java.util.Stack;
--- a/langtools/test/tools/javac/generics/wildcards/pos/AmbiguousCast2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/AmbiguousCast2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: unable to cast between two convertible types
  * @author gafter
  *
- * @compile -source 1.5 AmbiguousCast2.java
+ * @compile  AmbiguousCast2.java
  */
 
 import java.lang.ref.*;
--- a/langtools/test/tools/javac/generics/wildcards/pos/BoundsCollision.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/BoundsCollision.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary when upper bounds and lower bounds collide
  * @author gafter
  *
- * @compile -source 1.5 -Werror BoundsCollision.java
+ * @compile  -Werror BoundsCollision.java
  */
 
 class StreinBug {
--- a/langtools/test/tools/javac/generics/wildcards/pos/Capture.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/Capture.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Wildcard capture
  * @author gafter
  *
- * @compile -source 1.5 -Werror Capture.java
+ * @compile  -Werror Capture.java
  */
 
 class X<T> {}
--- a/langtools/test/tools/javac/generics/wildcards/pos/CastTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/CastTest.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test casts (legal, warning, and errors)
  * @author gafter
  *
- * @compile -source 1.5 -Werror CastTest.java
+ * @compile  -Werror CastTest.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/pos/InstanceOf.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/InstanceOf.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: type cast with instance of
  * @author gafter
  *
- * @compile -source 1.5 -Werror InstanceOf.java
+ * @compile  -Werror InstanceOf.java
  */
 
 class InstanceOf<T> {
--- a/langtools/test/tools/javac/generics/wildcards/pos/ParamCast.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/ParamCast.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary integrate improved wildcard substitution from CPH
  * @author gafter
  *
- * @compile -source 1.5 -Werror -Xlint:unchecked ParamCast.java
+ * @compile  -Werror -Xlint:unchecked ParamCast.java
  */
 
 class A<T> {}
--- a/langtools/test/tools/javac/generics/wildcards/pos/RvalConversion.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/RvalConversion.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary rvalue conversion changes "? extends X" to "X".
  * @author gafter
  *
- * @compile -source 1.5 RvalConversion.java
+ * @compile  RvalConversion.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/generics/wildcards/pos/UncheckedCast1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/pos/UncheckedCast1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generics: failure of some unchecked casts
  * @author gafter
  *
- * @compile -source 1.5 UncheckedCast1.java
+ * @compile  UncheckedCast1.java
  */
 
 class Z {
--- a/langtools/test/tools/javac/importscope/A.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/importscope/A.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary static import of private field crashes compiler
  * @author gafter
  *
- * @compile -source 1.5 A.java B.java
+ * @compile A.java B.java
  */
 
 package p1;
--- a/langtools/test/tools/javac/limits/FinallyNesting.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/limits/FinallyNesting.java	Mon Jul 06 11:42:37 2009 -0700
@@ -29,7 +29,7 @@
  *
  * @compile -source 1.4 -target 1.4 FinallyNesting.java
  */
-
+// Source and target 1.4 are needed for the test to pass with default memory sizes.
 class FinallyNesting {
     public static void main(String[] args) {
         int x;
--- a/langtools/test/tools/javac/lint/Unchecked.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/lint/Unchecked.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Add -Xlint flag
  * @author gafter
  *
- * @compile/fail -source 1.5 -Xlint:unchecked -Werror Unchecked.java
+ * @compile/fail -Xlint:unchecked -Werror Unchecked.java
  */
 
 class Unchecked<T> {
--- a/langtools/test/tools/javac/miranda/T4666866.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/miranda/T4666866.java	Mon Jul 06 11:42:37 2009 -0700
@@ -4,7 +4,7 @@
  * @summary REGRESSION: Generated error message unhelpful for missing methods
  * @author gafter
  *
- * @compile/fail/ref=T4666866.out -XDstdout -XDdiags=%b:%l:%_%m T4666866.java
+ * @compile/fail/ref=T4666866.out -XDstdout -XDrawDiagnostics T4666866.java
  */
 
 class t implements Runnable {}
--- a/langtools/test/tools/javac/miranda/T4666866.out	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/miranda/T4666866.out	Mon Jul 06 11:42:37 2009 -0700
@@ -1,4 +1,2 @@
-T4666866.java:10: t is not abstract and does not override abstract method run() in java.lang.Runnable
-class t implements Runnable {}
-^
+T4666866.java:10:1: compiler.err.does.not.override.abstract: t, run(), java.lang.Runnable
 1 error
--- a/langtools/test/tools/javac/miranda/T4711325.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/miranda/T4711325.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler allows unimplementable interfaces
  * @author gafter
  *
- * @compile -source 1.5 T4711325.java
+ * @compile                  T4711325.java
  * @compile/fail -source 1.4 T4711325.java
  */
 
--- a/langtools/test/tools/javac/mixedTarget/CompatibleAbstracts1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/mixedTarget/CompatibleAbstracts1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,14 +27,14 @@
  * @summary 1.4 javac should not accept the Covariant Return Type
  * @author gafter
  *
- * @compile      -source 1.5 CompatibleAbstracts1.java
- * @compile      -source 1.5 CompatibleAbstracts2.java
+ * @compile                  CompatibleAbstracts1.java
+ * @compile                  CompatibleAbstracts2.java
  * @compile      -source 1.4 CompatibleAbstracts2.java
- * @compile      -source 1.5 CompatibleAbstracts3.java
+ * @compile                  CompatibleAbstracts3.java
  * @compile/fail -source 1.4 CompatibleAbstracts3.java
- * @compile      -source 1.5 CompatibleAbstracts4.java
+ * @compile                  CompatibleAbstracts4.java
  * @compile/fail -source 1.4 CompatibleAbstracts4.java
- * @compile      -source 1.5 CompatibleAbstracts5.java
+ * @compile                  CompatibleAbstracts5.java
  * @compile/fail -source 1.4 CompatibleAbstracts5.java
  */
 
--- a/langtools/test/tools/javac/mixedTarget/ExtendCovariant2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/mixedTarget/ExtendCovariant2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
  * @author gafter
  *
  * @compile/fail -source 1.4 ExtendCovariant2.java
- * @compile -source 1.5 ExtendCovariant2.java
+ * @compile                  ExtendCovariant2.java
  */
 
 /**
--- a/langtools/test/tools/javac/overload/T5090220.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/overload/T5090220.java	Mon Jul 06 11:42:37 2009 -0700
@@ -25,7 +25,7 @@
  * @test
  * @bug 5090220
  * @summary Autoboxing applied when calculating most-specific method
- * @compile/fail -source 5 T5090220.java
+ * @compile/fail T5090220.java
  */
 
 class T5090220 {
--- a/langtools/test/tools/javac/processing/6348499/A.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/processing/6348499/A.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
 import javax.lang.model.element.*;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedSourceVersion(SourceVersion.RELEASE_7)
 public class A extends AbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
         Filer filer = processingEnv.getFiler();
--- a/langtools/test/tools/javac/processing/6414633/A.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/processing/6414633/A.java	Mon Jul 06 11:42:37 2009 -0700
@@ -30,7 +30,7 @@
 import javax.tools.*;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedSourceVersion(SourceVersion.RELEASE_7)
 public class A extends AbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
--- a/langtools/test/tools/javac/processing/6430209/b6341534.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/processing/6430209/b6341534.java	Mon Jul 06 11:42:37 2009 -0700
@@ -30,7 +30,7 @@
 import java.util.Set;
 
 @SupportedAnnotationTypes({"*"})
-@SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6)
+@SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_7)
 public class b6341534 extends AbstractProcessor {
     static int r = 0;
     static Elements E = null;
--- a/langtools/test/tools/javac/processing/T6439826.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/processing/T6439826.java	Mon Jul 06 11:42:37 2009 -0700
@@ -39,7 +39,7 @@
 
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6 )
+@SupportedSourceVersion(SourceVersion.RELEASE_7 )
 public class T6439826 extends AbstractProcessor {
     public static void main(String... args) {
         String testSrc = System.getProperty("test.src", ".");
--- a/langtools/test/tools/javac/processing/environment/TestSourceVersion.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/processing/environment/TestSourceVersion.java	Mon Jul 06 11:42:37 2009 -0700
@@ -34,6 +34,8 @@
  * @compile -processor TestSourceVersion -proc:only -source   5 -AExpectedVersion=RELEASE_5 HelloWorld.java
  * @compile -processor TestSourceVersion -proc:only -source 1.6 -AExpectedVersion=RELEASE_6 HelloWorld.java
  * @compile -processor TestSourceVersion -proc:only -source   6 -AExpectedVersion=RELEASE_6 HelloWorld.java
+ * @compile -processor TestSourceVersion -proc:only -source 1.7 -AExpectedVersion=RELEASE_7 HelloWorld.java
+ * @compile -processor TestSourceVersion -proc:only -source   7 -AExpectedVersion=RELEASE_7 HelloWorld.java
  */
 
 import java.util.Set;
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess2.out -XDstdout -XDdiags=%b:%l:%_%m ProtectedMemberAccess2.java
+ * @compile/fail/ref=ProtectedMemberAccess2.out -XDstdout -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess2.java
  */
 
 // 71 errors expected.
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess3.out -XDstdout -XDdiags=%b:%l:%_%m ProtectedMemberAccess3.java
+ * @compile/fail/ref=ProtectedMemberAccess3.out -XDstdout -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess3.java
  */
 
 // 46 errors expected.
--- a/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess4.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/protectedAccess/ProtectedMemberAccess4.java	Mon Jul 06 11:42:37 2009 -0700
@@ -4,7 +4,7 @@
  * @summary Verify correct implementation of JLS2e 6.6.2.1
  * @author maddox
  *
- * @compile/fail/ref=ProtectedMemberAccess4.out -XDstdout -XDdiags=%b:%l:%_%m ProtectedMemberAccess4.java
+ * @compile/fail/ref=ProtectedMemberAccess4.out -XDstdout -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess4.java
  */
 
 // 33 errors expected.
--- a/langtools/test/tools/javac/stackmap/T4955930.sh	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/stackmap/T4955930.sh	Mon Jul 06 11:42:37 2009 -0700
@@ -56,7 +56,7 @@
 TMP1=T4955930.javap
 
 cp "${TESTSRC}${FS}T4955930.java" .
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -target 6 T4955930.java
+"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -source 6 -target 6 T4955930.java
 result=$?
 if [ $result -ne 0 ]
 then
--- a/langtools/test/tools/javac/stackmap/UninitThis.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/stackmap/UninitThis.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,9 +26,6 @@
  * @bug 4948063
  * @summary Invalid java.io.FileInputStream with v49 generate by javac
  * @author gafter
- *
- * @compile -source 1.5 -target 1.5 UninitThis.java
- * @run main UninitThis
  */
 
 // may fail due to VM bug 4948729
--- a/langtools/test/tools/javac/staticImport/Ambig1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/staticImport/Ambig1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Missing ambiguity error when two methods are equally specific
  * @author gafter
  *
- * @compile/fail -source 1.5 Ambig1.java
+ * @compile/fail  Ambig1.java
  */
 
 package ambig1;
--- a/langtools/test/tools/javac/staticImport/ImportInherit.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/staticImport/ImportInherit.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary static import versus inherited members
  * @author gafter
  *
- * @compile -source 1.5 ImportInherit.java
+ * @compile  ImportInherit.java
  */
 
 package importInherit;
--- a/langtools/test/tools/javac/staticImport/ImportPrivate.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/staticImport/ImportPrivate.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary NPE while compiling static import of inaccessible class member
  * @author gafter
  *
- * @compile/fail -source 1.5 ImportPrivate.java
+ * @compile/fail  ImportPrivate.java
  */
 
 package importPrivate;
--- a/langtools/test/tools/javac/staticImport/PrivateStaticImport.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/staticImport/PrivateStaticImport.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary static import of private field crashes compiler
  * @author gafter
  *
- * @compile/fail -source 1.5 PrivateStaticImport.java
+ * @compile/fail  PrivateStaticImport.java
  */
 
 package psi;
--- a/langtools/test/tools/javac/staticImport/Shadow.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/staticImport/Shadow.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary compiler fails to shadow inapplicable method with static import
  * @author gafter
  *
- * @compile/fail -source 1.5 Shadow.java
+ * @compile/fail  Shadow.java
  */
 
 package shadow;
--- a/langtools/test/tools/javac/staticImport/StaticImport.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/staticImport/StaticImport.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary add support for JSR 201's static import facility
  * @author gafter
  *
- * @compile -source 1.5 StaticImport.java
+ * @compile  StaticImport.java
  * @run main StaticImport
  */
 
--- a/langtools/test/tools/javac/staticImport/StaticImport2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/staticImport/StaticImport2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary add support for JSR 201's static import facility
  * @author gafter
  *
- * @compile/fail -source 1.5 StaticImport2.java
+ * @compile/fail  StaticImport2.java
  */
 
 package p;
--- a/langtools/test/tools/javac/unicode/Unmappable.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/unicode/Unmappable.java	Mon Jul 06 11:42:37 2009 -0700
@@ -29,7 +29,7 @@
  *
  * @compile              -encoding ascii -source 1.5 Unmappable.java
  * @compile/fail -Werror -encoding ascii -source 1.5 Unmappable.java
- * @compile/fail         -encoding ascii -source 6 Unmappable.java
+ * @compile/fail         -encoding ascii             Unmappable.java
  */
 
 // example from 4766897
--- a/langtools/test/tools/javac/varargs/Anon.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/Anon.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary varargs versus anonymous constructors crashes javac
  * @author gafter
  *
- * @compile -source 1.5 Anon.java
+ * @compile  Anon.java
  */
 
 class Anon {
--- a/langtools/test/tools/javac/varargs/BadSyntax2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/BadSyntax2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary generic class method with vararg gets "java.lang.AssertionError: arraycode T"
  * @author gafter
  *
- * @compile -source 1.5 BadSyntax2.java
+ * @compile  BadSyntax2.java
  */
 
 class Tclass<T> {
--- a/langtools/test/tools/javac/varargs/Varargs1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/Varargs1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary varags, auto boxing
  * @author gafter
  *
- * @compile -source 1.5 Varargs1.java
+ * @compile  Varargs1.java
  * @run main Varargs1
  */
 
--- a/langtools/test/tools/javac/varargs/VarargsOverride.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/VarargsOverride.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,8 +27,8 @@
  * @summary overriding with method of different arity is prohibited
  * @author gafter
  *
- * @compile -source 1.5 VarargsOverride.java
- * @compile/fail -source 1.5 -Werror -Xlint VarargsOverride.java
+ * @compile  VarargsOverride.java
+ * @compile/fail  -Werror -Xlint VarargsOverride.java
  */
 
 package varargs.override;
--- a/langtools/test/tools/javac/varargs/Warn1.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/Warn1.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,9 +27,9 @@
  * @summary need warning if varargs argument isn't boxed
  * @author gafter
  *
- * @compile      -source 1.5                     Warn1.java
- * @compile/fail -source 1.5 -Werror             Warn1.java
- * @compile      -source 1.5 -Werror -Xlint:none Warn1.java
+ * @compile                           Warn1.java
+ * @compile/fail  -Werror             Warn1.java
+ * @compile       -Werror -Xlint:none Warn1.java
  */
 
 package varargs.warn1;
--- a/langtools/test/tools/javac/varargs/Warn2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/Warn2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,9 +27,9 @@
  * @summary need warning if varargs argument isn't boxed
  * @author gafter
  *
- * @compile      -source 1.5                     Warn2.java
- * @compile/fail -source 1.5 -Werror             Warn2.java
- * @compile      -source 1.5 -Werror -Xlint:none Warn2.java
+ * @compile                           Warn2.java
+ * @compile/fail  -Werror             Warn2.java
+ * @compile       -Werror -Xlint:none Warn2.java
  */
 
 package varargs.warn2;
--- a/langtools/test/tools/javac/varargs/warning/Warn2.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/warning/Warn2.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary fixed-arity warning given too often
  * @author gafter
  *
- * @compile -Werror -source 1.5 Warn2.java
+ * @compile -Werror  Warn2.java
  */
 
 package varargs.warning.warn2;
--- a/langtools/test/tools/javac/varargs/warning/Warn3.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/varargs/warning/Warn3.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary fixed-arity warning given too often
  * @author gafter
  *
- * @compile -Werror -source 1.5 Warn3.java
+ * @compile -Werror  Warn3.java
  */
 
 package varargs.warning.warn3;
--- a/langtools/test/tools/javac/versions/check.sh	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javac/versions/check.sh	Mon Jul 06 11:42:37 2009 -0700
@@ -24,9 +24,8 @@
 # @test
 # @bug 4981566 5028634 5094412 6304984
 # @summary Check interpretation of -target and -source options
-#
 # @build CheckClassFileVersion
-# @run shell check.sh
+# @run shell check.sh 
 
 TESTJAVA=${TESTJAVA:?}
 TC=${TESTCLASSES-.}
@@ -48,19 +47,26 @@
   $JC ${TESTTOOLVMOPTS} -d $TC $* $TC/X.java && $CFV $TC/X.class $V || exit 2
 }
 
-check 50.0
 check 48.0 -source 1.4
+
 check 49.0 -source 1.4 -target 1.5
-check 49.0 -target 1.5
-check 50.0 -source 1.5
-check 50.0 -target 1.6
-check 50.0 -target 6
-check 50.0 -source 1.6
-check 50.0 -source 6
+check 49.0 -source 1.5 -target 1.5
+
+check 50.0 -source 1.4 -target 1.6
+check 50.0 -source 1.5 -target 1.6
+check 50.0 -source 1.6 -target 1.6
+check 50.0 -source 1.6 -target 6
+check 50.0 -source 6 -target 1.6
+check 50.0 -source 6 -target 6
+
+check 51.0
+check 51.0 -source 1.5
+check 51.0 -source 1.6
+check 51.0 -source 6
+check 51.0 -source 1.7
+check 51.0 -source 7
 check 51.0 -target 1.7
 check 51.0 -target 7
-check 51.0 -source 1.7
-check 51.0 -source 7
 
 
 # Check source versions
@@ -85,21 +91,30 @@
   fi
 }
 
+# the following need to be updated when -source 7 features are available
 checksrc14() { pass $* $TC/X.java; fail $* $TC/Y.java; }
 checksrc15() { pass $* $TC/X.java; pass $* $TC/Y.java; }
 checksrc16() { checksrc15 $* ; }
+checksrc17() { checksrc15 $* ; }
 
 checksrc14 -source 1.4
 checksrc14 -source 1.4 -target 1.5
 
-checksrc15
-checksrc15 -target 1.5
 checksrc15 -source 1.5
+checksrc15 -source 1.5 -target 1.5
 
-checksrc16 -target 1.6
-checksrc16 -target 6
 checksrc16 -source 1.6
 checksrc16 -source 6
+checksrc16 -source 1.6 -target 1.6
+checksrc16 -source 6 -target 6
+
+checksrc17
+checksrc17 -target 1.7
+checksrc17 -target 7
+checksrc17 -source 1.7
+checksrc17 -source 7
+checksrc17 -source 1.7 -target 1.7
+checksrc17 -source 7 -target 7
 
 fail -source 1.5 -target 1.4 $TC/X.java
 fail -source 1.6 -target 1.4 $TC/X.java
--- a/langtools/test/tools/javadoc/LangVers.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/LangVers.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,8 +26,6 @@
  * @bug 4909767
  * @summary Verify that omitting Doclet.languageVersion() hides 1.5 language
  *      features from the doclet.
- * @compile -source 1.5 LangVers.java
- * @run main LangVers
  */
 
 import java.util.List;
--- a/langtools/test/tools/javadoc/annotations/annotateMethodsFields/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/annotations/annotateMethodsFields/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -28,7 +28,7 @@
  *          annotation type elements.
  *          Test an annotation type with a type nested within.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/annotations/annotatePackage/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/annotations/annotatePackage/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5031168
  * @summary Test package annotations and package-info.java package comments.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/annotations/annotateParams/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/annotations/annotateParams/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 5031171
  * @summary Test parameter annotations.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/annotations/defaults/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/annotations/defaults/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test an annotation type with default element values, and
  *          annotations that use them.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/annotations/elementTypes/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/annotations/elementTypes/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Test an annotation type and annotations with elements of various
  *          types.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/annotations/shortcuts/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/annotations/shortcuts/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4904495
  * @summary Verify that "shortcuts" are used when printing annotations.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/enum/docComments/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/enum/docComments/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the comments in an enum type.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/enum/enumType/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/enum/enumType/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the contents of an enum type.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/genericClass/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/genericClass/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the contents of the ClassDoc of a generic class.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/genericInnerAndOuter/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/genericInnerAndOuter/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Verify the contents of the ClassDoc of
  *          a generic class with a generic inner class.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/genericInterface/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/genericInterface/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the contents of the ClassDoc of a generic interface.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/genericMethod/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/genericMethod/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the reading of generic methods and constructors.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/genericSuper/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/genericSuper/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the contents of the ClassDoc of a generic class.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/supertypes/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/supertypes/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4922918
  * @summary Check supertypes and superinterfaces of parameterized types.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/throwsGeneric/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/throwsGeneric/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the reading of generic methods and constructors.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/tparamCycle/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/tparamCycle/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Check a type parameter whose bound cycles back on itself.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/tparamTagOnMethod/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/tparamTagOnMethod/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the reading of type parameter tags on methods.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/tparamTagOnType/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/tparamTagOnType/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the reading of a type parameter tag on an interface.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/generics/wildcards/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/generics/wildcards/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -26,7 +26,7 @@
  * @bug 4421066
  * @summary Verify the contents of the ClassDoc of a generic class.
  * @library ../../lib
- * @compile -source 1.5 ../../lib/Tester.java Main.java
+ * @compile  ../../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javadoc/lib/Tester.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/lib/Tester.java	Mon Jul 06 11:42:37 2009 -0700
@@ -39,7 +39,6 @@
     protected final String TEST_CLASSES = System.getProperty("test.classes",
                                                              ".");
     private final String DEFAULT_ARGS[] = {
-        "-source", "1.5",
         "-sourcepath", TEST_SRC,
     };
 
--- a/langtools/test/tools/javadoc/varArgs/Main.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javadoc/varArgs/Main.java	Mon Jul 06 11:42:37 2009 -0700
@@ -27,7 +27,7 @@
  * @summary Verify the contents of a ClassDoc containing a varArgs method.
  *          Verify that see/link tags can use "..." notation.
  * @library ../lib
- * @compile -source 1.5 ../lib/Tester.java Main.java
+ * @compile  ../lib/Tester.java Main.java
  * @run main Main
  */
 
--- a/langtools/test/tools/javap/ExtPath.java	Wed Jul 01 09:59:16 2009 -0700
+++ b/langtools/test/tools/javap/ExtPath.java	Mon Jul 06 11:42:37 2009 -0700
@@ -30,11 +30,12 @@
  * @run main/othervm ExtPath com.sun.crypto.provider.SunJCE
  */
 
-import sun.tools.javap.Main;
+import com.sun.tools.javap.Main;
 import java.io.*;
 
 public class ExtPath {
     public static void main(String[] args) {
-        Main.entry(args);
+        PrintWriter pw = new PrintWriter(System.out, true);
+        Main.run(args, pw);
     }
 }
--- a/langtools/test/tools/javap/ListTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-import java.io.*;
-import java.util.*;
-import javax.tools.*;
-
-/*
- * @test
- * @bug 6439940
- * @summary Cleanup javap implementation
- * @run main/othervm ListTest
- */
-public class ListTest {
-    public static void main(String[] args) throws Exception {
-        new ListTest().run();
-    }
-
-    ListTest() {
-        String v = System.getProperty("view.cmd");
-        //      v = "/opt/teamware/7.7/bin/filemerge -r";
-        if (v != null) {
-            viewResults = true;
-            viewCmd = Arrays.asList(v.split(" +"));
-        }
-    }
-
-    void run() throws Exception {
-        StandardLocation[] locs = new StandardLocation[] {
-            StandardLocation.PLATFORM_CLASS_PATH,
-            StandardLocation.CLASS_PATH,
-        };
-
-        int count = 0;
-        int pass = 0;
-        for (StandardLocation loc: locs) {
-            for (String testClassName: list(loc)) {
-                count++;
-                if (test(testClassName))
-                    pass++;
-            }
-        }
-
-        if (pass < count)
-            throw new Error(pass + "/" + count + " test cases passed");
-    }
-
-    Iterable<String> list(StandardLocation loc) throws IOException {
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager sfm = compiler.getStandardFileManager(null, null, null);
-        Set<JavaFileObject.Kind> kinds = Collections.singleton(JavaFileObject.Kind.CLASS);
-
-        List<String> list = new ArrayList<String>();
-        for (JavaFileObject fo: sfm.list(loc, testPackage, kinds, true)) {
-            //System.err.println(com.sun.tools.javac.util.Old199.getPath(fo));
-            list.add(sfm.inferBinaryName(loc, fo));
-        }
-        return list;
-    }
-
-    boolean test(String testClassName) throws Exception {
-        String[] args = new String[options.size() + 1];
-        options.toArray(args);
-        args[args.length - 1] = testClassName;
-        byte[] oldOut = runOldJavap(args);
-        byte[] newOut = runNewJavap(args);
-        boolean ok = equal(oldOut, newOut);
-        System.err.println((ok ? "pass" : "FAIL") + ": " + testClassName);
-        if (!ok && viewResults)
-            view(oldOut, newOut);
-        return ok;
-    }
-
-    byte[] runOldJavap(String[] args) {
-        //System.err.println("OLD: " + Arrays.asList(args));
-        PrintStream oldOut = System.out;
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        System.setOut(new PrintStream(out));
-        try {
-            sun.tools.javap.Main.entry(args);
-        } finally {
-            System.setOut(oldOut);
-        }
-        return out.toByteArray();
-    }
-
-    byte[] runNewJavap(String[] args) {
-        String[] nArgs = new String[args.length + 2];
-        nArgs[0] = "-XDcompat";
-        nArgs[1] = "-XDignore.symbol.file";
-        System.arraycopy(args, 0, nArgs, 2, args.length);
-        //System.err.println("NEW: " + Arrays.asList(nArgs));
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        com.sun.tools.javap.Main.run(nArgs,
-                                     new PrintWriter(new OutputStreamWriter(out), true));
-        return out.toByteArray();
-    }
-
-    File write(byte[] text, String suffix) throws IOException {
-        File f = new File("ListTest." + suffix);
-        FileOutputStream out = new FileOutputStream(f);
-        out.write(text);
-        out.close();
-        return f;
-    }
-
-    boolean equal(byte[] a1, byte[] a2) {
-        return Arrays.equals(a1, a2);
-    }
-
-    void view(byte[] oldOut, byte[] newOut) throws Exception {
-        File oldFile = write(oldOut, "old");
-        File newFile = write(newOut, "new");
-        List<String> cmd = new ArrayList<String>();
-        cmd.addAll(viewCmd);
-        cmd.add(oldFile.getPath());
-        cmd.add(newFile.getPath());
-        Process p = new ProcessBuilder(cmd).redirectErrorStream(true).start();
-        p.getOutputStream().close();
-        String line;
-        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        while ((line = in.readLine()) != null)
-            System.err.println(line);
-        in.close();
-        p.waitFor();
-    }
-
-    String testPackage = "java.lang";
-    List<String> options = Arrays.asList("-v");
-    boolean viewResults;
-    List<String> viewCmd;
-}
--- a/langtools/test/tools/javap/OptionTest.java	Wed Jul 01 09:59:16 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-import java.io.*;
-import java.util.*;
-
-/*
- * @test
- * @bug 6439940
- * @summary Cleanup javap implementation
- * @run main/othervm OptionTest
- */
-public class OptionTest {
-    public static void main(String[] args) throws Exception {
-        new OptionTest().run();
-    }
-
-    OptionTest() {
-        String v = System.getProperty("view.cmd");
-        if (v != null) {
-            viewResults = true;
-            viewCmd = Arrays.asList(v.split(" +"));
-        }
-    }
-
-
-    void run() throws Exception {
-        int count = 0;
-        int pass = 0;
-        // try combinations of options and compare old javap against new javap
-        for (int i = 0; i < (1<<8); i++) {
-            List<String> options = new ArrayList<String>();
-            if ((i & 0x01) != 0)
-                options.add("-c");
-            if ((i & 0x02) != 0)
-                options.add("-l");
-            if ((i & 0x04) != 0)
-                options.add("-public");
-            if ((i & 0x08) != 0)
-                options.add("-protected");
-            if ((i & 0x10) != 0)
-                options.add("-package");
-            if ((i & 0x20) != 0)
-                options.add("-private");
-            if ((i & 0x40) != 0)
-                options.add("-s");
-            if ((i & 0x80) != 0)
-                options.add("-verbose");
-            count++;
-            if (test(options))
-                pass++;
-        }
-
-        if (pass < count)
-            throw new Error(pass + "/" + count + " test cases passed");
-    }
-
-    boolean test(List<String> options) throws Exception {
-        String[] args = new String[options.size() + 1];
-        options.toArray(args);
-        args[args.length - 1] = testClassName;
-        String oldOut = runOldJavap(args);
-        String newOut = runNewJavap(args);
-        boolean ok = oldOut.equals(newOut);
-        System.err.println((ok ? "pass" : "FAIL") + ": " + options);
-        if (!ok && viewResults)
-            view(oldOut, newOut);
-        return ok;
-    }
-
-    String runOldJavap(String[] args) {
-        //System.err.println("OLD: " + Arrays.asList(args));
-        PrintStream oldOut = System.out;
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        System.setOut(new PrintStream(out));
-        try {
-            sun.tools.javap.Main.entry(args);
-        } finally {
-            System.setOut(oldOut);
-        }
-        return out.toString();
-    }
-
-    String runNewJavap(String[] args) {
-        String[] nArgs = new String[args.length + 2];
-        nArgs[0] = "-XDcompat";
-        nArgs[1] = "-XDignore.symbol.file";
-        System.arraycopy(args, 0, nArgs, 2, args.length);
-        //System.err.println("NEW: " + Arrays.asList(nArgs));
-        StringWriter out = new StringWriter();
-        com.sun.tools.javap.Main.run(nArgs, new PrintWriter(out, true));
-        return out.toString();
-    }
-
-    File write(String text, String suffix) throws IOException {
-        File f = File.createTempFile("OptionTest", suffix);
-        FileWriter out = new FileWriter(f);
-        out.write(text);
-        out.close();
-        return f;
-    }
-
-    void view(String oldOut, String newOut) throws Exception {
-        File oldFile = write(oldOut, "old");
-        File newFile = write(newOut, "new");
-        List<String> cmd = new ArrayList<String>();
-        cmd.addAll(viewCmd);
-        cmd.add(oldFile.getPath());
-        cmd.add(newFile.getPath());
-        Process p = new ProcessBuilder(cmd).redirectErrorStream(true).start();
-        p.getOutputStream().close();
-        String line;
-        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        while ((line = in.readLine()) != null)
-            System.err.println(line);
-        in.close();
-        p.waitFor();
-    }
-
-    String testClassName = "java.lang.SecurityManager";
-    boolean viewResults;
-    List<String> viewCmd;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javap/T6824493.java	Mon Jul 06 11:42:37 2009 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.io.*;
+import java.util.*;
+
+/*
+ * @test
+ * @bug 6824493
+ * @summary experimental support for additional info for instructions
+ * @compile -g T6824493.java
+ * @run main T6824493
+ */
+public class T6824493 {
+    public static void main(String... args) {
+        new T6824493().run();
+    }
+
+    void run() {
+        // for each of the options, we run javap and check for some
+        // marker strings in the output that generally indicate the
+        // presence of the expected output, without being as specific
+        // as a full golden file test.
+        test("-XDdetails:source",
+            "for (int i = 0; i < 10; i++) {",
+            "System.out.println(s + i);");
+
+        test("-XDdetails:tryBlocks",
+                "try[0]",
+                "end try[0]",
+                "catch[0]");
+
+        test("-XDdetails:stackMaps",
+                "StackMap locals:  this java/lang/String int",
+                "StackMap stack:  java/lang/Throwable");
+
+        test("-XDdetails:localVariables",
+                "start local 3 // java.util.List list",
+                "end local 3 // java.util.List list");
+
+        test("-XDdetails:localVariableTypes",
+                "start generic local 3 // java.util.List<java.lang.String> list",
+                "end generic local 3 // java.util.List<java.lang.String> list");
+
+        if (errors > 0)
+            throw new Error(errors + " errors found");
+    }
+
+    void test(String option, String... expect) {
+        String[] args = {
+            "-c",
+            "-classpath",
+            testSrc + File.pathSeparator + testClasses,
+            option,
+            "Test"
+        };
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        if (rc != 0) {
+            error("unexpected return code from javap: " + rc);
+            return;
+        }
+
+        String out = sw.toString();
+        System.out.println(out);
+        for (String e: expect) {
+            if (!out.contains(e))
+                error("Not found: " + e);
+        }
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    private int errors;
+    private String testSrc = System.getProperty("test.src", ".");
+    private String testClasses = System.getProperty("test.classes", ".");
+}
+
+class Test {
+    void m(String s) {
+        for (int i = 0; i < 10; i++) {
+            try {
+                List<String> list = null;
+                System.out.println(s + i);
+            } catch (NullPointerException e) {
+                System.out.println("catch NPE");
+            } finally {
+                System.out.println("finally");
+            }
+        }
+    }
+}
--- a/make/Defs-internal.gmk	Wed Jul 01 09:59:16 2009 -0700
+++ b/make/Defs-internal.gmk	Mon Jul 06 11:42:37 2009 -0700
@@ -218,6 +218,7 @@
     JDK_TOPDIR=$(ABS_JDK_TOPDIR) \
     JDK_MAKE_SHARED_DIR=$(ABS_JDK_TOPDIR)/make/common/shared \
     EXTERNALSANITYCONTROL=true \
+    SOURCE_LANGUAGE_VERSION=$(SOURCE_LANGUAGE_VERSION) \
     TARGET_CLASS_VERSION=$(TARGET_CLASS_VERSION) \
     MILESTONE=$(MILESTONE) \
     BUILD_NUMBER=$(BUILD_NUMBER) \