From 4282af91a0ff4be7f3339b5fbc0265966ee1910e Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Thu, 24 Mar 2011 15:45:27 -0700 Subject: [PATCH 001/168] 7030435: Some oop_oop_iterate_m() methods iterate outside of specified memory bounds Filter ref-containing locations through the memory-interval specified in the call. Reviewed-by: jcoomes, jwilhelm, tonyp --- hotspot/src/share/vm/oops/constantPoolKlass.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/oops/constantPoolKlass.cpp b/hotspot/src/share/vm/oops/constantPoolKlass.cpp index 367530717d6..e736ec1ed6d 100644 --- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp +++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp @@ -245,13 +245,13 @@ int constantPoolKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) } oop* addr; addr = cp->tags_addr(); - blk->do_oop(addr); + if (mr.contains(addr)) blk->do_oop(addr); addr = cp->cache_addr(); - blk->do_oop(addr); + if (mr.contains(addr)) blk->do_oop(addr); addr = cp->operands_addr(); - blk->do_oop(addr); + if (mr.contains(addr)) blk->do_oop(addr); addr = cp->pool_holder_addr(); - blk->do_oop(addr); + if (mr.contains(addr)) blk->do_oop(addr); return size; } From 3e02204f5df21d651219292a68780cb3c60a98fe Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Thu, 24 Mar 2011 15:47:01 -0700 Subject: [PATCH 002/168] 7029036: Card-table verification hangs with all framework collectors, except G1, even before the first GC When verifying clean card ranges, use memory-range-bounded iteration over oops of objects overlapping that range, thus avoiding the otherwise quadratic worst-case cost of scanning large object arrays. Reviewed-by: jmasa, jwilhelm, tonyp --- hotspot/src/share/vm/memory/cardTableRS.cpp | 40 +++++++++++++-------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index afc166615ab..dcaa7c682f5 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -318,17 +318,28 @@ private: protected: template void do_oop_work(T* p) { HeapWord* jp = (HeapWord*)p; - if (jp >= _begin && jp < _end) { - oop obj = oopDesc::load_decode_heap_oop(p); - guarantee(obj == NULL || - (HeapWord*)p < _boundary || - (HeapWord*)obj >= _boundary, - "pointer on clean card crosses boundary"); - } + assert(jp >= _begin && jp < _end, + err_msg("Error: jp " PTR_FORMAT " should be within " + "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")", + _begin, _end)); + oop obj = oopDesc::load_decode_heap_oop(p); + guarantee(obj == NULL || (HeapWord*)obj >= _boundary, + err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on " + "clean card crosses boundary" PTR_FORMAT, + (HeapWord*)obj, jp, _boundary)); } + public: VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) : - _boundary(b), _begin(begin), _end(end) {} + _boundary(b), _begin(begin), _end(end) { + assert(b <= begin, + err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT, + b, begin)); + assert(begin <= end, + err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT, + begin, end)); + } + virtual void do_oop(oop* p) { VerifyCleanCardClosure::do_oop_work(p); } virtual void do_oop(narrowOop* p) { VerifyCleanCardClosure::do_oop_work(p); } }; @@ -392,13 +403,14 @@ void CardTableRS::verify_space(Space* s, HeapWord* gen_boundary) { } } // Now traverse objects until end. - HeapWord* cur = start_block; - VerifyCleanCardClosure verify_blk(gen_boundary, begin, end); - while (cur < end) { - if (s->block_is_obj(cur) && s->obj_is_alive(cur)) { - oop(cur)->oop_iterate(&verify_blk); + if (begin < end) { + MemRegion mr(begin, end); + VerifyCleanCardClosure verify_blk(gen_boundary, begin, end); + for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) { + if (s->block_is_obj(cur) && s->obj_is_alive(cur)) { + oop(cur)->oop_iterate(&verify_blk, mr); + } } - cur += s->block_size(cur); } cur_entry = first_dirty; } else { From 4fd9f5071f6dc16b1c0e8e5c224476300c0977ad Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Wed, 23 Mar 2011 14:12:51 +0100 Subject: [PATCH 003/168] 6948149: G1: Imbalance in termination times Changed default value of WorkStealingYieldsBeforeSleep from 1000 to 5000. Added more information to G1 pause logging. Reviewed-by: jwilhelm, tonyp, jmasa --- .../g1/g1CollectorPolicy.cpp | 56 ++++++++----------- .../g1/g1CollectorPolicy.hpp | 8 +-- hotspot/src/share/vm/runtime/globals.hpp | 2 +- 3 files changed, 28 insertions(+), 38 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 18f11076996..1421e2d2e57 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -307,6 +307,7 @@ G1CollectorPolicy::G1CollectorPolicy() : _par_last_termination_times_ms = new double[_parallel_gc_threads]; _par_last_termination_attempts = new double[_parallel_gc_threads]; _par_last_gc_worker_end_times_ms = new double[_parallel_gc_threads]; + _par_last_gc_worker_times_ms = new double[_parallel_gc_threads]; // start conservatively _expensive_region_limit_ms = 0.5 * (double) MaxGCPauseMillis; @@ -911,6 +912,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, _par_last_termination_times_ms[i] = -1234.0; _par_last_termination_attempts[i] = -1234.0; _par_last_gc_worker_end_times_ms[i] = -1234.0; + _par_last_gc_worker_times_ms[i] = -1234.0; } #endif @@ -1063,8 +1065,7 @@ T sum_of(T* sum_arr, int start, int n, int N) { void G1CollectorPolicy::print_par_stats(int level, const char* str, - double* data, - bool summary) { + double* data) { double min = data[0], max = data[0]; double total = 0.0; LineBuffer buf(level); @@ -1078,20 +1079,15 @@ void G1CollectorPolicy::print_par_stats(int level, total += val; buf.append(" %3.1lf", val); } - if (summary) { - buf.append_and_print_cr(""); - double avg = total / (double) ParallelGCThreads; - buf.append(" "); - buf.append("Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf", - avg, min, max); - } - buf.append_and_print_cr("]"); + buf.append_and_print_cr(""); + double avg = total / (double) ParallelGCThreads; + buf.append_and_print_cr(" Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf, Diff: %5.1lf]", + avg, min, max, max - min); } void G1CollectorPolicy::print_par_sizes(int level, const char* str, - double* data, - bool summary) { + double* data) { double min = data[0], max = data[0]; double total = 0.0; LineBuffer buf(level); @@ -1105,14 +1101,10 @@ void G1CollectorPolicy::print_par_sizes(int level, total += val; buf.append(" %d", (int) val); } - if (summary) { - buf.append_and_print_cr(""); - double avg = total / (double) ParallelGCThreads; - buf.append(" "); - buf.append("Sum: %d, Avg: %d, Min: %d, Max: %d", - (int)total, (int)avg, (int)min, (int)max); - } - buf.append_and_print_cr("]"); + buf.append_and_print_cr(""); + double avg = total / (double) ParallelGCThreads; + buf.append_and_print_cr(" Sum: %d, Avg: %d, Min: %d, Max: %d, Diff: %d]", + (int)total, (int)avg, (int)min, (int)max, (int)max - (int)min); } void G1CollectorPolicy::print_stats (int level, @@ -1421,22 +1413,22 @@ void G1CollectorPolicy::record_collection_pause_end() { } if (parallel) { print_stats(1, "Parallel Time", _cur_collection_par_time_ms); - print_par_stats(2, "GC Worker Start Time", - _par_last_gc_worker_start_times_ms, false); + print_par_stats(2, "GC Worker Start Time", _par_last_gc_worker_start_times_ms); print_par_stats(2, "Update RS", _par_last_update_rs_times_ms); - print_par_sizes(3, "Processed Buffers", - _par_last_update_rs_processed_buffers, true); - print_par_stats(2, "Ext Root Scanning", - _par_last_ext_root_scan_times_ms); - print_par_stats(2, "Mark Stack Scanning", - _par_last_mark_stack_scan_times_ms); + print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers); + print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms); + print_par_stats(2, "Mark Stack Scanning", _par_last_mark_stack_scan_times_ms); print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms); print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms); print_par_stats(2, "Termination", _par_last_termination_times_ms); - print_par_sizes(3, "Termination Attempts", - _par_last_termination_attempts, true); - print_par_stats(2, "GC Worker End Time", - _par_last_gc_worker_end_times_ms, false); + print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts); + print_par_stats(2, "GC Worker End Time", _par_last_gc_worker_end_times_ms); + + for (int i = 0; i < _parallel_gc_threads; i++) { + _par_last_gc_worker_times_ms[i] = _par_last_gc_worker_end_times_ms[i] - _par_last_gc_worker_start_times_ms[i]; + } + print_par_stats(2, "GC Worker Times", _par_last_gc_worker_times_ms); + print_stats(2, "Other", parallel_other_time); print_stats(1, "Clear CT", _cur_clear_ct_time_ms); } else { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index f7375d6a48e..79c5ee225db 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -182,6 +182,7 @@ protected: double* _par_last_termination_times_ms; double* _par_last_termination_attempts; double* _par_last_gc_worker_end_times_ms; + double* _par_last_gc_worker_times_ms; // indicates that we are in young GC mode bool _in_young_gc_mode; @@ -569,11 +570,8 @@ protected: void print_stats(int level, const char* str, double value); void print_stats(int level, const char* str, int value); - void print_par_stats(int level, const char* str, double* data) { - print_par_stats(level, str, data, true); - } - void print_par_stats(int level, const char* str, double* data, bool summary); - void print_par_sizes(int level, const char* str, double* data, bool summary); + void print_par_stats(int level, const char* str, double* data); + void print_par_sizes(int level, const char* str, double* data); void check_other_times(int level, NumberSeq* other_times_ms, diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index cd320ba6fc8..7796debf9ad 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1924,7 +1924,7 @@ class CommandLineFlags { experimental(intx, WorkStealingSleepMillis, 1, \ "Sleep time when sleep is used for yields") \ \ - experimental(uintx, WorkStealingYieldsBeforeSleep, 1000, \ + experimental(uintx, WorkStealingYieldsBeforeSleep, 5000, \ "Number of yields before a sleep is done during workstealing") \ \ experimental(uintx, WorkStealingHardSpins, 4096, \ From c2275649b7622678fcebfa1680c32b60fd17fb1d Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Mon, 28 Mar 2011 10:58:54 -0700 Subject: [PATCH 004/168] 7026932: G1: No need to abort VM when card count cache expansion fails Manage allocation/freeing of the card cache counts and epochs arrays directly so that an allocation failure while attempting to expand these arrays does not abort the JVM. Failure to expand these arrays is not fatal. Reviewed-by: iveresov, tonyp --- .../g1/concurrentG1Refine.cpp | 178 +++++++++++++----- .../g1/concurrentG1Refine.hpp | 40 +++- .../vm/gc_implementation/g1/g1_globals.hpp | 4 + 3 files changed, 170 insertions(+), 52 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp index 09279048e90..4833c0a30d1 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp @@ -31,19 +31,23 @@ #include "gc_implementation/g1/heapRegionSeq.inline.hpp" #include "memory/space.inline.hpp" #include "runtime/atomic.hpp" +#include "runtime/java.hpp" #include "utilities/copy.hpp" // Possible sizes for the card counts cache: odd primes that roughly double in size. // (See jvmtiTagMap.cpp). -int ConcurrentG1Refine::_cc_cache_sizes[] = { - 16381, 32771, 76831, 150001, 307261, - 614563, 1228891, 2457733, 4915219, 9830479, - 19660831, 39321619, 78643219, 157286461, -1 + +#define MAX_SIZE ((size_t) -1) + +size_t ConcurrentG1Refine::_cc_cache_sizes[] = { + 16381, 32771, 76831, 150001, 307261, + 614563, 1228891, 2457733, 4915219, 9830479, + 19660831, 39321619, 78643219, 157286461, MAX_SIZE }; ConcurrentG1Refine::ConcurrentG1Refine() : _card_counts(NULL), _card_epochs(NULL), - _n_card_counts(0), _max_n_card_counts(0), + _n_card_counts(0), _max_cards(0), _max_n_card_counts(0), _cache_size_index(0), _expand_card_counts(false), _hot_cache(NULL), _def_use_cache(false), _use_cache(false), @@ -98,27 +102,44 @@ int ConcurrentG1Refine::thread_num() { void ConcurrentG1Refine::init() { if (G1ConcRSLogCacheSize > 0) { _g1h = G1CollectedHeap::heap(); - _max_n_card_counts = - (unsigned) (_g1h->max_capacity() >> CardTableModRefBS::card_shift); + + _max_cards = _g1h->max_capacity() >> CardTableModRefBS::card_shift; + _max_n_card_counts = _max_cards * G1MaxHotCardCountSizePercent / 100; size_t max_card_num = ((size_t)1 << (sizeof(unsigned)*BitsPerByte-1)) - 1; - guarantee(_max_n_card_counts < max_card_num, "card_num representation"); + guarantee(_max_cards < max_card_num, "card_num representation"); - int desired = _max_n_card_counts / InitialCacheFraction; - for (_cache_size_index = 0; - _cc_cache_sizes[_cache_size_index] >= 0; _cache_size_index++) { - if (_cc_cache_sizes[_cache_size_index] >= desired) break; + // We need _n_card_counts to be less than _max_n_card_counts here + // so that the expansion call (below) actually allocates the + // _counts and _epochs arrays. + assert(_n_card_counts == 0, "pre-condition"); + assert(_max_n_card_counts > 0, "pre-condition"); + + // Find the index into cache size array that is of a size that's + // large enough to hold desired_sz. + size_t desired_sz = _max_cards / InitialCacheFraction; + int desired_sz_index = 0; + while (_cc_cache_sizes[desired_sz_index] < desired_sz) { + desired_sz_index += 1; + assert(desired_sz_index < MAX_CC_CACHE_INDEX, "invariant"); } - _cache_size_index = MAX2(0, (_cache_size_index - 1)); + assert(desired_sz_index < MAX_CC_CACHE_INDEX, "invariant"); - int initial_size = _cc_cache_sizes[_cache_size_index]; - if (initial_size < 0) initial_size = _max_n_card_counts; + // If the desired_sz value is between two sizes then + // _cc_cache_sizes[desired_sz_index-1] < desired_sz <= _cc_cache_sizes[desired_sz_index] + // we will start with the lower size in the optimistic expectation that + // we will not need to expand up. Note desired_sz_index could also be 0. + if (desired_sz_index > 0 && + _cc_cache_sizes[desired_sz_index] > desired_sz) { + desired_sz_index -= 1; + } - // Make sure we don't go bigger than we will ever need - _n_card_counts = MIN2((unsigned) initial_size, _max_n_card_counts); - - _card_counts = NEW_C_HEAP_ARRAY(CardCountCacheEntry, _n_card_counts); - _card_epochs = NEW_C_HEAP_ARRAY(CardEpochCacheEntry, _n_card_counts); + if (!expand_card_count_cache(desired_sz_index)) { + // Allocation was unsuccessful - exit + vm_exit_during_initialization("Could not reserve enough space for card count cache"); + } + assert(_n_card_counts > 0, "post-condition"); + assert(_cache_size_index == desired_sz_index, "post-condition"); Copy::fill_to_bytes(&_card_counts[0], _n_card_counts * sizeof(CardCountCacheEntry)); @@ -163,10 +184,13 @@ void ConcurrentG1Refine::reinitialize_threads() { ConcurrentG1Refine::~ConcurrentG1Refine() { if (G1ConcRSLogCacheSize > 0) { + // Please see the comment in allocate_card_count_cache + // for why we call os::malloc() and os::free() directly. assert(_card_counts != NULL, "Logic"); - FREE_C_HEAP_ARRAY(CardCountCacheEntry, _card_counts); + os::free(_card_counts); assert(_card_epochs != NULL, "Logic"); - FREE_C_HEAP_ARRAY(CardEpochCacheEntry, _card_epochs); + os::free(_card_epochs); + assert(_hot_cache != NULL, "Logic"); FREE_C_HEAP_ARRAY(jbyte*, _hot_cache); } @@ -382,29 +406,93 @@ void ConcurrentG1Refine::clean_up_cache(int worker_i, } } -void ConcurrentG1Refine::expand_card_count_cache() { +// The arrays used to hold the card counts and the epochs must have +// a 1:1 correspondence. Hence they are allocated and freed together +// Returns true if the allocations of both the counts and epochs +// were successful; false otherwise. +bool ConcurrentG1Refine::allocate_card_count_cache(size_t n, + CardCountCacheEntry** counts, + CardEpochCacheEntry** epochs) { + // We call the allocation/free routines directly for the counts + // and epochs arrays. The NEW_C_HEAP_ARRAY/FREE_C_HEAP_ARRAY + // macros call AllocateHeap and FreeHeap respectively. + // AllocateHeap will call vm_exit_out_of_memory in the event + // of an allocation failure and abort the JVM. With the + // _counts/epochs arrays we only need to abort the JVM if the + // initial allocation of these arrays fails. + // + // Additionally AllocateHeap/FreeHeap do some tracing of + // allocate/free calls so calling one without calling the + // other can cause inconsistencies in the tracing. So we + // call neither. + + assert(*counts == NULL, "out param"); + assert(*epochs == NULL, "out param"); + + size_t counts_size = n * sizeof(CardCountCacheEntry); + size_t epochs_size = n * sizeof(CardEpochCacheEntry); + + *counts = (CardCountCacheEntry*) os::malloc(counts_size); + if (*counts == NULL) { + // allocation was unsuccessful + return false; + } + + *epochs = (CardEpochCacheEntry*) os::malloc(epochs_size); + if (*epochs == NULL) { + // allocation was unsuccessful - free counts array + assert(*counts != NULL, "must be"); + os::free(*counts); + *counts = NULL; + return false; + } + + // We successfully allocated both counts and epochs + return true; +} + +// Returns true if the card counts/epochs cache was +// successfully expanded; false otherwise. +bool ConcurrentG1Refine::expand_card_count_cache(int cache_size_idx) { + // Can we expand the card count and epoch tables? if (_n_card_counts < _max_n_card_counts) { - int new_idx = _cache_size_index+1; - int new_size = _cc_cache_sizes[new_idx]; - if (new_size < 0) new_size = _max_n_card_counts; + assert(cache_size_idx >= 0 && cache_size_idx < MAX_CC_CACHE_INDEX, "oob"); + size_t cache_size = _cc_cache_sizes[cache_size_idx]; // Make sure we don't go bigger than we will ever need - new_size = MIN2((unsigned) new_size, _max_n_card_counts); + cache_size = MIN2(cache_size, _max_n_card_counts); - // Expand the card count and card epoch tables - if (new_size > (int)_n_card_counts) { - // We can just free and allocate a new array as we're - // not interested in preserving the contents - assert(_card_counts != NULL, "Logic!"); - assert(_card_epochs != NULL, "Logic!"); - FREE_C_HEAP_ARRAY(CardCountCacheEntry, _card_counts); - FREE_C_HEAP_ARRAY(CardEpochCacheEntry, _card_epochs); - _n_card_counts = new_size; - _card_counts = NEW_C_HEAP_ARRAY(CardCountCacheEntry, _n_card_counts); - _card_epochs = NEW_C_HEAP_ARRAY(CardEpochCacheEntry, _n_card_counts); - _cache_size_index = new_idx; + // Should we expand the card count and card epoch tables? + if (cache_size > _n_card_counts) { + // We have been asked to allocate new, larger, arrays for + // the card counts and the epochs. Attempt the allocation + // of both before we free the existing arrays in case + // the allocation is unsuccessful... + CardCountCacheEntry* counts = NULL; + CardEpochCacheEntry* epochs = NULL; + + if (allocate_card_count_cache(cache_size, &counts, &epochs)) { + // Allocation was successful. + // We can just free the old arrays; we're + // not interested in preserving the contents + if (_card_counts != NULL) os::free(_card_counts); + if (_card_epochs != NULL) os::free(_card_epochs); + + // Cache the size of the arrays and the index that got us there. + _n_card_counts = cache_size; + _cache_size_index = cache_size_idx; + + _card_counts = counts; + _card_epochs = epochs; + + // We successfully allocated/expanded the caches. + return true; + } } } + + // We did not successfully expand the caches. + return false; } void ConcurrentG1Refine::clear_and_record_card_counts() { @@ -415,10 +503,16 @@ void ConcurrentG1Refine::clear_and_record_card_counts() { #endif if (_expand_card_counts) { - expand_card_count_cache(); + int new_idx = _cache_size_index + 1; + + if (expand_card_count_cache(new_idx)) { + // Allocation was successful and _n_card_counts has + // been updated to the new size. We only need to clear + // the epochs so we don't read a bogus epoch value + // when inserting a card into the hot card cache. + Copy::fill_to_bytes(&_card_epochs[0], _n_card_counts * sizeof(CardEpochCacheEntry)); + } _expand_card_counts = false; - // Only need to clear the epochs. - Copy::fill_to_bytes(&_card_epochs[0], _n_card_counts * sizeof(CardEpochCacheEntry)); } int this_epoch = (int) _n_periods; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp index 50ea5e9e6f6..68a9407a2f3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 @@ -94,7 +94,7 @@ class ConcurrentG1Refine: public CHeapObj { } CardEpochCacheEntry; julong make_epoch_entry(unsigned int card_num, unsigned int epoch) { - assert(0 <= card_num && card_num < _max_n_card_counts, "Bounds"); + assert(0 <= card_num && card_num < _max_cards, "Bounds"); assert(0 <= epoch && epoch <= _n_periods, "must be"); return ((julong) card_num << card_num_shift) | epoch; @@ -117,15 +117,24 @@ class ConcurrentG1Refine: public CHeapObj { CardEpochCacheEntry* _card_epochs; // The current number of buckets in the card count cache - unsigned _n_card_counts; + size_t _n_card_counts; - // The max number of buckets required for the number of - // cards for the entire reserved heap - unsigned _max_n_card_counts; + // The number of cards for the entire reserved heap + size_t _max_cards; + + // The max number of buckets for the card counts and epochs caches. + // This is the maximum that the counts and epochs will grow to. + // It is specified as a fraction or percentage of _max_cards using + // G1MaxHotCardCountSizePercent. + size_t _max_n_card_counts; // Possible sizes of the cache: odd primes that roughly double in size. // (See jvmtiTagMap.cpp). - static int _cc_cache_sizes[]; + enum { + MAX_CC_CACHE_INDEX = 15 // maximum index into the cache size array. + }; + + static size_t _cc_cache_sizes[MAX_CC_CACHE_INDEX]; // The index in _cc_cache_sizes corresponding to the size of // _card_counts. @@ -147,11 +156,22 @@ class ConcurrentG1Refine: public CHeapObj { CardTableModRefBS* _ct_bs; G1CollectedHeap* _g1h; - // Expands the array that holds the card counts to the next size up - void expand_card_count_cache(); + // Helper routine for expand_card_count_cache(). + // The arrays used to hold the card counts and the epochs must have + // a 1:1 correspondence. Hence they are allocated and freed together. + // Returns true if the allocations of both the counts and epochs + // were successful; false otherwise. + bool allocate_card_count_cache(size_t n, + CardCountCacheEntry** counts, + CardEpochCacheEntry** epochs); + + // Expands the arrays that hold the card counts and epochs + // to the cache size at index. Returns true if the expansion/ + // allocation was successful; false otherwise. + bool expand_card_count_cache(int index); // hash a given key (index of card_ptr) with the specified size - static unsigned int hash(size_t key, int size) { + static unsigned int hash(size_t key, size_t size) { return (unsigned int) key % size; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index 19a8338c6e6..b3d6ae0ed3a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -193,6 +193,10 @@ develop(intx, G1ConcRSHotCardLimit, 4, \ "The threshold that defines (>=) a hot card.") \ \ + develop(intx, G1MaxHotCardCountSizePercent, 25, \ + "The maximum size of the hot card count cache as a " \ + "percentage of the number of cards for the maximum heap.") \ + \ develop(bool, G1PrintOopAppls, false, \ "When true, print applications of closures to external locs.") \ \ From 349d820dd1587235f18f21a3068718a483f11fab Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Tue, 29 Mar 2011 22:36:16 -0400 Subject: [PATCH 005/168] 7029458: G1: Add newly-reclaimed regions to the beginning of the region free list, not the end What the synopsis says. Reviewed-by: jwilhelm, iveresov, johnc --- .../gc_implementation/g1/g1CollectedHeap.cpp | 6 +-- .../gc_implementation/g1/g1CollectedHeap.hpp | 2 +- .../vm/gc_implementation/g1/heapRegionSet.cpp | 39 +++++++++++++++++++ .../vm/gc_implementation/g1/heapRegionSet.hpp | 9 +++++ .../g1/heapRegionSet.inline.hpp | 17 ++++++++ 5 files changed, 69 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index f82eec43b6c..e481a8704cb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3879,7 +3879,7 @@ void G1CollectedHeap::release_gc_alloc_regions(bool totally) { if (r->is_empty()) { // We didn't actually allocate anything in it; let's just put // it back on the free list. - _free_list.add_as_tail(r); + _free_list.add_as_head(r); } else if (_retain_gc_alloc_region[ap] && !totally) { // retain it so that we can use it at the beginning of the next GC _retained_gc_alloc_regions[ap] = r; @@ -5013,7 +5013,7 @@ void G1CollectedHeap::free_region(HeapRegion* hr, *pre_used += hr->used(); hr->hr_clear(par, true /* clear_space */); - free_list->add_as_tail(hr); + free_list->add_as_head(hr); } void G1CollectedHeap::free_humongous_region(HeapRegion* hr, @@ -5065,7 +5065,7 @@ void G1CollectedHeap::update_sets_after_freeing_regions(size_t pre_used, } if (free_list != NULL && !free_list->is_empty()) { MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag); - _free_list.add_as_tail(free_list); + _free_list.add_as_head(free_list); } if (humongous_proxy_set != NULL && !humongous_proxy_set->is_empty()) { MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 5863e7c9860..82abce1d1b0 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1061,7 +1061,7 @@ public: } void append_secondary_free_list() { - _free_list.add_as_tail(&_secondary_free_list); + _free_list.add_as_head(&_secondary_free_list); } void append_secondary_free_list_if_not_empty_with_lock() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp index be80cd2201a..5f35e2f0520 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp @@ -261,6 +261,45 @@ void HeapRegionLinkedList::fill_in_ext_msg_extra(hrs_ext_msg* msg) { msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, head(), tail()); } +void HeapRegionLinkedList::add_as_head(HeapRegionLinkedList* from_list) { + hrs_assert_mt_safety_ok(this); + hrs_assert_mt_safety_ok(from_list); + + verify_optional(); + from_list->verify_optional(); + + if (from_list->is_empty()) return; + +#ifdef ASSERT + HeapRegionLinkedListIterator iter(from_list); + while (iter.more_available()) { + HeapRegion* hr = iter.get_next(); + // In set_containing_set() we check that we either set the value + // from NULL to non-NULL or vice versa to catch bugs. So, we have + // to NULL it first before setting it to the value. + hr->set_containing_set(NULL); + hr->set_containing_set(this); + } +#endif // ASSERT + + if (_head != NULL) { + assert(length() > 0 && _tail != NULL, hrs_ext_msg(this, "invariant")); + from_list->_tail->set_next(_head); + } else { + assert(length() == 0 && _head == NULL, hrs_ext_msg(this, "invariant")); + _tail = from_list->_tail; + } + _head = from_list->_head; + + _length += from_list->length(); + _region_num += from_list->region_num(); + _total_used_bytes += from_list->total_used_bytes(); + from_list->clear(); + + verify_optional(); + from_list->verify_optional(); +} + void HeapRegionLinkedList::add_as_tail(HeapRegionLinkedList* from_list) { hrs_assert_mt_safety_ok(this); hrs_assert_mt_safety_ok(from_list); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp index 5d53068ca88..ffb106f7946 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp @@ -277,6 +277,10 @@ protected: } public: + // It adds hr to the list as the new head. The region should not be + // a member of another set. + inline void add_as_head(HeapRegion* hr); + // It adds hr to the list as the new tail. The region should not be // a member of another set. inline void add_as_tail(HeapRegion* hr); @@ -288,6 +292,11 @@ public: // Convenience method. inline HeapRegion* remove_head_or_null(); + // It moves the regions from from_list to this list and empties + // from_list. The new regions will appear in the same order as they + // were in from_list and be linked in the beginning of this list. + void add_as_head(HeapRegionLinkedList* from_list); + // It moves the regions from from_list to this list and empties // from_list. The new regions will appear in the same order as they // were in from_list and be linked in the end of this list. diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp index 501f5a7aef8..cd2fc29fb9c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp @@ -110,6 +110,23 @@ inline void HeapRegionSet::remove_with_proxy(HeapRegion* hr, //////////////////// HeapRegionLinkedList //////////////////// +inline void HeapRegionLinkedList::add_as_head(HeapRegion* hr) { + hrs_assert_mt_safety_ok(this); + assert((length() == 0 && _head == NULL && _tail == NULL) || + (length() > 0 && _head != NULL && _tail != NULL), + hrs_ext_msg(this, "invariant")); + // add_internal() will verify the region. + add_internal(hr); + + // Now link the region. + if (_head != NULL) { + hr->set_next(_head); + } else { + _tail = hr; + } + _head = hr; +} + inline void HeapRegionLinkedList::add_as_tail(HeapRegion* hr) { hrs_assert_mt_safety_ok(this); assert((length() == 0 && _head == NULL && _tail == NULL) || From 3e9fe24ddd6fb8f67404d13c8afbccbd8b10189e Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Wed, 30 Mar 2011 10:26:59 -0400 Subject: [PATCH 006/168] 7023069: G1: Introduce symmetric locking in the slow allocation path 7023151: G1: refactor the code that operates on _cur_alloc_region to be re-used for allocs by the GC threads 7018286: G1: humongous allocation attempts should take the GC locker into account First, this change replaces the asymmetric locking scheme in the G1 slow alloc path by a summetric one. Second, it factors out the code that operates on _cur_alloc_region so that it can be re-used for allocations by the GC threads in the future. Reviewed-by: stefank, brutisso, johnc --- .../vm/gc_implementation/g1/g1AllocRegion.cpp | 208 +++++ .../vm/gc_implementation/g1/g1AllocRegion.hpp | 174 ++++ .../g1/g1AllocRegion.inline.hpp | 106 +++ .../gc_implementation/g1/g1CollectedHeap.cpp | 803 +++++++----------- .../gc_implementation/g1/g1CollectedHeap.hpp | 193 ++--- .../g1/g1CollectedHeap.inline.hpp | 131 +-- .../vm/gc_implementation/g1/heapRegion.cpp | 11 +- .../vm/gc_implementation/g1/heapRegion.hpp | 18 + .../g1/heapRegion.inline.hpp | 11 +- .../src/share/vm/memory/cardTableModRefBS.hpp | 5 + hotspot/src/share/vm/memory/space.cpp | 7 +- 11 files changed, 920 insertions(+), 747 deletions(-) create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp new file mode 100644 index 00000000000..5d0d916c48d --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc_implementation/g1/g1AllocRegion.inline.hpp" +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" + +G1CollectedHeap* G1AllocRegion::_g1h = NULL; +HeapRegion* G1AllocRegion::_dummy_region = NULL; + +void G1AllocRegion::setup(G1CollectedHeap* g1h, HeapRegion* dummy_region) { + assert(_dummy_region == NULL, "should be set once"); + assert(dummy_region != NULL, "pre-condition"); + assert(dummy_region->free() == 0, "pre-condition"); + + // Make sure that any allocation attempt on this region will fail + // and will not trigger any asserts. + assert(allocate(dummy_region, 1, false) == NULL, "should fail"); + assert(par_allocate(dummy_region, 1, false) == NULL, "should fail"); + assert(allocate(dummy_region, 1, true) == NULL, "should fail"); + assert(par_allocate(dummy_region, 1, true) == NULL, "should fail"); + + _g1h = g1h; + _dummy_region = dummy_region; +} + +void G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region, + bool bot_updates) { + assert(alloc_region != NULL && alloc_region != _dummy_region, + "pre-condition"); + + // Other threads might still be trying to allocate using a CAS out + // of the region we are trying to retire, as they can do so without + // holding the lock. So, we first have to make sure that noone else + // can allocate out of it by doing a maximal allocation. Even if our + // CAS attempt fails a few times, we'll succeed sooner or later + // given that failed CAS attempts mean that the region is getting + // closed to being full. + size_t free_word_size = alloc_region->free() / HeapWordSize; + + // This is the minimum free chunk we can turn into a dummy + // object. If the free space falls below this, then noone can + // allocate in this region anyway (all allocation requests will be + // of a size larger than this) so we won't have to perform the dummy + // allocation. + size_t min_word_size_to_fill = CollectedHeap::min_fill_size(); + + while (free_word_size >= min_word_size_to_fill) { + HeapWord* dummy = par_allocate(alloc_region, free_word_size, bot_updates); + if (dummy != NULL) { + // If the allocation was successful we should fill in the space. + CollectedHeap::fill_with_object(dummy, free_word_size); + alloc_region->set_pre_dummy_top(dummy); + break; + } + + free_word_size = alloc_region->free() / HeapWordSize; + // It's also possible that someone else beats us to the + // allocation and they fill up the region. In that case, we can + // just get out of the loop. + } + assert(alloc_region->free() / HeapWordSize < min_word_size_to_fill, + "post-condition"); +} + +void G1AllocRegion::retire(bool fill_up) { + assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly")); + + trace("retiring"); + HeapRegion* alloc_region = _alloc_region; + if (alloc_region != _dummy_region) { + // We never have to check whether the active region is empty or not, + // and potentially free it if it is, given that it's guaranteed that + // it will never be empty. + assert(!alloc_region->is_empty(), + ar_ext_msg(this, "the alloc region should never be empty")); + + if (fill_up) { + fill_up_remaining_space(alloc_region, _bot_updates); + } + + assert(alloc_region->used() >= _used_bytes_before, + ar_ext_msg(this, "invariant")); + size_t allocated_bytes = alloc_region->used() - _used_bytes_before; + retire_region(alloc_region, allocated_bytes); + _used_bytes_before = 0; + _alloc_region = _dummy_region; + } + trace("retired"); +} + +HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size, + bool force) { + assert(_alloc_region == _dummy_region, ar_ext_msg(this, "pre-condition")); + assert(_used_bytes_before == 0, ar_ext_msg(this, "pre-condition")); + + trace("attempting region allocation"); + HeapRegion* new_alloc_region = allocate_new_region(word_size, force); + if (new_alloc_region != NULL) { + new_alloc_region->reset_pre_dummy_top(); + // Need to do this before the allocation + _used_bytes_before = new_alloc_region->used(); + HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates); + assert(result != NULL, ar_ext_msg(this, "the allocation should succeeded")); + + OrderAccess::storestore(); + // Note that we first perform the allocation and then we store the + // region in _alloc_region. This is the reason why an active region + // can never be empty. + _alloc_region = new_alloc_region; + trace("region allocation successful"); + return result; + } else { + trace("region allocation failed"); + return NULL; + } + ShouldNotReachHere(); +} + +void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) { + msg->append("[%s] %s b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT, + _name, message, BOOL_TO_STR(_bot_updates), + _alloc_region, _used_bytes_before); +} + +void G1AllocRegion::init() { + trace("initializing"); + assert(_alloc_region == NULL && _used_bytes_before == 0, + ar_ext_msg(this, "pre-condition")); + assert(_dummy_region != NULL, "should have been set"); + _alloc_region = _dummy_region; + trace("initialized"); +} + +HeapRegion* G1AllocRegion::release() { + trace("releasing"); + HeapRegion* alloc_region = _alloc_region; + retire(false /* fill_up */); + assert(_alloc_region == _dummy_region, "post-condition of retire()"); + _alloc_region = NULL; + trace("released"); + return (alloc_region == _dummy_region) ? NULL : alloc_region; +} + +#if G1_ALLOC_REGION_TRACING +void G1AllocRegion::trace(const char* str, size_t word_size, HeapWord* result) { + // All the calls to trace that set either just the size or the size + // and the result are considered part of level 2 tracing and are + // skipped during level 1 tracing. + if ((word_size == 0 && result == NULL) || (G1_ALLOC_REGION_TRACING > 1)) { + const size_t buffer_length = 128; + char hr_buffer[buffer_length]; + char rest_buffer[buffer_length]; + + HeapRegion* alloc_region = _alloc_region; + if (alloc_region == NULL) { + jio_snprintf(hr_buffer, buffer_length, "NULL"); + } else if (alloc_region == _dummy_region) { + jio_snprintf(hr_buffer, buffer_length, "DUMMY"); + } else { + jio_snprintf(hr_buffer, buffer_length, + HR_FORMAT, HR_FORMAT_PARAMS(alloc_region)); + } + + if (G1_ALLOC_REGION_TRACING > 1) { + if (result != NULL) { + jio_snprintf(rest_buffer, buffer_length, SIZE_FORMAT" "PTR_FORMAT, + word_size, result); + } else if (word_size != 0) { + jio_snprintf(rest_buffer, buffer_length, SIZE_FORMAT, word_size); + } else { + jio_snprintf(rest_buffer, buffer_length, ""); + } + } else { + jio_snprintf(rest_buffer, buffer_length, ""); + } + + tty->print_cr("[%s] %s : %s %s", _name, hr_buffer, str, rest_buffer); + } +} +#endif // G1_ALLOC_REGION_TRACING + +G1AllocRegion::G1AllocRegion(const char* name, + bool bot_updates) + : _name(name), _bot_updates(bot_updates), + _alloc_region(NULL), _used_bytes_before(0) { } + diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp new file mode 100644 index 00000000000..d329d1ed543 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP + +#include "gc_implementation/g1/heapRegion.hpp" + +class G1CollectedHeap; + +// 0 -> no tracing, 1 -> basic tracing, 2 -> basic + allocation tracing +#define G1_ALLOC_REGION_TRACING 0 + +class ar_ext_msg; + +// A class that holds a region that is active in satisfying allocation +// requests, potentially issued in parallel. When the active region is +// full it will be retired it replaced with a new one. The +// implementation assumes that fast-path allocations will be lock-free +// and a lock will need to be taken when the active region needs to be +// replaced. + +class G1AllocRegion VALUE_OBJ_CLASS_SPEC { + friend class ar_ext_msg; + +private: + // The active allocating region we are currently allocating out + // of. The invariant is that if this object is initialized (i.e., + // init() has been called and release() has not) then _alloc_region + // is either an active allocating region or the dummy region (i.e., + // it can never be NULL) and this object can be used to satisfy + // allocation requests. If this object is not initialized + // (i.e. init() has not been called or release() has been called) + // then _alloc_region is NULL and this object should not be used to + // satisfy allocation requests (it was done this way to force the + // correct use of init() and release()). + HeapRegion* _alloc_region; + + // When we set up a new active region we save its used bytes in this + // field so that, when we retire it, we can calculate how much space + // we allocated in it. + size_t _used_bytes_before; + + // Specifies whether the allocate calls will do BOT updates or not. + bool _bot_updates; + + // Useful for debugging and tracing. + const char* _name; + + // A dummy region (i.e., it's been allocated specially for this + // purpose and it is not part of the heap) that is full (i.e., top() + // == end()). When we don't have a valid active region we make + // _alloc_region point to this. This allows us to skip checking + // whether the _alloc_region is NULL or not. + static HeapRegion* _dummy_region; + + // Some of the methods below take a bot_updates parameter. Its value + // should be the same as the _bot_updates field. The idea is that + // the parameter will be a constant for a particular alloc region + // and, given that these methods will be hopefully inlined, the + // compiler should compile out the test. + + // Perform a non-MT-safe allocation out of the given region. + static inline HeapWord* allocate(HeapRegion* alloc_region, + size_t word_size, + bool bot_updates); + + // Perform a MT-safe allocation out of the given region. + static inline HeapWord* par_allocate(HeapRegion* alloc_region, + size_t word_size, + bool bot_updates); + + // Ensure that the region passed as a parameter has been filled up + // so that noone else can allocate out of it any more. + static void fill_up_remaining_space(HeapRegion* alloc_region, + bool bot_updates); + + // Retire the active allocating region. If fill_up is true then make + // sure that the region is full before we retire it so that noone + // else can allocate out of it. + void retire(bool fill_up); + + // Allocate a new active region and use it to perform a word_size + // allocation. The force parameter will be passed on to + // G1CollectedHeap::allocate_new_alloc_region() and tells it to try + // to allocate a new region even if the max has been reached. + HeapWord* new_alloc_region_and_allocate(size_t word_size, bool force); + + void fill_in_ext_msg(ar_ext_msg* msg, const char* message); + +protected: + // For convenience as subclasses use it. + static G1CollectedHeap* _g1h; + + virtual HeapRegion* allocate_new_region(size_t word_size, bool force) = 0; + virtual void retire_region(HeapRegion* alloc_region, + size_t allocated_bytes) = 0; + + G1AllocRegion(const char* name, bool bot_updates); + +public: + static void setup(G1CollectedHeap* g1h, HeapRegion* dummy_region); + + HeapRegion* get() const { + // Make sure that the dummy region does not escape this class. + return (_alloc_region == _dummy_region) ? NULL : _alloc_region; + } + + // The following two are the building blocks for the allocation method. + + // First-level allocation: Should be called without holding a + // lock. It will try to allocate lock-free out of the active region, + // or return NULL if it was unable to. + inline HeapWord* attempt_allocation(size_t word_size, bool bot_updates); + + // Second-level allocation: Should be called while holding a + // lock. It will try to first allocate lock-free out of the active + // region or, if it's unable to, it will try to replace the active + // alloc region with a new one. We require that the caller takes the + // appropriate lock before calling this so that it is easier to make + // it conform to its locking protocol. + inline HeapWord* attempt_allocation_locked(size_t word_size, + bool bot_updates); + + // Should be called to allocate a new region even if the max of this + // type of regions has been reached. Should only be called if other + // allocation attempts have failed and we are not holding a valid + // active region. + inline HeapWord* attempt_allocation_force(size_t word_size, + bool bot_updates); + + // Should be called before we start using this object. + void init(); + + // Should be called when we want to release the active region which + // is returned after it's been retired. + HeapRegion* release(); + +#if G1_ALLOC_REGION_TRACING + void trace(const char* str, size_t word_size = 0, HeapWord* result = NULL); +#else // G1_ALLOC_REGION_TRACING + void trace(const char* str, size_t word_size = 0, HeapWord* result = NULL) { } +#endif // G1_ALLOC_REGION_TRACING +}; + +class ar_ext_msg : public err_msg { +public: + ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("") { + alloc_region->fill_in_ext_msg(this, message); + } +}; + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp new file mode 100644 index 00000000000..c096de3837a --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP + +#include "gc_implementation/g1/g1AllocRegion.hpp" + +inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region, + size_t word_size, + bool bot_updates) { + assert(alloc_region != NULL, err_msg("pre-condition")); + + if (!bot_updates) { + return alloc_region->allocate_no_bot_updates(word_size); + } else { + return alloc_region->allocate(word_size); + } +} + +inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, + size_t word_size, + bool bot_updates) { + assert(alloc_region != NULL, err_msg("pre-condition")); + assert(!alloc_region->is_empty(), err_msg("pre-condition")); + + if (!bot_updates) { + return alloc_region->par_allocate_no_bot_updates(word_size); + } else { + return alloc_region->par_allocate(word_size); + } +} + +inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size, + bool bot_updates) { + assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition")); + + HeapRegion* alloc_region = _alloc_region; + assert(alloc_region != NULL, ar_ext_msg(this, "not initialized properly")); + + HeapWord* result = par_allocate(alloc_region, word_size, bot_updates); + if (result != NULL) { + trace("alloc", word_size, result); + return result; + } + trace("alloc failed", word_size); + return NULL; +} + +inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size, + bool bot_updates) { + // First we have to tedo the allocation, assuming we're holding the + // appropriate lock, in case another thread changed the region while + // we were waiting to get the lock. + HeapWord* result = attempt_allocation(word_size, bot_updates); + if (result != NULL) { + return result; + } + + retire(true /* fill_up */); + result = new_alloc_region_and_allocate(word_size, false /* force */); + if (result != NULL) { + trace("alloc locked (second attempt)", word_size, result); + return result; + } + trace("alloc locked failed", word_size); + return NULL; +} + +inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size, + bool bot_updates) { + assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition")); + assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly")); + + trace("forcing alloc"); + HeapWord* result = new_alloc_region_and_allocate(word_size, true /* force */); + if (result != NULL) { + trace("alloc forced", word_size, result); + return result; + } + trace("alloc forced failed", word_size); + return NULL; +} + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index e481a8704cb..1c2b116a5ba 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -28,6 +28,7 @@ #include "gc_implementation/g1/concurrentG1Refine.hpp" #include "gc_implementation/g1/concurrentG1RefineThread.hpp" #include "gc_implementation/g1/concurrentMarkThread.inline.hpp" +#include "gc_implementation/g1/g1AllocRegion.inline.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1CollectorPolicy.hpp" #include "gc_implementation/g1/g1MarkSweep.hpp" @@ -517,8 +518,7 @@ G1CollectedHeap::new_region_try_secondary_free_list() { return NULL; } -HeapRegion* G1CollectedHeap::new_region_work(size_t word_size, - bool do_expand) { +HeapRegion* G1CollectedHeap::new_region(size_t word_size, bool do_expand) { assert(!isHumongous(word_size) || word_size <= (size_t) HeapRegion::GrainWords, "the only time we use this to allocate a humongous region is " @@ -566,7 +566,7 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(int purpose, size_t word_size) { HeapRegion* alloc_region = NULL; if (_gc_alloc_region_counts[purpose] < g1_policy()->max_regions(purpose)) { - alloc_region = new_region_work(word_size, true /* do_expand */); + alloc_region = new_region(word_size, true /* do_expand */); if (purpose == GCAllocForSurvived && alloc_region != NULL) { alloc_region->set_survivor(); } @@ -587,7 +587,7 @@ int G1CollectedHeap::humongous_obj_allocate_find_first(size_t num_regions, // Only one region to allocate, no need to go through the slower // path. The caller will attempt the expasion if this fails, so // let's not try to expand here too. - HeapRegion* hr = new_region_work(word_size, false /* do_expand */); + HeapRegion* hr = new_region(word_size, false /* do_expand */); if (hr != NULL) { first = hr->hrs_index(); } else { @@ -788,407 +788,12 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) { return result; } -void -G1CollectedHeap::retire_cur_alloc_region(HeapRegion* cur_alloc_region) { - // Other threads might still be trying to allocate using CASes out - // of the region we are retiring, as they can do so without holding - // the Heap_lock. So we first have to make sure that noone else can - // allocate in it by doing a maximal allocation. Even if our CAS - // attempt fails a few times, we'll succeed sooner or later given - // that a failed CAS attempt mean that the region is getting closed - // to being full (someone else succeeded in allocating into it). - size_t free_word_size = cur_alloc_region->free() / HeapWordSize; - - // This is the minimum free chunk we can turn into a dummy - // object. If the free space falls below this, then noone can - // allocate in this region anyway (all allocation requests will be - // of a size larger than this) so we won't have to perform the dummy - // allocation. - size_t min_word_size_to_fill = CollectedHeap::min_fill_size(); - - while (free_word_size >= min_word_size_to_fill) { - HeapWord* dummy = - cur_alloc_region->par_allocate_no_bot_updates(free_word_size); - if (dummy != NULL) { - // If the allocation was successful we should fill in the space. - CollectedHeap::fill_with_object(dummy, free_word_size); - break; - } - - free_word_size = cur_alloc_region->free() / HeapWordSize; - // It's also possible that someone else beats us to the - // allocation and they fill up the region. In that case, we can - // just get out of the loop - } - assert(cur_alloc_region->free() / HeapWordSize < min_word_size_to_fill, - "sanity"); - - retire_cur_alloc_region_common(cur_alloc_region); - assert(_cur_alloc_region == NULL, "post-condition"); -} - -// See the comment in the .hpp file about the locking protocol and -// assumptions of this method (and other related ones). -HeapWord* -G1CollectedHeap::replace_cur_alloc_region_and_allocate(size_t word_size, - bool at_safepoint, - bool do_dirtying, - bool can_expand) { - assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); - assert(_cur_alloc_region == NULL, - "replace_cur_alloc_region_and_allocate() should only be called " - "after retiring the previous current alloc region"); - assert(SafepointSynchronize::is_at_safepoint() == at_safepoint, - "at_safepoint and is_at_safepoint() should be a tautology"); - assert(!can_expand || g1_policy()->can_expand_young_list(), - "we should not call this method with can_expand == true if " - "we are not allowed to expand the young gen"); - - if (can_expand || !g1_policy()->is_young_list_full()) { - HeapRegion* new_cur_alloc_region = new_alloc_region(word_size); - if (new_cur_alloc_region != NULL) { - assert(new_cur_alloc_region->is_empty(), - "the newly-allocated region should be empty, " - "as right now we only allocate new regions out of the free list"); - g1_policy()->update_region_num(true /* next_is_young */); - set_region_short_lived_locked(new_cur_alloc_region); - - assert(!new_cur_alloc_region->isHumongous(), - "Catch a regression of this bug."); - - // We need to ensure that the stores to _cur_alloc_region and, - // subsequently, to top do not float above the setting of the - // young type. - OrderAccess::storestore(); - - // Now, perform the allocation out of the region we just - // allocated. Note that noone else can access that region at - // this point (as _cur_alloc_region has not been updated yet), - // so we can just go ahead and do the allocation without any - // atomics (and we expect this allocation attempt to - // suceeded). Given that other threads can attempt an allocation - // with a CAS and without needing the Heap_lock, if we assigned - // the new region to _cur_alloc_region before first allocating - // into it other threads might have filled up the new region - // before we got a chance to do the allocation ourselves. In - // that case, we would have needed to retire the region, grab a - // new one, and go through all this again. Allocating out of the - // new region before assigning it to _cur_alloc_region avoids - // all this. - HeapWord* result = - new_cur_alloc_region->allocate_no_bot_updates(word_size); - assert(result != NULL, "we just allocate out of an empty region " - "so allocation should have been successful"); - assert(is_in(result), "result should be in the heap"); - - // Now make sure that the store to _cur_alloc_region does not - // float above the store to top. - OrderAccess::storestore(); - _cur_alloc_region = new_cur_alloc_region; - - if (!at_safepoint) { - Heap_lock->unlock(); - } - - // do the dirtying, if necessary, after we release the Heap_lock - if (do_dirtying) { - dirty_young_block(result, word_size); - } - return result; - } - } - - assert(_cur_alloc_region == NULL, "we failed to allocate a new current " - "alloc region, it should still be NULL"); - assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); - return NULL; -} - -// See the comment in the .hpp file about the locking protocol and -// assumptions of this method (and other related ones). -HeapWord* -G1CollectedHeap::attempt_allocation_slow(size_t word_size) { - assert_heap_locked_and_not_at_safepoint(); - assert(!isHumongous(word_size), "attempt_allocation_slow() should not be " - "used for humongous allocations"); - - // We should only reach here when we were unable to allocate - // otherwise. So, we should have not active current alloc region. - assert(_cur_alloc_region == NULL, "current alloc region should be NULL"); - - // We will loop while succeeded is false, which means that we tried - // to do a collection, but the VM op did not succeed. So, when we - // exit the loop, either one of the allocation attempts was - // successful, or we succeeded in doing the VM op but which was - // unable to allocate after the collection. - for (int try_count = 1; /* we'll return or break */; try_count += 1) { - bool succeeded = true; - - // Every time we go round the loop we should be holding the Heap_lock. - assert_heap_locked(); - - if (GC_locker::is_active_and_needs_gc()) { - // We are locked out of GC because of the GC locker. We can - // allocate a new region only if we can expand the young gen. - - if (g1_policy()->can_expand_young_list()) { - // Yes, we are allowed to expand the young gen. Let's try to - // allocate a new current alloc region. - HeapWord* result = - replace_cur_alloc_region_and_allocate(word_size, - false, /* at_safepoint */ - true, /* do_dirtying */ - true /* can_expand */); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - } - // We could not expand the young gen further (or we could but we - // failed to allocate a new region). We'll stall until the GC - // locker forces a GC. - - // If this thread is not in a jni critical section, we stall - // the requestor until the critical section has cleared and - // GC allowed. When the critical section clears, a GC is - // initiated by the last thread exiting the critical section; so - // we retry the allocation sequence from the beginning of the loop, - // rather than causing more, now probably unnecessary, GC attempts. - JavaThread* jthr = JavaThread::current(); - assert(jthr != NULL, "sanity"); - if (jthr->in_critical()) { - if (CheckJNICalls) { - fatal("Possible deadlock due to allocating while" - " in jni critical section"); - } - // We are returning NULL so the protocol is that we're still - // holding the Heap_lock. - assert_heap_locked(); - return NULL; - } - - Heap_lock->unlock(); - GC_locker::stall_until_clear(); - - // No need to relock the Heap_lock. We'll fall off to the code - // below the else-statement which assumes that we are not - // holding the Heap_lock. - } else { - // We are not locked out. So, let's try to do a GC. The VM op - // will retry the allocation before it completes. - - // Read the GC count while holding the Heap_lock - unsigned int gc_count_before = SharedHeap::heap()->total_collections(); - - Heap_lock->unlock(); - - HeapWord* result = - do_collection_pause(word_size, gc_count_before, &succeeded); - assert_heap_not_locked(); - if (result != NULL) { - assert(succeeded, "the VM op should have succeeded"); - - // Allocations that take place on VM operations do not do any - // card dirtying and we have to do it here. - dirty_young_block(result, word_size); - return result; - } - } - - // Both paths that get us here from above unlock the Heap_lock. - assert_heap_not_locked(); - - // We can reach here when we were unsuccessful in doing a GC, - // because another thread beat us to it, or because we were locked - // out of GC due to the GC locker. In either case a new alloc - // region might be available so we will retry the allocation. - HeapWord* result = attempt_allocation(word_size); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - - // So far our attempts to allocate failed. The only time we'll go - // around the loop and try again is if we tried to do a GC and the - // VM op that we tried to schedule was not successful because - // another thread beat us to it. If that happened it's possible - // that by the time we grabbed the Heap_lock again and tried to - // allocate other threads filled up the young generation, which - // means that the allocation attempt after the GC also failed. So, - // it's worth trying to schedule another GC pause. - if (succeeded) { - break; - } - - // Give a warning if we seem to be looping forever. - if ((QueuedAllocationWarningCount > 0) && - (try_count % QueuedAllocationWarningCount == 0)) { - warning("G1CollectedHeap::attempt_allocation_slow() " - "retries %d times", try_count); - } - } - - assert_heap_locked(); - return NULL; -} - -// See the comment in the .hpp file about the locking protocol and -// assumptions of this method (and other related ones). -HeapWord* -G1CollectedHeap::attempt_allocation_humongous(size_t word_size, - bool at_safepoint) { - // This is the method that will allocate a humongous object. All - // allocation paths that attempt to allocate a humongous object - // should eventually reach here. Currently, the only paths are from - // mem_allocate() and attempt_allocation_at_safepoint(). - assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); - assert(isHumongous(word_size), "attempt_allocation_humongous() " - "should only be used for humongous allocations"); - assert(SafepointSynchronize::is_at_safepoint() == at_safepoint, - "at_safepoint and is_at_safepoint() should be a tautology"); - - HeapWord* result = NULL; - - // We will loop while succeeded is false, which means that we tried - // to do a collection, but the VM op did not succeed. So, when we - // exit the loop, either one of the allocation attempts was - // successful, or we succeeded in doing the VM op but which was - // unable to allocate after the collection. - for (int try_count = 1; /* we'll return or break */; try_count += 1) { - bool succeeded = true; - - // Given that humongous objects are not allocated in young - // regions, we'll first try to do the allocation without doing a - // collection hoping that there's enough space in the heap. - result = humongous_obj_allocate(word_size); - assert(_cur_alloc_region == NULL || !_cur_alloc_region->isHumongous(), - "catch a regression of this bug."); - if (result != NULL) { - if (!at_safepoint) { - // If we're not at a safepoint, unlock the Heap_lock. - Heap_lock->unlock(); - } - return result; - } - - // If we failed to allocate the humongous object, we should try to - // do a collection pause (if we're allowed) in case it reclaims - // enough space for the allocation to succeed after the pause. - if (!at_safepoint) { - // Read the GC count while holding the Heap_lock - unsigned int gc_count_before = SharedHeap::heap()->total_collections(); - - // If we're allowed to do a collection we're not at a - // safepoint, so it is safe to unlock the Heap_lock. - Heap_lock->unlock(); - - result = do_collection_pause(word_size, gc_count_before, &succeeded); - assert_heap_not_locked(); - if (result != NULL) { - assert(succeeded, "the VM op should have succeeded"); - return result; - } - - // If we get here, the VM operation either did not succeed - // (i.e., another thread beat us to it) or it succeeded but - // failed to allocate the object. - - // If we're allowed to do a collection we're not at a - // safepoint, so it is safe to lock the Heap_lock. - Heap_lock->lock(); - } - - assert(result == NULL, "otherwise we should have exited the loop earlier"); - - // So far our attempts to allocate failed. The only time we'll go - // around the loop and try again is if we tried to do a GC and the - // VM op that we tried to schedule was not successful because - // another thread beat us to it. That way it's possible that some - // space was freed up by the thread that successfully scheduled a - // GC. So it's worth trying to allocate again. - if (succeeded) { - break; - } - - // Give a warning if we seem to be looping forever. - if ((QueuedAllocationWarningCount > 0) && - (try_count % QueuedAllocationWarningCount == 0)) { - warning("G1CollectedHeap::attempt_allocation_humongous " - "retries %d times", try_count); - } - } - - assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); - return NULL; -} - -HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size, - bool expect_null_cur_alloc_region) { - assert_at_safepoint(true /* should_be_vm_thread */); - assert(_cur_alloc_region == NULL || !expect_null_cur_alloc_region, - err_msg("the current alloc region was unexpectedly found " - "to be non-NULL, cur alloc region: "PTR_FORMAT" " - "expect_null_cur_alloc_region: %d word_size: "SIZE_FORMAT, - _cur_alloc_region, expect_null_cur_alloc_region, word_size)); - - if (!isHumongous(word_size)) { - if (!expect_null_cur_alloc_region) { - HeapRegion* cur_alloc_region = _cur_alloc_region; - if (cur_alloc_region != NULL) { - // We are at a safepoint so no reason to use the MT-safe version. - HeapWord* result = cur_alloc_region->allocate_no_bot_updates(word_size); - if (result != NULL) { - assert(is_in(result), "result should be in the heap"); - - // We will not do any dirtying here. This is guaranteed to be - // called during a safepoint and the thread that scheduled the - // pause will do the dirtying if we return a non-NULL result. - return result; - } - - retire_cur_alloc_region_common(cur_alloc_region); - } - } - - assert(_cur_alloc_region == NULL, - "at this point we should have no cur alloc region"); - return replace_cur_alloc_region_and_allocate(word_size, - true, /* at_safepoint */ - false /* do_dirtying */, - false /* can_expand */); - } else { - return attempt_allocation_humongous(word_size, - true /* at_safepoint */); - } - - ShouldNotReachHere(); -} - HeapWord* G1CollectedHeap::allocate_new_tlab(size_t word_size) { assert_heap_not_locked_and_not_at_safepoint(); - assert(!isHumongous(word_size), "we do not allow TLABs of humongous size"); + assert(!isHumongous(word_size), "we do not allow humongous TLABs"); - // First attempt: Try allocating out of the current alloc region - // using a CAS. If that fails, take the Heap_lock and retry the - // allocation, potentially replacing the current alloc region. - HeapWord* result = attempt_allocation(word_size); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - - // Second attempt: Go to the slower path where we might try to - // schedule a collection. - result = attempt_allocation_slow(word_size); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - - assert_heap_locked(); - // Need to unlock the Heap_lock before returning. - Heap_lock->unlock(); - return NULL; + unsigned int dummy_gc_count_before; + return attempt_allocation(word_size, &dummy_gc_count_before); } HeapWord* @@ -1200,48 +805,18 @@ G1CollectedHeap::mem_allocate(size_t word_size, assert(!is_tlab, "mem_allocate() this should not be called directly " "to allocate TLABs"); - // Loop until the allocation is satisified, - // or unsatisfied after GC. + // Loop until the allocation is satisified, or unsatisfied after GC. for (int try_count = 1; /* we'll return */; try_count += 1) { unsigned int gc_count_before; - { - if (!isHumongous(word_size)) { - // First attempt: Try allocating out of the current alloc region - // using a CAS. If that fails, take the Heap_lock and retry the - // allocation, potentially replacing the current alloc region. - HeapWord* result = attempt_allocation(word_size); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - assert_heap_locked(); - - // Second attempt: Go to the slower path where we might try to - // schedule a collection. - result = attempt_allocation_slow(word_size); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - } else { - // attempt_allocation_humongous() requires the Heap_lock to be held. - Heap_lock->lock(); - - HeapWord* result = attempt_allocation_humongous(word_size, - false /* at_safepoint */); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - } - - assert_heap_locked(); - // Read the gc count while the heap lock is held. - gc_count_before = SharedHeap::heap()->total_collections(); - - // Release the Heap_lock before attempting the collection. - Heap_lock->unlock(); + HeapWord* result = NULL; + if (!isHumongous(word_size)) { + result = attempt_allocation(word_size, &gc_count_before); + } else { + result = attempt_allocation_humongous(word_size, &gc_count_before); + } + if (result != NULL) { + return result; } // Create the garbage collection operation... @@ -1249,7 +824,6 @@ G1CollectedHeap::mem_allocate(size_t word_size, // ...and get the VM thread to execute it. VMThread::execute(&op); - assert_heap_not_locked(); if (op.prologue_succeeded() && op.pause_succeeded()) { // If the operation was successful we'll return the result even // if it is NULL. If the allocation attempt failed immediately @@ -1275,21 +849,207 @@ G1CollectedHeap::mem_allocate(size_t word_size, } ShouldNotReachHere(); + return NULL; } -void G1CollectedHeap::abandon_cur_alloc_region() { - assert_at_safepoint(true /* should_be_vm_thread */); +HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size, + unsigned int *gc_count_before_ret) { + // Make sure you read the note in attempt_allocation_humongous(). - HeapRegion* cur_alloc_region = _cur_alloc_region; - if (cur_alloc_region != NULL) { - assert(!cur_alloc_region->is_empty(), - "the current alloc region can never be empty"); - assert(cur_alloc_region->is_young(), - "the current alloc region should be young"); + assert_heap_not_locked_and_not_at_safepoint(); + assert(!isHumongous(word_size), "attempt_allocation_slow() should not " + "be called for humongous allocation requests"); - retire_cur_alloc_region_common(cur_alloc_region); + // We should only get here after the first-level allocation attempt + // (attempt_allocation()) failed to allocate. + + // We will loop until a) we manage to successfully perform the + // allocation or b) we successfully schedule a collection which + // fails to perform the allocation. b) is the only case when we'll + // return NULL. + HeapWord* result = NULL; + for (int try_count = 1; /* we'll return */; try_count += 1) { + bool should_try_gc; + unsigned int gc_count_before; + + { + MutexLockerEx x(Heap_lock); + + result = _mutator_alloc_region.attempt_allocation_locked(word_size, + false /* bot_updates */); + if (result != NULL) { + return result; + } + + // If we reach here, attempt_allocation_locked() above failed to + // allocate a new region. So the mutator alloc region should be NULL. + assert(_mutator_alloc_region.get() == NULL, "only way to get here"); + + if (GC_locker::is_active_and_needs_gc()) { + if (g1_policy()->can_expand_young_list()) { + result = _mutator_alloc_region.attempt_allocation_force(word_size, + false /* bot_updates */); + if (result != NULL) { + return result; + } + } + should_try_gc = false; + } else { + // Read the GC count while still holding the Heap_lock. + gc_count_before = SharedHeap::heap()->total_collections(); + should_try_gc = true; + } + } + + if (should_try_gc) { + bool succeeded; + result = do_collection_pause(word_size, gc_count_before, &succeeded); + if (result != NULL) { + assert(succeeded, "only way to get back a non-NULL result"); + return result; + } + + if (succeeded) { + // If we get here we successfully scheduled a collection which + // failed to allocate. No point in trying to allocate + // further. We'll just return NULL. + MutexLockerEx x(Heap_lock); + *gc_count_before_ret = SharedHeap::heap()->total_collections(); + return NULL; + } + } else { + GC_locker::stall_until_clear(); + } + + // We can reach here if we were unsuccessul in scheduling a + // collection (because another thread beat us to it) or if we were + // stalled due to the GC locker. In either can we should retry the + // allocation attempt in case another thread successfully + // performed a collection and reclaimed enough space. We do the + // first attempt (without holding the Heap_lock) here and the + // follow-on attempt will be at the start of the next loop + // iteration (after taking the Heap_lock). + result = _mutator_alloc_region.attempt_allocation(word_size, + false /* bot_updates */); + if (result != NULL ){ + return result; + } + + // Give a warning if we seem to be looping forever. + if ((QueuedAllocationWarningCount > 0) && + (try_count % QueuedAllocationWarningCount == 0)) { + warning("G1CollectedHeap::attempt_allocation_slow() " + "retries %d times", try_count); + } } - assert(_cur_alloc_region == NULL, "post-condition"); + + ShouldNotReachHere(); + return NULL; +} + +HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size, + unsigned int * gc_count_before_ret) { + // The structure of this method has a lot of similarities to + // attempt_allocation_slow(). The reason these two were not merged + // into a single one is that such a method would require several "if + // allocation is not humongous do this, otherwise do that" + // conditional paths which would obscure its flow. In fact, an early + // version of this code did use a unified method which was harder to + // follow and, as a result, it had subtle bugs that were hard to + // track down. So keeping these two methods separate allows each to + // be more readable. It will be good to keep these two in sync as + // much as possible. + + assert_heap_not_locked_and_not_at_safepoint(); + assert(isHumongous(word_size), "attempt_allocation_humongous() " + "should only be called for humongous allocations"); + + // We will loop until a) we manage to successfully perform the + // allocation or b) we successfully schedule a collection which + // fails to perform the allocation. b) is the only case when we'll + // return NULL. + HeapWord* result = NULL; + for (int try_count = 1; /* we'll return */; try_count += 1) { + bool should_try_gc; + unsigned int gc_count_before; + + { + MutexLockerEx x(Heap_lock); + + // Given that humongous objects are not allocated in young + // regions, we'll first try to do the allocation without doing a + // collection hoping that there's enough space in the heap. + result = humongous_obj_allocate(word_size); + if (result != NULL) { + return result; + } + + if (GC_locker::is_active_and_needs_gc()) { + should_try_gc = false; + } else { + // Read the GC count while still holding the Heap_lock. + gc_count_before = SharedHeap::heap()->total_collections(); + should_try_gc = true; + } + } + + if (should_try_gc) { + // If we failed to allocate the humongous object, we should try to + // do a collection pause (if we're allowed) in case it reclaims + // enough space for the allocation to succeed after the pause. + + bool succeeded; + result = do_collection_pause(word_size, gc_count_before, &succeeded); + if (result != NULL) { + assert(succeeded, "only way to get back a non-NULL result"); + return result; + } + + if (succeeded) { + // If we get here we successfully scheduled a collection which + // failed to allocate. No point in trying to allocate + // further. We'll just return NULL. + MutexLockerEx x(Heap_lock); + *gc_count_before_ret = SharedHeap::heap()->total_collections(); + return NULL; + } + } else { + GC_locker::stall_until_clear(); + } + + // We can reach here if we were unsuccessul in scheduling a + // collection (because another thread beat us to it) or if we were + // stalled due to the GC locker. In either can we should retry the + // allocation attempt in case another thread successfully + // performed a collection and reclaimed enough space. Give a + // warning if we seem to be looping forever. + + if ((QueuedAllocationWarningCount > 0) && + (try_count % QueuedAllocationWarningCount == 0)) { + warning("G1CollectedHeap::attempt_allocation_humongous() " + "retries %d times", try_count); + } + } + + ShouldNotReachHere(); + return NULL; +} + +HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size, + bool expect_null_mutator_alloc_region) { + assert_at_safepoint(true /* should_be_vm_thread */); + assert(_mutator_alloc_region.get() == NULL || + !expect_null_mutator_alloc_region, + "the current alloc region was unexpectedly found to be non-NULL"); + + if (!isHumongous(word_size)) { + return _mutator_alloc_region.attempt_allocation_locked(word_size, + false /* bot_updates */); + } else { + return humongous_obj_allocate(word_size); + } + + ShouldNotReachHere(); } void G1CollectedHeap::abandon_gc_alloc_regions() { @@ -1417,8 +1177,8 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { HandleMark hm; // Discard invalid handles created during verification - prepare_for_verify(); gclog_or_tty->print(" VerifyBeforeGC:"); + prepare_for_verify(); Universe::verify(true); } @@ -1439,9 +1199,8 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, concurrent_mark()->abort(); // Make sure we'll choose a new allocation region afterwards. - abandon_cur_alloc_region(); + release_mutator_alloc_region(); abandon_gc_alloc_regions(); - assert(_cur_alloc_region == NULL, "Invariant."); g1_rem_set()->cleanupHRRS(); tear_down_region_lists(); @@ -1547,6 +1306,8 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, // evacuation pause. clear_cset_fast_test(); + init_mutator_alloc_region(); + double end = os::elapsedTime(); g1_policy()->record_full_collection_end(); @@ -1720,8 +1481,9 @@ G1CollectedHeap::satisfy_failed_allocation(size_t word_size, *succeeded = true; // Let's attempt the allocation first. - HeapWord* result = attempt_allocation_at_safepoint(word_size, - false /* expect_null_cur_alloc_region */); + HeapWord* result = + attempt_allocation_at_safepoint(word_size, + false /* expect_null_mutator_alloc_region */); if (result != NULL) { assert(*succeeded, "sanity"); return result; @@ -1748,7 +1510,7 @@ G1CollectedHeap::satisfy_failed_allocation(size_t word_size, // Retry the allocation result = attempt_allocation_at_safepoint(word_size, - true /* expect_null_cur_alloc_region */); + true /* expect_null_mutator_alloc_region */); if (result != NULL) { assert(*succeeded, "sanity"); return result; @@ -1765,7 +1527,7 @@ G1CollectedHeap::satisfy_failed_allocation(size_t word_size, // Retry the allocation once more result = attempt_allocation_at_safepoint(word_size, - true /* expect_null_cur_alloc_region */); + true /* expect_null_mutator_alloc_region */); if (result != NULL) { assert(*succeeded, "sanity"); return result; @@ -1796,7 +1558,7 @@ HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) { if (expand(expand_bytes)) { verify_region_sets_optional(); return attempt_allocation_at_safepoint(word_size, - false /* expect_null_cur_alloc_region */); + false /* expect_null_mutator_alloc_region */); } return NULL; } @@ -1940,7 +1702,6 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : _evac_failure_scan_stack(NULL) , _mark_in_progress(false), _cg1r(NULL), _summary_bytes_used(0), - _cur_alloc_region(NULL), _refine_cte_cl(NULL), _full_collection(false), _free_list("Master Free List"), @@ -2099,7 +1860,6 @@ jint G1CollectedHeap::initialize() { _g1_max_committed = _g1_committed; _hrs = new HeapRegionSeq(_expansion_regions); 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. @@ -2195,6 +1955,22 @@ jint G1CollectedHeap::initialize() { // Do later initialization work for concurrent refinement. _cg1r->init(); + // Here we allocate the dummy full region that is required by the + // G1AllocRegion class. If we don't pass an address in the reserved + // space here, lots of asserts fire. + MemRegion mr(_g1_reserved.start(), HeapRegion::GrainWords); + HeapRegion* dummy_region = new HeapRegion(_bot_shared, mr, true); + // We'll re-use the same region whether the alloc region will + // require BOT updates or not and, if it doesn't, then a non-young + // region will complain that it cannot support allocations without + // BOT updates. So we'll tag the dummy region as young to avoid that. + dummy_region->set_young(); + // Make sure it's full. + dummy_region->set_top(dummy_region->end()); + G1AllocRegion::setup(this, dummy_region); + + init_mutator_alloc_region(); + return JNI_OK; } @@ -2261,7 +2037,7 @@ size_t G1CollectedHeap::used() const { "Should be owned on this thread's behalf."); size_t result = _summary_bytes_used; // Read only once in case it is set to NULL concurrently - HeapRegion* hr = _cur_alloc_region; + HeapRegion* hr = _mutator_alloc_region.get(); if (hr != NULL) result += hr->used(); return result; @@ -2324,13 +2100,11 @@ size_t G1CollectedHeap::unsafe_max_alloc() { // to free(), resulting in a SIGSEGV. Note that this doesn't appear // to be a problem in the optimized build, since the two loads of the // current allocation region field are optimized away. - HeapRegion* car = _cur_alloc_region; - - // FIXME: should iterate over all regions? - if (car == NULL) { + HeapRegion* hr = _mutator_alloc_region.get(); + if (hr == NULL) { return 0; } - return car->free(); + return hr->free(); } bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { @@ -2781,16 +2555,12 @@ size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const { // since we can't allow tlabs to grow big enough to accomodate // humongous objects. - // We need to store the cur alloc region locally, since it might change - // between when we test for NULL and when we use it later. - ContiguousSpace* cur_alloc_space = _cur_alloc_region; + HeapRegion* hr = _mutator_alloc_region.get(); size_t max_tlab_size = _humongous_object_threshold_in_words * wordSize; - - if (cur_alloc_space == NULL) { + if (hr == NULL) { return max_tlab_size; } else { - return MIN2(MAX2(cur_alloc_space->free(), (size_t)MinTLABSize), - max_tlab_size); + return MIN2(MAX2(hr->free(), (size_t) MinTLABSize), max_tlab_size); } } @@ -3364,6 +3134,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { } verify_region_sets_optional(); + verify_dirty_young_regions(); { // This call will decide whether this pause is an initial-mark @@ -3425,8 +3196,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { HandleMark hm; // Discard invalid handles created during verification - prepare_for_verify(); gclog_or_tty->print(" VerifyBeforeGC:"); + prepare_for_verify(); Universe::verify(false); } @@ -3442,7 +3213,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { // Forget the current alloc region (we might even choose it to be part // of the collection set!). - abandon_cur_alloc_region(); + release_mutator_alloc_region(); // The elapsed time induced by the start time below deliberately elides // the possible verification above. @@ -3573,6 +3344,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); #endif // YOUNG_LIST_VERBOSE + init_mutator_alloc_region(); + double end_time_sec = os::elapsedTime(); double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; g1_policy()->record_pause_time_ms(pause_time_ms); @@ -3655,6 +3428,15 @@ size_t G1CollectedHeap::desired_plab_sz(GCAllocPurpose purpose) return gclab_word_size; } +void G1CollectedHeap::init_mutator_alloc_region() { + assert(_mutator_alloc_region.get() == NULL, "pre-condition"); + _mutator_alloc_region.init(); +} + +void G1CollectedHeap::release_mutator_alloc_region() { + _mutator_alloc_region.release(); + assert(_mutator_alloc_region.get() == NULL, "post-condition"); +} void G1CollectedHeap::set_gc_alloc_region(int purpose, HeapRegion* r) { assert(purpose >= 0 && purpose < GCAllocPurposeCount, "invalid purpose"); @@ -5140,10 +4922,8 @@ class G1VerifyCardTableCleanup: public HeapRegionClosure { CardTableModRefBS* _ct_bs; public: G1VerifyCardTableCleanup(CardTableModRefBS* ct_bs) - : _ct_bs(ct_bs) - { } - virtual bool doHeapRegion(HeapRegion* r) - { + : _ct_bs(ct_bs) { } + virtual bool doHeapRegion(HeapRegion* r) { MemRegion mr(r->bottom(), r->end()); if (r->is_survivor()) { _ct_bs->verify_dirty_region(mr); @@ -5153,6 +4933,29 @@ public: return false; } }; + +void G1CollectedHeap::verify_dirty_young_list(HeapRegion* head) { + CardTableModRefBS* ct_bs = (CardTableModRefBS*) (barrier_set()); + for (HeapRegion* hr = head; hr != NULL; hr = hr->get_next_young_region()) { + // We cannot guarantee that [bottom(),end()] is dirty. Threads + // dirty allocated blocks as they allocate them. The thread that + // retires each region and replaces it with a new one will do a + // maximal allocation to fill in [pre_dummy_top(),end()] but will + // not dirty that area (one less thing to have to do while holding + // a lock). So we can only verify that [bottom(),pre_dummy_top()] + // is dirty. Also note that verify_dirty_region() requires + // mr.start() and mr.end() to be card aligned and pre_dummy_top() + // is not guaranteed to be. + MemRegion mr(hr->bottom(), + ct_bs->align_to_card_boundary(hr->pre_dummy_top())); + ct_bs->verify_dirty_region(mr); + } +} + +void G1CollectedHeap::verify_dirty_young_regions() { + verify_dirty_young_list(_young_list->first_region()); + verify_dirty_young_list(_young_list->first_survivor_region()); +} #endif void G1CollectedHeap::cleanUpCardTable() { @@ -5500,6 +5303,44 @@ bool G1CollectedHeap::is_in_closed_subset(const void* p) const { } } +HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size, + bool force) { + assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); + assert(!force || g1_policy()->can_expand_young_list(), + "if force is true we should be able to expand the young list"); + if (force || !g1_policy()->is_young_list_full()) { + HeapRegion* new_alloc_region = new_region(word_size, + false /* do_expand */); + if (new_alloc_region != NULL) { + g1_policy()->update_region_num(true /* next_is_young */); + set_region_short_lived_locked(new_alloc_region); + return new_alloc_region; + } + } + return NULL; +} + +void G1CollectedHeap::retire_mutator_alloc_region(HeapRegion* alloc_region, + size_t allocated_bytes) { + assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); + assert(alloc_region->is_young(), "all mutator alloc regions should be young"); + + g1_policy()->add_region_to_incremental_cset_lhs(alloc_region); + _summary_bytes_used += allocated_bytes; +} + +HeapRegion* MutatorAllocRegion::allocate_new_region(size_t word_size, + bool force) { + return _g1h->new_mutator_alloc_region(word_size, force); +} + +void MutatorAllocRegion::retire_region(HeapRegion* alloc_region, + size_t allocated_bytes) { + _g1h->retire_mutator_alloc_region(alloc_region, allocated_bytes); +} + +// Heap region set verification + class VerifyRegionListsClosure : public HeapRegionClosure { private: HumongousRegionSet* _humongous_set; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 82abce1d1b0..9a6a7161195 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -26,6 +26,7 @@ #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_HPP #include "gc_implementation/g1/concurrentMark.hpp" +#include "gc_implementation/g1/g1AllocRegion.hpp" #include "gc_implementation/g1/g1RemSet.hpp" #include "gc_implementation/g1/heapRegionSets.hpp" #include "gc_implementation/parNew/parGCAllocBuffer.hpp" @@ -128,6 +129,15 @@ public: void print(); }; +class MutatorAllocRegion : public G1AllocRegion { +protected: + virtual HeapRegion* allocate_new_region(size_t word_size, bool force); + virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes); +public: + MutatorAllocRegion() + : G1AllocRegion("Mutator Alloc Region", false /* bot_updates */) { } +}; + class RefineCardTableEntryClosure; class G1CollectedHeap : public SharedHeap { friend class VM_G1CollectForAllocation; @@ -135,6 +145,7 @@ class G1CollectedHeap : public SharedHeap { friend class VM_G1CollectFull; friend class VM_G1IncCollectionPause; friend class VMStructs; + friend class MutatorAllocRegion; // Closures used in implementation. friend class G1ParCopyHelper; @@ -197,12 +208,15 @@ private: // The sequence of all heap regions in the heap. HeapRegionSeq* _hrs; - // The region from which normal-sized objects are currently being - // allocated. May be NULL. - HeapRegion* _cur_alloc_region; + // Alloc region used to satisfy mutator allocation requests. + MutatorAllocRegion _mutator_alloc_region; + + // It resets the mutator alloc region before new allocations can take place. + void init_mutator_alloc_region(); + + // It releases the mutator alloc region. + void release_mutator_alloc_region(); - // Postcondition: cur_alloc_region == NULL. - void abandon_cur_alloc_region(); void abandon_gc_alloc_regions(); // The to-space memory regions into which objects are being copied during @@ -360,27 +374,21 @@ protected: G1CollectorPolicy* _g1_policy; // This is the second level of trying to allocate a new region. If - // new_region_work didn't find a region in the free_list, this call - // will check whether there's anything available in the - // secondary_free_list and/or wait for more regions to appear in that - // list, if _free_regions_coming is set. + // new_region() didn't find a region on the free_list, this call will + // check whether there's anything available on the + // secondary_free_list and/or wait for more regions to appear on + // that list, if _free_regions_coming is set. HeapRegion* new_region_try_secondary_free_list(); // Try to allocate a single non-humongous HeapRegion sufficient for // an allocation of the given word_size. If do_expand is true, // attempt to expand the heap if necessary to satisfy the allocation // request. - HeapRegion* new_region_work(size_t word_size, bool do_expand); + HeapRegion* new_region(size_t word_size, bool do_expand); - // Try to allocate a new region to be used for allocation by a - // mutator thread. Attempt to expand the heap if no region is + // Try to allocate a new region to be used for allocation by + // a GC thread. It will try to expand the heap if no region is // available. - HeapRegion* new_alloc_region(size_t word_size) { - return new_region_work(word_size, false /* do_expand */); - } - - // Try to allocate a new region to be used for allocation by a GC - // thread. Attempt to expand the heap if no region is available. HeapRegion* new_gc_alloc_region(int purpose, size_t word_size); // Attempt to satisfy a humongous allocation request of the given @@ -415,10 +423,6 @@ protected: // * All non-TLAB allocation requests should go to mem_allocate() // and mem_allocate() should never be called with is_tlab == true. // - // * If the GC locker is active we currently stall until we can - // allocate a new young region. This will be changed in the - // near future (see CR 6994056). - // // * If either call cannot satisfy the allocation request using the // current allocating region, they will try to get a new one. If // this fails, they will attempt to do an evacuation pause and @@ -441,122 +445,38 @@ protected: bool is_tlab, /* expected to be false */ bool* gc_overhead_limit_was_exceeded); - // The following methods, allocate_from_cur_allocation_region(), - // attempt_allocation(), attempt_allocation_locked(), - // replace_cur_alloc_region_and_allocate(), - // attempt_allocation_slow(), and attempt_allocation_humongous() - // have very awkward pre- and post-conditions with respect to - // locking: - // - // If they are called outside a safepoint they assume the caller - // holds the Heap_lock when it calls them. However, on exit they - // will release the Heap_lock if they return a non-NULL result, but - // keep holding the Heap_lock if they return a NULL result. The - // reason for this is that we need to dirty the cards that span - // allocated blocks on young regions to avoid having to take the - // slow path of the write barrier (for performance reasons we don't - // update RSets for references whose source is a young region, so we - // don't need to look at dirty cards on young regions). But, doing - // this card dirtying while holding the Heap_lock can be a - // scalability bottleneck, especially given that some allocation - // requests might be of non-trivial size (and the larger the region - // size is, the fewer allocations requests will be considered - // humongous, as the humongous size limit is a fraction of the - // region size). So, when one of these calls succeeds in allocating - // a block it does the card dirtying after it releases the Heap_lock - // which is why it will return without holding it. - // - // The above assymetry is the reason why locking / unlocking is done - // explicitly (i.e., with Heap_lock->lock() and - // Heap_lock->unlocked()) instead of using MutexLocker and - // MutexUnlocker objects. The latter would ensure that the lock is - // unlocked / re-locked at every possible exit out of the basic - // block. However, we only want that action to happen in selected - // places. - // - // Further, if the above methods are called during a safepoint, then - // naturally there's no assumption about the Heap_lock being held or - // there's no attempt to unlock it. The parameter at_safepoint - // indicates whether the call is made during a safepoint or not (as - // an optimization, to avoid reading the global flag with - // SafepointSynchronize::is_at_safepoint()). - // - // The methods share these parameters: - // - // * word_size : the size of the allocation request in words - // * at_safepoint : whether the call is done at a safepoint; this - // also determines whether a GC is permitted - // (at_safepoint == false) or not (at_safepoint == true) - // * do_dirtying : whether the method should dirty the allocated - // block before returning - // - // They all return either the address of the block, if they - // successfully manage to allocate it, or NULL. + // The following three methods take a gc_count_before_ret + // parameter which is used to return the GC count if the method + // returns NULL. Given that we are required to read the GC count + // while holding the Heap_lock, and these paths will take the + // Heap_lock at some point, it's easier to get them to read the GC + // count while holding the Heap_lock before they return NULL instead + // of the caller (namely: mem_allocate()) having to also take the + // Heap_lock just to read the GC count. - // It tries to satisfy an allocation request out of the current - // alloc region, which is passed as a parameter. It assumes that the - // caller has checked that the current alloc region is not NULL. - // Given that the caller has to check the current alloc region for - // at least NULL, it might as well pass it as the first parameter so - // that the method doesn't have to read it from the - // _cur_alloc_region field again. It is called from both - // attempt_allocation() and attempt_allocation_locked() and the - // with_heap_lock parameter indicates whether the caller was holding - // the heap lock when it called it or not. - inline HeapWord* allocate_from_cur_alloc_region(HeapRegion* cur_alloc_region, - size_t word_size, - bool with_heap_lock); + // First-level mutator allocation attempt: try to allocate out of + // the mutator alloc region without taking the Heap_lock. This + // should only be used for non-humongous allocations. + inline HeapWord* attempt_allocation(size_t word_size, + unsigned int* gc_count_before_ret); - // First-level of allocation slow path: it attempts to allocate out - // of the current alloc region in a lock-free manner using a CAS. If - // that fails it takes the Heap_lock and calls - // attempt_allocation_locked() for the second-level slow path. - inline HeapWord* attempt_allocation(size_t word_size); + // Second-level mutator allocation attempt: take the Heap_lock and + // retry the allocation attempt, potentially scheduling a GC + // pause. This should only be used for non-humongous allocations. + HeapWord* attempt_allocation_slow(size_t word_size, + unsigned int* gc_count_before_ret); - // Second-level of allocation slow path: while holding the Heap_lock - // it tries to allocate out of the current alloc region and, if that - // fails, tries to allocate out of a new current alloc region. - inline HeapWord* attempt_allocation_locked(size_t word_size); - - // It assumes that the current alloc region has been retired and - // tries to allocate a new one. If it's successful, it performs the - // allocation out of the new current alloc region and updates - // _cur_alloc_region. Normally, it would try to allocate a new - // region if the young gen is not full, unless can_expand is true in - // which case it would always try to allocate a new region. - HeapWord* replace_cur_alloc_region_and_allocate(size_t word_size, - bool at_safepoint, - bool do_dirtying, - bool can_expand); - - // Third-level of allocation slow path: when we are unable to - // allocate a new current alloc region to satisfy an allocation - // request (i.e., when attempt_allocation_locked() fails). It will - // try to do an evacuation pause, which might stall due to the GC - // locker, and retry the allocation attempt when appropriate. - HeapWord* attempt_allocation_slow(size_t word_size); - - // The method that tries to satisfy a humongous allocation - // request. If it cannot satisfy it it will try to do an evacuation - // pause to perhaps reclaim enough space to be able to satisfy the - // allocation request afterwards. + // Takes the Heap_lock and attempts a humongous allocation. It can + // potentially schedule a GC pause. HeapWord* attempt_allocation_humongous(size_t word_size, - bool at_safepoint); + unsigned int* gc_count_before_ret); - // It does the common work when we are retiring the current alloc region. - inline void retire_cur_alloc_region_common(HeapRegion* cur_alloc_region); - - // It retires the current alloc region, which is passed as a - // parameter (since, typically, the caller is already holding on to - // it). It sets _cur_alloc_region to NULL. - void retire_cur_alloc_region(HeapRegion* cur_alloc_region); - - // It attempts to do an allocation immediately before or after an - // evacuation pause and can only be called by the VM thread. It has - // slightly different assumptions that the ones before (i.e., - // assumes that the current alloc region has been retired). + // Allocation attempt that should be called during safepoints (e.g., + // at the end of a successful GC). expect_null_mutator_alloc_region + // specifies whether the mutator alloc region is expected to be NULL + // or not. HeapWord* attempt_allocation_at_safepoint(size_t word_size, - bool expect_null_cur_alloc_region); + bool expect_null_mutator_alloc_region); // It dirties the cards that cover the block so that so that the post // write barrier never queues anything when updating objects on this @@ -583,6 +503,12 @@ protected: // GC pause. void retire_alloc_region(HeapRegion* alloc_region, bool par); + // These two methods are the "callbacks" from the G1AllocRegion class. + + HeapRegion* new_mutator_alloc_region(size_t word_size, bool force); + void retire_mutator_alloc_region(HeapRegion* alloc_region, + size_t allocated_bytes); + // - if explicit_gc is true, the GC is for a System.gc() or a heap // inspection request and should collect the entire heap // - if clear_all_soft_refs is true, all soft references should be @@ -1027,6 +953,9 @@ public: // The number of regions available for "regular" expansion. size_t expansion_regions() { return _expansion_regions; } + void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN; + void verify_dirty_young_regions() PRODUCT_RETURN; + // verify_region_sets() performs verification over the region // lists. It will be compiled in the product code to be used when // necessary (i.e., during heap verification). diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp index 43c12272c7e..185d0a318cc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @@ -27,6 +27,7 @@ #include "gc_implementation/g1/concurrentMark.hpp" #include "gc_implementation/g1/g1CollectedHeap.hpp" +#include "gc_implementation/g1/g1AllocRegion.inline.hpp" #include "gc_implementation/g1/g1CollectorPolicy.hpp" #include "gc_implementation/g1/heapRegionSeq.inline.hpp" #include "utilities/taskqueue.hpp" @@ -59,131 +60,23 @@ inline bool G1CollectedHeap::obj_in_cs(oop obj) { return r != NULL && r->in_collection_set(); } -// See the comment in the .hpp file about the locking protocol and -// assumptions of this method (and other related ones). inline HeapWord* -G1CollectedHeap::allocate_from_cur_alloc_region(HeapRegion* cur_alloc_region, - size_t word_size, - bool with_heap_lock) { - assert_not_at_safepoint(); - assert(with_heap_lock == Heap_lock->owned_by_self(), - "with_heap_lock and Heap_lock->owned_by_self() should be a tautology"); - assert(cur_alloc_region != NULL, "pre-condition of the method"); - assert(cur_alloc_region->is_young(), - "we only support young current alloc regions"); - assert(!isHumongous(word_size), "allocate_from_cur_alloc_region() " - "should not be used for humongous allocations"); - assert(!cur_alloc_region->isHumongous(), "Catch a regression of this bug."); - - assert(!cur_alloc_region->is_empty(), - err_msg("region ["PTR_FORMAT","PTR_FORMAT"] should not be empty", - cur_alloc_region->bottom(), cur_alloc_region->end())); - HeapWord* result = cur_alloc_region->par_allocate_no_bot_updates(word_size); - if (result != NULL) { - assert(is_in(result), "result should be in the heap"); - - if (with_heap_lock) { - Heap_lock->unlock(); - } - assert_heap_not_locked(); - // Do the dirtying after we release the Heap_lock. - dirty_young_block(result, word_size); - return result; - } - - if (with_heap_lock) { - assert_heap_locked(); - } else { - assert_heap_not_locked(); - } - return NULL; -} - -// See the comment in the .hpp file about the locking protocol and -// assumptions of this method (and other related ones). -inline HeapWord* -G1CollectedHeap::attempt_allocation(size_t word_size) { +G1CollectedHeap::attempt_allocation(size_t word_size, + unsigned int* gc_count_before_ret) { assert_heap_not_locked_and_not_at_safepoint(); - assert(!isHumongous(word_size), "attempt_allocation() should not be called " - "for humongous allocation requests"); + assert(!isHumongous(word_size), "attempt_allocation() should not " + "be called for humongous allocation requests"); - HeapRegion* cur_alloc_region = _cur_alloc_region; - if (cur_alloc_region != NULL) { - HeapWord* result = allocate_from_cur_alloc_region(cur_alloc_region, - word_size, - false /* with_heap_lock */); - assert_heap_not_locked(); - if (result != NULL) { - return result; - } + HeapWord* result = _mutator_alloc_region.attempt_allocation(word_size, + false /* bot_updates */); + if (result == NULL) { + result = attempt_allocation_slow(word_size, gc_count_before_ret); } - - // Our attempt to allocate lock-free failed as the current - // allocation region is either NULL or full. So, we'll now take the - // Heap_lock and retry. - Heap_lock->lock(); - - HeapWord* result = attempt_allocation_locked(word_size); + assert_heap_not_locked(); if (result != NULL) { - assert_heap_not_locked(); - return result; + dirty_young_block(result, word_size); } - - assert_heap_locked(); - return NULL; -} - -inline void -G1CollectedHeap::retire_cur_alloc_region_common(HeapRegion* cur_alloc_region) { - assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); - assert(cur_alloc_region != NULL && cur_alloc_region == _cur_alloc_region, - "pre-condition of the call"); - assert(cur_alloc_region->is_young(), - "we only support young current alloc regions"); - - // The region is guaranteed to be young - g1_policy()->add_region_to_incremental_cset_lhs(cur_alloc_region); - _summary_bytes_used += cur_alloc_region->used(); - _cur_alloc_region = NULL; -} - -inline HeapWord* -G1CollectedHeap::attempt_allocation_locked(size_t word_size) { - assert_heap_locked_and_not_at_safepoint(); - assert(!isHumongous(word_size), "attempt_allocation_locked() " - "should not be called for humongous allocation requests"); - - // First, reread the current alloc region and retry the allocation - // in case somebody replaced it while we were waiting to get the - // Heap_lock. - HeapRegion* cur_alloc_region = _cur_alloc_region; - if (cur_alloc_region != NULL) { - HeapWord* result = allocate_from_cur_alloc_region( - cur_alloc_region, word_size, - true /* with_heap_lock */); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - - // We failed to allocate out of the current alloc region, so let's - // retire it before getting a new one. - retire_cur_alloc_region(cur_alloc_region); - } - - assert_heap_locked(); - // Try to get a new region and allocate out of it - HeapWord* result = replace_cur_alloc_region_and_allocate(word_size, - false, /* at_safepoint */ - true, /* do_dirtying */ - false /* can_expand */); - if (result != NULL) { - assert_heap_not_locked(); - return result; - } - - assert_heap_locked(); - return NULL; + return result; } // It dirties the cards that cover the block so that so that the post diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index b25f7cf5290..65d9b7c4d97 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -360,6 +360,7 @@ void HeapRegion::hr_clear(bool par, bool clear_space) { set_young_index_in_cset(-1); uninstall_surv_rate_group(); set_young_type(NotYoung); + reset_pre_dummy_top(); if (!par) { // If this is parallel, this will be done later. @@ -923,11 +924,11 @@ void G1OffsetTableContigSpace::set_saved_mark() { ContiguousSpace::set_saved_mark(); OrderAccess::storestore(); _gc_time_stamp = curr_gc_time_stamp; - // The following fence is to force a flush of the writes above, but - // is strictly not needed because when an allocating worker thread - // calls set_saved_mark() it does so under the ParGCRareEvent_lock; - // when the lock is released, the write will be flushed. - // OrderAccess::fence(); + // No need to do another barrier to flush the writes above. If + // this is called in parallel with other threads trying to + // allocate into the region, the caller should call this while + // holding a lock and when the lock is released the writes will be + // flushed. } } diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index 2d7385ef9b7..8e86ba94c79 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -149,6 +149,13 @@ class G1OffsetTableContigSpace: public ContiguousSpace { G1BlockOffsetArrayContigSpace _offsets; Mutex _par_alloc_lock; volatile unsigned _gc_time_stamp; + // When we need to retire an allocation region, while other threads + // are also concurrently trying to allocate into it, we typically + // allocate a dummy object at the end of the region to ensure that + // no more allocations can take place in it. However, sometimes we + // want to know where the end of the last "real" object we allocated + // into the region was and this is what this keeps track. + HeapWord* _pre_dummy_top; public: // Constructor. If "is_zeroed" is true, the MemRegion "mr" may be @@ -163,6 +170,17 @@ class G1OffsetTableContigSpace: public ContiguousSpace { virtual void set_saved_mark(); void reset_gc_time_stamp() { _gc_time_stamp = 0; } + // See the comment above in the declaration of _pre_dummy_top for an + // explanation of what it is. + void set_pre_dummy_top(HeapWord* pre_dummy_top) { + assert(is_in(pre_dummy_top) && pre_dummy_top <= top(), "pre-condition"); + _pre_dummy_top = pre_dummy_top; + } + HeapWord* pre_dummy_top() { + return (_pre_dummy_top == NULL) ? top() : _pre_dummy_top; + } + void reset_pre_dummy_top() { _pre_dummy_top = NULL; } + virtual void initialize(MemRegion mr, bool clear_space, bool mangle_space); virtual void clear(bool mangle_space); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp index 3750bdae37c..93cad742435 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp @@ -38,15 +38,8 @@ inline HeapWord* G1OffsetTableContigSpace::allocate(size_t size) { // this is used for larger LAB allocations only. inline HeapWord* G1OffsetTableContigSpace::par_allocate(size_t size) { MutexLocker x(&_par_alloc_lock); - // This ought to be just "allocate", because of the lock above, but that - // ContiguousSpace::allocate asserts that either the allocating thread - // holds the heap lock or it is the VM thread and we're at a safepoint. - // The best I (dld) could figure was to put a field in ContiguousSpace - // meaning "locking at safepoint taken care of", and set/reset that - // here. But this will do for now, especially in light of the comment - // above. Perhaps in the future some lock-free manner of keeping the - // coordination. - HeapWord* res = ContiguousSpace::par_allocate(size); + // Given that we take the lock no need to use par_allocate() here. + HeapWord* res = ContiguousSpace::allocate(size); if (res != NULL) { _offsets.alloc_block(res, size); } diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index da1166ae718..34a924ef36e 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -382,6 +382,11 @@ public: return (addr_for(pcard) == p); } + HeapWord* align_to_card_boundary(HeapWord* p) { + jbyte* pcard = byte_for(p + card_size_in_words - 1); + return addr_for(pcard); + } + // The kinds of precision a CardTableModRefBS may offer. enum PrecisionStyle { Precise, diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 65afc7b4a14..1971332cd06 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -818,9 +818,14 @@ size_t ContiguousSpace::block_size(const HeapWord* p) const { // This version requires locking. inline HeapWord* ContiguousSpace::allocate_impl(size_t size, HeapWord* const end_value) { + // In G1 there are places where a GC worker can allocates into a + // region using this serial allocation code without being prone to a + // race with other GC workers (we ensure that no other GC worker can + // access the same region at the same time). So the assert below is + // too strong in the case of G1. assert(Heap_lock->owned_by_self() || (SafepointSynchronize::is_at_safepoint() && - Thread::current()->is_VM_thread()), + (Thread::current()->is_VM_thread() || UseG1GC)), "not locked"); HeapWord* obj = top(); if (pointer_delta(end_value, obj) >= size) { From cec5c20656217a62a2ff23325f38d1ef788733aa Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Mon, 4 Apr 2011 13:18:35 -0400 Subject: [PATCH 007/168] 7033292: G1: nightly failure: Non-dirty cards in region that should be dirty The epochs on the card cache array are initialized to 0 and our initial epoch also starts at 0. So, until the first GC, it might be possible to successfully "claim" a card which was in fact never initialized. Reviewed-by: johnc, iveresov, ysr --- .../share/vm/gc_implementation/g1/concurrentG1Refine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp index 4833c0a30d1..a7b24607064 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp @@ -51,7 +51,11 @@ ConcurrentG1Refine::ConcurrentG1Refine() : _cache_size_index(0), _expand_card_counts(false), _hot_cache(NULL), _def_use_cache(false), _use_cache(false), - _n_periods(0), + // We initialize the epochs of the array to 0. By initializing + // _n_periods to 1 and not 0 we automatically invalidate all the + // entries on the array. Otherwise we might accidentally think that + // we claimed a card that was in fact never set (see CR7033292). + _n_periods(1), _threads(NULL), _n_threads(0) { From f418b77aa6d7bfbf1ef61a58e765ea987cbc5227 Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Mon, 4 Apr 2011 14:23:17 -0400 Subject: [PATCH 008/168] 7027766: G1: introduce flag to dump the liveness information per region at the end of marking Repurpose the existing flag G1PrintRegionLivenessInfo to print out the liveness distribution across the regions in the heap at the end of marking. Reviewed-by: iveresov, jwilhelm --- .../g1/collectionSetChooser.cpp | 51 +---- .../g1/collectionSetChooser.hpp | 2 - .../gc_implementation/g1/concurrentMark.cpp | 178 +++++++++++++++++- .../gc_implementation/g1/concurrentMark.hpp | 50 +++++ .../gc_implementation/g1/g1CollectedHeap.hpp | 8 +- .../vm/gc_implementation/g1/g1_globals.hpp | 6 +- .../vm/gc_implementation/g1/heapRegion.hpp | 9 +- 7 files changed, 249 insertions(+), 55 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp index 585ff2d3468..7e18ec6376c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp @@ -262,38 +262,17 @@ CollectionSetChooser::sortMarkedHeapRegions() { for (int i = 0; i < _numMarkedRegions; i++) { assert(_markedRegions.at(i) != NULL, "Should be true by sorting!"); _markedRegions.at(i)->set_sort_index(i); - if (G1PrintRegionLivenessInfo > 0) { - if (i == 0) gclog_or_tty->print_cr("Sorted marked regions:"); - if (i < G1PrintRegionLivenessInfo || - (_numMarkedRegions-i) < G1PrintRegionLivenessInfo) { - HeapRegion* hr = _markedRegions.at(i); - size_t u = hr->used(); - gclog_or_tty->print_cr(" Region %d: %d used, %d max live, %5.2f%%.", - i, u, hr->max_live_bytes(), - 100.0*(float)hr->max_live_bytes()/(float)u); - } + } + if (G1PrintRegionLivenessInfo) { + G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Sorting"); + for (int i = 0; i < _numMarkedRegions; ++i) { + HeapRegion* r = _markedRegions.at(i); + cl.doHeapRegion(r); } } - if (G1PolicyVerbose > 1) - printSortedHeapRegions(); assert(verify(), "should now be sorted"); } -void -printHeapRegion(HeapRegion *hr) { - if (hr->isHumongous()) - gclog_or_tty->print("H: "); - if (hr->in_collection_set()) - gclog_or_tty->print("CS: "); - gclog_or_tty->print_cr("Region " PTR_FORMAT " (%s%s) " - "[" PTR_FORMAT ", " PTR_FORMAT"] " - "Used: " SIZE_FORMAT "K, garbage: " SIZE_FORMAT "K.", - hr, hr->is_young() ? "Y " : " ", - hr->is_marked()? "M1" : "M0", - hr->bottom(), hr->end(), - hr->used()/K, hr->garbage_bytes()/K); -} - void CollectionSetChooser::addMarkedHeapRegion(HeapRegion* hr) { assert(!hr->isHumongous(), @@ -351,27 +330,9 @@ CollectionSetChooser::clearMarkedHeapRegions(){ void CollectionSetChooser::updateAfterFullCollection() { - G1CollectedHeap* g1h = G1CollectedHeap::heap(); clearMarkedHeapRegions(); } -void -CollectionSetChooser::printSortedHeapRegions() { - gclog_or_tty->print_cr("Printing %d Heap Regions sorted by amount of known garbage", - _numMarkedRegions); - - DEBUG_ONLY(int marked_count = 0;) - for (int i = 0; i < _markedRegions.length(); i++) { - HeapRegion* r = _markedRegions.at(i); - if (r != NULL) { - printHeapRegion(r); - DEBUG_ONLY(marked_count++;) - } - } - assert(marked_count == _numMarkedRegions, "must be"); - gclog_or_tty->print_cr("Done sorted heap region print"); -} - void CollectionSetChooser::removeRegion(HeapRegion *hr) { int si = hr->sort_index(); assert(si == -1 || hr->is_marked(), "Sort index not valid."); diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp index 04ceba27921..c8e22339e35 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp @@ -100,8 +100,6 @@ public: CollectionSetChooser(); - void printSortedHeapRegions(); - void sortMarkedHeapRegions(); void fillCache(); bool addRegionToCache(void); diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index e453b91c35a..efb6c0d037b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -1204,7 +1204,6 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { g1p->record_concurrent_mark_remark_end(); } - #define CARD_BM_TEST_MODE 0 class CalcLiveObjectsClosure: public HeapRegionClosure { @@ -1726,6 +1725,11 @@ void ConcurrentMark::cleanup() { } _total_counting_time += this_final_counting_time; + if (G1PrintRegionLivenessInfo) { + G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Marking"); + _g1h->heap_region_iterate(&cl); + } + // Install newly created mark bitMap as "prev". swapMarkBitMaps(); @@ -4423,3 +4427,175 @@ CMTask::CMTask(int task_id, _marking_step_diffs_ms.add(0.5); } + +// These are formatting macros that are used below to ensure +// consistent formatting. The *_H_* versions are used to format the +// header for a particular value and they should be kept consistent +// with the corresponding macro. Also note that most of the macros add +// the necessary white space (as a prefix) which makes them a bit +// easier to compose. + +// All the output lines are prefixed with this string to be able to +// identify them easily in a large log file. +#define G1PPRL_LINE_PREFIX "###" + +#define G1PPRL_ADDR_BASE_FORMAT " "PTR_FORMAT"-"PTR_FORMAT +#ifdef _LP64 +#define G1PPRL_ADDR_BASE_H_FORMAT " %37s" +#else // _LP64 +#define G1PPRL_ADDR_BASE_H_FORMAT " %21s" +#endif // _LP64 + +// For per-region info +#define G1PPRL_TYPE_FORMAT " %-4s" +#define G1PPRL_TYPE_H_FORMAT " %4s" +#define G1PPRL_BYTE_FORMAT " "SIZE_FORMAT_W(9) +#define G1PPRL_BYTE_H_FORMAT " %9s" +#define G1PPRL_DOUBLE_FORMAT " %14.1f" +#define G1PPRL_DOUBLE_H_FORMAT " %14s" + +// For summary info +#define G1PPRL_SUM_ADDR_FORMAT(tag) " "tag":"G1PPRL_ADDR_BASE_FORMAT +#define G1PPRL_SUM_BYTE_FORMAT(tag) " "tag": "SIZE_FORMAT +#define G1PPRL_SUM_MB_FORMAT(tag) " "tag": %1.2f MB" +#define G1PPRL_SUM_MB_PERC_FORMAT(tag) G1PPRL_SUM_MB_FORMAT(tag)" / %1.2f %%" + +G1PrintRegionLivenessInfoClosure:: +G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name) + : _out(out), + _total_used_bytes(0), _total_capacity_bytes(0), + _total_prev_live_bytes(0), _total_next_live_bytes(0), + _hum_used_bytes(0), _hum_capacity_bytes(0), + _hum_prev_live_bytes(0), _hum_next_live_bytes(0) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + MemRegion g1_committed = g1h->g1_committed(); + MemRegion g1_reserved = g1h->g1_reserved(); + double now = os::elapsedTime(); + + // Print the header of the output. + _out->cr(); + _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now); + _out->print_cr(G1PPRL_LINE_PREFIX" HEAP" + G1PPRL_SUM_ADDR_FORMAT("committed") + G1PPRL_SUM_ADDR_FORMAT("reserved") + G1PPRL_SUM_BYTE_FORMAT("region-size"), + g1_committed.start(), g1_committed.end(), + g1_reserved.start(), g1_reserved.end(), + HeapRegion::GrainBytes); + _out->print_cr(G1PPRL_LINE_PREFIX); + _out->print_cr(G1PPRL_LINE_PREFIX + G1PPRL_TYPE_H_FORMAT + G1PPRL_ADDR_BASE_H_FORMAT + G1PPRL_BYTE_H_FORMAT + G1PPRL_BYTE_H_FORMAT + G1PPRL_BYTE_H_FORMAT + G1PPRL_DOUBLE_H_FORMAT, + "type", "address-range", + "used", "prev-live", "next-live", "gc-eff"); +} + +// It takes as a parameter a reference to one of the _hum_* fields, it +// deduces the corresponding value for a region in a humongous region +// series (either the region size, or what's left if the _hum_* field +// is < the region size), and updates the _hum_* field accordingly. +size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) { + size_t bytes = 0; + // The > 0 check is to deal with the prev and next live bytes which + // could be 0. + if (*hum_bytes > 0) { + bytes = MIN2((size_t) HeapRegion::GrainBytes, *hum_bytes); + *hum_bytes -= bytes; + } + return bytes; +} + +// It deduces the values for a region in a humongous region series +// from the _hum_* fields and updates those accordingly. It assumes +// that that _hum_* fields have already been set up from the "starts +// humongous" region and we visit the regions in address order. +void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes, + size_t* capacity_bytes, + size_t* prev_live_bytes, + size_t* next_live_bytes) { + assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition"); + *used_bytes = get_hum_bytes(&_hum_used_bytes); + *capacity_bytes = get_hum_bytes(&_hum_capacity_bytes); + *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes); + *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes); +} + +bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) { + const char* type = ""; + HeapWord* bottom = r->bottom(); + HeapWord* end = r->end(); + size_t capacity_bytes = r->capacity(); + size_t used_bytes = r->used(); + size_t prev_live_bytes = r->live_bytes(); + size_t next_live_bytes = r->next_live_bytes(); + double gc_eff = r->gc_efficiency(); + if (r->used() == 0) { + type = "FREE"; + } else if (r->is_survivor()) { + type = "SURV"; + } else if (r->is_young()) { + type = "EDEN"; + } else if (r->startsHumongous()) { + type = "HUMS"; + + assert(_hum_used_bytes == 0 && _hum_capacity_bytes == 0 && + _hum_prev_live_bytes == 0 && _hum_next_live_bytes == 0, + "they should have been zeroed after the last time we used them"); + // Set up the _hum_* fields. + _hum_capacity_bytes = capacity_bytes; + _hum_used_bytes = used_bytes; + _hum_prev_live_bytes = prev_live_bytes; + _hum_next_live_bytes = next_live_bytes; + get_hum_bytes(&used_bytes, &capacity_bytes, + &prev_live_bytes, &next_live_bytes); + end = bottom + HeapRegion::GrainWords; + } else if (r->continuesHumongous()) { + type = "HUMC"; + get_hum_bytes(&used_bytes, &capacity_bytes, + &prev_live_bytes, &next_live_bytes); + assert(end == bottom + HeapRegion::GrainWords, "invariant"); + } else { + type = "OLD"; + } + + _total_used_bytes += used_bytes; + _total_capacity_bytes += capacity_bytes; + _total_prev_live_bytes += prev_live_bytes; + _total_next_live_bytes += next_live_bytes; + + // Print a line for this particular region. + _out->print_cr(G1PPRL_LINE_PREFIX + G1PPRL_TYPE_FORMAT + G1PPRL_ADDR_BASE_FORMAT + G1PPRL_BYTE_FORMAT + G1PPRL_BYTE_FORMAT + G1PPRL_BYTE_FORMAT + G1PPRL_DOUBLE_FORMAT, + type, bottom, end, + used_bytes, prev_live_bytes, next_live_bytes, gc_eff); + + return false; +} + +G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() { + // Print the footer of the output. + _out->print_cr(G1PPRL_LINE_PREFIX); + _out->print_cr(G1PPRL_LINE_PREFIX + " SUMMARY" + G1PPRL_SUM_MB_FORMAT("capacity") + G1PPRL_SUM_MB_PERC_FORMAT("used") + G1PPRL_SUM_MB_PERC_FORMAT("prev-live") + G1PPRL_SUM_MB_PERC_FORMAT("next-live"), + bytes_to_mb(_total_capacity_bytes), + bytes_to_mb(_total_used_bytes), + perc(_total_used_bytes, _total_capacity_bytes), + bytes_to_mb(_total_prev_live_bytes), + perc(_total_prev_live_bytes, _total_capacity_bytes), + bytes_to_mb(_total_next_live_bytes), + perc(_total_next_live_bytes, _total_capacity_bytes)); + _out->cr(); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp index e256d4e1f83..b85969786ac 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp @@ -1149,4 +1149,54 @@ public: #endif // _MARKING_STATS_ }; +// Class that's used to to print out per-region liveness +// information. It's currently used at the end of marking and also +// after we sort the old regions at the end of the cleanup operation. +class G1PrintRegionLivenessInfoClosure: public HeapRegionClosure { +private: + outputStream* _out; + + // Accumulators for these values. + size_t _total_used_bytes; + size_t _total_capacity_bytes; + size_t _total_prev_live_bytes; + size_t _total_next_live_bytes; + + // These are set up when we come across a "stars humongous" region + // (as this is where most of this information is stored, not in the + // subsequent "continues humongous" regions). After that, for every + // region in a given humongous region series we deduce the right + // values for it by simply subtracting the appropriate amount from + // these fields. All these values should reach 0 after we've visited + // the last region in the series. + size_t _hum_used_bytes; + size_t _hum_capacity_bytes; + size_t _hum_prev_live_bytes; + size_t _hum_next_live_bytes; + + static double perc(size_t val, size_t total) { + if (total == 0) { + return 0.0; + } else { + return 100.0 * ((double) val / (double) total); + } + } + + static double bytes_to_mb(size_t val) { + return (double) val / (double) M; + } + + // See the .cpp file. + size_t get_hum_bytes(size_t* hum_bytes); + void get_hum_bytes(size_t* used_bytes, size_t* capacity_bytes, + size_t* prev_live_bytes, size_t* next_live_bytes); + +public: + // The header and footer are printed in the constructor and + // destructor respectively. + G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name); + virtual bool doHeapRegion(HeapRegion* r); + ~G1PrintRegionLivenessInfoClosure(); +}; + #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 9a6a7161195..a9412774486 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1057,7 +1057,13 @@ public: return _g1_reserved.contains(p); } - // Returns a MemRegion that corresponds to the space that has been + // Returns a MemRegion that corresponds to the space that has been + // reserved for the heap + MemRegion g1_reserved() { + return _g1_reserved; + } + + // Returns a MemRegion that corresponds to the space that has been // committed in the heap MemRegion g1_committed() { return _g1_committed; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index b3d6ae0ed3a..aafd16e0219 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -138,9 +138,9 @@ develop(bool, G1RSCountHisto, false, \ "If true, print a histogram of RS occupancies after each pause") \ \ - develop(intx, G1PrintRegionLivenessInfo, 0, \ - "When > 0, print the occupancies of the best and worst" \ - "regions.") \ + product(bool, G1PrintRegionLivenessInfo, false, \ + "Prints the liveness information for all regions in the heap " \ + "at the end of a marking cycle.") \ \ develop(bool, G1PrintParCleanupStats, false, \ "When true, print extra stats about parallel cleanup.") \ diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index 8e86ba94c79..6c307f942de 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -398,13 +398,16 @@ class HeapRegion: public G1OffsetTableContigSpace { // The number of bytes marked live in the region in the last marking phase. size_t marked_bytes() { return _prev_marked_bytes; } + size_t live_bytes() { + return (top() - prev_top_at_mark_start()) * HeapWordSize + marked_bytes(); + } + // The number of bytes counted in the next marking. size_t next_marked_bytes() { return _next_marked_bytes; } // The number of bytes live wrt the next marking. size_t next_live_bytes() { - return (top() - next_top_at_mark_start()) - * HeapWordSize - + next_marked_bytes(); + return + (top() - next_top_at_mark_start()) * HeapWordSize + next_marked_bytes(); } // A lower bound on the amount of garbage bytes in the region. From 154f0709bd051995249938f69162706ae5226c9a Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Fri, 18 Feb 2011 10:07:34 -0800 Subject: [PATCH 009/168] 7020042: G1: Partially remove fix for 6994628 Disable reference discovery and processing during concurrent marking by disabling fix for 6994628. Reviewed-by: tonyp, ysr --- .../src/share/vm/gc_implementation/g1/concurrentMark.cpp | 8 ++++++-- hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index efb6c0d037b..7cf1a9ddc39 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -3203,8 +3203,12 @@ public: CMTask* task) : _g1h(g1h), _cm(cm), _task(task) { - _ref_processor = g1h->ref_processor(); - assert(_ref_processor != NULL, "should not be NULL"); + assert(_ref_processor == NULL, "should be initialized to NULL"); + + if (G1UseConcMarkReferenceProcessing) { + _ref_processor = g1h->ref_processor(); + assert(_ref_processor != NULL, "should not be NULL"); + } } }; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index aafd16e0219..b42949f22a1 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -89,6 +89,11 @@ "The number of discovered reference objects to process before " \ "draining concurrent marking work queues.") \ \ + experimental(bool, G1UseConcMarkReferenceProcessing, false, \ + "If true, enable reference discovery during concurrent " \ + "marking and reference processing at the end of remark " \ + "(unsafe).") \ + \ develop(bool, G1SATBBarrierPrintNullPreVals, false, \ "If true, count frac of ptr writes with null pre-vals.") \ \ From 4efe3a9cb74a3bbe1961e2d304a5fa428a452b42 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Mon, 21 Mar 2011 22:02:00 -0700 Subject: [PATCH 010/168] 7027797: take care of ECDH_anon/DH_anon server key exchange for TLS 1.2 The signature of server key exanage message could be null Reviewed-by: vinnie --- .../sun/security/ssl/HandshakeMessage.java | 128 +++++++++--------- jdk/test/sun/security/ec/TestEC.java | 4 +- .../sun/security/pkcs11/fips/CipherTest.java | 124 +++++++++++++++-- .../security/pkcs11/sslecc/CipherTest.java | 126 +++++++++++++++-- .../ssl/sanity/interop/CipherTest.java | 124 +++++++++++++++-- .../sanity/interop/ClientJSSEServerJSSE.java | 4 +- 6 files changed, 401 insertions(+), 109 deletions(-) diff --git a/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java b/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java index f5f84c1ef9d..13cadcf7fb1 100644 --- a/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java +++ b/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java @@ -1,5 +1,5 @@ /* - * copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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 @@ -694,47 +694,6 @@ class DH_ServerKeyExchange extends ServerKeyExchange // the preferable signature algorithm used by this ServerKeyExchange message private SignatureAndHashAlgorithm preferableSignatureAlgorithm; - /* Return the Diffie-Hellman modulus */ - BigInteger getModulus() { - return new BigInteger(1, dh_p); - } - - /* Return the Diffie-Hellman base/generator */ - BigInteger getBase() { - return new BigInteger(1, dh_g); - } - - /* Return the server's Diffie-Hellman public key */ - BigInteger getServerPublicKey() { - return new BigInteger(1, dh_Ys); - } - - /* - * Update sig with nonces and Diffie-Hellman public key. - */ - private void updateSignature(Signature sig, byte clntNonce[], - byte svrNonce[]) throws SignatureException { - int tmp; - - sig.update(clntNonce); - sig.update(svrNonce); - - tmp = dh_p.length; - sig.update((byte)(tmp >> 8)); - sig.update((byte)(tmp & 0x0ff)); - sig.update(dh_p); - - tmp = dh_g.length; - sig.update((byte)(tmp >> 8)); - sig.update((byte)(tmp & 0x0ff)); - sig.update(dh_g); - - tmp = dh_Ys.length; - sig.update((byte)(tmp >> 8)); - sig.update((byte)(tmp & 0x0ff)); - sig.update(dh_Ys); - } - /* * Construct from initialized DH key object, for DH_anon * key exchange. @@ -779,12 +738,6 @@ class DH_ServerKeyExchange extends ServerKeyExchange signature = sig.sign(); } - private void setValues(DHCrypt obj) { - dh_p = toByteArray(obj.getModulus()); - dh_g = toByteArray(obj.getBase()); - dh_Ys = toByteArray(obj.getPublicKey()); - } - /* * Construct a DH_ServerKeyExchange message from an input * stream, as if sent from server to client for use with @@ -875,6 +828,53 @@ class DH_ServerKeyExchange extends ServerKeyExchange } } + /* Return the Diffie-Hellman modulus */ + BigInteger getModulus() { + return new BigInteger(1, dh_p); + } + + /* Return the Diffie-Hellman base/generator */ + BigInteger getBase() { + return new BigInteger(1, dh_g); + } + + /* Return the server's Diffie-Hellman public key */ + BigInteger getServerPublicKey() { + return new BigInteger(1, dh_Ys); + } + + /* + * Update sig with nonces and Diffie-Hellman public key. + */ + private void updateSignature(Signature sig, byte clntNonce[], + byte svrNonce[]) throws SignatureException { + int tmp; + + sig.update(clntNonce); + sig.update(svrNonce); + + tmp = dh_p.length; + sig.update((byte)(tmp >> 8)); + sig.update((byte)(tmp & 0x0ff)); + sig.update(dh_p); + + tmp = dh_g.length; + sig.update((byte)(tmp >> 8)); + sig.update((byte)(tmp & 0x0ff)); + sig.update(dh_g); + + tmp = dh_Ys.length; + sig.update((byte)(tmp >> 8)); + sig.update((byte)(tmp & 0x0ff)); + sig.update(dh_Ys); + } + + private void setValues(DHCrypt obj) { + dh_p = toByteArray(obj.getModulus()); + dh_g = toByteArray(obj.getBase()); + dh_Ys = toByteArray(obj.getPublicKey()); + } + int messageLength() { int temp = 6; // overhead for p, g, y(s) values. @@ -945,8 +945,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange * We support named curves only, no explicitly encoded curves. */ static final -class ECDH_ServerKeyExchange extends ServerKeyExchange -{ +class ECDH_ServerKeyExchange extends ServerKeyExchange { // constants for ECCurveType private final static int CURVE_EXPLICIT_PRIME = 1; @@ -1120,10 +1119,12 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange } int messageLength() { - int sigLen = (signatureBytes == null) ? 0 : 2 + signatureBytes.length; - - if (protocolVersion.v >= ProtocolVersion.TLS12.v) { - sigLen += SignatureAndHashAlgorithm.sizeInRecord(); + int sigLen = 0; + if (signatureBytes != null) { + sigLen = 2 + signatureBytes.length; + if (protocolVersion.v >= ProtocolVersion.TLS12.v) { + sigLen += SignatureAndHashAlgorithm.sizeInRecord(); + } } return 4 + pointBytes.length + sigLen; @@ -1133,12 +1134,13 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange s.putInt8(CURVE_NAMED_CURVE); s.putInt16(curveId); s.putBytes8(pointBytes); - if (protocolVersion.v >= ProtocolVersion.TLS12.v) { - s.putInt8(preferableSignatureAlgorithm.getHashValue()); - s.putInt8(preferableSignatureAlgorithm.getSignatureValue()); - } if (signatureBytes != null) { + if (protocolVersion.v >= ProtocolVersion.TLS12.v) { + s.putInt8(preferableSignatureAlgorithm.getHashValue()); + s.putInt8(preferableSignatureAlgorithm.getSignatureValue()); + } + s.putBytes16(signatureBytes); } } @@ -1147,9 +1149,13 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange s.println("*** ECDH ServerKeyExchange"); if (debug != null && Debug.isOn("verbose")) { - if (protocolVersion.v >= ProtocolVersion.TLS12.v) { - s.println("Signature Algorithm " + - preferableSignatureAlgorithm.getAlgorithmName()); + if (signatureBytes == null) { + s.println("Anonymous"); + } else { + if (protocolVersion.v >= ProtocolVersion.TLS12.v) { + s.println("Signature Algorithm " + + preferableSignatureAlgorithm.getAlgorithmName()); + } } s.println("Server key: " + publicKey); diff --git a/jdk/test/sun/security/ec/TestEC.java b/jdk/test/sun/security/ec/TestEC.java index fe075cd3f0a..3c4a8950627 100644 --- a/jdk/test/sun/security/ec/TestEC.java +++ b/jdk/test/sun/security/ec/TestEC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -25,8 +25,6 @@ * @test * @bug 6840752 * @summary Provide out-of-the-box support for ECC algorithms - * @ignore JSSE supported cipher suites are changed with CR 6916074, - * need to update this test case in JDK 7 soon * @library ../pkcs11 * @library ../pkcs11/ec * @library ../pkcs11/sslecc diff --git a/jdk/test/sun/security/pkcs11/fips/CipherTest.java b/jdk/test/sun/security/pkcs11/fips/CipherTest.java index 3736aa07d08..8dad4a76dcc 100644 --- a/jdk/test/sun/security/pkcs11/fips/CipherTest.java +++ b/jdk/test/sun/security/pkcs11/fips/CipherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -114,19 +114,7 @@ public class CipherTest { } boolean isEnabled() { - // ignore SCSV - if (cipherSuite.equals("TLS_EMPTY_RENEGOTIATION_INFO_SCSV")) { - return false; - } - - // ignore exportable cipher suite for TLSv1.1 - if (protocol.equals("TLSv1.1")) { - if(cipherSuite.indexOf("_EXPORT_") != -1) { - return false; - } - } - - return true; + return TLSCipherStatus.isEnabled(cipherSuite, protocol); } public String toString() { @@ -137,6 +125,114 @@ public class CipherTest { return s; } + static enum TLSCipherStatus { + // cipher suites supported since TLS 1.2 + CS_01("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_02("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_03("TLS_RSA_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_04("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_05("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_06("TLS_DHE_RSA_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_07("TLS_DHE_DSS_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + + CS_08("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_09("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_10("TLS_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_11("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_12("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_13("TLS_DHE_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_14("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + + CS_15("TLS_DH_anon_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_16("TLS_DH_anon_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_17("TLS_RSA_WITH_NULL_SHA256", 0x0303, 0xFFFF), + + // cipher suites obsoleted since TLS 1.2 + CS_50("SSL_RSA_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_51("SSL_DHE_RSA_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_52("SSL_DHE_DSS_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_53("SSL_DH_anon_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_54("TLS_KRB5_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_55("TLS_KRB5_WITH_DES_CBC_MD5", 0x0000, 0x0303), + + // cipher suites obsoleted since TLS 1.1 + CS_60("SSL_RSA_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_61("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_62("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_63("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_64("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_65("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_66("TLS_KRB5_EXPORT_WITH_RC4_40_SHA", 0x0000, 0x0302), + CS_67("TLS_KRB5_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_68("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", 0x0000, 0x0302), + CS_69("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", 0x0000, 0x0302), + + // ignore TLS_EMPTY_RENEGOTIATION_INFO_SCSV always + CS_99("TLS_EMPTY_RENEGOTIATION_INFO_SCSV", 0xFFFF, 0x0000); + + // the cipher suite name + final String cipherSuite; + + // supported since protocol version + final int supportedSince; + + // obsoleted since protocol version + final int obsoletedSince; + + TLSCipherStatus(String cipherSuite, + int supportedSince, int obsoletedSince) { + this.cipherSuite = cipherSuite; + this.supportedSince = supportedSince; + this.obsoletedSince = obsoletedSince; + } + + static boolean isEnabled(String cipherSuite, String protocol) { + int versionNumber = toVersionNumber(protocol); + + if (versionNumber < 0) { + return true; // unlikely to happen + } + + for (TLSCipherStatus status : TLSCipherStatus.values()) { + if (cipherSuite.equals(status.cipherSuite)) { + if ((versionNumber < status.supportedSince) || + (versionNumber >= status.obsoletedSince)) { + return false; + } + + return true; + } + } + + return true; + } + + private static int toVersionNumber(String protocol) { + int versionNumber = -1; + + switch (protocol) { + case "SSLv2Hello": + versionNumber = 0x0002; + break; + case "SSLv3": + versionNumber = 0x0300; + break; + case "TLSv1": + versionNumber = 0x0301; + break; + case "TLSv1.1": + versionNumber = 0x0302; + break; + case "TLSv1.2": + versionNumber = 0x0303; + break; + default: + // unlikely to happen + } + + return versionNumber; + } + } } private List tests; diff --git a/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java b/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java index 09ab1c66ffb..64153f58d20 100644 --- a/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java +++ b/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -114,19 +114,7 @@ public class CipherTest { } boolean isEnabled() { - // ignore SCSV - if (cipherSuite.equals("TLS_EMPTY_RENEGOTIATION_INFO_SCSV")) { - return false; - } - - // ignore exportable cipher suite for TLSv1.1 - if (protocol.equals("TLSv1.1")) { - if(cipherSuite.indexOf("_EXPORT_") != -1) { - return false; - } - } - - return true; + return TLSCipherStatus.isEnabled(cipherSuite, protocol); } public String toString() { @@ -137,6 +125,114 @@ public class CipherTest { return s; } + static enum TLSCipherStatus { + // cipher suites supported since TLS 1.2 + CS_01("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_02("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_03("TLS_RSA_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_04("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_05("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_06("TLS_DHE_RSA_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_07("TLS_DHE_DSS_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + + CS_08("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_09("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_10("TLS_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_11("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_12("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_13("TLS_DHE_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_14("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + + CS_15("TLS_DH_anon_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_16("TLS_DH_anon_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_17("TLS_RSA_WITH_NULL_SHA256", 0x0303, 0xFFFF), + + // cipher suites obsoleted since TLS 1.2 + CS_50("SSL_RSA_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_51("SSL_DHE_RSA_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_52("SSL_DHE_DSS_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_53("SSL_DH_anon_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_54("TLS_KRB5_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_55("TLS_KRB5_WITH_DES_CBC_MD5", 0x0000, 0x0303), + + // cipher suites obsoleted since TLS 1.1 + CS_60("SSL_RSA_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_61("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_62("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_63("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_64("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_65("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_66("TLS_KRB5_EXPORT_WITH_RC4_40_SHA", 0x0000, 0x0302), + CS_67("TLS_KRB5_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_68("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", 0x0000, 0x0302), + CS_69("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", 0x0000, 0x0302), + + // ignore TLS_EMPTY_RENEGOTIATION_INFO_SCSV always + CS_99("TLS_EMPTY_RENEGOTIATION_INFO_SCSV", 0xFFFF, 0x0000); + + // the cipher suite name + final String cipherSuite; + + // supported since protocol version + final int supportedSince; + + // obsoleted since protocol version + final int obsoletedSince; + + TLSCipherStatus(String cipherSuite, + int supportedSince, int obsoletedSince) { + this.cipherSuite = cipherSuite; + this.supportedSince = supportedSince; + this.obsoletedSince = obsoletedSince; + } + + static boolean isEnabled(String cipherSuite, String protocol) { + int versionNumber = toVersionNumber(protocol); + + if (versionNumber < 0) { + return true; // unlikely to happen + } + + for (TLSCipherStatus status : TLSCipherStatus.values()) { + if (cipherSuite.equals(status.cipherSuite)) { + if ((versionNumber < status.supportedSince) || + (versionNumber >= status.obsoletedSince)) { + return false; + } + + return true; + } + } + + return true; + } + + private static int toVersionNumber(String protocol) { + int versionNumber = -1; + + switch (protocol) { + case "SSLv2Hello": + versionNumber = 0x0002; + break; + case "SSLv3": + versionNumber = 0x0300; + break; + case "TLSv1": + versionNumber = 0x0301; + break; + case "TLSv1.1": + versionNumber = 0x0302; + break; + case "TLSv1.2": + versionNumber = 0x0303; + break; + default: + // unlikely to happen + } + + return versionNumber; + } + } } private List tests; @@ -170,11 +266,13 @@ public class CipherTest { // no client with anonymous ciphersuites continue; } + tests.add(new TestParameters(cipherSuite, protocol, clientAuth)); } } } + testIterator = tests.iterator(); } diff --git a/jdk/test/sun/security/ssl/sanity/interop/CipherTest.java b/jdk/test/sun/security/ssl/sanity/interop/CipherTest.java index c7b544260ae..9c5af7eda4a 100644 --- a/jdk/test/sun/security/ssl/sanity/interop/CipherTest.java +++ b/jdk/test/sun/security/ssl/sanity/interop/CipherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -115,19 +115,7 @@ public class CipherTest { } boolean isEnabled() { - // ignore SCSV - if (cipherSuite.equals("TLS_EMPTY_RENEGOTIATION_INFO_SCSV")) { - return false; - } - - // ignore exportable cipher suite for TLSv1.1 - if (protocol.equals("TLSv1.1")) { - if(cipherSuite.indexOf("_EXPORT_") != -1) { - return false; - } - } - - return true; + return TLSCipherStatus.isEnabled(cipherSuite, protocol); } public String toString() { @@ -138,6 +126,114 @@ public class CipherTest { return s; } + static enum TLSCipherStatus { + // cipher suites supported since TLS 1.2 + CS_01("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_02("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_03("TLS_RSA_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_04("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_05("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF), + CS_06("TLS_DHE_RSA_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_07("TLS_DHE_DSS_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + + CS_08("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_09("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_10("TLS_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_11("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_12("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_13("TLS_DHE_RSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_14("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + + CS_15("TLS_DH_anon_WITH_AES_256_CBC_SHA256", 0x0303, 0xFFFF), + CS_16("TLS_DH_anon_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF), + CS_17("TLS_RSA_WITH_NULL_SHA256", 0x0303, 0xFFFF), + + // cipher suites obsoleted since TLS 1.2 + CS_50("SSL_RSA_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_51("SSL_DHE_RSA_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_52("SSL_DHE_DSS_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_53("SSL_DH_anon_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_54("TLS_KRB5_WITH_DES_CBC_SHA", 0x0000, 0x0303), + CS_55("TLS_KRB5_WITH_DES_CBC_MD5", 0x0000, 0x0303), + + // cipher suites obsoleted since TLS 1.1 + CS_60("SSL_RSA_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_61("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_62("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_63("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_64("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_65("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", 0x0000, 0x0302), + CS_66("TLS_KRB5_EXPORT_WITH_RC4_40_SHA", 0x0000, 0x0302), + CS_67("TLS_KRB5_EXPORT_WITH_RC4_40_MD5", 0x0000, 0x0302), + CS_68("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", 0x0000, 0x0302), + CS_69("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", 0x0000, 0x0302), + + // ignore TLS_EMPTY_RENEGOTIATION_INFO_SCSV always + CS_99("TLS_EMPTY_RENEGOTIATION_INFO_SCSV", 0xFFFF, 0x0000); + + // the cipher suite name + final String cipherSuite; + + // supported since protocol version + final int supportedSince; + + // obsoleted since protocol version + final int obsoletedSince; + + TLSCipherStatus(String cipherSuite, + int supportedSince, int obsoletedSince) { + this.cipherSuite = cipherSuite; + this.supportedSince = supportedSince; + this.obsoletedSince = obsoletedSince; + } + + static boolean isEnabled(String cipherSuite, String protocol) { + int versionNumber = toVersionNumber(protocol); + + if (versionNumber < 0) { + return true; // unlikely to happen + } + + for (TLSCipherStatus status : TLSCipherStatus.values()) { + if (cipherSuite.equals(status.cipherSuite)) { + if ((versionNumber < status.supportedSince) || + (versionNumber >= status.obsoletedSince)) { + return false; + } + + return true; + } + } + + return true; + } + + private static int toVersionNumber(String protocol) { + int versionNumber = -1; + + switch (protocol) { + case "SSLv2Hello": + versionNumber = 0x0002; + break; + case "SSLv3": + versionNumber = 0x0300; + break; + case "TLSv1": + versionNumber = 0x0301; + break; + case "TLSv1.1": + versionNumber = 0x0302; + break; + case "TLSv1.2": + versionNumber = 0x0303; + break; + default: + // unlikely to happen + } + + return versionNumber; + } + } } private List tests; diff --git a/jdk/test/sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java b/jdk/test/sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java index 74564602d00..953d2ea8e5f 100644 --- a/jdk/test/sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java +++ b/jdk/test/sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -25,8 +25,6 @@ * @test * @bug 4496785 * @summary Verify that all ciphersuites work in all configurations - * @ignore JSSE supported cipher suites are changed with CR 6916074, - * need to update this test case in JDK 7 soon * @author Andreas Sterbenz * @run main/othervm/timeout=300 ClientJSSEServerJSSE */ From 91f8f158a4b2b2c1327a95692b1d7c6f14088818 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Tue, 22 Mar 2011 11:22:38 +0300 Subject: [PATCH 011/168] 6993561: java.awt.image.SampleModel.setSamples() methods not always throw ArrayIndexOutOfBoundsException Reviewed-by: jgodinez, prr --- .../classes/java/awt/image/SampleModel.java | 36 +++++++++++++++---- jdk/test/java/awt/image/GetSamplesTest.java | 9 +++-- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/jdk/src/share/classes/java/awt/image/SampleModel.java b/jdk/src/share/classes/java/awt/image/SampleModel.java index 2412da2db94..8b51116f75b 100644 --- a/jdk/src/share/classes/java/awt/image/SampleModel.java +++ b/jdk/src/share/classes/java/awt/image/SampleModel.java @@ -1315,9 +1315,16 @@ public abstract class SampleModel int iArray[], DataBuffer data) { int Offset=0; + int x1 = x + w; + int y1 = y + h; + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } - for (int i=y; i<(y+h); i++) { - for (int j=x; j<(x+w); j++) { + for (int i=y; i= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } + + for (int i=y; i= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } + + for (int i=y; i Date: Tue, 22 Mar 2011 12:28:03 +0300 Subject: [PATCH 012/168] 6773586: java.awt.image.SampleModel.getPixels() methods not allways throw ArrayIndexOutOfBoundsException Reviewed-by: jgodinez, prr --- .../java/awt/image/BandedSampleModel.java | 14 +++- .../java/awt/image/ComponentSampleModel.java | 14 +++- .../classes/java/awt/image/SampleModel.java | 72 +++++++++++++++---- .../image/SinglePixelPackedSampleModel.java | 14 +++- 4 files changed, 96 insertions(+), 18 deletions(-) diff --git a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java index 5a9acc50ae5..c1a620c7d8f 100644 --- a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java @@ -408,7 +408,12 @@ public final class BandedSampleModel extends ComponentSampleModel */ public int[] getPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { - if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } @@ -690,7 +695,12 @@ public final class BandedSampleModel extends ComponentSampleModel */ public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { - if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } diff --git a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java index 12ce6189ad4..627c9291074 100644 --- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java @@ -739,7 +739,12 @@ public class ComponentSampleModel extends SampleModel */ public int[] getPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { - if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || y > height || y1 < 0 || y1 > height) + { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } @@ -1025,7 +1030,12 @@ public class ComponentSampleModel extends SampleModel */ public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { - if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } diff --git a/jdk/src/share/classes/java/awt/image/SampleModel.java b/jdk/src/share/classes/java/awt/image/SampleModel.java index 8b51116f75b..e1437645e70 100644 --- a/jdk/src/share/classes/java/awt/image/SampleModel.java +++ b/jdk/src/share/classes/java/awt/image/SampleModel.java @@ -759,14 +759,22 @@ public abstract class SampleModel int pixels[]; int Offset=0; + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } if (iArray != null) pixels = iArray; else pixels = new int[numBands * w * h]; - for (int i=y; i<(h+y); i++) { - for (int j=x; j<(w+x); j++) { + for (int i=y; i= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } if (fArray != null) pixels = fArray; else pixels = new float[numBands * w * h]; - for (int i=y; i<(h+y); i++) { - for(int j=x; j<(w+x); j++) { + for (int i=y; i= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } if (dArray != null) pixels = dArray; @@ -845,8 +869,8 @@ public abstract class SampleModel pixels = new double[numBands * w * h]; // Fix 4217412 - for (int i=y; i<(h+y); i++) { - for (int j=x; j<(w+x); j++) { + for (int i=y; i= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } + + for (int i=y; i= width || w > width || x1 < 0 || x1 > width|| + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } + + for (int i=y; i= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } + + for (int i=y; i width) || (y + h > height)) { + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } @@ -659,7 +664,12 @@ public class SinglePixelPackedSampleModel extends SampleModel */ public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { - if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) { + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } From b115ff4faea04972db6ae46871ef2f17e84a6e81 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 22 Mar 2011 11:07:40 -0700 Subject: [PATCH 013/168] 6737397: Should support running JCK test suite with test/Makefile and JPRT Reviewed-by: alanb --- make/jprt.properties | 16 +++++++++++++++- test/Makefile | 9 +++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/make/jprt.properties b/make/jprt.properties index 777e27c8a2f..950fc52cede 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -323,6 +323,21 @@ jprt.make.rule.all.test.targets= \ ${jprt.my.windows.i586}-product-c1-jdk_tools2, \ windows_x64_5.2-product-c2-jdk_tools2 +# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken) +jprt.my.jck.test.target.set= \ + solaris_sparc_5.10-product-c1-JCK7TESTRULE, \ + solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \ + solaris_i586_5.10-product-c1-JCK7TESTRULE, \ + solaris_x64_5.10-product-c2-JCK7TESTRULE, \ + linux_i586_2.6-product-c1-JCK7TESTRULE, \ + linux_x64_2.6-product-c2-JCK7TESTRULE + +# JCK testset targets (e.g. jprt submit -testset jck ... ) +jprt.make.rule.jck.test.targets= \ + ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7devtools}, \ + ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7runtime}, \ + ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler} + # Select list to use (allow for testset to be empty too) jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} @@ -333,4 +348,3 @@ jprt.test.targets=${jprt.vm.test.targets} # Directories to be excluded from the source bundles jprt.bundle.exclude.src.dirs=build dist webrev - diff --git a/test/Makefile b/test/Makefile index 26d00bb4994..95c69464732 100644 --- a/test/Makefile +++ b/test/Makefile @@ -73,13 +73,16 @@ JDK_TEST_LIST2 = \ jdk_rmi \ jdk_swing +# These are the current jck test targets in the jdk repository +JDK_JCK7_LIST = jck7devtools jck7compiler jck7runtime + # Default test target (everything) all: $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST) # Test targets $(LANGTOOLS_TEST_LIST): @$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@)) -$(JDK_TEST_LIST) $(JDK_TEST_LIST2): +$(JDK_TEST_LIST) $(JDK_TEST_LIST2) $(JDK_JCK7_LIST): @$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), $@) clean: @@ -87,7 +90,9 @@ clean: ################################################################ # Phony targets (e.g. these are not filenames) -.PHONY: all clean $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST) +.PHONY: all clean \ + $(JDK_TEST_LIST) $(JDK_TEST_LIST2) $(JDK_JCK7_LIST) \ + $(LANGTOOLS_TEST_LIST) ################################################################ From 119b647cba7b751e08eab82fe2bd881b3ea1da11 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 22 Mar 2011 11:08:09 -0700 Subject: [PATCH 014/168] 6737397: Should support running JCK test suite with test/Makefile and JPRT Reviewed-by: alanb --- jdk/make/jprt.properties | 26 ++++- jdk/test/Makefile | 199 ++++++++++++++------------------------- jdk/test/ProblemList.txt | 3 + 3 files changed, 95 insertions(+), 133 deletions(-) diff --git a/jdk/make/jprt.properties b/jdk/make/jprt.properties index 7cb87c1e3a3..b479e22f06a 100644 --- a/jdk/make/jprt.properties +++ b/jdk/make/jprt.properties @@ -52,8 +52,11 @@ jprt.build.targets= \ ${jprt.my.windows.i586}-{product|fastdebug}, \ windows_x64_5.2-{product|fastdebug} +# User can select the test set with jprt submit "-testset name" option +jprt.my.test.set=${jprt.test.set} + # Standard vm test target -jprt.test.targets= \ +jprt.vm.default.test.targets= \ solaris_sparc_5.10-product-c1-jvm98, \ solaris_sparcv9_5.10-product-c2-jvm98, \ solaris_i586_5.10-product-c1-jvm98, \ @@ -63,8 +66,10 @@ jprt.test.targets= \ ${jprt.my.windows.i586}-product-c1-jvm98, \ windows_x64_5.2-product-c2-jvm98 -# User can select the test set with jprt submit "-testset name" option -jprt.my.test.set=${jprt.test.set} +# Select vm testlist to use (allow for testset to be empty too) +jprt.vm.all.test.targets=${jprt.vm.default.test.targets} +jprt.vm..test.targets=${jprt.vm.default.test.targets} +jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets} # Default jdk test targets in test/Makefile (no fastdebug & limited c2) jprt.make.rule.default.test.targets= \ @@ -281,6 +286,21 @@ jprt.make.rule.all.test.targets= \ ${jprt.my.windows.i586}-product-c1-jdk_tools2, \ windows_x64_5.2-product-c2-jdk_tools2 +# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken) +jprt.my.jck.test.target.set= \ + solaris_sparc_5.10-product-c1-JCK7TESTRULE, \ + solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \ + solaris_i586_5.10-product-c1-JCK7TESTRULE, \ + solaris_x64_5.10-product-c2-JCK7TESTRULE, \ + linux_i586_2.6-product-c1-JCK7TESTRULE, \ + linux_x64_2.6-product-c2-JCK7TESTRULE + +# JCK testset targets (e.g. jprt submit -testset jck ... ) +jprt.make.rule.jck.test.targets= \ + ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7devtools}, \ + ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7runtime}, \ + ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler} + # Select list to use (allow for testset to be empty too) jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} diff --git a/jdk/test/Makefile b/jdk/test/Makefile index d1171b96027..0fe74310c52 100644 --- a/jdk/test/Makefile +++ b/jdk/test/Makefile @@ -261,6 +261,7 @@ endif # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed. ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \ && $(CD) $(ABS_TEST_OUTPUT_DIR) \ + && $(CHMOD) -R a+r . \ && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt STATS_TXT_NAME = Stats.txt @@ -312,7 +313,9 @@ BUNDLE_UP_AND_EXIT = \ else \ $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \ fi; \ - $(CAT) $(STATS_TXT); \ + if [ -f $(STATS_TXT) ] ; then \ + $(CAT) $(STATS_TXT); \ + fi; \ $(ZIP_UP_RESULTS) ; \ $(TESTEXIT) \ ) @@ -370,10 +373,10 @@ EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt # Create exclude list for this platform and arch ifdef NO_EXCLUDES -$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) +$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES) @$(ECHO) "NOTHING_EXCLUDED" > $@ else -$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) +$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES) @$(RM) $@ $@.temp1 $@.temp2 @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)' ) ;\ @@ -385,7 +388,7 @@ $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) ($(ECHO) "#") ;\ ) | $(SED) -e 's@^[\ ]*@@' \ | $(EGREP) -v '^#' > $@.temp1 - @for tdir in $(TESTDIRS) ; do \ + for tdir in $(TESTDIRS) SOLARIS_10_SH_BUG_NO_EMPTY_FORS ; do \ ( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \ done @$(ECHO) "# at least one line" >> $@.temp2 @@ -400,11 +403,11 @@ endef # Running batches of tests with or without samevm define RunSamevmBatch $(ECHO) "Running tests in samevm mode: $?" -$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests +$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests endef define RunOthervmBatch $(ECHO) "Running tests in othervm mode: $?" -$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests +$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests endef define SummaryInfo $(ECHO) "########################################################" @@ -706,7 +709,7 @@ PHONY_LIST += perftest # vmsqe tests # Expect JPRT to set JPRT_VMSQE_HOME. -VMSQE_HOME = /java/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm +VMSQE_HOME = $(SLASH_JAVA)/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm ifdef JPRT_VMSQE_HOME VMSQE_HOME = $(JPRT_VMSQE_HOME) endif @@ -718,7 +721,7 @@ ifdef JPRT_RUNVMSQE_HOME endif # Expect JPRT to set JPRT_TONGA3_HOME. -TONGA3_HOME = /java/sqe//tools/gtee/harness/tonga +TONGA3_HOME = $(SLASH_JAVA)/sqe/tools/gtee/harness/tonga ifdef JPRT_TONGA3_HOME TONGA3_HOME = $(JPRT_TONGA3_HOME) endif @@ -771,148 +774,84 @@ PHONY_LIST += vmsqe_jdwp vmsqe_jdi vmsqe_jdb vmsqe_quick-jdi vmsqe_sajdi \ # jck tests -JCK_WORK_DIR = $(ABS_TEST_OUTPUT_DIR)/JCKwork -JCK_REPORT_DIR = $(ABS_TEST_OUTPUT_DIR)/JCKreport -JCK_PROPERTIES = $(ABS_TEST_OUTPUT_DIR)/jck.properties -JCK_CONFIG = $(ABS_TEST_OUTPUT_DIR)/jck.config - -JCK_JAVA_EXE = $(PRODUCT_HOME)/bin/java$(EXESUFFIX) - -JCK_JAVATEST_JAR = $(JCK_HOME)/lib/javatest.jar -JCK_JAVATEST = $(ALT_BOOTDIR)/bin/java -jar $(JCK_JAVATEST_JAR) - -$(JCK_CONFIG): $(TEST_ROOT)/JCK-$(JCK_BUNDLE_NAME)-$(JCK_RELEASE)-base.jti - $(RM) $@ - $(MKDIR) -p $(@D) - $(CP) $< $@ - -$(JCK_PROPERTIES): $(PRODUCT_HOME) $(JCK_JAVA_EXE) - $(RM) $@ - $(MKDIR) -p $(@D) - $(ECHO) "jck.env.compiler.compRefExecute.cmdAsFile=$(JCK_JAVA_EXE)" >> $@ - $(ECHO) "jck.env.compiler.compRefExecute.systemRoot=$(SYSTEMROOT)" >> $@ - $(ECHO) "jck.env.compiler.testCompile.testCompileAPImultiJVM.cmdAsFile=$(JCK_JAVA_EXE)" >> $@ - $(ECHO) "jck.tests.tests=$(JCK_BUNDLE_TESTDIRS)" >> $@ - -jck_tests: prep $(JCK_HOME) $(JCK_PROPERTIES) $(JCK_CONFIG) $(JCK_JAVATEST_JAR) - $(MKDIR) -p $(JCK_WORK_DIR) - ( $(JCK_JAVATEST) \ - -verbose:commands,non-pass \ - -testSuite $(JCK_HOME) \ - -workDir $(JCK_WORK_DIR) \ - -config $(JCK_CONFIG) \ - -set -file $(JCK_PROPERTIES) \ - -runtests \ - -writeReport $(JCK_REPORT_DIR) \ - ) ; $(BUNDLE_UP_AND_EXIT) - -PHONY_LIST += jck_tests - -################################################################ - -# jck6 tests - -JCK6_RELEASE = 6b -JCK6_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK6_RELEASE)/archive/fcs/binaries - -# Expect JPRT to set JPRT_JCK6COMPILER_HOME. -JCK6COMPILER_HOME = $(JCK6_DEFAULT_HOME)/JCK-compiler-$(JCK6_RELEASE) -ifdef JPRT_JCK6COMPILER_HOME - JCK6COMPILER_HOME = $(JPRT_JCK6COMPILER_HOME) -endif - -# Expect JPRT to set JPRT_JCK6RUNTIME_HOME. -JCK6RUNTIME_HOME = $(JCK6_DEFAULT_HOME)/JCK-runtime-$(JCK6_RELEASE) -ifdef JPRT_JCK6RUNTIME_HOME - JCK6RUNTIME_HOME = $(JPRT_JCK6RUNTIME_HOME) -endif - -# Expect JPRT to set JPRT_JCK6DEVTOOLS_HOME. -JCK6DEVTOOLS_HOME = $(JCK6_DEFAULT_HOME)/JCK-devtools-$(JCK6_RELEASE) -ifdef JPRT_JCK6DEVTOOLS_HOME - JCK6DEVTOOLS_HOME = $(JPRT_JCK6DEVTOOLS_HOME) -endif - -jck6_tests: JCK_HOME=$(JCK6_HOME) -jck6_tests: JCK_RELEASE=$(JCK6_RELEASE) -jck6_tests: jck_tests - -jck6compiler: JCK6_HOME=$(JCK6COMPILER_HOME) -jck6compiler: JCK_BUNDLE_NAME=compiler -jck6compiler: jck6_tests - -jck6compiler_lang: JCK_BUNDLE_TESTDIRS=lang -jck6compiler_lang: jck6compiler - -jck6runtime: JCK6_HOME=$(JCK6RUNTIME_HOME) -jck6runtime: JCK_BUNDLE_NAME=runtime -jck6runtime: jck6_tests - -jck6runtime_lang: JCK_BUNDLE_TESTDIRS=lang -jck6runtime_lang: jck6runtime - -jck6devtools: JCK6_HOME=$(JCK6DEVTOOLS_HOME) -jck6devtools: JCK_BUNDLE_NAME=devtools -jck6devtools: jck6_tests - -jck6devtools_lang: JCK_BUNDLE_TESTDIRS=lang -jck6devtools_lang: jck6devtools - -PHONY_LIST += jck6compiler jck6runtime jck6devtools jck6_tests \ - jck6compiler_lang jck6runtime_lang jck6devtools_lang - -################################################################ - -# jck7 tests - -JCK7_RELEASE = 7 -JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK7_RELEASE)/archive/fcs/binaries +# Default is to use jck 7 from /java/re +JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries # Expect JPRT to set JPRT_JCK7COMPILER_HOME. -JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-$(JCK7_RELEASE) +JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-7 ifdef JPRT_JCK7COMPILER_HOME - JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME) + JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)/JCK-compiler-7 endif # Expect JPRT to set JPRT_JCK7RUNTIME_HOME. -JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-$(JCK7_RELEASE) +JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-7 ifdef JPRT_JCK7RUNTIME_HOME - JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME) + JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)/JCK-runtime-7 endif # Expect JPRT to set JPRT_JCK7DEVTOOLS_HOME. -JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-$(JCK7_RELEASE) +JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-7 ifdef JPRT_JCK7DEVTOOLS_HOME - JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME) + JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)/JCK-devtools-7 endif -jck7_tests: JCK_HOME=$(JCK7_HOME) -jck7_tests: JCK_RELEASE=$(JCK7_RELEASE) -jck7_tests: jck_tests +# The jtjck.jar utility to use to run the tests +JTJCK_JAR = $(JCK_HOME)/lib/jtjck.jar +JTJCK_JAVA_ARGS = -XX:MaxPermSize=256m -Xmx512m +JTJCK_OPTIONS = -headless -v -jck7compiler: JCK7_HOME=$(JCK7COMPILER_HOME) -jck7compiler: JCK_BUNDLE_NAME=compiler -jck7compiler: jck7_tests +# Default tests to run +ifndef JCK_COMPILER_TESTS + JCK_COMPILER_TESTS = +endif +ifndef JCK_RUNTIME_TESTS + JCK_RUNTIME_TESTS = +endif +ifndef JCK_DEVTOOLS_TESTS + JCK_DEVTOOLS_TESTS = +endif -jck7compiler_lang: JCK_BUNDLE_TESTDIRS=lang -jck7compiler_lang: jck7compiler +# Generic rule used to run jck tests +_generic_jck_tests: prep $(PRODUCT_HOME) $(EXCLUDELIST) + @$(EXPAND) $(EXCLUDELIST) \ + | $(CUT) -d' ' -f1 \ + | $(SED) -e 's@^@Excluding: @' + ( $(CD) $(ABS_TEST_OUTPUT_DIR) && \ + $(PRODUCT_HOME)/bin/java $(JTJCK_JAVA_ARGS) \ + -jar "$(JTJCK_JAR)" \ + $(JTJCK_OPTIONS) \ + -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ + -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ + -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ + $(TESTDIRS) \ + ) ; $(BUNDLE_UP_AND_EXIT) -jck7runtime: JCK7_HOME=$(JCK7RUNTIME_HOME) -jck7runtime: JCK_BUNDLE_NAME=runtime -jck7runtime: jck7_tests +# JCK7 compiler tests +jck7compiler: + $(MAKE) UNIQUE_DIR=$@ \ + JCK_HOME=$(JCK7COMPILER_HOME) \ + TESTDIRS="$(JCK_COMPILER_TESTS)" \ + _generic_jck_tests -jck7runtime_lang: JCK_BUNDLE_TESTDIRS=lang -jck7runtime_lang: jck7runtime +# JCK7 runtime tests +jck7runtime: + $(MAKE) UNIQUE_DIR=$@ \ + JCK_HOME=$(JCK7RUNTIME_HOME) \ + TESTDIRS="$(JCK_RUNTIME_TESTS)" \ + _generic_jck_tests -jck7devtools: JCK7_HOME=$(JCK7DEVTOOLS_HOME) -jck7devtools: JCK_BUNDLE_NAME=devtools -jck7devtools: jck7_tests +# JCK7 devtools tests +jck7devtools: + $(MAKE) UNIQUE_DIR=$@ \ + JCK_HOME=$(JCK7DEVTOOLS_HOME) \ + TESTDIRS="$(JCK_DEVTOOLS_TESTS)" \ + _generic_jck_tests -jck7devtools_lang: JCK_BUNDLE_TESTDIRS=lang -jck7devtools_lang: jck7devtools +# Run all 3 sets of JCK7 tests +jck_all: jck7runtime jck7devtools jck7compiler -PHONY_LIST += jck7compiler jck7runtime jck7devtools jck7_tests \ - jck7compiler_lang jck7runtime_lang jck7devtools_lang +PHONY_LIST += jck_all _generic_jck_tests \ + jck7compiler jck7runtime jck7devtools ################################################################ diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 27518785b07..d0336f9b6a1 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -690,6 +690,9 @@ sun/tools/jconsole/ResourceCheckTest.sh generic-all # jdk_util +# Filed 7027061 +java/util/Locale/Bug6989440.java windows-all + # Filed 6933803 java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all From 93af7b4699d05df1955828ad3df14d4b787740a3 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 22 Mar 2011 18:56:16 -0400 Subject: [PATCH 015/168] 7025066: Build systems changes to support SE Embedded Integration Define Embedded specific files and include them in the main files. Allow finer control over some build options. Reviewed-by: ohair, bobv, collins --- jdk/make/common/Defs-embedded.gmk | 53 ++++ jdk/make/common/Defs.gmk | 7 +- jdk/make/common/Library.gmk | 4 +- jdk/make/common/Release-embedded.gmk | 232 ++++++++++++++++++ jdk/make/common/Release.gmk | 30 ++- jdk/make/common/shared/Sanity-Settings.gmk | 4 +- jdk/make/java/zip/Makefile | 7 +- jdk/make/sun/nio/cs/Makefile | 11 +- .../classes/sun/misc/Version.java.template | 24 +- 9 files changed, 351 insertions(+), 21 deletions(-) create mode 100644 jdk/make/common/Defs-embedded.gmk create mode 100644 jdk/make/common/Release-embedded.gmk diff --git a/jdk/make/common/Defs-embedded.gmk b/jdk/make/common/Defs-embedded.gmk new file mode 100644 index 00000000000..f196e2f4fed --- /dev/null +++ b/jdk/make/common/Defs-embedded.gmk @@ -0,0 +1,53 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# Variable definitions for SE Embedded builds. This file should +# not contain rules. +# +ifdef JAVASE_EMBEDDED + +# Compress jar files +COMPRESS_JARS = true + +# Don't mmap zip files +LIBZIP_CAN_USE_MMAP = false + +# Disable ALSA version check +REQUIRED_ALSA_VERSION = + +# Compilation settings +OTHER_CPPFLAGS += -DJAVASE_EMBEDDED + +# Product naming +PRODUCT_SUFFIX = SE Runtime Environment for Embedded +RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX) + +# Reduced JRE locations +JRE_REDUCED_HEADLESS_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-headless-image +JRE_REDUCED_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-image + +endif # JAVASE_EMBEDDED + diff --git a/jdk/make/common/Defs.gmk b/jdk/make/common/Defs.gmk index 8ece69eba90..3c1ff2c0270 100644 --- a/jdk/make/common/Defs.gmk +++ b/jdk/make/common/Defs.gmk @@ -115,6 +115,12 @@ endif include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk +# +# SE-Embedded support, if enabled +# + +include $(JDK_TOPDIR)/make/common/Defs-embedded.gmk + # # Cross-compilation Settings # @@ -144,7 +150,6 @@ ifdef BUILD_CLIENT_ONLY VM_NAME = client endif - # # Freetype logic is applicable to OpenJDK only # diff --git a/jdk/make/common/Library.gmk b/jdk/make/common/Library.gmk index e7a24d477ff..9999406b718 100644 --- a/jdk/make/common/Library.gmk +++ b/jdk/make/common/Library.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1995, 2011, Oracle and/or its affiliates. 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 @@ -78,7 +78,7 @@ LINKER=$(LINK.c) endif $(ACTUAL_LIBRARY):: $(INIT) $(TEMPDIR) $(LIBDIR) $(BINDIR) $(EXTDIR) classheaders - + @$(ECHO) Building lib:$(ACTUAL_LIBRARY) # # COMPILE_APPROACH: Different approaches to compile up the native object # files as quickly as possible. diff --git a/jdk/make/common/Release-embedded.gmk b/jdk/make/common/Release-embedded.gmk new file mode 100644 index 00000000000..0d7875fd339 --- /dev/null +++ b/jdk/make/common/Release-embedded.gmk @@ -0,0 +1,232 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# SE-Embedded Reduced JRE targets +# +ifdef JAVASE_EMBEDDED + +reduced-image-jre reduced-headless-image-jre :: + @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." + +# Add the reduced-jre images as pre-reqs. These will be processed last +images:: reduced-image-jre reduced-headless-image-jre + + +###################################################### +# Create the headless rt.jar +###################################################### + +NOT_HEADLESS_RT_JAR_LIST = $(ABS_TEMPDIR)/not_hl_rt_jar.list +HEADLESS_RT_JAR_FILELIST=$(JARFILELISTS_TEMPDIR)/hl_rt_jar_list +TOTAL_HEADLESS_JAR_FILELIST=$(REORDER_TEMPDIR)/hl_file_list +HEADLESS_CLASSLIST=$(ABS_TEMPDIR)/headless_classlist + +# Add the jar file directories that we don't want in the +# headless JRE. If you want to remove most classes in a +# directory, put the directory in the NOT_HEADLESS_RT_JAR_LIST +# and put the individual classes you want to keep in the +# HEADLESS_CLASSLIST file. +$(NOT_HEADLESS_RT_JAR_LIST): $(NOT_RT_JAR_LIST) + $(RM) $(HEADLESS_CLASSLIST) + $(RM) $(NOT_HEADLESS_RT_JAR_LIST) + $(CP) $(NOT_RT_JAR_LIST) $(NOT_HEADLESS_RT_JAR_LIST) + $(ECHO) "sun/awt/motif/" >> $@ + $(ECHO) "sun/awt/X11/" >> $@ + $(ECHO) "sun/applet/" >> $@ + $(ECHO) "sun/java2d/opengl/" >> $@ + $(ECHO) "com/sun/java/swing/plaf/" >> $@ + $(ECHO) "sun/awt/motif/MFontConfiguration" >$(HEADLESS_CLASSLIST) + $(ECHO) "sun/applet/AppContextCreator" >>$(HEADLESS_CLASSLIST) + $(ECHO) "sun/applet/AppletAudioClip" >>$(HEADLESS_CLASSLIST) + $(ECHO) "sun/java2d/opengl/GLXSurfaceData" >>$(HEADLESS_CLASSLIST) + $(ECHO) "sun/java2d/opengl/GLXSurfaceData"\$$"GLXOffScreenSurfaceData" >>$(HEADLESS_CLASSLIST) + $(ECHO) "sun/java2d/opengl/GLXVolatileSurfaceManager" >>$(HEADLESS_CLASSLIST) + $(ECHO) "sun/java2d/opengl/OGLSurfaceData" >>$(HEADLESS_CLASSLIST) + +$(TOTAL_HEADLESS_JAR_FILELIST): $(JARREORDER_JARFILE) $(NOT_HEADLESS_RT_JAR_LIST) + $(prep-target) + $(RM) $@.temp + $(CD) $(CLASSBINDIR) ; \ + $(BOOT_JAVA_CMD) -jar $(JARREORDER_JARFILE) \ + -o $@.temp $(HEADLESS_CLASSLIST) $(NOT_HEADLESS_RT_JAR_LIST) . + $(MV) $@.temp $@ + @$(CD) $(CLASSBINDIR); $(java-vm-cleanup) + +# Create the headless rt.jar file list & non-class files list +MakeHeadlessJarFileList: $(TOTAL_HEADLESS_JAR_FILELIST) $(JARSPLIT_JARFILE) + @$(RM) $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST) + $(BOOT_JAVA_CMD) -jar $(JARSPLIT_JARFILE) $(TOTAL_HEADLESS_JAR_FILELIST) \ + -o $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST) + @$(java-vm-cleanup) + +# Create headless rt.jar +HL_RT_JAR=$(ABS_TEMPDIR)/rt-hl-orig.jar +$(HL_RT_JAR): MakeHeadlessJarFileList $(JAR_MANIFEST_FILE) + $(prep-target) + $(CD) $(CLASSBINDIR) ; \ + $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ @$(HEADLESS_RT_JAR_FILELIST) \ + $(JAR_JFLAGS) + @$(CD) $(CLASSBINDIR); $(java-vm-cleanup) + + +# +# Produce a reduced Headful JRE for Embedded Devices +# +# The deployment binaries are added during the deployment build process +# + +# Binaries that don't get included in reduced jre image bin directory +NOT_REDUCEDJRE_BIN = \ + java_vm \ + kinit \ + klist \ + ktab \ + orbd \ + policytool \ + rmid \ + rmiregistry \ + servertool \ + tnameserv \ + pack200 \ + unpack200 + +# jars/resources/libs that don't get included in reduced jre image lib directory +NOT_REDUCEDJRE_LIB = \ + charsets.jar \ + ext/dnsns.jar \ + ext/localedata.jar \ + $(LIBARCH)/client/classes.jsa \ + $(LIBARCH)/libjavaplugin_jni.so \ + $(LIBARCH)/libjavaplugin_nscp_gcc29.so \ + $(LIBARCH)/libjavaplugin_nscp.so \ + $(LIBARCH)/libjavaplugin_oji.so + + +ifeq ($(PLATFORM), linux) + STRIP_OPTS = --strip-unneeded +else + STRIP_OPTS = -x +endif + + +reduced-image-jre:: + @$(ECHO) Starting to Produce Reduced JRE + @# + @# First make a copy of the full JRE + @# + $(RM) -r $(JRE_REDUCED_IMAGE_DIR) + $(MKDIR) -p $(JRE_REDUCED_IMAGE_DIR) + $(CD) $(JRE_IMAGE_DIR); \ + $(TAR) cf - . | ($(CD) $(JRE_REDUCED_IMAGE_DIR); $(TAR) xf - ); + + @# strip the main .so files + $(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/client/libjvm.so +ifndef BUILD_CLIENT_ONLY + $(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/server/libjvm.so +endif + + @# + @# Remove all of the files that are not needed for the + @# reduced JRE + @# + for l in $(NOT_JREREDUCED_BIN) ; do \ + $(RM) $(JRE_REDUCED_IMAGE_DIR)/bin/$$l ; \ + done + for l in $(NOT_JREREDUCED_LIB) ; do \ + $(RM) $(JRE_REDUCED_IMAGE_DIR)/lib/$$l ; \ + done + + @# Remove misc. other files + $(RM) -r $(JRE_REDUCED_IMAGE_DIR)/man + $(RM) -f $(JRE_REDUCED_IMAGE_DIR)/CHANGES + + @$(ECHO) Done Creating Reduced JRE + +# +# Produce a reduced Headless JRE +# +reduced-headless-image-jre:: $(RT_JAR) $(RESOURCES_JAR) $(BUILD_META_INDEX) $(HL_RT_JAR) + @$(ECHO) Starting to Produce Reduced Headless JRE + @# + @# First make a copy of the reduced JRE we just built + @# + $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR) + $(MKDIR) -p $(JRE_REDUCED_HEADLESS_IMAGE_DIR) + $(CD) $(JRE_REDUCED_IMAGE_DIR); \ + $(TAR) cf - . | ($(CD) $(JRE_REDUCED_HEADLESS_IMAGE_DIR); $(TAR) xf - ); + + @# Replace the full rt.jar with the headless rt.jar + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar + $(CP) $(HL_RT_JAR) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar + + @# + @# Remove all of the files that are not needed for the + @# reduced Headless JRE + @# + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/gtkhelper + $(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libjsoundalsa.so + $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/audio + $(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/applet + $(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/awt_robot + $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/xawt + $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libsplashscreen.so + @# Remove oblique fonts and reduce font support to LucidaSansRegular only + $(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/oblique-fonts + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiBold.ttf + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiItalic.ttf + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightItalic.ttf + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightRegular.ttf + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaSansDemiBold.ttf + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterBold.ttf + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterRegular.ttf + +ifeq ($(PLATFORM), linux) +# put out minimal fonts.dir file for the remaining font + $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + $(ECHO) 6>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-2">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-4">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-5">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-7">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-9">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir + +endif # Linux + + @# + @# all done with JRE reduced headless image + @# + + @$(ECHO) Done Creating Reduced Headless JRE + +images-clobber:: + $(RM) -r $(JRE_REDUCED_IMAGE_DIR) + $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR) + +.PHONY: reduced-image-jre reduced-headless-image-jre + +endif # JAVASE_EMBEDDED + diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk index b2d105b3f2e..d528fc5c7a9 100644 --- a/jdk/make/common/Release.gmk +++ b/jdk/make/common/Release.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -38,7 +38,7 @@ THIS_JDK_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSIO IMAGE_BINDIR = bin -# The compiler should not issue a "Sun Propietary" warning when compiling +# The compiler should not issue a "Proprietary" warning when compiling # classes in the com.sun.java.swing.plaf packages, since we've always # allowed, and even advocated, extending them (see bug 6476749). # @@ -205,6 +205,16 @@ if [ "$(JA_DIRNAME)" != "" ] ; then \ fi endef + +# no compression unless requested +ifndef COMPRESS_JARS + CREATE_JAR_OPTS = c0mf + CREATE_JAR_OPTS_NOMANIFEST = c0f +else + CREATE_JAR_OPTS = cmf + CREATE_JAR_OPTS_NOMANIFEST = cf +endif + # # Targets. # @@ -232,7 +242,7 @@ images:: sanity-images post-sanity-images \ $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \ trim-image-jre trim-image-jdk \ identify-image-jre identify-image-jdk \ - process-image-jre process-image-jdk sec-files sec-files-win jgss-files + process-image-jre process-image-jdk sec-files sec-files-win jgss-files # Don't use these image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre @@ -623,7 +633,7 @@ RESOURCES_JAR=$(ABS_TEMPDIR)/resources-orig.jar $(RESOURCES_JAR): $(RES_JAR_FILELIST) $(JAR_MANIFEST_FILE) $(prep-target) $(CD) $(CLASSBINDIR) && \ - $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ + $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \ @$(RES_JAR_FILELIST) $(BOOT_JAR_JFLAGS) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) @@ -632,7 +642,7 @@ JSSE_JAR=$(ABS_TEMPDIR)/jsse-orig.jar $(JSSE_JAR): $(JAR_MANIFEST_FILE) $(prep-target) $(CD) $(CLASSBINDIR) && \ - $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ + $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \ $(JSSE_CLASSES_DIRS) $(BOOT_JAR_JFLAGS) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) @@ -679,7 +689,7 @@ RT_JAR=$(ABS_TEMPDIR)/rt-orig.jar $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE) $(prep-target) $(CD) $(CLASSBINDIR) && \ - $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \ + $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \ @$(RT_JAR_FILELIST) $(BOOT_JAR_JFLAGS) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) @@ -687,6 +697,10 @@ $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE) BUILDMETAINDEX_JARFILE = $(ABS_BUILDTOOLJARDIR)/buildmetaindex.jar +# SE-Embedded targets if enabled +include $(JDK_TOPDIR)/make/common/Release-embedded.gmk + + ###################################################### # JRE Image ###################################################### @@ -939,7 +953,7 @@ initial-image-jdk:: initial-image-jdk-setup \ @# lib/tools.jar @# $(CD) $(CLASSBINDIR) && \ - $(BOOT_JAR_CMD) c0f $(ABS_LIBDIR)/tools.jar \ + $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(ABS_LIBDIR)/tools.jar \ $(TOOLS) $(BOOT_JAR_JFLAGS) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) $(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar @@ -952,7 +966,7 @@ initial-image-jdk:: initial-image-jdk-setup \ -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \ -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \ $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS) - $(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \ + $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(LIBDIR)/ct.sym \ -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS) @$(java-vm-cleanup) $(CP) $(LIBDIR)/ct.sym $(JDK_IMAGE_DIR)/lib/ct.sym diff --git a/jdk/make/common/shared/Sanity-Settings.gmk b/jdk/make/common/shared/Sanity-Settings.gmk index 0184a74792d..36179fed5fd 100644 --- a/jdk/make/common/shared/Sanity-Settings.gmk +++ b/jdk/make/common/shared/Sanity-Settings.gmk @@ -185,7 +185,9 @@ ifeq ($(PLATFORM),windows) endif endif ifeq ($(PLATFORM),linux) - ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION) + ifdef REQUIRED_ALSA_VERSION + ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION) + endif endif ALL_SETTINGS+=$(call addRequiredVersionSetting,OS_VERSION) ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_NAME) diff --git a/jdk/make/java/zip/Makefile b/jdk/make/java/zip/Makefile index fd83ea3f282..906e7e85096 100644 --- a/jdk/make/java/zip/Makefile +++ b/jdk/make/java/zip/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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 @@ -50,7 +50,10 @@ FILES_export = \ java/util/jar/JarFile.java ifneq ($(PLATFORM), windows) -OTHER_CFLAGS += -DUSE_MMAP + # Use mmap unless explicitly disallowed + ifneq ($(LIBZIP_CAN_USE_MMAP),false) + OTHER_CFLAGS += -DUSE_MMAP + endif endif # diff --git a/jdk/make/sun/nio/cs/Makefile b/jdk/make/sun/nio/cs/Makefile index eeddbb03120..d60d8a528d5 100644 --- a/jdk/make/sun/nio/cs/Makefile +++ b/jdk/make/sun/nio/cs/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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 @@ -120,8 +120,15 @@ $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH) $(install-file) +# no compression unless requested +ifndef COMPRESS_JARS + CREATE_JAR_OPTS_NOMANIFEST = cf0 +else + CREATE_JAR_OPTS_NOMANIFEST = cf +endif + $(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT) - $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \ + $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(CHARSETS_JAR) \ -C $(CLASSDESTDIR) sun \ -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \ $(BOOT_JAR_JFLAGS) diff --git a/jdk/src/share/classes/sun/misc/Version.java.template b/jdk/src/share/classes/sun/misc/Version.java.template index 974526a915e..62babae1008 100644 --- a/jdk/src/share/classes/sun/misc/Version.java.template +++ b/jdk/src/share/classes/sun/misc/Version.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 @@ -36,8 +36,8 @@ public class Version { "@@java_version@@"; private static final String java_runtime_name = - "@@java_runtime_name@@"; - + "@@java_runtime_name@@"; + private static final String java_runtime_version = "@@java_runtime_version@@"; @@ -87,12 +87,26 @@ public class Version { * Give a stream, it will print version info on it. */ public static void print(PrintStream ps) { + boolean isHeadless = false; + + /* Report that we're running headless if the property is true */ + String headless = System.getProperty("java.awt.headless"); + if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) { + isHeadless = true; + } + /* First line: platform version. */ ps.println(launcher_name + " version \"" + java_version + "\""); /* Second line: runtime version (ie, libraries). */ - ps.println(java_runtime_name + " (build " + - java_runtime_version + ")"); + + ps.print(java_runtime_name + " (build " + java_runtime_version); + + if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) { + // embedded builds report headless state + ps.print(", headless"); + } + ps.println(')'); /* Third line: JVM information. */ String java_vm_name = System.getProperty("java.vm.name"); From 881add500f88967c43ecd73c4992cbbdb8b2eac7 Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Tue, 22 Mar 2011 18:32:41 -0700 Subject: [PATCH 016/168] 7025314: NLS: translatability violation on standard.properties Reviewed-by: jjg --- .../formats/html/markup/HtmlWriter.java | 6 +- .../html/resources/standard.properties | 71 +++++-------------- .../internal/toolkit/resources/stylesheet.css | 6 +- .../testJavascript/TestJavascript.java | 8 +-- .../testNavagation/TestNavagation.java | 20 +++--- .../TestNewLanguageFeatures.java | 14 ++-- 6 files changed, 46 insertions(+), 79 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java index 0ebd587f094..166f9ef8c1a 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -188,8 +188,8 @@ public class HtmlWriter extends PrintWriter { nextclassLabel = getResource("doclet.Next_Class"); summaryLabel = getResource("doclet.Summary"); detailLabel = getResource("doclet.Detail"); - framesLabel = getResource("doclet.FRAMES"); - noframesLabel = getResource("doclet.NO_FRAMES"); + framesLabel = getResource("doclet.Frames"); + noframesLabel = getResource("doclet.No_Frames"); treeLabel = getResource("doclet.Tree"); classLabel = getResource("doclet.Class"); deprecatedLabel = getResource("doclet.navDeprecated"); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties index b59771f2c42..c645c10a608 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties @@ -11,54 +11,30 @@ doclet.Window_Class_Hierarchy=Class Hierarchy doclet.Interface_Hierarchy=Interface Hierarchy doclet.Enum_Hierarchy=Enum Hierarchy doclet.Annotation_Type_Hierarchy=Annotation Type Hierarchy -# The following ALL CAPS words should be translated. It is used as "Previous" link on javadoc. -doclet.Prev=PREV -# The following ALL CAPS words should be translated. It is used as "Next" link on javadoc. -doclet.Next=NEXT -# The following ALL CAPS words should be translated. It is used as "Previous Class" link on javadoc. -doclet.Prev_Class=PREV CLASS -# The following ALL CAPS words should be translated. It is used as "Next Class" link on javadoc. -doclet.Next_Class=NEXT CLASS -# The following ALL CAPS words should be translated. It is used as "Previous Package" link on javadoc. -doclet.Prev_Package=PREV PACKAGE -# The following ALL CAPS words should be translated. It is used as "Next Package" link on javadoc. -doclet.Next_Package=NEXT PACKAGE -# The following ALL CAPS words should be translated. It is used as "Previous Letter" link on javadoc alphabetical index. -doclet.Prev_Letter=PREV LETTER -# The following ALL CAPS words should be translated. It is used as "Next Letter" link on javadoc alphabetical index. -doclet.Next_Letter=NEXT LETTER -# The following ALL CAPS words should be translated. It is used as "Show List" link on javadoc. -doclet.Show_Lists=SHOW LISTS -# The following ALL CAPS words should be translated. It is used as "Hide List" link on javadoc. -doclet.Hide_Lists=HIDE LISTS +doclet.Prev=Prev +doclet.Next=Next +doclet.Prev_Class=Prev Class +doclet.Next_Class=Next Class +doclet.Prev_Package=Prev Package +doclet.Next_Package=Next Package +doclet.Prev_Letter=Prev Letter +doclet.Next_Letter=Next Letter doclet.Href_Class_Title=class in {0} doclet.Href_Interface_Title=interface in {0} doclet.Href_Annotation_Title=annotation in {0} doclet.Href_Enum_Title=enum in {0} doclet.Href_Type_Param_Title=type parameter in {0} doclet.Href_Class_Or_Interface_Title=class or interface in {0} -# The following ALL CAPS words should be translated. It's used as SUMMARY: NESTED | FIELD | CONSTR | METHOD, meaning Nested Class Summary, Field Summary, Constructor Summary, or Method Summary. -doclet.Summary=SUMMARY: -# The following ALL CAPS words should be translated. It is used as DETAIL: FIELD | CONSTR | METHOD, meaning Field Detail, Constructor Detail, or Method Detail. -doclet.Detail=DETAIL: -# The following ALL CAPS words should be translated. It is used as "Nested" (Nested Class Summary) link on javadoc. -doclet.navNested=NESTED -# The following ALL CAPS words should be translated. It is used as "Optional" (Optional Element Summary) link on javadoc. -doclet.navAnnotationTypeOptionalMember=OPTIONAL -# The following ALL CAPS words should be translated. It is used as "Required" (Required Element Summary) link on javadoc. -doclet.navAnnotationTypeRequiredMember=REQUIRED -# The following ALL CAPS words should be translated. It is used as "Element" (Required Element Summary) link on javadoc. -doclet.navAnnotationTypeMember=ELEMENT -# The following ALL CAPS words should be translated. It is used as "Field" (Field Detail) link on javadoc. -doclet.navField=FIELD -# The following ALL CAPS words should be translated. It is used as "Enum Constants" link on javadoc. -doclet.navEnum=ENUM CONSTANTS -# The following ALL CAPS words should be translated. It is used as "Constructor" (Constructor Detail) link on javadoc. -doclet.navConstructor=CONSTR -# The following ALL CAPS words should be translated. It is used as "Method" (Method Detail) link on javadoc. -doclet.navMethod=METHOD -# The following resource does not seem to be used anymore. -doclet.navFactoryMethod=FACTORY +doclet.Summary=Summary: +doclet.Detail=Detail: +doclet.navNested=Nested +doclet.navAnnotationTypeOptionalMember=Optional +doclet.navAnnotationTypeRequiredMember=Required +doclet.navAnnotationTypeMember=Element +doclet.navField=Field +doclet.navEnum=Enum Constants +doclet.navConstructor=Constr +doclet.navMethod=Method doclet.Index=Index doclet.Window_Single_Index=Index doclet.Window_Split_Index={0}-Index @@ -66,12 +42,6 @@ doclet.Help=Help doclet.Skip_navigation_links=Skip navigation links doclet.New_Page=NewPage doclet.None=None -# The following resource does not seem to be used anymore -doclet.CLASSES=CLASSES -# The following resource does not seem to be used anymore -doclet.MEMBERS=MEMBERS -# The following resource does not seem to be used anymore -doclet.NONE=NONE doclet.Factory_Method_Detail=Static Factory Method Detail doclet.navDeprecated=Deprecated doclet.Deprecated_List=Deprecated List @@ -136,10 +106,7 @@ doclet.also=also doclet.Option=Option doclet.Or=Or doclet.Frames=Frames -# The following ALL CAPS words should be translated. It is used as "FRAMES" javadoc navigation link to indicate displaying the page with HTML frames. -doclet.FRAMES=FRAMES -# The following ALL CAPS words should be translated. It is used as "NO FRAMES" javadoc navigation link to indicate displaying the page without HTML frames. -doclet.NO_FRAMES=NO FRAMES +doclet.No_Frames=No Frames doclet.Package_Hierarchies=Package Hierarchies: doclet.Hierarchy_For_Package=Hierarchy For Package {0} doclet.Source_Code=Source Code: diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css index 73bab366e70..1f8fd6a2eaa 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css @@ -142,19 +142,19 @@ ul.navList li.navBarCell1Rev { .subNav ul.navList { float:left; margin:0; - font-size:0.7em; + font-size:0.8em; width:350px; } ul.subNavList { float:left; margin:0; - font-size:0.7em; + font-size:0.8em; width:350px; } ul.subNavList li{ list-style:none; float:left; - font-size:90%; + font-size:98%; } /* Page header and footer styles diff --git a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java index 54deaad0bc7..b1293bf2919 100644 --- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java +++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4665566 4855876 + * @bug 4665566 4855876 7025314 * @summary Verify that the output has the right javascript. * @author jamieh * @library ../lib/ @@ -45,9 +45,9 @@ public class TestJavascript extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "C.html", - "FRAMES"}, + "Frames"}, {BUG_ID + FS + "TestJavascript.html", - "FRAMES"}, + "Frames"}, {BUG_ID + FS + "index.html", " + show-javadoc + + + + debug + + + + compile-selected + + includes + ${src.dir} + \.java$ + relative-path + + , + + + + + run + + main.class + ${src.dir} + \.java$ + java-name + + + + + + + + debug + + main.class + ${src.dir} + \.java$ + java-name + + + + + + + + debug-fix + + class + ${src.dir} + \.java$ + relative-path-noext + + + + + + + + jar + ${jar} + jar + clean + + + + + + ${src.dir} + + + ${main.dir}/README.txt + + + + + + + + + + + + + + + + + ${src.dir} + ${cp} + ${run.cp} + ${nbjdk.bootclasspath} + ${classes.dir} + ${jar} + ${javadoc.dir} + 1.5 + + + + From 1273c8e2331cbfb150194a3b73b192de0fc22cb8 Mon Sep 17 00:00:00 2001 From: Jim Holmlund Date: Thu, 24 Mar 2011 11:40:13 -0700 Subject: [PATCH 035/168] 7029823: (ann) test/java/lang/annotation/package-info.java no longer compiles Use @Deprecated instead of @java.lang.annotation.Documented Reviewed-by: jjg, smarks --- jdk/test/java/lang/annotation/PackageMain.java | 6 ++---- jdk/test/java/lang/annotation/package-info.java | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/jdk/test/java/lang/annotation/PackageMain.java b/jdk/test/java/lang/annotation/PackageMain.java index 8b3f727d8c7..5c73a9ebb25 100644 --- a/jdk/test/java/lang/annotation/PackageMain.java +++ b/jdk/test/java/lang/annotation/PackageMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 @@ -21,8 +21,6 @@ * questions. */ -import java.lang.annotation.Documented; - public class PackageMain { public static void main(String[] args) throws Exception { Class c = Class.forName("foo.bar.Baz"); @@ -30,7 +28,7 @@ public class PackageMain { System.out.println("cl=" + c.getClassLoader()); Package p = c.getPackage(); System.out.println("p=" + p); - Documented d = p.getAnnotation(Documented.class); + Deprecated d = p.getAnnotation(Deprecated.class); if (d == null) throw new Error(); } } diff --git a/jdk/test/java/lang/annotation/package-info.java b/jdk/test/java/lang/annotation/package-info.java index f5463672c5c..8b057d87a3d 100644 --- a/jdk/test/java/lang/annotation/package-info.java +++ b/jdk/test/java/lang/annotation/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 @@ -31,7 +31,7 @@ * @run main PackageMain */ -@java.lang.annotation.Documented +@Deprecated package foo.bar; class Baz {} From 4eb4d46567fbebd278508740df88ac5a7debc995 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 24 Mar 2011 21:45:46 +0300 Subject: [PATCH 036/168] 6825739: jdk regression test failing on linux: java/lang/reflect/Method/InheritedMethods.java Reviewed-by: rupashka --- jdk/test/java/lang/reflect/Method/InheritedMethods.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/jdk/test/java/lang/reflect/Method/InheritedMethods.java b/jdk/test/java/lang/reflect/Method/InheritedMethods.java index 9da23d69832..ebfdc0823cd 100644 --- a/jdk/test/java/lang/reflect/Method/InheritedMethods.java +++ b/jdk/test/java/lang/reflect/Method/InheritedMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -23,17 +23,14 @@ /* @test @bug 4471738 - @ignore until 6825739 fixed @summary Failure to properly traverse class hierarchy in Class.getMethod() */ import java.lang.reflect.Method; import java.util.Collection; import java.util.List; -import javax.swing.JPanel; -import javax.swing.JLabel; -public class InheritedMethods extends JPanel { +public class InheritedMethods { public static void main(String[] args) throws Exception { new InheritedMethods(); } InheritedMethods() throws Exception { Class c = Foo.class; @@ -41,7 +38,6 @@ public class InheritedMethods extends JPanel { if (m.getDeclaringClass() != java.util.List.class) { throw new RuntimeException("TEST FAILED"); } - add(new JLabel("Test")); } interface Foo extends List { } } From 7be50d11b146bdffd2d43b1b7acb5fc64c6a02b9 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 24 Mar 2011 16:14:30 -0700 Subject: [PATCH 037/168] 6597678: JavaCompiler.getStandardFileManager always uses default charset not the one that user specifies Reviewed-by: mcimadamore --- .../sun/tools/javac/api/JavacTaskImpl.java | 2 +- .../com/sun/tools/javac/api/JavacTool.java | 11 +- .../JavacProcessingEnvironment.java | 7 +- .../sun/tools/javac/util/JavacMessages.java | 15 ++- langtools/test/tools/javac/util/T6597678.java | 105 ++++++++++++++++++ 5 files changed, 130 insertions(+), 10 deletions(-) create mode 100644 langtools/test/tools/javac/util/T6597678.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java index 17f894a09a0..9a756e2007e 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java @@ -187,7 +187,7 @@ public class JavacTaskImpl extends JavacTask { if (taskListener != null) context.put(TaskListener.class, wrap(taskListener)); //initialize compiler's default locale - JavacMessages.instance(context).setCurrentLocale(locale); + context.put(Locale.class, locale); } // where private TaskListener wrap(final TaskListener tl) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java index 23405f6e1d4..5f46cadc715 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java @@ -28,8 +28,10 @@ package com.sun.tools.javac.api; import java.io.File; import java.io.InputStream; import java.io.OutputStream; +import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; @@ -49,10 +51,8 @@ import com.sun.tools.javac.main.RecognizedOptions.GrumpyHelper; import com.sun.tools.javac.main.RecognizedOptions; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Log; -import com.sun.tools.javac.util.JavacMessages; import com.sun.tools.javac.util.Options; import com.sun.tools.javac.util.Pair; -import java.nio.charset.Charset; /** * TODO: describe com.sun.tools.javac.api.Tool @@ -145,10 +145,13 @@ public final class JavacTool implements JavaCompiler { Locale locale, Charset charset) { Context context = new Context(); - JavacMessages.instance(context).setCurrentLocale(locale); + context.put(Locale.class, locale); if (diagnosticListener != null) context.put(DiagnosticListener.class, diagnosticListener); - context.put(Log.outKey, new PrintWriter(System.err, true)); // FIXME + PrintWriter pw = (charset == null) + ? new PrintWriter(System.err, true) + : new PrintWriter(new OutputStreamWriter(System.err, charset), true); + context.put(Log.outKey, pw); return new JavacFileManager(context, true, charset); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index e83c477b2af..fcd80af41c0 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -34,8 +34,8 @@ import java.io.Closeable; import java.io.File; import java.io.PrintWriter; import java.io.IOException; -import java.net.MalformedURLException; import java.io.StringWriter; +import java.net.MalformedURLException; import javax.annotation.processing.*; import javax.lang.model.SourceVersion; @@ -1061,6 +1061,11 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea PrintWriter out = context.get(Log.outKey); Assert.checkNonNull(out); next.put(Log.outKey, out); + Locale locale = context.get(Locale.class); + if (locale != null) + next.put(Locale.class, locale); + Assert.checkNonNull(messages); + next.put(JavacMessages.messagesKey, messages); final boolean shareNames = true; if (shareNames) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java index 0ec0ffea9d7..dbd699365a8 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 @@ -44,7 +44,7 @@ import java.util.Map; */ public class JavacMessages implements Messages { /** The context key for the JavacMessages object. */ - protected static final Context.Key messagesKey = + public static final Context.Key messagesKey = new Context.Key(); /** Get the JavacMessages instance for this context. */ @@ -77,7 +77,7 @@ public class JavacMessages implements Messages { /** Creates a JavacMessages object. */ public JavacMessages(Context context) { - this(defaultBundleName); + this(defaultBundleName, context.get(Locale.class)); context.put(messagesKey, this); } @@ -85,10 +85,17 @@ public class JavacMessages implements Messages { * @param bundleName the name to identify the resource buundle of localized messages. */ public JavacMessages(String bundleName) throws MissingResourceException { + this(bundleName, null); + } + + /** Creates a JavacMessages object. + * @param bundleName the name to identify the resource buundle of localized messages. + */ + public JavacMessages(String bundleName, Locale locale) throws MissingResourceException { bundleNames = List.nil(); bundleCache = new HashMap>>(); add(bundleName); - setCurrentLocale(Locale.getDefault()); + setCurrentLocale(locale); } public JavacMessages() throws MissingResourceException { diff --git a/langtools/test/tools/javac/util/T6597678.java b/langtools/test/tools/javac/util/T6597678.java new file mode 100644 index 00000000000..81cadbcc942 --- /dev/null +++ b/langtools/test/tools/javac/util/T6597678.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 6597678 + * @summary Ensure Messages propogated between rounds + * @library ../lib + * @build JavacTestingAbstractProcessor T6597678 + * @run main T6597678 + */ + +import java.io.*; +import java.util.*; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedOptions; +import javax.lang.model.element.TypeElement; +import javax.tools.Diagnostic; + + +import com.sun.tools.javac.processing.JavacProcessingEnvironment; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.JavacMessages; + +public class T6597678 extends JavacTestingAbstractProcessor { + public static void main(String... args) throws Exception { + new T6597678().run(); + } + + + void run() throws Exception { + String myName = T6597678.class.getSimpleName(); + File testSrc = new File(System.getProperty("test.src")); + File file = new File(testSrc, myName + ".java"); + + compile( + "-proc:only", + "-processor", myName, + file.getPath()); + } + + void compile(String... args) throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + int rc = com.sun.tools.javac.Main.compile(args, pw); + pw.close(); + String out = sw.toString(); + if (!out.isEmpty()) + System.err.println(out); + if (rc != 0) + throw new Exception("compilation failed unexpectedly: rc=" + rc); + } + + //--------------- + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + Context context = ((JavacProcessingEnvironment) processingEnv).getContext(); + Locale locale = context.get(Locale.class); + JavacMessages messages = context.get(JavacMessages.messagesKey); + + round++; + if (round == 1) { + initialLocale = locale; + initialMessages = messages; + } else { + checkEqual("locale", locale, initialLocale); + checkEqual("messages", messages, initialMessages); + } + + return true; + } + + void checkEqual(String label, T actual, T expected) { + if (actual != expected) + messager.printMessage(Diagnostic.Kind.ERROR, + "Unexpected value for " + label + + "; expected: " + expected + + "; found: " + actual); + } + + int round = 0; + Locale initialLocale; + JavacMessages initialMessages; +} From 3d3e0d5f7f382266aae1f7780c697af089ed7bbf Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Thu, 24 Mar 2011 17:26:40 -0700 Subject: [PATCH 038/168] 7029680: fix test/sun/misc/Version/Version.java build parsing Reviewed-by: ohair --- jdk/test/sun/misc/Version/Version.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/jdk/test/sun/misc/Version/Version.java b/jdk/test/sun/misc/Version/Version.java index 6e7d3626d9f..16ecd1ea9c8 100644 --- a/jdk/test/sun/misc/Version/Version.java +++ b/jdk/test/sun/misc/Version/Version.java @@ -142,15 +142,21 @@ public class Version { // non-product VM will have -debug|-release appended cs = cs.subSequence(1, cs.length()); String[] res = cs.toString().split("-"); - for (String s : res) { + for (int i = res.length - 1; i >= 0; i--) { + String s = res[i]; if (s.charAt(0) == 'b') { - build = - Integer.valueOf(s.substring(1, s.length())).intValue(); - break; + try { + build = Integer.parseInt(s.substring(1, s.length())); + break; + } catch (NumberFormatException nfe) { + // ignore + } } } } } - return new VersionInfo(major, minor, micro, update, special, build); + VersionInfo vi = new VersionInfo(major, minor, micro, update, special, build); + System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi); + return vi; } } From f7860d24d94cce31d597b16720e6083579b9cd30 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Fri, 25 Mar 2011 11:58:30 +0800 Subject: [PATCH 039/168] 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build Reviewed-by: mullan --- .../classes/java/util/jar/JarVerifier.java | 6 +++ .../security/util/ManifestEntryVerifier.java | 3 +- jdk/test/java/util/jar/JarFile/MevNPE.java | 45 +++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 jdk/test/java/util/jar/JarFile/MevNPE.java diff --git a/jdk/src/share/classes/java/util/jar/JarVerifier.java b/jdk/src/share/classes/java/util/jar/JarVerifier.java index abbb85e3768..4f84ac28eff 100644 --- a/jdk/src/share/classes/java/util/jar/JarVerifier.java +++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java @@ -415,6 +415,12 @@ class JarVerifier { pendingBlocks = null; signerCache = null; manDig = null; + // MANIFEST.MF is always treated as signed and verified, + // move its signers from sigFileSigners to verifiedSigners. + if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) { + verifiedSigners.put(JarFile.MANIFEST_NAME, + sigFileSigners.remove(JarFile.MANIFEST_NAME)); + } } static class VerifierStream extends java.io.InputStream { diff --git a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java index 3bcc18a7456..9eee5421da5 100644 --- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java +++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java @@ -195,8 +195,7 @@ public class ManifestEntryVerifier { Hashtable sigFileSigners) throws JarException { - // MANIFEST.MF should not be skipped. It has signers. - if (skip && !entry.getName().equals(JarFile.MANIFEST_NAME)) { + if (skip) { return null; } diff --git a/jdk/test/java/util/jar/JarFile/MevNPE.java b/jdk/test/java/util/jar/JarFile/MevNPE.java new file mode 100644 index 00000000000..f8627d33324 --- /dev/null +++ b/jdk/test/java/util/jar/JarFile/MevNPE.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 7023056 + * @summary NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build + */ +import java.io.*; +import java.util.jar.*; + +public class MevNPE { + public static void main(String[] args) throws Exception { + File f = new File(System.getProperty("test.src", "."), "Signed.jar"); + try (JarFile jf = new JarFile(f, true)) { + try (InputStream s1 = jf.getInputStream( + jf.getJarEntry(JarFile.MANIFEST_NAME))) { + s1.read(new byte[10000]); + }; + try (InputStream s2 = jf.getInputStream( + jf.getJarEntry(JarFile.MANIFEST_NAME))) { + s2.read(new byte[10000]); + }; + } + } +} From 4171ca786ea2f80aa0bd834719ab6a784b8eaab3 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Fri, 25 Mar 2011 09:35:39 +0100 Subject: [PATCH 040/168] 7029017: Additional architecture support for c2 compiler Enables cross building of a c2 VM. Support masking of shift counts when the processor architecture mandates it. Reviewed-by: kvn, never --- hotspot/make/linux/makefiles/adlc.make | 6 ++-- hotspot/make/linux/makefiles/gcc.make | 4 +++ hotspot/make/linux/makefiles/rules.make | 8 ++++++ hotspot/make/linux/makefiles/sparcWorks.make | 3 ++ hotspot/src/cpu/sparc/vm/sparc.ad | 4 +++ hotspot/src/cpu/x86/vm/x86_32.ad | 4 +++ hotspot/src/cpu/x86/vm/x86_64.ad | 4 +++ hotspot/src/share/vm/adlc/main.cpp | 5 ++++ hotspot/src/share/vm/opto/chaitin.cpp | 2 +- hotspot/src/share/vm/opto/compile.cpp | 30 ++++++++++++++++++++ hotspot/src/share/vm/opto/lcm.cpp | 3 ++ hotspot/src/share/vm/opto/matcher.cpp | 3 ++ hotspot/src/share/vm/opto/matcher.hpp | 5 ++++ 13 files changed, 77 insertions(+), 4 deletions(-) diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make index 84ff8f88c58..0c15c1c6589 100644 --- a/hotspot/make/linux/makefiles/adlc.make +++ b/hotspot/make/linux/makefiles/adlc.make @@ -102,7 +102,7 @@ all: $(EXEC) $(EXEC) : $(OBJECTS) @echo Making adlc - $(QUIETLY) $(LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS) + $(QUIETLY) $(HOST.LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS) # Random dependencies: $(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp @@ -204,14 +204,14 @@ PROCESS_AD_FILES = awk '{ \ $(OUTDIR)/%.o: %.cpp @echo Compiling $< $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE) + $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE) # Some object files are given a prefix, to disambiguate # them from objects of the same name built for the VM. $(OUTDIR)/adlc-%.o: %.cpp @echo Compiling $< $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE) + $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE) # ######################################################################### diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make index 04c407bce9e..28105c41a1a 100644 --- a/hotspot/make/linux/makefiles/gcc.make +++ b/hotspot/make/linux/makefiles/gcc.make @@ -30,9 +30,13 @@ ifdef CROSS_COMPILE_ARCH CPP = $(ALT_COMPILER_PATH)/g++ CC = $(ALT_COMPILER_PATH)/gcc +HOSTCPP = g++ +HOSTCC = gcc else CPP = g++ CC = gcc +HOSTCPP = $(CPP) +HOSTCC = $(CC) endif AS = $(CC) -c diff --git a/hotspot/make/linux/makefiles/rules.make b/hotspot/make/linux/makefiles/rules.make index 4237597e986..12eafe8b3f4 100644 --- a/hotspot/make/linux/makefiles/rules.make +++ b/hotspot/make/linux/makefiles/rules.make @@ -55,6 +55,14 @@ LINK_NOPROF.CC = $(CCC) $(LFLAGS) $(AOUT_FLAGS) LINK_LIB.CC = $(CCC) $(LFLAGS) $(SHARED_FLAG) PREPROCESS.CC = $(CC_COMPILE) -E +# cross compiling the jvm with c2 requires host compilers to build +# adlc tool + +HOST.CC_COMPILE = $(HOSTCPP) $(CPPFLAGS) $(CFLAGS) +HOST.COMPILE.CC = $(HOST.CC_COMPILE) -c +HOST.LINK_NOPROF.CC = $(HOSTCPP) $(LFLAGS) $(AOUT_FLAGS) + + # Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k". REMOVE_TARGET = rm -f $@ diff --git a/hotspot/make/linux/makefiles/sparcWorks.make b/hotspot/make/linux/makefiles/sparcWorks.make index 77076fff16c..818ef42b088 100644 --- a/hotspot/make/linux/makefiles/sparcWorks.make +++ b/hotspot/make/linux/makefiles/sparcWorks.make @@ -29,6 +29,9 @@ CPP = CC CC = cc AS = $(CC) -c +HOSTCPP = $(CPP) +HOSTCC = $(CC) + ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) ARCHFLAG/i486 = -m32 ARCHFLAG/amd64 = -m64 diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index cffc8fb5f7f..f2d7656d38c 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -1843,6 +1843,10 @@ const int Matcher::init_array_short_size = 8 * BytesPerLong; // registers? True for Intel but false for most RISCs const bool Matcher::clone_shift_expressions = false; +// Do we need to mask the count passed to shift instructions or does +// the cpu only look at the lower 5/6 bits anyway? +const bool Matcher::need_masked_shift_count = false; + bool Matcher::narrow_oop_use_complex_address() { NOT_LP64(ShouldNotCallThis()); assert(UseCompressedOops, "only for compressed oops code"); diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index 6fdb24f931e..e9cf81147b7 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -1393,6 +1393,10 @@ const int Matcher::init_array_short_size = 8 * BytesPerLong; // registers? True for Intel but false for most RISCs const bool Matcher::clone_shift_expressions = true; +// Do we need to mask the count passed to shift instructions or does +// the cpu only look at the lower 5/6 bits anyway? +const bool Matcher::need_masked_shift_count = false; + bool Matcher::narrow_oop_use_complex_address() { ShouldNotCallThis(); return true; diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 2466269c6bd..b0835d208de 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -2000,6 +2000,10 @@ const int Matcher::init_array_short_size = 8 * BytesPerLong; // into registers? True for Intel but false for most RISCs const bool Matcher::clone_shift_expressions = true; +// Do we need to mask the count passed to shift instructions or does +// the cpu only look at the lower 5/6 bits anyway? +const bool Matcher::need_masked_shift_count = false; + bool Matcher::narrow_oop_use_complex_address() { assert(UseCompressedOops, "only for compressed oops code"); return (LogMinObjAlignmentInBytes <= 3); diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp index 3d74a4f02f9..88a75e684b1 100644 --- a/hotspot/src/share/vm/adlc/main.cpp +++ b/hotspot/src/share/vm/adlc/main.cpp @@ -239,6 +239,11 @@ int main(int argc, char *argv[]) AD.addInclude(AD._CPP_file, "assembler_sparc.inline.hpp"); AD.addInclude(AD._CPP_file, "nativeInst_sparc.hpp"); AD.addInclude(AD._CPP_file, "vmreg_sparc.inline.hpp"); +#endif +#ifdef TARGET_ARCH_arm + AD.addInclude(AD._CPP_file, "assembler_arm.inline.hpp"); + AD.addInclude(AD._CPP_file, "nativeInst_arm.hpp"); + AD.addInclude(AD._CPP_file, "vmreg_arm.inline.hpp"); #endif AD.addInclude(AD._HPP_file, "memory/allocation.hpp"); AD.addInclude(AD._HPP_file, "opto/machnode.hpp"); diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp index 6108084f9d0..3c363e9ffaf 100644 --- a/hotspot/src/share/vm/opto/chaitin.cpp +++ b/hotspot/src/share/vm/opto/chaitin.cpp @@ -673,7 +673,7 @@ void PhaseChaitin::gather_lrg_masks( bool after_aggressive ) { case Op_RegD: lrg.set_num_regs(2); // Define platform specific register pressure -#ifdef SPARC +#if defined(SPARC) || defined(ARM) lrg.set_reg_pressure(2); #elif defined(IA32) if( ireg == Op_RegL ) { diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index c9e04bb7a3e..39bcf30bd77 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -2544,6 +2544,36 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc ) { frc.inc_inner_loop_count(); } break; + case Op_LShiftI: + case Op_RShiftI: + case Op_URShiftI: + case Op_LShiftL: + case Op_RShiftL: + case Op_URShiftL: + if (Matcher::need_masked_shift_count) { + // The cpu's shift instructions don't restrict the count to the + // lower 5/6 bits. We need to do the masking ourselves. + Node* in2 = n->in(2); + juint mask = (n->bottom_type() == TypeInt::INT) ? (BitsPerInt - 1) : (BitsPerLong - 1); + const TypeInt* t = in2->find_int_type(); + if (t != NULL && t->is_con()) { + juint shift = t->get_con(); + if (shift > mask) { // Unsigned cmp + Compile* C = Compile::current(); + n->set_req(2, ConNode::make(C, TypeInt::make(shift & mask))); + } + } else { + if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) { + Compile* C = Compile::current(); + Node* shift = new (C, 3) AndINode(in2, ConNode::make(C, TypeInt::make(mask))); + n->set_req(2, shift); + } + } + if (in2->outcnt() == 0) { // Remove dead node + in2->disconnect_inputs(NULL); + } + } + break; default: assert( !n->is_Call(), "" ); assert( !n->is_Mem(), "" ); diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index 3d84f6baf76..fd3343c3c71 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -42,6 +42,9 @@ #ifdef TARGET_ARCH_MODEL_zero # include "adfiles/ad_zero.hpp" #endif +#ifdef TARGET_ARCH_MODEL_arm +# include "adfiles/ad_arm.hpp" +#endif // Optimization - Graph Style diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 2bd3acd6f15..48ff22d10c9 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -49,6 +49,9 @@ #ifdef TARGET_ARCH_MODEL_zero # include "adfiles/ad_zero.hpp" #endif +#ifdef TARGET_ARCH_MODEL_arm +# include "adfiles/ad_arm.hpp" +#endif OptoReg::Name OptoReg::c_frame_pointer; diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp index c1627c60f50..e8d3c99f853 100644 --- a/hotspot/src/share/vm/opto/matcher.hpp +++ b/hotspot/src/share/vm/opto/matcher.hpp @@ -427,6 +427,11 @@ public: // Do ints take an entire long register or just half? static const bool int_in_long; + // Do the processor's shift instructions only use the low 5/6 bits + // of the count for 32/64 bit ints? If not we need to do the masking + // ourselves. + static const bool need_masked_shift_count; + // This routine is run whenever a graph fails to match. // If it returns, the compiler should bailout to interpreter without error. // In non-product mode, SoftMatchFailure is false to detect non-canonical From 6d3c3c71dc86155b7e9fe03e3ff4602337bf148f Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Fri, 25 Mar 2011 12:50:59 +0300 Subject: [PATCH 041/168] 6989717: media native code compiler warnings Reviewed-by: jgodinez, prr --- .../sun/awt/medialib/mlib_ImageAffine.c | 6 +++ .../sun/awt/medialib/mlib_ImageAffineEdge.c | 49 ++++++++++++++++++- .../awt/medialib/mlib_ImageColorTrue2Index.c | 14 +++--- .../sun/awt/medialib/mlib_ImageConvMxN.c | 18 +++++++ .../sun/awt/medialib/mlib_ImageConv_16ext.c | 8 +-- .../sun/awt/medialib/mlib_ImageConv_16nw.c | 8 +-- .../sun/awt/medialib/mlib_ImageConv_32nw.c | 2 +- .../sun/awt/medialib/mlib_ImageConv_8ext.c | 8 +-- .../sun/awt/medialib/mlib_ImageConv_8nw.c | 8 +-- .../sun/awt/medialib/mlib_ImageConv_D64nw.c | 4 +- .../sun/awt/medialib/mlib_ImageConv_F32nw.c | 2 +- .../sun/awt/medialib/mlib_ImageConv_u16ext.c | 8 +-- .../sun/awt/medialib/mlib_ImageConv_u16nw.c | 8 +-- .../sun/awt/medialib/mlib_ImageCopy_Bit.c | 8 +-- .../sun/awt/medialib/mlib_ImageCreate.c | 4 +- 15 files changed, 111 insertions(+), 44 deletions(-) diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c index e0f47978490..18f997325ee 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c @@ -210,6 +210,8 @@ mlib_status mlib_ImageAffine_alltypes(mlib_image *dst, t_ind = 4; else if (type == MLIB_DOUBLE) t_ind = 5; + else + return MLIB_FAILURE; /* unknown image type */ if (colormap != NULL && filter != MLIB_NEAREST) { if (t_ind != 0 && t_ind != 1) @@ -318,6 +320,10 @@ mlib_status mlib_ImageAffine_alltypes(mlib_image *dst, } break; + + default: + /* nothing to do for other edge types. */ + break; } if (param_e->buff_malloc != NULL) diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c index 5a8e209a0e0..cb06dee4d12 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c @@ -616,6 +616,9 @@ void mlib_ImageAffineEdgeZero(mlib_affine_param *param, MLIB_PROCESS_EDGES_ZERO(mlib_d64); break; } + default: + /* Image type MLIB_BIT is not used in java, so we can ignore it. */ + break; } } @@ -643,6 +646,9 @@ void mlib_ImageAffineEdgeNearest(mlib_affine_param *param, case MLIB_DOUBLE: MLIB_PROCESS_EDGES(MLIB_EDGE_NEAREST_LINE, mlib_d64); break; + default: + /* Image type MLIB_BIT is not used in java, so we can ignore it. */ + break; } } @@ -673,8 +679,11 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param, if (ltype == MLIB_BYTE) { buff = mlib_malloc(channels * max_xsize); } - else { + else if (ltype == MLIB_SHORT) { buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16)); + } else { + /* Unsupported type of lookup table. Report a failure */ + return MLIB_FAILURE; } if (buff == NULL) @@ -691,6 +700,9 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param, srcStride >>= 1; MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16); break; + default: + /* Incompatible image type. Ignore it for now. */ + break; } break; @@ -705,9 +717,18 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param, srcStride >>= 1; MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16); break; + default: + /* Incompatible image type. Ignore it for now. */ + break; } break; + default: + /* Unsupported type of lookup table. + * Can not be here due to check on line 685, + * so just ignore it. + */ + break; } mlib_free(buff); @@ -744,6 +765,10 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param, srcStride >>= 3; MLIB_PROCESS_EDGES(MLIB_EDGE_BL, mlib_d64); break; + + default: + /* Image type MLIB_BIT is not supported, ignore it. */ + break; } return MLIB_SUCCESS; @@ -803,8 +828,11 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param, if (ltype == MLIB_BYTE) { buff = mlib_malloc(channels * max_xsize); } - else { + else if (ltype == MLIB_SHORT) { buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16)); + } else { + /* Unsupported type of lookup table. */ + return MLIB_FAILURE; } if (buff == NULL) @@ -821,6 +849,9 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param, srcStride >>= 1; MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16); break; + default: + /* Ignore incomatible image type. */ + break; } break; @@ -835,9 +866,19 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param, srcStride >>= 1; MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16); break; + default: + /* Ignore incomatible image type. */ + break; } break; + + default: + /* Unsupported type of lookup table. + * Can not be here due to check on line 836, + * so just ignore it. + */ + break; } mlib_free(buff); @@ -895,6 +936,10 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param, } break; + + default: + /* Ignore unsupported image type MLIB_BIT */ + break; } return MLIB_SUCCESS; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c index dfe13e20362..375008197e4 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c @@ -2623,9 +2623,10 @@ mlib_status mlib_ImageColorTrue2Index(mlib_image *dst, return MLIB_FAILURE; } } + default: + /* Unsupported type of destination image */ + return MLIB_FAILURE; } - - break; } case MLIB_SHORT: @@ -2678,18 +2679,15 @@ mlib_status mlib_ImageColorTrue2Index(mlib_image *dst, return MLIB_FAILURE; } } + default: + /* Unsupported type of destination image */ + return MLIB_FAILURE; } - - break; } default: return MLIB_FAILURE; } - - /* we need to return something to make Microsoft VC happy. - Return FAILURE because on success we likely to return earlier. */ - return MLIB_FAILURE; } /***************************************************************/ diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c index baf3c70fc18..c149d42de70 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c @@ -211,6 +211,13 @@ mlib_status mlib_ImageConvMxN_f(mlib_image *dst, case MLIB_DOUBLE: ret = mlib_convMxNnw_d64(dst_i, src_i, kernel, m, n, dm, dn, cmask); break; + + default: + /* For some reasons, there is no convolution routine for type MLIB_BIT. + * For now, we silently ignore it (because this image type is not used by java), + * but probably we have to report an error. + */ + break; } } @@ -221,6 +228,11 @@ mlib_status mlib_ImageConvMxN_f(mlib_image *dst, case MLIB_EDGE_DST_COPY_SRC: mlib_ImageConvCopyEdge(dst_e, src_e, dx_l, dx_r, dy_t, dy_b, cmask); break; + default: + /* Other edge conditions do not need additional handling. + * Note also that they are not exposed in public Java API + */ + break; } } else { /* MLIB_EDGE_SRC_EXTEND */ @@ -279,6 +291,12 @@ mlib_status mlib_ImageConvMxN_f(mlib_image *dst, case MLIB_DOUBLE: mlib_convMxNext_d64(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask); break; + default: + /* For some reasons, there is no convolution routine for type MLIB_BIT. + * For now, we silently ignore it (because this image type is not used by java), + * but probably we have to report an error. + */ + break; } } diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c index 796063b0284..5ddcbb3e9b4 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c @@ -1869,8 +1869,8 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst, /***************************************************************/ mlib_status CONV_FUNC_MxN { - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)]; FTYPE **buffs = buffs_arr, *buffd; FTYPE akernel[256], *k = akernel, fscale = DSCALE; @@ -2332,8 +2332,8 @@ mlib_status CONV_FUNC_MxN mlib_status CONV_FUNC_MxN_I { - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)]; mlib_s32 *pbuff = buff; mlib_s32 **buffs = buffs_arr, *buffd; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c index 53e1d8a793c..8c5ada353bd 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c @@ -148,8 +148,8 @@ typedef union { /***************************************************************/ #define DEF_VARS(type) \ - type *adr_src, *sl, *sp; \ - type *adr_dst, *dl, *dp; \ + type *adr_src, *sl, *sp = NULL; \ + type *adr_dst, *dl, *dp = NULL; \ FTYPE *pbuff = buff; \ mlib_s32 wid, hgt, sll, dll; \ mlib_s32 nchannel, chan1; \ @@ -2060,8 +2060,8 @@ mlib_status CONV_FUNC_I(MxN)(mlib_image *dst, mlib_s32 d0, d1, shift1, shift2; mlib_s32 k0, k1, k2, k3, k4, k5, k6; mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7; - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; mlib_s32 wid, hgt, sll, dll; mlib_s32 nchannel, chan1; mlib_s32 i, j, c; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c index 5a74988ce34..eb7037307ca 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c @@ -78,7 +78,7 @@ /***************************************************************/ #define DEF_VARS_MxN(type) \ GET_SRC_DST_PARAMETERS(type); \ - type *sl, *sp, *dl, *dp; \ + type *sl, *sp = NULL, *dl, *dp = NULL; \ mlib_d64 *pbuff = buff; \ mlib_s32 i, j, c diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c index 53d54990deb..3a006ed5f83 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c @@ -1869,8 +1869,8 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst, /***************************************************************/ mlib_status CONV_FUNC_MxN { - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)]; FTYPE **buffs = buffs_arr, *buffd; FTYPE akernel[256], *k = akernel, fscale = DSCALE; @@ -2332,8 +2332,8 @@ mlib_status CONV_FUNC_MxN mlib_status CONV_FUNC_MxN_I { - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)]; mlib_s32 *pbuff = buff; mlib_s32 **buffs = buffs_arr, *buffd; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c index 1b09b1bcade..ce337534c6f 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c @@ -149,8 +149,8 @@ typedef union { /***************************************************************/ #define DEF_VARS(type) \ - type *adr_src, *sl, *sp; \ - type *adr_dst, *dl, *dp; \ + type *adr_src, *sl, *sp = NULL; \ + type *adr_dst, *dl, *dp = NULL; \ FTYPE *pbuff = buff; \ mlib_s32 wid, hgt, sll, dll; \ mlib_s32 nchannel, chan1; \ @@ -2061,8 +2061,8 @@ mlib_status CONV_FUNC_I(MxN)(mlib_image *dst, mlib_s32 d0, d1, shift1, shift2; mlib_s32 k0, k1, k2, k3, k4, k5, k6; mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7; - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; mlib_s32 wid, hgt, sll, dll; mlib_s32 nchannel, chan1; mlib_s32 i, j, c; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c index cb08ae2ae80..2e84957bdf1 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c @@ -71,8 +71,8 @@ #define DEF_VARS(type) \ GET_SRC_DST_PARAMETERS(type); \ type *sl; \ - type *dl, *dp; \ - mlib_s32 i, j, c + type *dl, *dp = NULL; \ + mlib_s32 i = 0, j, c /***************************************************************/ #undef KSIZE diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c index c78615fd718..d19448d936c 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c @@ -71,7 +71,7 @@ #define DEF_VARS(type) \ GET_SRC_DST_PARAMETERS(type); \ type *sl; \ - type *dl, *dp; \ + type *dl, *dp = NULL; \ mlib_s32 i, j, c /***************************************************************/ diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c index a3f79ffb564..f412112b168 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c @@ -1869,8 +1869,8 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst, /***************************************************************/ mlib_status CONV_FUNC_MxN { - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)]; FTYPE **buffs = buffs_arr, *buffd; FTYPE akernel[256], *k = akernel, fscale = DSCALE; @@ -2332,8 +2332,8 @@ mlib_status CONV_FUNC_MxN mlib_status CONV_FUNC_MxN_I { - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)]; mlib_s32 *pbuff = buff; mlib_s32 **buffs = buffs_arr, *buffd; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c index 2f017c6f8d0..eb68aeff7dd 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c @@ -148,8 +148,8 @@ typedef union { /***************************************************************/ #define DEF_VARS(type) \ - type *adr_src, *sl, *sp; \ - type *adr_dst, *dl, *dp; \ + type *adr_src, *sl, *sp = NULL; \ + type *adr_dst, *dl, *dp = NULL; \ FTYPE *pbuff = buff; \ mlib_s32 wid, hgt, sll, dll; \ mlib_s32 nchannel, chan1; \ @@ -2060,8 +2060,8 @@ mlib_status CONV_FUNC_I(MxN)(mlib_image *dst, mlib_s32 d0, d1, shift1, shift2; mlib_s32 k0, k1, k2, k3, k4, k5, k6; mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7; - DTYPE *adr_src, *sl, *sp; - DTYPE *adr_dst, *dl, *dp; + DTYPE *adr_src, *sl, *sp = NULL; + DTYPE *adr_dst, *dl, *dp = NULL; mlib_s32 wid, hgt, sll, dll; mlib_s32 nchannel, chan1; mlib_s32 i, j, c; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c index 503883e1866..a5fdb06cd2a 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c @@ -204,9 +204,9 @@ void mlib_ImageCopy_bit_na(const mlib_u8 *sa, mlib_u64 *dp; /* 8-byte aligned start points in dst */ mlib_u64 *sp; /* 8-byte aligned start point in src */ mlib_s32 j; /* offset of address in dst */ - mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF; + mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL; mlib_u64 dmask; - mlib_u64 lsrc, lsrc0, lsrc1, ldst; + mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst; mlib_s32 ls_offset, ld_offset, shift; if (size <= 0) return; @@ -427,9 +427,9 @@ void mlib_ImageCopy_bit_na_r(const mlib_u8 *sa, mlib_u64 *dp; /* 8-byte aligned start points in dst */ mlib_u64 *sp; /* 8-byte aligned start point in src */ mlib_s32 j; /* offset of address in dst */ - mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF; + mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL; mlib_u64 dmask; - mlib_u64 lsrc, lsrc0, lsrc1, ldst; + mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst; mlib_s32 ls_offset, ld_offset, shift; if (size <= 0) return; diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c index ba1a2b47fb0..fe065b35df3 100644 --- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c +++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c @@ -334,7 +334,7 @@ mlib_image *mlib_ImageCreateSubimage(mlib_image *img, mlib_s32 width; /* for parent image */ mlib_s32 height; /* for parent image */ mlib_s32 stride; - mlib_s32 bitoffset; + mlib_s32 bitoffset = 0; void *data; /* sanity check */ @@ -423,7 +423,7 @@ mlib_image *mlib_ImageSetSubimage(mlib_image *dst, mlib_s32 channels = src -> channels; mlib_s32 stride = src -> stride; mlib_u8 *data = src -> data; - mlib_s32 bitoffset; + mlib_s32 bitoffset = 0; data += y * stride; From ebba49aa621e94d6d675aa2d6b9a760b24aaf86d Mon Sep 17 00:00:00 2001 From: David Holmes Date: Fri, 25 Mar 2011 07:09:38 -0400 Subject: [PATCH 042/168] 7030063: AWT support for SE-Embedded integration AWT support for SE-Embedded Reviewed-by: anthony, art, bobv, collins, alanb --- jdk/make/launchers/Makefile | 13 +- jdk/make/sun/Makefile | 15 +- jdk/make/sun/awt/mawt.gmk | 16 +- jdk/make/sun/jawt/Makefile | 15 +- jdk/make/sun/jpeg/Makefile | 3 +- jdk/make/sun/security/tools/Makefile | 4 +- jdk/make/sun/xawt/Makefile | 21 +- jdk/src/share/classes/java/awt/Toolkit.java | 4 +- jdk/src/share/classes/sun/awt/HToolkit.java | 378 ++++++++++++++++++ .../solaris/classes/sun/awt/X11/XToolkit.java | 8 +- .../classes/sun/awt/X11/XTrayIconPeer.java | 4 +- .../solaris/native/java/lang/java_props_md.c | 44 +- jdk/src/solaris/native/sun/awt/jawt.c | 7 +- jdk/src/solaris/native/sun/xawt/XToolkit.c | 128 +++++- 14 files changed, 611 insertions(+), 49 deletions(-) create mode 100644 jdk/src/share/classes/sun/awt/HToolkit.java diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index 8d7036be179..cc07bbe9cb0 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 @@ -44,8 +44,17 @@ $(MAKE) -f Makefile.launcher \ endef # Run MAKE $@ for all generic launchers -define make-all-launchers +ifndef BUILD_HEADLESS_ONLY +define make-appletviewer $(call make-launcher, appletviewer, sun.applet.Main, , ) +endef +else +define make-appletviewer +endef +endif + +define make-all-launchers +$(make-appletviewer) $(call make-launcher, apt, com.sun.tools.apt.Main, , ) $(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , ) $(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , ) diff --git a/jdk/make/sun/Makefile b/jdk/make/sun/Makefile index cac9b8781d6..6e0830cd117 100644 --- a/jdk/make/sun/Makefile +++ b/jdk/make/sun/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1995, 2011, Oracle and/or its affiliates. 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 @@ -69,10 +69,17 @@ endif # nio need to be compiled before awt to have all charsets ready SUBDIRS = jar security javazic misc net nio text launcher + +ifdef BUILD_HEADLESS_ONLY + DISPLAY_LIBS = awt $(HEADLESS_SUBDIR) + DISPLAY_TOOLS = +else + DISPLAY_LIBS = awt splashscreen $(XAWT_SUBDIR) $(HEADLESS_SUBDIR) + DISPLAY_TOOLS = applet +endif SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \ - awt splashscreen $(XAWT_SUBDIR) \ - $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \ - jawt font jpeg cmm applet beans + $(DISPLAY_LIBS) $(DGA_SUBDIR) \ + jawt font jpeg cmm $(DISPLAY_TOOLS) beans SUBDIRS_management = management SUBDIRS_misc = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing SUBDIRS_tools = native2ascii serialver tools jconsole diff --git a/jdk/make/sun/awt/mawt.gmk b/jdk/make/sun/awt/mawt.gmk index 44de692602b..f8160ee7d7d 100644 --- a/jdk/make/sun/awt/mawt.gmk +++ b/jdk/make/sun/awt/mawt.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -149,13 +149,13 @@ ifeq ($(PLATFORM), linux) LIBXT = -lXt else # Allows for builds on Debian GNU Linux, X11 is in a different place - LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \ + LIBXT = $(firstword $(wildcard $(OPENWIN_LIB)/libXt.a) \ $(wildcard /usr/lib/libXt.a)) - LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \ + LIBSM = $(firstword $(wildcard $(OPENWIN_LIB)/libSM.a) \ $(wildcard /usr/lib/libSM.a)) - LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \ + LIBICE = $(firstword $(wildcard $(OPENWIN_LIB)/libICE.a) \ $(wildcard /usr/lib/libICE.a)) - LIBXTST = $(firstword $(wildcard /usr/X11R6/lib/libXtst.a) \ + LIBXTST = $(firstword $(wildcard $(OPENWIN_LIB)/libXtst.a) \ $(wildcard /usr/lib/libXtst.a)) endif endif @@ -224,9 +224,9 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \ $(EVENT_MODEL) ifeq ($(PLATFORM), linux) -# Checking for the X11/extensions headers at the additional location - CPPFLAGS += -I/X11R6/include/X11/extensions \ - -I/usr/include/X11/extensions + # Checking for the X11/extensions headers at the additional location + CPPFLAGS += -I$(firstword $(wildcard $(OPENWIN_HOME)/include/X11/extensions) \ + $(wildcard /usr/include/X11/extensions)) endif ifeq ($(PLATFORM), solaris) diff --git a/jdk/make/sun/jawt/Makefile b/jdk/make/sun/jawt/Makefile index 7741e1b5a83..afbce78e638 100644 --- a/jdk/make/sun/jawt/Makefile +++ b/jdk/make/sun/jawt/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 @@ -112,11 +112,20 @@ CPPFLAGS += -I$(OPENWIN_HOME)/include \ # Libraries to link in. # ifeq ($(PLATFORM), solaris) -OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender + ifndef BUILD_HEADLESS_ONLY + OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender + else + OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/headless -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender + endif endif # PLATFORM ifeq ($(PLATFORM), linux) -OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt + ifndef BUILD_HEADLESS_ONLY + OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt + else + OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/headless -lmawt + CFLAGS += -DHEADLESS + endif endif # PLATFORM endif # PLATFORM diff --git a/jdk/make/sun/jpeg/Makefile b/jdk/make/sun/jpeg/Makefile index 78c53c461a1..880fc7c5e78 100644 --- a/jdk/make/sun/jpeg/Makefile +++ b/jdk/make/sun/jpeg/Makefile @@ -73,9 +73,10 @@ ifeq ($(PLATFORM), linux) # Recommended way to avoid such warning is to declare the variable as # volatile to prevent the optimization. However, this approach does not # work because we have to declare all variables as volatile in result. - +ifndef CROSS_COMPILE_ARCH OTHER_CFLAGS += -Wno-clobbered endif +endif include $(BUILDDIR)/common/Mapfile-vers.gmk include $(BUILDDIR)/common/Library.gmk diff --git a/jdk/make/sun/security/tools/Makefile b/jdk/make/sun/security/tools/Makefile index bfdb261f6ba..f46070d07ca 100644 --- a/jdk/make/sun/security/tools/Makefile +++ b/jdk/make/sun/security/tools/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -46,5 +46,7 @@ include $(BUILDDIR)/common/Classes.gmk build: $(call make-launcher, keytool, sun.security.tools.KeyTool, , ) +ifndef BUILD_HEADLESS_ONLY $(call make-launcher, policytool, sun.security.tools.policytool.PolicyTool, , ) +endif diff --git a/jdk/make/sun/xawt/Makefile b/jdk/make/sun/xawt/Makefile index afe16f5737d..cf322d9023c 100644 --- a/jdk/make/sun/xawt/Makefile +++ b/jdk/make/sun/xawt/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -129,10 +129,17 @@ CPPFLAGS += -DXAWT -DXAWT_HACK \ -I$(PLATFORM_SRC)/native/sun/awt ifeq ($(PLATFORM), linux) -# Allows for builds on Debian GNU Linux, X11 is in a different place - CPPFLAGS += -I/usr/X11R6/include/X11/extensions \ - -I/usr/include/X11/extensions \ - -I$(OPENWIN_HOME)/include + ifndef CROSS_COMPILE_ARCH + # Allows for builds on Debian GNU Linux, X11 is in a different place + # This should really be handled at a higher-level so we don't have to + # work-around this when cross-compiling + CPPFLAGS += -I/usr/X11R6/include/X11/extensions \ + -I/usr/include/X11/extensions \ + -I$(OPENWIN_HOME)/include + else + CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \ + -I$(OPENWIN_HOME)/include + endif endif # We have some odd logic here because some Solaris 10 updates @@ -245,7 +252,11 @@ XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt $(SIZERS): $(SIZERS_C) $(prep-target) +ifndef CROSS_COMPILE_ARCH $(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c +else + $(HOST_CC) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c +endif $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA) $(prep-target) diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index 85ee6db4a43..aa10f201c9d 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. 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 @@ -858,7 +858,7 @@ public abstract class Toolkit { String nm = null; Class cls = null; try { - nm = System.getProperty("awt.toolkit", "sun.awt.X11.XToolkit"); + nm = System.getProperty("awt.toolkit"); try { cls = Class.forName(nm); } catch (ClassNotFoundException e) { diff --git a/jdk/src/share/classes/sun/awt/HToolkit.java b/jdk/src/share/classes/sun/awt/HToolkit.java new file mode 100644 index 00000000000..edadb84f397 --- /dev/null +++ b/jdk/src/share/classes/sun/awt/HToolkit.java @@ -0,0 +1,378 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.awt; + +import java.awt.*; +import java.awt.dnd.*; +import java.awt.dnd.peer.DragSourceContextPeer; +import java.awt.im.InputMethodHighlight; +import java.awt.im.spi.InputMethodDescriptor; +import java.awt.image.*; +import java.awt.datatransfer.Clipboard; +import java.awt.peer.*; +import java.util.Map; +import java.util.Properties; + +/* + * HToolkit is a platform independent Toolkit used + * with the HeadlessToolkit. It is primarily used + * in embedded JRE's that do not have sun/awt/X11 classes. + */ +public class HToolkit extends SunToolkit + implements ComponentFactory { + + public HToolkit() { + } + + /* + * Component peer objects - unsupported. + */ + + public WindowPeer createWindow(Window target) + throws HeadlessException { + throw new HeadlessException(); + } + + public FramePeer createFrame(Frame target) + throws HeadlessException { + throw new HeadlessException(); + } + + public DialogPeer createDialog(Dialog target) + throws HeadlessException { + throw new HeadlessException(); + } + + public ButtonPeer createButton(Button target) + throws HeadlessException { + throw new HeadlessException(); + } + + public TextFieldPeer createTextField(TextField target) + throws HeadlessException { + throw new HeadlessException(); + } + + public ChoicePeer createChoice(Choice target) + throws HeadlessException { + throw new HeadlessException(); + } + + public LabelPeer createLabel(Label target) + throws HeadlessException { + throw new HeadlessException(); + } + + public ListPeer createList(List target) + throws HeadlessException { + throw new HeadlessException(); + } + + public CheckboxPeer createCheckbox(Checkbox target) + throws HeadlessException { + throw new HeadlessException(); + } + + public ScrollbarPeer createScrollbar(Scrollbar target) + throws HeadlessException { + throw new HeadlessException(); + } + + public ScrollPanePeer createScrollPane(ScrollPane target) + throws HeadlessException { + throw new HeadlessException(); + } + + public TextAreaPeer createTextArea(TextArea target) + throws HeadlessException { + throw new HeadlessException(); + } + + public FileDialogPeer createFileDialog(FileDialog target) + throws HeadlessException { + throw new HeadlessException(); + } + + public MenuBarPeer createMenuBar(MenuBar target) + throws HeadlessException { + throw new HeadlessException(); + } + + public MenuPeer createMenu(Menu target) + throws HeadlessException { + throw new HeadlessException(); + } + + public PopupMenuPeer createPopupMenu(PopupMenu target) + throws HeadlessException { + throw new HeadlessException(); + } + + public MenuItemPeer createMenuItem(MenuItem target) + throws HeadlessException { + throw new HeadlessException(); + } + + public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) + throws HeadlessException { + throw new HeadlessException(); + } + + public DragSourceContextPeer createDragSourceContextPeer( + DragGestureEvent dge) + throws InvalidDnDOperationException { + throw new InvalidDnDOperationException("Headless environment"); + } + + public RobotPeer createRobot(Robot target, GraphicsDevice screen) + throws AWTException, HeadlessException { + throw new HeadlessException(); + } + + public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) { + // See 6833019. + return + new KeyboardFocusManagerPeer() { + public Window getCurrentFocusedWindow() { return null; } + public void setCurrentFocusOwner(Component comp) {} + public Component getCurrentFocusOwner() { return null; } + public void clearGlobalFocusOwner(Window activeWindow) {} + }; + } + + public TrayIconPeer createTrayIcon(TrayIcon target) + throws HeadlessException { + throw new HeadlessException(); + } + + public SystemTrayPeer createSystemTray(SystemTray target) + throws HeadlessException { + throw new HeadlessException(); + } + + public boolean isTraySupported() { + return false; + } + + public GlobalCursorManager getGlobalCursorManager() + throws HeadlessException { + throw new HeadlessException(); + } + + /* + * Headless toolkit - unsupported. + */ + protected void loadSystemColors(int[] systemColors) + throws HeadlessException { + throw new HeadlessException(); + } + + public ColorModel getColorModel() + throws HeadlessException { + throw new HeadlessException(); + } + + public int getScreenResolution() + throws HeadlessException { + throw new HeadlessException(); + } + + public Map mapInputMethodHighlight(InputMethodHighlight highlight) + throws HeadlessException { + throw new HeadlessException(); + } + + public int getMenuShortcutKeyMask() + throws HeadlessException { + throw new HeadlessException(); + } + + public boolean getLockingKeyState(int keyCode) + throws UnsupportedOperationException { + throw new HeadlessException(); + } + + public void setLockingKeyState(int keyCode, boolean on) + throws UnsupportedOperationException { + throw new HeadlessException(); + } + + public Cursor createCustomCursor(Image cursor, Point hotSpot, String name) + throws IndexOutOfBoundsException, HeadlessException { + throw new HeadlessException(); + } + + public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) + throws HeadlessException { + throw new HeadlessException(); + } + + public int getMaximumCursorColors() + throws HeadlessException { + throw new HeadlessException(); + } + + public T + createDragGestureRecognizer(Class abstractRecognizerClass, + DragSource ds, Component c, + int srcActions, DragGestureListener dgl) + { + return null; + } + + public int getScreenHeight() + throws HeadlessException { + throw new HeadlessException(); + } + + public int getScreenWidth() + throws HeadlessException { + throw new HeadlessException(); + } + + public Dimension getScreenSize() + throws HeadlessException { + throw new HeadlessException(); + } + + public Insets getScreenInsets(GraphicsConfiguration gc) + throws HeadlessException { + throw new HeadlessException(); + } + + public void setDynamicLayout(boolean dynamic) + throws HeadlessException { + throw new HeadlessException(); + } + + protected boolean isDynamicLayoutSet() + throws HeadlessException { + throw new HeadlessException(); + } + + public boolean isDynamicLayoutActive() + throws HeadlessException { + throw new HeadlessException(); + } + + public Clipboard getSystemClipboard() + throws HeadlessException { + throw new HeadlessException(); + } + + /* + * Printing + */ + public PrintJob getPrintJob(Frame frame, String jobtitle, + JobAttributes jobAttributes, + PageAttributes pageAttributes) { + if (frame != null) { + // Should never happen + throw new HeadlessException(); + } + throw new IllegalArgumentException( + "PrintJob not supported in a headless environment"); + } + + public PrintJob getPrintJob(Frame frame, String doctitle, Properties props) + { + if (frame != null) { + // Should never happen + throw new HeadlessException(); + } + throw new IllegalArgumentException( + "PrintJob not supported in a headless environment"); + } + + /* + * Headless toolkit - supported. + */ + + public void sync() { + // Do nothing + } + + protected boolean syncNativeQueue(final long timeout) { + return false; + } + + public void beep() { + // Send alert character + System.out.write(0x07); + } + + + /* + * Fonts + */ + public FontPeer getFontPeer(String name, int style) { + return (FontPeer)null; + } + + /* + * Modality + */ + public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) { + return false; + } + + public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) { + return false; + } + + public boolean isDesktopSupported() { + return false; + } + + public DesktopPeer createDesktopPeer(Desktop target) + throws HeadlessException{ + throw new HeadlessException(); + } + + public boolean isWindowOpacityControlSupported() { + return false; + } + + public boolean isWindowShapingSupported() { + return false; + } + + public boolean isWindowTranslucencySupported() { + return false; + } + + public void grab(Window w) { } + + public void ungrab(Window w) { } + + protected boolean syncNativeQueue() { return false; } + + public InputMethodDescriptor getInputMethodAdapterDescriptor() + throws AWTException + { + return (InputMethodDescriptor)null; + } +} diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java index ad92d2e9c00..a8dd37aae90 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -135,6 +135,12 @@ public final class XToolkit extends UNIXToolkit implements Runnable { noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler")); } + /* + * Return (potentially) platform specific display timeout for the + * tray icon + */ + static native long getTrayIconDisplayTimeout(); + //---- ERROR HANDLER CODE ----// /* diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java index ff7b78e2c13..7bc452c968e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 @@ -230,7 +230,7 @@ public class XTrayIconPeer implements TrayIconPeer, // Wait till the EmbeddedFrame is reparented long start = System.currentTimeMillis(); - final long PERIOD = 2000L; + final long PERIOD = XToolkit.getTrayIconDisplayTimeout(); XToolkit.awtLock(); try { while (!isTrayIconDisplayed) { diff --git a/jdk/src/solaris/native/java/lang/java_props_md.c b/jdk/src/solaris/native/java/lang/java_props_md.c index 1e4e3b6d64b..0a24f8653db 100644 --- a/jdk/src/solaris/native/java/lang/java_props_md.c +++ b/jdk/src/solaris/native/java/lang/java_props_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 @@ -55,6 +55,11 @@ #endif #endif +#ifdef JAVASE_EMBEDDED +#include +#include +#endif + /* Take an array of string pairs (map of key->value) and a string (key). * Examine each pair in the map to see if the first string (key) matches the * string. If so, store the second string of the pair (value) in the value and @@ -304,6 +309,36 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script, return 1; } +#ifdef JAVASE_EMBEDDED +/* Determine the default embedded toolkit based on whether lib/xawt/ + * exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX + */ +static char* getEmbeddedToolkit() { + Dl_info dlinfo; + char buf[MAXPATHLEN]; + int32_t len; + char *p; + struct stat statbuf; + + /* Get address of this library and the directory containing it. */ + dladdr((void *)getEmbeddedToolkit, &dlinfo); + realpath((char *)dlinfo.dli_fname, buf); + len = strlen(buf); + p = strrchr(buf, '/'); + /* Default AWT Toolkit on Linux and Solaris is XAWT. */ + strncpy(p, "/xawt/", MAXPATHLEN-len-1); + /* Check if it exists */ + if (stat(buf, &statbuf) == -1 && errno == ENOENT) { + /* No - this is a reduced-headless-jre so use special HToolkit */ + return "sun.awt.HToolkit"; + } + else { + /* Yes - this is a headful JRE so fallback to SE defaults */ + return NULL; + } +} +#endif + /* This function gets called very early, before VM_CALLS are setup. * Do not use any of the VM_CALLS entries!!! */ @@ -328,7 +363,12 @@ GetJavaProperties(JNIEnv *env) /* Java 2D properties */ sprops.graphics_env = "sun.awt.X11GraphicsEnvironment"; - sprops.awt_toolkit = NULL; + +#ifdef JAVASE_EMBEDDED + sprops.awt_toolkit = getEmbeddedToolkit(); + if (sprops.awt_toolkit == NULL) // default as below +#endif + sprops.awt_toolkit = "sun.awt.X11.XToolkit"; /* This is used only for debugging of font problems. */ v = getenv("JAVA2D_FONTPATH"); diff --git a/jdk/src/solaris/native/sun/awt/jawt.c b/jdk/src/solaris/native/sun/awt/jawt.c index b682edaf45d..f6f8530cb9a 100644 --- a/jdk/src/solaris/native/sun/awt/jawt.c +++ b/jdk/src/solaris/native/sun/awt/jawt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 @@ -33,6 +33,10 @@ */ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) { +#if defined(JAVASE_EMBEDDED) && defined(HEADLESS) + /* there are no AWT libs available at all */ + return JNI_FALSE; +#else if (awt == NULL) { return JNI_FALSE; } @@ -51,4 +55,5 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) } return JNI_TRUE; +#endif } diff --git a/jdk/src/solaris/native/sun/xawt/XToolkit.c b/jdk/src/solaris/native/sun/xawt/XToolkit.c index 4ea63143c70..69620ffc1e6 100644 --- a/jdk/src/solaris/native/sun/xawt/XToolkit.c +++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -110,6 +110,21 @@ Java_sun_awt_X11_XToolkit_initIDs awt_ModLockIsShiftLock = (*env)->GetStaticIntField(env, clazz, fid) != 0 ? True : False; } +/* + * Class: sun_awt_X11_XToolkit + * Method: getTrayIconDisplayTimeout + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout + (JNIEnv *env, jclass clazz) +{ +#ifndef JAVASE_EMBEDDED + return (jlong) 2000; +#else + return (jlong) 10000; +#endif +} + /* * Class: sun_awt_X11_XToolkit * Method: getDefaultXColormap @@ -340,15 +355,34 @@ static uint32_t get_poll_timeout(jlong nextTaskTime); #define AWT_READPIPE (awt_pipe_fds[0]) #define AWT_WRITEPIPE (awt_pipe_fds[1]) -#define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */ +#ifdef JAVASE_EMBEDDED + #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) /* milliseconds */ +#else + #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */ +#endif + #define DEF_AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */ #define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */ #define TIMEOUT_TIMEDOUT 0 #define TIMEOUT_EVENTS 1 +/* awt_poll_alg - AWT Poll Events Aging Algorithms */ +#define AWT_POLL_FALSE 1 +#define AWT_POLL_AGING_SLOW 2 +#define AWT_POLL_AGING_FAST 3 + +#define AWT_POLL_THRESHOLD 1000 // msec, Block if delay is larger +#define AWT_POLL_BLOCK -1 // cause poll() block + // Static fields +#ifdef JAVASE_EMBEDDED + static int awt_poll_alg = AWT_POLL_AGING_FAST; +#else + static int awt_poll_alg = AWT_POLL_AGING_SLOW; +#endif + static uint32_t AWT_FLUSH_TIMEOUT = DEF_AWT_FLUSH_TIMEOUT; /* milliseconds */ static uint32_t AWT_MAX_POLL_TIMEOUT = DEF_AWT_MAX_POLL_TIMEOUT; /* milliseconds */ static pthread_t awt_MainThread = 0; @@ -417,6 +451,7 @@ awt_pipe_init() { */ static void readEnv() { char * value; + int tmp_poll_alg; static Boolean env_read = False; if (env_read) return; @@ -451,6 +486,23 @@ static void readEnv() { if (static_poll_timeout != 0) { curPollTimeout = static_poll_timeout; } + + // non-blocking poll() + value = getenv("_AWT_POLL_ALG"); + if (value != NULL) { + tmp_poll_alg = atoi(value); + switch(tmp_poll_alg) { + case AWT_POLL_FALSE: + case AWT_POLL_AGING_SLOW: + case AWT_POLL_AGING_FAST: + awt_poll_alg = tmp_poll_alg; + break; + default: + PRINT("Unknown value of _AWT_POLL_ALG, assuming Slow Aging Algorithm by default"); + awt_poll_alg = AWT_POLL_AGING_SLOW; + break; + } + } } /** @@ -478,14 +530,29 @@ static void update_poll_timeout(int timeout_control) { if (static_poll_timeout != 0) return; // Update it otherwise - if (timeout_control == TIMEOUT_TIMEDOUT) { - /* add 1/4 (plus 1, in case the division truncates to 0) */ - curPollTimeout += ((curPollTimeout>>2) + 1); - curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout); - } else if (timeout_control == TIMEOUT_EVENTS) { - /* subtract 1/4 (plus 1, in case the division truncates to 0) */ - curPollTimeout -= ((curPollTimeout>>2) + 1); - curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout); + + switch(awt_poll_alg) { + case AWT_POLL_AGING_SLOW: + if (timeout_control == TIMEOUT_TIMEDOUT) { + /* add 1/4 (plus 1, in case the division truncates to 0) */ + curPollTimeout += ((curPollTimeout>>2) + 1); + curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout); + } else if (timeout_control == TIMEOUT_EVENTS) { + /* subtract 1/4 (plus 1, in case the division truncates to 0) */ + curPollTimeout -= ((curPollTimeout>>2) + 1); + curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout); + } + break; + case AWT_POLL_AGING_FAST: + if (timeout_control == TIMEOUT_TIMEDOUT) { + curPollTimeout += ((curPollTimeout>>2) + 1); + curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout); + if((int)curPollTimeout > AWT_POLL_THRESHOLD || (int)curPollTimeout == AWT_POLL_BLOCK) + curPollTimeout = AWT_POLL_BLOCK; + } else if (timeout_control == TIMEOUT_EVENTS) { + curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, 1); + } + break; } } @@ -497,16 +564,37 @@ static void update_poll_timeout(int timeout_control) { */ static uint32_t get_poll_timeout(jlong nextTaskTime) { + uint32_t ret_timeout; + uint32_t timeout; + uint32_t taskTimeout; + uint32_t flushTimeout; + jlong curTime = awtJNI_TimeMillis(); - uint32_t timeout = curPollTimeout; - uint32_t taskTimeout = (nextTaskTime == -1) ? AWT_MAX_POLL_TIMEOUT : (uint32_t)max(0, (int32_t)(nextTaskTime - curTime)); - uint32_t flushTimeout = (awt_next_flush_time > 0) ? (uint32_t)max(0, (int32_t)(awt_next_flush_time - curTime)) : AWT_MAX_POLL_TIMEOUT; + timeout = curPollTimeout; + switch(awt_poll_alg) { + case AWT_POLL_AGING_SLOW: + case AWT_POLL_AGING_FAST: + taskTimeout = (nextTaskTime == -1) ? AWT_MAX_POLL_TIMEOUT : (uint32_t)max(0, (int32_t)(nextTaskTime - curTime)); + flushTimeout = (awt_next_flush_time > 0) ? (uint32_t)max(0, (int32_t)(awt_next_flush_time - curTime)) : AWT_MAX_POLL_TIMEOUT; - PRINT2("to: %d, ft: %d, to: %d, tt: %d, mil: %d\n", taskTimeout, flushTimeout, timeout, (int)nextTaskTime, (int)curTime); + PRINT2("to: %d, ft: %d, to: %d, tt: %d, mil: %d\n", taskTimeout, flushTimeout, timeout, (int)nextTaskTime, (int)curTime); - // Adjust timeout to flush_time and task_time - return min(flushTimeout, min(taskTimeout, timeout)); -} /* awt_get_poll_timeout() */ + // Adjust timeout to flush_time and task_time + ret_timeout = min(flushTimeout, min(taskTimeout, timeout)); + if((int)curPollTimeout == AWT_POLL_BLOCK) + ret_timeout = AWT_POLL_BLOCK; + break; + + case AWT_POLL_FALSE: + ret_timeout = (nextTaskTime > curTime) ? + (nextTaskTime - curTime) : + ((nextTaskTime == -1) ? -1 : 0); + break; + } + + return ret_timeout; + +} /* get_poll_timeout() */ /* * Waits for X/Xt events to appear on the pipe. Returns only when @@ -598,6 +686,8 @@ performPoll(JNIEnv *env, jlong nextTaskTime) { if (result == 0) { /* poll() timed out -- update timeout value */ update_poll_timeout(TIMEOUT_TIMEDOUT); + PRINT2("%s(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n", + performPoll, curPollTimeout); } if (pollFds[1].revents) { int count; @@ -606,10 +696,14 @@ performPoll(JNIEnv *env, jlong nextTaskTime) { do { count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE ); } while (count == AWT_POLL_BUFSIZE ); + PRINT2("%s(): data on the AWT pipe: curPollTimeout = %d \n", + performPoll, curPollTimeout); } if (pollFds[0].revents) { // Events in X pipe update_poll_timeout(TIMEOUT_EVENTS); + PRINT2("%s(): TIMEOUT_EVENTS curPollTimeout = %ld \n", + performPoll, curPollTimeout); } return; From 466a172fafa0a1f5333ba9bca189e5b8f8d750ab Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 13:17:38 +0100 Subject: [PATCH 043/168] 7030792: /jfc/TransparentRuler needs to be included into build process Reviewed-by: rupashka, ohair --- jdk/make/mkdemo/jfc/Makefile | 3 +- jdk/make/mkdemo/jfc/TransparentRuler/Makefile | 44 +++++++++++++++++++ jdk/src/share/demo/nbproject/project.xml | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 jdk/make/mkdemo/jfc/TransparentRuler/Makefile diff --git a/jdk/make/mkdemo/jfc/Makefile b/jdk/make/mkdemo/jfc/Makefile index 768e5b8f4a8..8eecf285978 100644 --- a/jdk/make/mkdemo/jfc/Makefile +++ b/jdk/make/mkdemo/jfc/Makefile @@ -39,7 +39,8 @@ SUBDIRS = \ Notepad \ SampleTree \ SwingApplet \ - TableExample + TableExample \ + TransparentRuler # Some demos aren't currently included in OpenJDK ifndef OPENJDK diff --git a/jdk/make/mkdemo/jfc/TransparentRuler/Makefile b/jdk/make/mkdemo/jfc/TransparentRuler/Makefile new file mode 100644 index 00000000000..7092b875048 --- /dev/null +++ b/jdk/make/mkdemo/jfc/TransparentRuler/Makefile @@ -0,0 +1,44 @@ +# +# Copyright (c) 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# Makefile to build the TransparentRuler demo. +# + +BUILDDIR = ../../.. +PRODUCT = demo/jfc +DEMONAME = TransparentRuler +include $(BUILDDIR)/common/Defs.gmk + +DEMO_ROOT = $(SHARE_SRC)/demo/jfc/$(DEMONAME) +DEMO_TOPFILES = ./README.txt +DEMO_MAINCLASS = transparentruler.Ruler +DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME) + + +# +# Demo jar building rules. +# +include $(BUILDDIR)/common/Demo.gmk diff --git a/jdk/src/share/demo/nbproject/project.xml b/jdk/src/share/demo/nbproject/project.xml index 585faf33b00..43667547ddf 100644 --- a/jdk/src/share/demo/nbproject/project.xml +++ b/jdk/src/share/demo/nbproject/project.xml @@ -50,6 +50,7 @@ nbproject/jfc/Stylepad nbproject/jfc/SwingApplet nbproject/jfc/TableExample + nbproject/jfc/TransparentRuler nbproject/scripting/jconsole-plugin nbproject/management/FullThreadDump nbproject/management/JTop From a9452d32b7a4e679a73f440c2909b204195a56ec Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 13:23:09 +0100 Subject: [PATCH 044/168] 7027698: /jfc/SampleTree demo needs to be improved Reviewed-by: rupashka --- .../demo/jfc/SampleTree/DynamicTreeNode.java | 190 ++++---- .../share/demo/jfc/SampleTree/SampleData.java | 52 +- .../share/demo/jfc/SampleTree/SampleTree.java | 456 +++++++++--------- .../SampleTree/SampleTreeCellRenderer.java | 123 ++--- .../demo/jfc/SampleTree/SampleTreeModel.java | 47 +- 5 files changed, 447 insertions(+), 421 deletions(-) diff --git a/jdk/src/share/demo/jfc/SampleTree/DynamicTreeNode.java b/jdk/src/share/demo/jfc/SampleTree/DynamicTreeNode.java index 02c5ddfae68..fa6db4dfd13 100644 --- a/jdk/src/share/demo/jfc/SampleTree/DynamicTreeNode.java +++ b/jdk/src/share/demo/jfc/SampleTree/DynamicTreeNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,154 +29,154 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ -import javax.swing.tree.DefaultMutableTreeNode; import java.awt.Color; import java.awt.Font; -import java.awt.Toolkit; +import java.awt.GraphicsEnvironment; import java.util.Random; +import javax.swing.tree.DefaultMutableTreeNode; + /** - * DynamicTreeNode illustrates one of the possible ways in which dynamic - * loading can be used in tree. The basic premise behind this is that - * getChildCount() will be messaged from JTreeModel before any children - * are asked for. So, the first time getChildCount() is issued the - * children are loaded.

- * It should be noted that isLeaf will also be messaged from the model. - * The default behavior of TreeNode is to message getChildCount to - * determine this. As such, isLeaf is subclassed to always return false.

- * There are others ways this could be accomplished as well. Instead of - * subclassing TreeNode you could subclass JTreeModel and do the same - * thing in getChildCount(). Or, if you aren't using TreeNode you could - * write your own TreeModel implementation. - * Another solution would be to listen for TreeNodeExpansion events and - * the first time a node has been expanded post the appropriate insertion - * events. I would not recommend this approach though, the other two - * are much simpler and cleaner (and are faster from the perspective of - * how tree deals with it). - * - * NOTE: getAllowsChildren() can be messaged before getChildCount(). - * For this example the nodes always allow children, so it isn't - * a problem, but if you do support true leaf nodes you may want - * to check for loading in getAllowsChildren too. - * - * @author Scott Violet - */ - -public class DynamicTreeNode extends DefaultMutableTreeNode -{ + * DynamicTreeNode illustrates one of the possible ways in which dynamic + * loading can be used in tree. The basic premise behind this is that + * getChildCount() will be messaged from JTreeModel before any children + * are asked for. So, the first time getChildCount() is issued the + * children are loaded.

+ * It should be noted that isLeaf will also be messaged from the model. + * The default behavior of TreeNode is to message getChildCount to + * determine this. As such, isLeaf is subclassed to always return false.

+ * There are others ways this could be accomplished as well. Instead of + * subclassing TreeNode you could subclass JTreeModel and do the same + * thing in getChildCount(). Or, if you aren't using TreeNode you could + * write your own TreeModel implementation. + * Another solution would be to listen for TreeNodeExpansion events and + * the first time a node has been expanded post the appropriate insertion + * events. I would not recommend this approach though, the other two + * are much simpler and cleaner (and are faster from the perspective of + * how tree deals with it). + * + * NOTE: getAllowsChildren() can be messaged before getChildCount(). + * For this example the nodes always allow children, so it isn't + * a problem, but if you do support true leaf nodes you may want + * to check for loading in getAllowsChildren too. + * + * @author Scott Violet + */ +@SuppressWarnings("serial") +public class DynamicTreeNode extends DefaultMutableTreeNode { // Class stuff. + /** Number of names. */ - static protected float nameCount; - + protected static float nameCount; /** Names to use for children. */ - static protected String[] names; - + protected static final String[] NAMES; /** Potential fonts used to draw with. */ - static protected Font[] fonts; - + protected static Font[] fonts; /** Used to generate the names. */ - static protected Random nameGen; - + protected static Random nameGen; /** Number of children to create for each node. */ - static protected final int DefaultChildrenCount = 7; + protected static final int DEFAULT_CHILDREN_COUNT = 7; static { - String[] fontNames; + String[] fontNames; try { - fontNames = Toolkit.getDefaultToolkit().getFontList(); + fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment(). + getAvailableFontFamilyNames(); + } catch (Exception e) { fontNames = null; } - if(fontNames == null || fontNames.length == 0) { - names = new String[] {"Mark Andrews", "Tom Ball", "Alan Chung", - "Rob Davis", "Jeff Dinkins", - "Amy Fowler", "James Gosling", - "David Karlton", "Dave Kloba", - "Dave Moore", "Hans Muller", - "Rick Levenson", "Tim Prinzing", - "Chester Rose", "Ray Ryan", - "Georges Saab", "Scott Violet", - "Kathy Walrath", "Arnaud Weber" }; - } - else { + if (fontNames == null || fontNames.length == 0) { + NAMES = new String[] { "Mark Andrews", "Tom Ball", "Alan Chung", + "Rob Davis", "Jeff Dinkins", + "Amy Fowler", "James Gosling", + "David Karlton", "Dave Kloba", + "Dave Moore", "Hans Muller", + "Rick Levenson", "Tim Prinzing", + "Chester Rose", "Ray Ryan", + "Georges Saab", "Scott Violet", + "Kathy Walrath", "Arnaud Weber" }; + } else { /* Create the Fonts, creating fonts is slow, much better to - do it once. */ - int fontSize = 12; + do it once. */ + int fontSize = 12; - names = fontNames; - fonts = new Font[names.length]; - for(int counter = 0, maxCounter = names.length; - counter < maxCounter; counter++) { + NAMES = fontNames; + fonts = new Font[NAMES.length]; + for (int counter = 0, maxCounter = NAMES.length; + counter < maxCounter; counter++) { try { fonts[counter] = new Font(fontNames[counter], 0, fontSize); - } - catch (Exception e) { + } catch (Exception e) { fonts[counter] = null; } fontSize = ((fontSize + 2 - 12) % 12) + 12; } } - nameCount = (float)names.length; + nameCount = (float) NAMES.length; nameGen = new Random(System.currentTimeMillis()); } - - /** Have the children of this node been loaded yet? */ - protected boolean hasLoaded; + protected boolean hasLoaded; /** - * Constructs a new DynamicTreeNode instance with o as the user - * object. - */ + * Constructs a new DynamicTreeNode instance with o as the user + * object. + */ public DynamicTreeNode(Object o) { super(o); } + @Override public boolean isLeaf() { return false; } /** - * If hasLoaded is false, meaning the children have not yet been - * loaded, loadChildren is messaged and super is messaged for - * the return value. - */ + * If hasLoaded is false, meaning the children have not yet been + * loaded, loadChildren is messaged and super is messaged for + * the return value. + */ + @Override public int getChildCount() { - if(!hasLoaded) { + if (!hasLoaded) { loadChildren(); } return super.getChildCount(); } /** - * Messaged the first time getChildCount is messaged. Creates - * children with random names from names. - */ + * Messaged the first time getChildCount is messaged. Creates + * children with random names from names. + */ protected void loadChildren() { - DynamicTreeNode newNode; - Font font; - int randomIndex; - SampleData data; + DynamicTreeNode newNode; + Font font; + int randomIndex; + SampleData data; - for(int counter = 0; counter < DynamicTreeNode.DefaultChildrenCount; - counter++) { - randomIndex = (int)(nameGen.nextFloat() * nameCount); - if(fonts != null) - font = fonts[randomIndex]; - else + for (int counter = 0; counter < DynamicTreeNode.DEFAULT_CHILDREN_COUNT; + counter++) { + randomIndex = (int) (nameGen.nextFloat() * nameCount); + String displayString = NAMES[randomIndex]; + if (fonts == null || fonts[randomIndex].canDisplayUpTo(displayString) + != -1) { font = null; - if(counter % 2 == 0) - data = new SampleData(font, Color.red, names[randomIndex]); - else - data = new SampleData(font, Color.blue, names[randomIndex]); + } else { + font = fonts[randomIndex]; + } + + if (counter % 2 == 0) { + data = new SampleData(font, Color.red, displayString); + } else { + data = new SampleData(font, Color.blue, displayString); + } newNode = new DynamicTreeNode(data); /* Don't use add() here, add calls insert(newNode, getChildCount()) - so if you want to use add, just be sure to set hasLoaded = true - first. */ + so if you want to use add, just be sure to set hasLoaded = true + first. */ insert(newNode, counter); } /* This node has now been loaded, mark it so. */ diff --git a/jdk/src/share/demo/jfc/SampleTree/SampleData.java b/jdk/src/share/demo/jfc/SampleTree/SampleData.java index 375f36b4073..48a92dd8d0d 100644 --- a/jdk/src/share/demo/jfc/SampleTree/SampleData.java +++ b/jdk/src/share/demo/jfc/SampleTree/SampleData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,32 +29,27 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.awt.Color; import java.awt.Font; + /** - * @author Scott Violet - */ + * @author Scott Violet + */ +public class SampleData extends Object { -public class SampleData extends Object -{ /** Font used for drawing. */ - protected Font font; - + protected Font font; /** Color used for text. */ - protected Color color; - + protected Color color; /** Value to display. */ - protected String string; - + protected String string; /** - * Constructs a new instance of SampleData with the passed in - * arguments. - */ + * Constructs a new instance of SampleData with the passed in + * arguments. + */ public SampleData(Font newFont, Color newColor, String newString) { font = newFont; color = newColor; @@ -62,47 +57,48 @@ public class SampleData extends Object } /** - * Sets the font that is used to represent this object. - */ + * Sets the font that is used to represent this object. + */ public void setFont(Font newFont) { font = newFont; } /** - * Returns the Font used to represent this object. - */ + * Returns the Font used to represent this object. + */ public Font getFont() { return font; } /** - * Sets the color used to draw the text. - */ + * Sets the color used to draw the text. + */ public void setColor(Color newColor) { color = newColor; } /** - * Returns the color used to draw the text. - */ + * Returns the color used to draw the text. + */ public Color getColor() { return color; } /** - * Sets the string to display for this object. - */ + * Sets the string to display for this object. + */ public void setString(String newString) { string = newString; } /** - * Returnes the string to display for this object. - */ + * Returnes the string to display for this object. + */ public String string() { return string; } + @Override public String toString() { return string; } diff --git a/jdk/src/share/demo/jfc/SampleTree/SampleTree.java b/jdk/src/share/demo/jfc/SampleTree/SampleTree.java index 760180d391b..831d70cbdf9 100644 --- a/jdk/src/share/demo/jfc/SampleTree/SampleTree.java +++ b/jdk/src/share/demo/jfc/SampleTree/SampleTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,9 +29,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.*; import javax.swing.event.*; import java.awt.BorderLayout; @@ -40,58 +41,57 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.util.*; +import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.*; import javax.swing.tree.*; -/** - * A demo for illustrating how to do different things with JTree. - * The data that this displays is rather boring, that is each node will - * have 7 children that have random names based on the fonts. Each node - * is then drawn with that font and in a different color. - * While the data isn't interesting the example illustrates a number - * of things: - * - * For an example of dynamicaly loading children refer to DynamicTreeNode. - * For an example of adding/removing/inserting/reloading refer to the inner - * classes of this class, AddAction, RemovAction, InsertAction and - * ReloadAction. - * For an example of creating your own cell renderer refer to - * SampleTreeCellRenderer. - * For an example of subclassing JTreeModel for editing refer to - * SampleTreeModel. - * - * @author Scott Violet - */ -public class SampleTree -{ +/** + * A demo for illustrating how to do different things with JTree. + * The data that this displays is rather boring, that is each node will + * have 7 children that have random names based on the fonts. Each node + * is then drawn with that font and in a different color. + * While the data isn't interesting the example illustrates a number + * of things: + * + * For an example of dynamicaly loading children refer to DynamicTreeNode. + * For an example of adding/removing/inserting/reloading refer to the inner + * classes of this class, AddAction, RemovAction, InsertAction and + * ReloadAction. + * For an example of creating your own cell renderer refer to + * SampleTreeCellRenderer. + * For an example of subclassing JTreeModel for editing refer to + * SampleTreeModel. + * + * @author Scott Violet + */ +public final class SampleTree { + /** Window for showing Tree. */ - protected JFrame frame; + protected JFrame frame; /** Tree used for the example. */ - protected JTree tree; + protected JTree tree; /** Tree model. */ - protected DefaultTreeModel treeModel; + protected DefaultTreeModel treeModel; /** - * Constructs a new instance of SampleTree. - */ + * Constructs a new instance of SampleTree. + */ public SampleTree() { - // Force SampleTree to come up in the Cross Platform L&F + // Trying to set Nimbus look and feel try { - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - // If you want the System L&F instead, comment out the above line and - // uncomment the following: - // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception exc) { - System.err.println("Error loading L&F: " + exc); + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception ignored) { } - - JMenuBar menuBar = constructMenuBar(); - JPanel panel = new JPanel(true); + JMenuBar menuBar = constructMenuBar(); + JPanel panel = new JPanel(true); frame = new JFrame("SampleTree"); frame.getContentPane().add("Center", panel); @@ -106,18 +106,18 @@ public class SampleTree tree = new JTree(treeModel); /* Enable tool tips for the tree, without this tool tips will not - be picked up. */ + be picked up. */ ToolTipManager.sharedInstance().registerComponent(tree); /* Make the tree use an instance of SampleTreeCellRenderer for - drawing. */ + drawing. */ tree.setCellRenderer(new SampleTreeCellRenderer()); /* Make tree ask for the height of each row. */ tree.setRowHeight(-1); /* Put the Tree in a scroller. */ - JScrollPane sp = new JScrollPane(); + JScrollPane sp = new JScrollPane(); sp.setPreferredSize(new Dimension(300, 300)); sp.getViewport().add(tree); @@ -126,19 +126,18 @@ public class SampleTree panel.add("Center", sp); panel.add("South", constructOptionsPanel()); - frame.addWindowListener( new WindowAdapter() { - public void windowClosing(WindowEvent e) {System.exit(0);}}); - + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); - frame.show(); + frame.setVisible(true); } /** Constructs a JPanel containing check boxes for the different - * options that tree supports. */ + * options that tree supports. */ + @SuppressWarnings("serial") private JPanel constructOptionsPanel() { - JCheckBox aCheckbox; - JPanel retPanel = new JPanel(false); - JPanel borderPane = new JPanel(false); + JCheckBox aCheckbox; + JPanel retPanel = new JPanel(false); + JPanel borderPane = new JPanel(false); borderPane.setLayout(new BorderLayout()); retPanel.setLayout(new FlowLayout()); @@ -162,39 +161,54 @@ public class SampleTree borderPane.add(retPanel, BorderLayout.CENTER); /* Create a set of radio buttons that dictate what selection should - be allowed in the tree. */ - ButtonGroup group = new ButtonGroup(); - JPanel buttonPane = new JPanel(false); - JRadioButton button; + be allowed in the tree. */ + ButtonGroup group = new ButtonGroup(); + JPanel buttonPane = new JPanel(false); + JRadioButton button; buttonPane.setLayout(new FlowLayout()); buttonPane.setBorder(new TitledBorder("Selection Mode")); button = new JRadioButton("Single"); button.addActionListener(new AbstractAction() { - public boolean isEnabled() { return true; } + + @Override + public boolean isEnabled() { + return true; + } + public void actionPerformed(ActionEvent e) { - tree.getSelectionModel().setSelectionMode - (TreeSelectionModel.SINGLE_TREE_SELECTION); + tree.getSelectionModel().setSelectionMode( + TreeSelectionModel.SINGLE_TREE_SELECTION); } }); group.add(button); buttonPane.add(button); button = new JRadioButton("Contiguous"); button.addActionListener(new AbstractAction() { - public boolean isEnabled() { return true; } + + @Override + public boolean isEnabled() { + return true; + } + public void actionPerformed(ActionEvent e) { - tree.getSelectionModel().setSelectionMode - (TreeSelectionModel.CONTIGUOUS_TREE_SELECTION); + tree.getSelectionModel().setSelectionMode( + TreeSelectionModel.CONTIGUOUS_TREE_SELECTION); } }); group.add(button); buttonPane.add(button); button = new JRadioButton("Discontiguous"); button.addActionListener(new AbstractAction() { - public boolean isEnabled() { return true; } + + @Override + public boolean isEnabled() { + return true; + } + public void actionPerformed(ActionEvent e) { - tree.getSelectionModel().setSelectionMode - (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); + tree.getSelectionModel().setSelectionMode( + TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); } }); button.setSelected(true); @@ -209,33 +223,33 @@ public class SampleTree /* JPanel clickPanel = new JPanel(); Object[] values = { "Never", new Integer(1), - new Integer(2), new Integer(3) }; + new Integer(2), new Integer(3) }; final JComboBox clickCBox = new JComboBox(values); clickPanel.setLayout(new FlowLayout()); clickPanel.add(new JLabel("Click count to expand:")); clickCBox.setSelectedIndex(2); clickCBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - Object selItem = clickCBox.getSelectedItem(); + public void actionPerformed(ActionEvent ae) { + Object selItem = clickCBox.getSelectedItem(); - if(selItem instanceof Integer) - tree.setToggleClickCount(((Integer)selItem).intValue()); - else // Don't toggle - tree.setToggleClickCount(0); - } + if(selItem instanceof Integer) + tree.setToggleClickCount(((Integer)selItem).intValue()); + else // Don't toggle + tree.setToggleClickCount(0); + } }); clickPanel.add(clickCBox); borderPane.add(clickPanel, BorderLayout.NORTH); -*/ + */ return borderPane; } /** Construct a menu. */ private JMenuBar constructMenuBar() { - JMenu menu; - JMenuBar menuBar = new JMenuBar(); - JMenuItem menuItem; + JMenu menu; + JMenuBar menuBar = new JMenuBar(); + JMenuItem menuItem; /* Good ol exit. */ menu = new JMenu("File"); @@ -243,9 +257,11 @@ public class SampleTree menuItem = menu.add(new JMenuItem("Exit")); menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { System.exit(0); - }}); + } + }); /* Tree related stuff. */ menu = new JMenu("Tree"); @@ -267,14 +283,15 @@ public class SampleTree } /** - * Returns the TreeNode instance that is selected in the tree. - * If nothing is selected, null is returned. - */ + * Returns the TreeNode instance that is selected in the tree. + * If nothing is selected, null is returned. + */ protected DefaultMutableTreeNode getSelectedNode() { - TreePath selPath = tree.getSelectionPath(); + TreePath selPath = tree.getSelectionPath(); - if(selPath != null) - return (DefaultMutableTreeNode)selPath.getLastPathComponent(); + if (selPath != null) { + return (DefaultMutableTreeNode) selPath.getLastPathComponent(); + } return null; } @@ -290,133 +307,136 @@ public class SampleTree return new DynamicTreeNode(new SampleData(null, Color.black, name)); } + /** - * AddAction is used to add a new item after the selected item. - */ - class AddAction extends Object implements ActionListener - { + * AddAction is used to add a new item after the selected item. + */ + class AddAction extends Object implements ActionListener { + /** Number of nodes that have been added. */ - public int addCount; + public int addCount; /** - * Messaged when the user clicks on the Add menu item. - * Determines the selection from the Tree and adds an item - * after that. If nothing is selected, an item is added to - * the root. - */ + * Messaged when the user clicks on the Add menu item. + * Determines the selection from the Tree and adds an item + * after that. If nothing is selected, an item is added to + * the root. + */ public void actionPerformed(ActionEvent e) { - DefaultMutableTreeNode lastItem = getSelectedNode(); - DefaultMutableTreeNode parent; + DefaultMutableTreeNode lastItem = getSelectedNode(); + DefaultMutableTreeNode parent; /* Determine where to create the new node. */ - if(lastItem != null) { - parent = (DefaultMutableTreeNode)lastItem.getParent(); - if(parent == null) { - parent = (DefaultMutableTreeNode)treeModel.getRoot(); + if (lastItem != null) { + parent = (DefaultMutableTreeNode) lastItem.getParent(); + if (parent == null) { + parent = (DefaultMutableTreeNode) treeModel.getRoot(); lastItem = null; } + } else { + parent = (DefaultMutableTreeNode) treeModel.getRoot(); } - else - parent = (DefaultMutableTreeNode)treeModel.getRoot(); if (parent == null) { // new root - treeModel.setRoot(createNewNode("Added " + - Integer.toString(addCount++))); - } - else { - int newIndex; - if(lastItem == null) + treeModel.setRoot(createNewNode("Added " + Integer.toString( + addCount++))); + } else { + int newIndex; + if (lastItem == null) { newIndex = treeModel.getChildCount(parent); - else + } else { newIndex = parent.getIndex(lastItem) + 1; + } /* Let the treemodel know. */ - treeModel.insertNodeInto(createNewNode("Added " + - Integer.toString(addCount++)), - parent, newIndex); + treeModel.insertNodeInto(createNewNode("Added " + Integer. + toString(addCount++)), + parent, newIndex); } } } // End of SampleTree.AddAction /** - * InsertAction is used to insert a new item before the selected item. - */ - class InsertAction extends Object implements ActionListener - { + * InsertAction is used to insert a new item before the selected item. + */ + class InsertAction extends Object implements ActionListener { + /** Number of nodes that have been added. */ - public int insertCount; + public int insertCount; /** - * Messaged when the user clicks on the Insert menu item. - * Determines the selection from the Tree and inserts an item - * after that. If nothing is selected, an item is added to - * the root. - */ + * Messaged when the user clicks on the Insert menu item. + * Determines the selection from the Tree and inserts an item + * after that. If nothing is selected, an item is added to + * the root. + */ public void actionPerformed(ActionEvent e) { - DefaultMutableTreeNode lastItem = getSelectedNode(); - DefaultMutableTreeNode parent; + DefaultMutableTreeNode lastItem = getSelectedNode(); + DefaultMutableTreeNode parent; /* Determine where to create the new node. */ - if(lastItem != null) { - parent = (DefaultMutableTreeNode)lastItem.getParent(); - if(parent == null) { - parent = (DefaultMutableTreeNode)treeModel.getRoot(); + if (lastItem != null) { + parent = (DefaultMutableTreeNode) lastItem.getParent(); + if (parent == null) { + parent = (DefaultMutableTreeNode) treeModel.getRoot(); lastItem = null; } + } else { + parent = (DefaultMutableTreeNode) treeModel.getRoot(); } - else - parent = (DefaultMutableTreeNode)treeModel.getRoot(); if (parent == null) { // new root - treeModel.setRoot(createNewNode("Inserted " + - Integer.toString(insertCount++))); - } - else { - int newIndex; + treeModel.setRoot(createNewNode("Inserted " + Integer.toString( + insertCount++))); + } else { + int newIndex; - if(lastItem == null) + if (lastItem == null) { newIndex = treeModel.getChildCount(parent); - else + } else { newIndex = parent.getIndex(lastItem); + } /* Let the treemodel know. */ - treeModel.insertNodeInto(createNewNode("Inserted " + - Integer.toString(insertCount++)), - parent, newIndex); + treeModel.insertNodeInto(createNewNode("Inserted " + Integer. + toString(insertCount++)), + parent, newIndex); } } } // End of SampleTree.InsertAction /** - * ReloadAction is used to reload from the selected node. If nothing - * is selected, reload is not issued. - */ - class ReloadAction extends Object implements ActionListener - { - /** - * Messaged when the user clicks on the Reload menu item. - * Determines the selection from the Tree and asks the treemodel - * to reload from that node. - */ - public void actionPerformed(ActionEvent e) { - DefaultMutableTreeNode lastItem = getSelectedNode(); + * ReloadAction is used to reload from the selected node. If nothing + * is selected, reload is not issued. + */ + class ReloadAction extends Object implements ActionListener { - if(lastItem != null) + /** + * Messaged when the user clicks on the Reload menu item. + * Determines the selection from the Tree and asks the treemodel + * to reload from that node. + */ + public void actionPerformed(ActionEvent e) { + DefaultMutableTreeNode lastItem = getSelectedNode(); + + if (lastItem != null) { treeModel.reload(lastItem); + } } } // End of SampleTree.ReloadAction + /** - * RemoveAction removes the selected node from the tree. If - * The root or nothing is selected nothing is removed. - */ - class RemoveAction extends Object implements ActionListener - { + * RemoveAction removes the selected node from the tree. If + * The root or nothing is selected nothing is removed. + */ + class RemoveAction extends Object implements ActionListener { + /** - * Removes the selected item as long as it isn't root. - */ + * Removes the selected item as long as it isn't root. + */ public void actionPerformed(ActionEvent e) { TreePath[] selected = getSelectedPaths(); @@ -451,19 +471,17 @@ public class SampleTree paths[counter] = null; } treeModel.setRoot(null); - } - else { + } else { // Find the siblings of path. TreePath parent = path.getParentPath(); - MutableTreeNode parentNode = (MutableTreeNode)parent. - getLastPathComponent(); - ArrayList toRemove = new ArrayList(); - int depth = parent.getPathCount(); + MutableTreeNode parentNode = (MutableTreeNode) parent. + getLastPathComponent(); + ArrayList toRemove = new ArrayList(); // First pass, find paths with a parent TreePath of parent for (int counter = paths.length - 1; counter >= 0; counter--) { - if (paths[counter] != null && paths[counter]. - getParentPath().equals(parent)) { + if (paths[counter] != null && paths[counter].getParentPath(). + equals(parent)) { toRemove.add(paths[counter]); paths[counter] = null; } @@ -477,9 +495,9 @@ public class SampleTree for (int counter = paths.length - 1; counter >= 0; counter--) { if (paths[counter] != null) { for (int rCounter = rCount - 1; rCounter >= 0; - rCounter--) { - if (((TreePath)toRemove.get(rCounter)). - isDescendant(paths[counter])) { + rCounter--) { + if ((toRemove.get(rCounter)).isDescendant( + paths[counter])) { paths[counter] = null; } } @@ -493,10 +511,10 @@ public class SampleTree int[] indices = new int[rCount]; Object[] removedNodes = new Object[rCount]; for (int counter = rCount - 1; counter >= 0; counter--) { - removedNodes[counter] = ((TreePath)toRemove.get(counter)). - getLastPathComponent(); - indices[counter] = treeModel.getIndexOfChild - (parentNode, removedNodes[counter]); + removedNodes[counter] = (toRemove.get(counter)). + getLastPathComponent(); + indices[counter] = treeModel.getIndexOfChild(parentNode, + removedNodes[counter]); parentNode.remove(indices[counter]); } treeModel.nodesWereRemoved(parentNode, indices, removedNodes); @@ -522,8 +540,7 @@ public class SampleTree return shallowestPath; } } - } - else { + } else { shallowestPath = paths[counter]; shallowest = paths[counter].getPathCount(); } @@ -540,67 +557,70 @@ public class SampleTree * This is actually rather expensive, it would be more efficient * to extract the indices and then do the comparision. */ - private class PositionComparator implements Comparator { - public int compare(Object o1, Object o2) { - TreePath p1 = (TreePath)o1; - int o1Index = treeModel.getIndexOfChild(p1.getParentPath(). - getLastPathComponent(), p1.getLastPathComponent()); - TreePath p2 = (TreePath)o2; - int o2Index = treeModel.getIndexOfChild(p2.getParentPath(). - getLastPathComponent(), p2.getLastPathComponent()); - return o1Index - o2Index; - } + private class PositionComparator implements Comparator { - public boolean equals(Object obj) { - return super.equals(obj); + public int compare(TreePath p1, TreePath p2) { + int p1Index = treeModel.getIndexOfChild(p1.getParentPath(). + getLastPathComponent(), p1.getLastPathComponent()); + int p2Index = treeModel.getIndexOfChild(p2.getParentPath(). + getLastPathComponent(), p2.getLastPathComponent()); + return p1Index - p2Index; } } - } // End of SampleTree.RemoveAction /** - * ShowHandlesChangeListener implements the ChangeListener interface - * to toggle the state of showing the handles in the tree. - */ - class ShowHandlesChangeListener extends Object implements ChangeListener - { - public void stateChanged(ChangeEvent e) { - tree.setShowsRootHandles(((JCheckBox)e.getSource()).isSelected()); - } + * ShowHandlesChangeListener implements the ChangeListener interface + * to toggle the state of showing the handles in the tree. + */ + class ShowHandlesChangeListener extends Object implements ChangeListener { + public void stateChanged(ChangeEvent e) { + tree.setShowsRootHandles(((JCheckBox) e.getSource()).isSelected()); + } } // End of class SampleTree.ShowHandlesChangeListener /** - * ShowRootChangeListener implements the ChangeListener interface - * to toggle the state of showing the root node in the tree. - */ - class ShowRootChangeListener extends Object implements ChangeListener - { - public void stateChanged(ChangeEvent e) { - tree.setRootVisible(((JCheckBox)e.getSource()).isSelected()); - } + * ShowRootChangeListener implements the ChangeListener interface + * to toggle the state of showing the root node in the tree. + */ + class ShowRootChangeListener extends Object implements ChangeListener { + public void stateChanged(ChangeEvent e) { + tree.setRootVisible(((JCheckBox) e.getSource()).isSelected()); + } } // End of class SampleTree.ShowRootChangeListener /** - * TreeEditableChangeListener implements the ChangeListener interface - * to toggle between allowing editing and now allowing editing in - * the tree. - */ - class TreeEditableChangeListener extends Object implements ChangeListener - { - public void stateChanged(ChangeEvent e) { - tree.setEditable(((JCheckBox)e.getSource()).isSelected()); - } + * TreeEditableChangeListener implements the ChangeListener interface + * to toggle between allowing editing and now allowing editing in + * the tree. + */ + class TreeEditableChangeListener extends Object implements ChangeListener { + public void stateChanged(ChangeEvent e) { + tree.setEditable(((JCheckBox) e.getSource()).isSelected()); + } } // End of class SampleTree.TreeEditableChangeListener + public static void main(String args[]) { + try { + SwingUtilities.invokeAndWait(new Runnable() { - static public void main(String args[]) { - new SampleTree(); + @SuppressWarnings(value = "ResultOfObjectAllocationIgnored") + public void run() { + new SampleTree(); + } + }); + } catch (InterruptedException ex) { + Logger.getLogger(SampleTree.class.getName()).log(Level.SEVERE, null, + ex); + } catch (InvocationTargetException ex) { + Logger.getLogger(SampleTree.class.getName()).log(Level.SEVERE, null, + ex); + } } - } diff --git a/jdk/src/share/demo/jfc/SampleTree/SampleTreeCellRenderer.java b/jdk/src/share/demo/jfc/SampleTree/SampleTreeCellRenderer.java index 51c1a371c5c..d45bf4e27b6 100644 --- a/jdk/src/share/demo/jfc/SampleTree/SampleTreeCellRenderer.java +++ b/jdk/src/share/demo/jfc/SampleTree/SampleTreeCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import javax.swing.Icon; import javax.swing.ImageIcon; @@ -42,48 +40,56 @@ import java.awt.Component; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; +import javax.swing.UIManager; + + +@SuppressWarnings("serial") +public class SampleTreeCellRenderer extends JLabel implements TreeCellRenderer { -public class SampleTreeCellRenderer extends JLabel implements TreeCellRenderer -{ /** Font used if the string to be displayed isn't a font. */ - static protected Font defaultFont; + protected static Font defaultFont; /** Icon to use when the item is collapsed. */ - static protected ImageIcon collapsedIcon; + protected static ImageIcon collapsedIcon; /** Icon to use when the item is expanded. */ - static protected ImageIcon expandedIcon; - + protected static ImageIcon expandedIcon; /** Color to use for the background when selected. */ - static protected final Color SelectedBackgroundColor = Color.yellow;//new Color(0, 0, 128); + protected static final Color SELECTED_BACKGROUND_COLOR; - static - { + static { + if ("Nimbus".equals(UIManager.getLookAndFeel().getName())) { + SELECTED_BACKGROUND_COLOR = new Color(0, 0, + 0, 0); + } else { + SELECTED_BACKGROUND_COLOR = Color.YELLOW; + } try { defaultFont = new Font("SansSerif", 0, 12); - } catch (Exception e) {} + } catch (Exception e) { + } try { - collapsedIcon = new ImageIcon(SampleTreeCellRenderer.class.getResource("/resources/images/collapsed.gif")); - expandedIcon = new ImageIcon(SampleTreeCellRenderer.class.getResource("/resources/images/expanded.gif")); + collapsedIcon = new ImageIcon(SampleTreeCellRenderer.class. + getResource("/resources/images/collapsed.gif")); + expandedIcon = new ImageIcon(SampleTreeCellRenderer.class. + getResource("/resources/images/expanded.gif")); } catch (Exception e) { System.out.println("Couldn't load images: " + e); } } - /** Whether or not the item that was last configured is selected. */ - protected boolean selected; + protected boolean selected; /** - * This is messaged from JTree whenever it needs to get the size - * of the component or it wants to draw it. - * This attempts to set the font based on value, which will be - * a TreeNode. - */ + * This is messaged from JTree whenever it needs to get the size + * of the component or it wants to draw it. + * This attempts to set the font based on value, which will be + * a TreeNode. + */ public Component getTreeCellRendererComponent(JTree tree, Object value, - boolean selected, boolean expanded, - boolean leaf, int row, - boolean hasFocus) { - Font font; - String stringValue = tree.convertValueToText(value, selected, - expanded, leaf, row, hasFocus); + boolean selected, boolean expanded, + boolean leaf, int row, + boolean hasFocus) { + String stringValue = tree.convertValueToText(value, selected, + expanded, leaf, row, hasFocus); /* Set the text. */ setText(stringValue); @@ -91,24 +97,27 @@ public class SampleTreeCellRenderer extends JLabel implements TreeCellRenderer setToolTipText(stringValue); /* Set the image. */ - if(expanded) + if (expanded) { setIcon(expandedIcon); - else if(!leaf) + } else if (!leaf) { setIcon(collapsedIcon); - else + } else { setIcon(null); + } /* Set the color and the font based on the SampleData userObject. */ - SampleData userObject = (SampleData)((DefaultMutableTreeNode)value) - .getUserObject(); - if(hasFocus) - setForeground(Color.cyan); - else + SampleData userObject = (SampleData) ((DefaultMutableTreeNode) value). + getUserObject(); + if (hasFocus) { + setForeground(UIManager.getColor("Tree.selectionForeground")); + } else { setForeground(userObject.getColor()); - if(userObject.getFont() == null) + } + if (userObject.getFont() == null) { setFont(defaultFont); - else + } else { setFont(userObject.getFont()); + } /* Update the selected flag for the next paint. */ this.selected = selected; @@ -117,36 +126,36 @@ public class SampleTreeCellRenderer extends JLabel implements TreeCellRenderer } /** - * paint is subclassed to draw the background correctly. JLabel - * currently does not allow backgrounds other than white, and it - * will also fill behind the icon. Something that isn't desirable. - */ + * paint is subclassed to draw the background correctly. JLabel + * currently does not allow backgrounds other than white, and it + * will also fill behind the icon. Something that isn't desirable. + */ + @Override public void paint(Graphics g) { - Color bColor; - Icon currentI = getIcon(); + Color bColor; + Icon currentI = getIcon(); - if(selected) - bColor = SelectedBackgroundColor; - else if(getParent() != null) - /* Pick background color up from parent (which will come from - the JTree we're contained in). */ + if (selected) { + bColor = SELECTED_BACKGROUND_COLOR; + } else if (getParent() != null) /* Pick background color up from parent (which will come from + the JTree we're contained in). */ { bColor = getParent().getBackground(); - else + } else { bColor = getBackground(); + } g.setColor(bColor); - if(currentI != null && getText() != null) { - int offset = (currentI.getIconWidth() + getIconTextGap()); + if (currentI != null && getText() != null) { + int offset = (currentI.getIconWidth() + getIconTextGap()); if (getComponentOrientation().isLeftToRight()) { g.fillRect(offset, 0, getWidth() - 1 - offset, - getHeight() - 1); - } - else { + getHeight() - 1); + } else { g.fillRect(0, 0, getWidth() - 1 - offset, getHeight() - 1); } + } else { + g.fillRect(0, 0, getWidth() - 1, getHeight() - 1); } - else - g.fillRect(0, 0, getWidth()-1, getHeight()-1); super.paint(g); } } diff --git a/jdk/src/share/demo/jfc/SampleTree/SampleTreeModel.java b/jdk/src/share/demo/jfc/SampleTree/SampleTreeModel.java index 4facf196d09..51ee2daec91 100644 --- a/jdk/src/share/demo/jfc/SampleTree/SampleTreeModel.java +++ b/jdk/src/share/demo/jfc/SampleTree/SampleTreeModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeNode; @@ -38,40 +36,43 @@ import javax.swing.tree.TreePath; import javax.swing.tree.DefaultMutableTreeNode; import java.awt.Color; -/** - * SampleTreeModel extends JTreeModel to extends valueForPathChanged. - * This method is called as a result of the user editing a value in - * the tree. If you allow editing in your tree, are using TreeNodes - * and the user object of the TreeNodes is not a String, then you're going - * to have to subclass JTreeModel as this example does. - * - * @author Scott Violet - */ -public class SampleTreeModel extends DefaultTreeModel -{ +/** + * SampleTreeModel extends JTreeModel to extends valueForPathChanged. + * This method is called as a result of the user editing a value in + * the tree. If you allow editing in your tree, are using TreeNodes + * and the user object of the TreeNodes is not a String, then you're going + * to have to subclass JTreeModel as this example does. + * + * @author Scott Violet + */ +@SuppressWarnings("serial") +public class SampleTreeModel extends DefaultTreeModel { + /** - * Creates a new instance of SampleTreeModel with newRoot set - * to the root of this model. - */ + * Creates a new instance of SampleTreeModel with newRoot set + * to the root of this model. + */ public SampleTreeModel(TreeNode newRoot) { super(newRoot); } /** - * Subclassed to message setString() to the changed path item. - */ + * Subclassed to message setString() to the changed path item. + */ + @Override public void valueForPathChanged(TreePath path, Object newValue) { /* Update the user object. */ - DefaultMutableTreeNode aNode = (DefaultMutableTreeNode)path.getLastPathComponent(); - SampleData sampleData = (SampleData)aNode.getUserObject(); + DefaultMutableTreeNode aNode = (DefaultMutableTreeNode) path. + getLastPathComponent(); + SampleData sampleData = (SampleData) aNode.getUserObject(); - sampleData.setString((String)newValue); + sampleData.setString((String) newValue); /* UUUhhhhh, pretty colors. */ sampleData.setColor(Color.green); /* Since we've changed how the data is to be displayed, message - nodeChanged. */ + nodeChanged. */ nodeChanged(aNode); } } From 3d4529f30fdb03db6bbd991917c0a2f41267de1f Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 13:24:39 +0100 Subject: [PATCH 045/168] 7027697: /jfc/Notepad demo needs to be improved Reviewed-by: rupashka --- .../demo/jfc/Notepad/ElementTreePanel.java | 340 ++++++++++-------- jdk/src/share/demo/jfc/Notepad/Notepad.java | 283 +++++++++------ 2 files changed, 363 insertions(+), 260 deletions(-) diff --git a/jdk/src/share/demo/jfc/Notepad/ElementTreePanel.java b/jdk/src/share/demo/jfc/Notepad/ElementTreePanel.java index 34915782258..0a208c92693 100644 --- a/jdk/src/share/demo/jfc/Notepad/ElementTreePanel.java +++ b/jdk/src/share/demo/jfc/Notepad/ElementTreePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,17 +29,36 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.text.*; -import javax.swing.tree.*; -import javax.swing.undo.*; -import java.awt.*; -import java.beans.*; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Font; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.*; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.SwingConstants; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.text.AttributeSet; +import javax.swing.text.Document; +import javax.swing.text.Element; +import javax.swing.text.JTextComponent; +import javax.swing.text.StyleConstants; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; + /** * Displays a tree showing all the elements in a text Document. Selecting @@ -49,16 +68,20 @@ import java.util.*; * * @author Scott Violet */ -public class ElementTreePanel extends JPanel implements CaretListener, DocumentListener, PropertyChangeListener, TreeSelectionListener { - /** Tree showing the documents element structure. */ - protected JTree tree; - /** Text component showing elemenst for. */ - protected JTextComponent editor; - /** Model for the tree. */ - protected ElementTreeModel treeModel; - /** Set to true when updatin the selection. */ - protected boolean updatingSelection; +@SuppressWarnings("serial") +public class ElementTreePanel extends JPanel implements CaretListener, + DocumentListener, PropertyChangeListener, TreeSelectionListener { + /** Tree showing the documents element structure. */ + protected JTree tree; + /** Text component showing elemenst for. */ + protected JTextComponent editor; + /** Model for the tree. */ + protected ElementTreeModel treeModel; + /** Set to true when updatin the selection. */ + protected boolean updatingSelection; + + @SuppressWarnings("LeakingThisInConstructor") public ElementTreePanel(JTextComponent editor) { this.editor = editor; @@ -67,25 +90,28 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL // Create the tree. treeModel = new ElementTreeModel(document); tree = new JTree(treeModel) { + + @Override public String convertValueToText(Object value, boolean selected, - boolean expanded, boolean leaf, - int row, boolean hasFocus) { + boolean expanded, boolean leaf, + int row, boolean hasFocus) { // Should only happen for the root - if(!(value instanceof Element)) + if (!(value instanceof Element)) { return value.toString(); + } - Element e = (Element)value; - AttributeSet as = e.getAttributes().copyAttributes(); - String asString; + Element e = (Element) value; + AttributeSet as = e.getAttributes().copyAttributes(); + String asString; - if(as != null) { - StringBuffer retBuffer = new StringBuffer("["); - Enumeration names = as.getAttributeNames(); + if (as != null) { + StringBuilder retBuffer = new StringBuilder("["); + Enumeration names = as.getAttributeNames(); - while(names.hasMoreElements()) { - Object nextName = names.nextElement(); + while (names.hasMoreElements()) { + Object nextName = names.nextElement(); - if(nextName != StyleConstants.ResolveAttribute) { + if (nextName != StyleConstants.ResolveAttribute) { retBuffer.append(" "); retBuffer.append(nextName); retBuffer.append("="); @@ -94,16 +120,16 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL } retBuffer.append(" ]"); asString = retBuffer.toString(); - } - else + } else { asString = "[ ]"; + } - if(e.isLeaf()) - return e.getName() + " [" + e.getStartOffset() + - ", " + e.getEndOffset() +"] Attributes: " + asString; - return e.getName() + " [" + e.getStartOffset() + - ", " + e.getEndOffset() + "] Attributes: " + - asString; + if (e.isLeaf()) { + return e.getName() + " [" + e.getStartOffset() + ", " + e. + getEndOffset() + "] Attributes: " + asString; + } + return e.getName() + " [" + e.getStartOffset() + ", " + e. + getEndOffset() + "] Attributes: " + asString; } }; tree.addTreeSelectionListener(this); @@ -117,10 +143,13 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL // This is a temporary workaround, increase the needed size by 15, // hoping that will be enough. tree.setCellRenderer(new DefaultTreeCellRenderer() { + + @Override public Dimension getPreferredSize() { Dimension retValue = super.getPreferredSize(); - if(retValue != null) + if (retValue != null) { retValue.width += 15; + } return retValue; } }); @@ -139,7 +168,8 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL add(new JScrollPane(tree), BorderLayout.CENTER); // Add a label above tree to describe what is being shown - JLabel label = new JLabel("Elements that make up the current document", SwingConstants.CENTER); + JLabel label = new JLabel("Elements that make up the current document", + SwingConstants.CENTER); label.setFont(new Font("Dialog", Font.BOLD, 14)); add(label, BorderLayout.NORTH); @@ -157,7 +187,7 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL } if (this.editor != null) { - Document oldDoc = this.editor.getDocument(); + Document oldDoc = this.editor.getDocument(); oldDoc.removeDocumentListener(this); this.editor.removePropertyChangeListener(this); @@ -167,9 +197,8 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL if (editor == null) { treeModel = null; tree.setModel(null); - } - else { - Document newDoc = editor.getDocument(); + } else { + Document newDoc = editor.getDocument(); newDoc.addDocumentListener(this); editor.addPropertyChangeListener(this); @@ -180,17 +209,15 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL } // PropertyChangeListener - /** * Invoked when a property changes. We are only interested in when the * Document changes to reset the DocumentListener. */ public void propertyChange(PropertyChangeEvent e) { - if (e.getSource() == getEditor() && - e.getPropertyName().equals("document")) { - JTextComponent editor = getEditor(); - Document oldDoc = (Document)e.getOldValue(); - Document newDoc = (Document)e.getNewValue(); + if (e.getSource() == getEditor() && e.getPropertyName().equals( + "document")) { + Document oldDoc = (Document) e.getOldValue(); + Document newDoc = (Document) e.getNewValue(); // Reset the DocumentListener oldDoc.removeDocumentListener(this); @@ -202,9 +229,7 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL } } - // DocumentListener - /** * Gives notification that there was an insert into the document. The * given range bounds the freshly inserted region. @@ -236,53 +261,50 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL } // CaretListener - /** * Messaged when the selection in the editor has changed. Will update * the selection in the tree. */ public void caretUpdate(CaretEvent e) { - if(!updatingSelection) { - JTextComponent editor = getEditor(); - int selBegin = Math.min(e.getDot(), e.getMark()); - int end = Math.max(e.getDot(), e.getMark()); - Vector paths = new Vector(); - TreeModel model = getTreeModel(); - Object root = model.getRoot(); - int rootCount = model.getChildCount(root); + if (!updatingSelection) { + int selBegin = Math.min(e.getDot(), e.getMark()); + int end = Math.max(e.getDot(), e.getMark()); + List paths = new ArrayList(); + TreeModel model = getTreeModel(); + Object root = model.getRoot(); + int rootCount = model.getChildCount(root); // Build an array of all the paths to all the character elements // in the selection. - for(int counter = 0; counter < rootCount; counter++) { - int start = selBegin; + for (int counter = 0; counter < rootCount; counter++) { + int start = selBegin; - while(start <= end) { - TreePath path = getPathForIndex(start, root, - (Element)model.getChild(root, counter)); - Element charElement = (Element)path. - getLastPathComponent(); + while (start <= end) { + TreePath path = getPathForIndex(start, root, + (Element) model.getChild(root, counter)); + Element charElement = (Element) path.getLastPathComponent(); - paths.addElement(path); - if(start >= charElement.getEndOffset()) + paths.add(path); + if (start >= charElement.getEndOffset()) { start++; - else + } else { start = charElement.getEndOffset(); + } } } // If a path was found, select it (them). - int numPaths = paths.size(); + int numPaths = paths.size(); - if(numPaths > 0) { - TreePath[] pathArray = new TreePath[numPaths]; + if (numPaths > 0) { + TreePath[] pathArray = new TreePath[numPaths]; - paths.copyInto(pathArray); + paths.toArray(pathArray); updatingSelection = true; try { getTree().setSelectionPaths(pathArray); getTree().scrollPathToVisible(pathArray[0]); - } - finally { + } finally { updatingSelection = false; } } @@ -290,27 +312,24 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL } // TreeSelectionListener - /** - * Called whenever the value of the selection changes. - * @param e the event that characterizes the change. - */ + * Called whenever the value of the selection changes. + * @param e the event that characterizes the change. + */ public void valueChanged(TreeSelectionEvent e) { - JTree tree = getTree(); - if(!updatingSelection && tree.getSelectionCount() == 1) { - TreePath selPath = tree.getSelectionPath(); - Object lastPathComponent = selPath.getLastPathComponent(); + if (!updatingSelection && tree.getSelectionCount() == 1) { + TreePath selPath = tree.getSelectionPath(); + Object lastPathComponent = selPath.getLastPathComponent(); - if(!(lastPathComponent instanceof DefaultMutableTreeNode)) { - Element selElement = (Element)lastPathComponent; + if (!(lastPathComponent instanceof DefaultMutableTreeNode)) { + Element selElement = (Element) lastPathComponent; updatingSelection = true; try { getEditor().select(selElement.getStartOffset(), - selElement.getEndOffset()); - } - finally { + selElement.getEndOffset()); + } finally { updatingSelection = false; } } @@ -318,7 +337,6 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL } // Local methods - /** * @return tree showing elements. */ @@ -347,15 +365,14 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL protected void updateTree(DocumentEvent event) { updatingSelection = true; try { - TreeModel model = getTreeModel(); - Object root = model.getRoot(); + TreeModel model = getTreeModel(); + Object root = model.getRoot(); - for(int counter = model.getChildCount(root) - 1; counter >= 0; - counter--) { - updateTree(event, (Element)model.getChild(root, counter)); + for (int counter = model.getChildCount(root) - 1; counter >= 0; + counter--) { + updateTree(event, (Element) model.getChild(root, counter)); } - } - finally { + } finally { updatingSelection = false; } } @@ -372,53 +389,50 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL DocumentEvent.ElementChange ec = event.getChange(element); if (ec != null) { - Element[] removed = ec.getChildrenRemoved(); - Element[] added = ec.getChildrenAdded(); - int startIndex = ec.getIndex(); + Element[] removed = ec.getChildrenRemoved(); + Element[] added = ec.getChildrenAdded(); + int startIndex = ec.getIndex(); // Check for removed. - if(removed != null && removed.length > 0) { - int[] indices = new int[removed.length]; + if (removed != null && removed.length > 0) { + int[] indices = new int[removed.length]; - for(int counter = 0; counter < removed.length; counter++) { + for (int counter = 0; counter < removed.length; counter++) { indices[counter] = startIndex + counter; } - getTreeModel().nodesWereRemoved((TreeNode)element, indices, - removed); + getTreeModel().nodesWereRemoved((TreeNode) element, indices, + removed); } // check for added - if(added != null && added.length > 0) { - int[] indices = new int[added.length]; + if (added != null && added.length > 0) { + int[] indices = new int[added.length]; - for(int counter = 0; counter < added.length; counter++) { + for (int counter = 0; counter < added.length; counter++) { indices[counter] = startIndex + counter; } - getTreeModel().nodesWereInserted((TreeNode)element, indices); + getTreeModel().nodesWereInserted((TreeNode) element, indices); } } - if(!element.isLeaf()) { - int startIndex = element.getElementIndex - (event.getOffset()); - int elementCount = element.getElementCount(); - int endIndex = Math.min(elementCount - 1, - element.getElementIndex - (event.getOffset() + event.getLength())); + if (!element.isLeaf()) { + int startIndex = element.getElementIndex(event.getOffset()); + int elementCount = element.getElementCount(); + int endIndex = Math.min(elementCount - 1, + element.getElementIndex(event.getOffset() + + event.getLength())); - if(startIndex > 0 && startIndex < elementCount && - element.getElement(startIndex).getStartOffset() == - event.getOffset()) { + if (startIndex > 0 && startIndex < elementCount && element. + getElement(startIndex).getStartOffset() == event.getOffset()) { // Force checking the previous element. startIndex--; } - if(startIndex != -1 && endIndex != -1) { - for(int counter = startIndex; counter <= endIndex; counter++) { + if (startIndex != -1 && endIndex != -1) { + for (int counter = startIndex; counter <= endIndex; counter++) { updateTree(event, element.getElement(counter)); } } - } - else { + } else { // Element is a leaf, assume it changed - getTreeModel().nodeChanged((TreeNode)element); + getTreeModel().nodeChanged((TreeNode) element); } } @@ -426,14 +440,14 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL * Returns a TreePath to the element at position. */ protected TreePath getPathForIndex(int position, Object root, - Element rootElement) { - TreePath path = new TreePath(root); - Element child = rootElement.getElement - (rootElement.getElementIndex(position)); + Element rootElement) { + TreePath path = new TreePath(root); + Element child = rootElement.getElement(rootElement.getElementIndex( + position)); path = path.pathByAddingChild(rootElement); path = path.pathByAddingChild(child); - while(!child.isLeaf()) { + while (!child.isLeaf()) { child = child.getElement(child.getElementIndex(position)); path = path.pathByAddingChild(child); } @@ -456,7 +470,8 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL * methods have been subclassed, primarily to special case the root. */ public static class ElementTreeModel extends DefaultTreeModel { - protected Element[] rootElements; + + protected Element[] rootElements; public ElementTreeModel(Document document) { super(new DefaultMutableTreeNode("root"), false); @@ -474,13 +489,14 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL * @param parent a node in the tree, obtained from this data source * @return the child of parent at index index */ + @Override public Object getChild(Object parent, int index) { - if(parent == root) + if (parent == root) { return rootElements[index]; + } return super.getChild(parent, index); } - /** * Returns the number of children of parent. Returns 0 * if the node is a leaf or if it has no children. @@ -490,13 +506,14 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL * @param parent a node in the tree, obtained from this data source * @return the number of children of the node parent */ + @Override public int getChildCount(Object parent) { - if(parent == root) + if (parent == root) { return rootElements.length; + } return super.getChildCount(parent); } - /** * Returns true if node is a leaf. It is possible for * this method to return false even if node has no @@ -507,21 +524,25 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL * @param node a node in the tree, obtained from this data source * @return true if node is a leaf */ + @Override public boolean isLeaf(Object node) { - if(node == root) + if (node == root) { return false; + } return super.isLeaf(node); } /** * Returns the index of child in parent. */ + @Override public int getIndexOfChild(Object parent, Object child) { - if(parent == root) { - for(int counter = rootElements.length - 1; counter >= 0; - counter--) { - if(rootElements[counter] == child) + if (parent == root) { + for (int counter = rootElements.length - 1; counter >= 0; + counter--) { + if (rootElements[counter] == child) { return counter; + } } return -1; } @@ -532,18 +553,19 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL * Invoke this method after you've changed how node is to be * represented in the tree. */ + @Override public void nodeChanged(TreeNode node) { - if(listenerList != null && node != null) { - TreeNode parent = node.getParent(); + if (listenerList != null && node != null) { + TreeNode parent = node.getParent(); - if(parent == null && node != root) { + if (parent == null && node != root) { parent = root; } - if(parent != null) { - int anIndex = getIndexOfChild(parent, node); + if (parent != null) { + int anIndex = getIndexOfChild(parent, node); - if(anIndex != -1) { - int[] cIndexs = new int[1]; + if (anIndex != -1) { + int[] cIndexs = new int[1]; cIndexs[0] = anIndex; nodesChanged(parent, cIndexs); @@ -555,26 +577,28 @@ public class ElementTreePanel extends JPanel implements CaretListener, DocumentL /** * Returns the path to a particluar node. This is recursive. */ + @Override protected TreeNode[] getPathToRoot(TreeNode aNode, int depth) { - TreeNode[] retNodes; + TreeNode[] retNodes; /* Check for null, in case someone passed in a null node, or - they passed in an element that isn't rooted at root. */ - if(aNode == null) { - if(depth == 0) + they passed in an element that isn't rooted at root. */ + if (aNode == null) { + if (depth == 0) { return null; - else + } else { retNodes = new TreeNode[depth]; - } - else { + } + } else { depth++; - if(aNode == root) + if (aNode == root) { retNodes = new TreeNode[depth]; - else { + } else { TreeNode parent = aNode.getParent(); - if(parent == null) + if (parent == null) { parent = root; + } retNodes = getPathToRoot(parent, depth); } retNodes[retNodes.length - depth] = aNode; diff --git a/jdk/src/share/demo/jfc/Notepad/Notepad.java b/jdk/src/share/demo/jfc/Notepad/Notepad.java index 1c742798c61..a6d7e03a946 100644 --- a/jdk/src/share/demo/jfc/Notepad/Notepad.java +++ b/jdk/src/share/demo/jfc/Notepad/Notepad.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,20 +29,73 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ -import java.awt.*; -import java.awt.event.*; -import java.beans.*; -import java.io.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.FileDialog; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.StringTokenizer; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JToolBar; +import javax.swing.JViewport; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.event.UndoableEditEvent; +import javax.swing.event.UndoableEditListener; +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.JTextComponent; +import javax.swing.text.PlainDocument; +import javax.swing.text.Segment; +import javax.swing.text.TextAction; +import javax.swing.undo.CannotRedoException; +import javax.swing.undo.CannotUndoException; +import javax.swing.undo.UndoManager; -import javax.swing.text.*; -import javax.swing.undo.*; -import javax.swing.event.*; -import javax.swing.*; /** * Sample application using the simple text editor component that @@ -50,22 +103,24 @@ import javax.swing.*; * * @author Timothy Prinzing */ +@SuppressWarnings("serial") class Notepad extends JPanel { private static ResourceBundle resources; - private final static String EXIT_AFTER_PAINT = new String("-exit"); + private final static String EXIT_AFTER_PAINT = "-exit"; private static boolean exitAfterFirstPaint; static { try { resources = ResourceBundle.getBundle("resources.Notepad", - Locale.getDefault()); + Locale.getDefault()); } catch (MissingResourceException mre) { System.err.println("resources/Notepad.properties not found"); System.exit(1); } } + @Override public void paintChildren(Graphics g) { super.paintChildren(g); if (exitAfterFirstPaint) { @@ -73,17 +128,19 @@ class Notepad extends JPanel { } } + @SuppressWarnings("OverridableMethodCallInConstructor") Notepad() { super(true); - // Force SwingSet to come up in the Cross Platform L&F + // Trying to set Nimbus look and feel try { - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - // If you want the System L&F instead, comment out the above line and - // uncomment the following: - // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception exc) { - System.err.println("Error loading L&F: " + exc); + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception ignored) { } setBorder(BorderFactory.createEtchedBorder()); @@ -95,7 +152,7 @@ class Notepad extends JPanel { editor.getDocument().addUndoableEditListener(undoHandler); // install the command table - commands = new Hashtable(); + commands = new HashMap(); Action[] actions = getActions(); for (int i = 0; i < actions.length; i++) { Action a = actions[i]; @@ -109,15 +166,17 @@ class Notepad extends JPanel { try { String vpFlag = resources.getString("ViewportBackingStore"); Boolean bs = Boolean.valueOf(vpFlag); - port.setBackingStoreEnabled(bs.booleanValue()); - } catch (MissingResourceException mre) { + port.setScrollMode(bs.booleanValue() + ? JViewport.BACKINGSTORE_SCROLL_MODE + : JViewport.BLIT_SCROLL_MODE); + } catch (MissingResourceException ignored) { // just use the viewport default } - menuItems = new Hashtable(); + menuItems = new HashMap(); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); - panel.add("North",createToolbar()); + panel.add("North", createToolbar()); panel.add("Center", scroller); add("Center", panel); add("South", createStatusbar()); @@ -125,28 +184,28 @@ class Notepad extends JPanel { public static void main(String[] args) { try { - String vers = System.getProperty("java.version"); - if (vers.compareTo("1.1.2") < 0) { - System.out.println("!!!WARNING: Swing must be run with a " + - "1.1.2 or higher version VM!!!"); - } - if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) { - exitAfterFirstPaint = true; - } - JFrame frame = new JFrame(); - frame.setTitle(resources.getString("Title")); - frame.setBackground(Color.lightGray); - frame.getContentPane().setLayout(new BorderLayout()); - Notepad notepad = new Notepad(); - frame.getContentPane().add("Center", notepad); - frame.setJMenuBar(notepad.createMenubar()); - frame.addWindowListener(new AppCloser()); - frame.pack(); - frame.setSize(500, 600); - frame.show(); + if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) { + exitAfterFirstPaint = true; + } + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + JFrame frame = new JFrame(); + frame.setTitle(resources.getString("Title")); + frame.setBackground(Color.lightGray); + frame.getContentPane().setLayout(new BorderLayout()); + Notepad notepad = new Notepad(); + frame.getContentPane().add("Center", notepad); + frame.setJMenuBar(notepad.createMenubar()); + frame.addWindowListener(new AppCloser()); + frame.pack(); + frame.setSize(500, 600); + frame.setVisible(true); + } + }); } catch (Throwable t) { - System.out.println("uncaught exception: " + t); - t.printStackTrace(); + Logger.getLogger(Notepad.class.getName()).log(Level.SEVERE, + "uncaught exception", t); } } @@ -177,6 +236,7 @@ class Notepad extends JPanel { return editor; } + /** * To shutdown when run as an application. This is a * fairly lame implementation. A more self-respecting @@ -184,6 +244,8 @@ class Notepad extends JPanel { * was needed. */ protected static final class AppCloser extends WindowAdapter { + + @Override public void windowClosing(WindowEvent e) { System.exit(0); } @@ -239,11 +301,11 @@ class Notepad extends JPanel { * if one wasn't created. */ protected JMenuItem getMenuItem(String cmd) { - return (JMenuItem) menuItems.get(cmd); + return menuItems.get(cmd); } protected Action getAction(String cmd) { - return (Action) commands.get(cmd); + return commands.get(cmd); } protected String getResourceString(String nm) { @@ -328,10 +390,14 @@ class Notepad extends JPanel { protected JButton createToolbarButton(String key) { URL url = getResource(key + imageSuffix); JButton b = new JButton(new ImageIcon(url)) { - public float getAlignmentY() { return 0.5f; } + + @Override + public float getAlignmentY() { + return 0.5f; + } }; b.setRequestFocusEnabled(false); - b.setMargin(new Insets(1,1,1,1)); + b.setMargin(new Insets(1, 1, 1, 1)); String astr = getResourceString(key + actionSuffix); if (astr == null) { @@ -360,15 +426,17 @@ class Notepad extends JPanel { * resource file. */ protected String[] tokenize(String input) { - Vector v = new Vector(); + List v = new ArrayList(); StringTokenizer t = new StringTokenizer(input); String cmd[]; - while (t.hasMoreTokens()) - v.addElement(t.nextToken()); + while (t.hasMoreTokens()) { + v.add(t.nextToken()); + } cmd = new String[v.size()]; - for (int i = 0; i < cmd.length; i++) - cmd[i] = (String) v.elementAt(i); + for (int i = 0; i < cmd.length; i++) { + cmd[i] = v.get(i); + } return cmd; } @@ -416,13 +484,16 @@ class Notepad extends JPanel { } // Yarked from JMenu, ideally this would be public. + private class ActionChangedListener implements PropertyChangeListener { + JMenuItem menuItem; ActionChangedListener(JMenuItem mi) { super(); this.menuItem = mi; } + public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); if (e.getPropertyName().equals(Action.NAME)) { @@ -434,56 +505,48 @@ class Notepad extends JPanel { } } } - private JTextComponent editor; - private Hashtable commands; - private Hashtable menuItems; + private Map commands; + private Map menuItems; private JMenuBar menubar; private JToolBar toolbar; private JComponent status; private JFrame elementTreeFrame; protected ElementTreePanel elementTreePanel; - protected FileDialog fileDialog; - /** * Listener for the edits on the current document. */ protected UndoableEditListener undoHandler = new UndoHandler(); - /** UndoManager that we add edits to. */ protected UndoManager undo = new UndoManager(); - /** * Suffix applied to the key used in resource file * lookups for an image. */ public static final String imageSuffix = "Image"; - /** * Suffix applied to the key used in resource file * lookups for a label. */ public static final String labelSuffix = "Label"; - /** * Suffix applied to the key used in resource file * lookups for an action. */ public static final String actionSuffix = "Action"; - /** * Suffix applied to the key used in resource file * lookups for tooltip text. */ public static final String tipSuffix = "Tooltip"; - public static final String openAction = "open"; - public static final String newAction = "new"; + public static final String newAction = "new"; public static final String saveAction = "save"; public static final String exitAction = "exit"; public static final String showElementTreeAction = "showElementTree"; + class UndoHandler implements UndoableEditListener { /** @@ -497,6 +560,7 @@ class Notepad extends JPanel { } } + /** * FIXME - I'm not very useful yet */ @@ -507,17 +571,14 @@ class Notepad extends JPanel { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); } + @Override public void paint(Graphics g) { super.paint(g); } - } - // --- action implementations ----------------------------------- - private UndoAction undoAction = new UndoAction(); private RedoAction redoAction = new RedoAction(); - /** * Actions defined by the Notepad class */ @@ -531,7 +592,9 @@ class Notepad extends JPanel { redoAction }; + class UndoAction extends AbstractAction { + public UndoAction() { super("Undo"); setEnabled(false); @@ -541,26 +604,27 @@ class Notepad extends JPanel { try { undo.undo(); } catch (CannotUndoException ex) { - System.out.println("Unable to undo: " + ex); - ex.printStackTrace(); + Logger.getLogger(UndoAction.class.getName()).log(Level.SEVERE, + "Unable to undo", ex); } update(); redoAction.update(); } protected void update() { - if(undo.canUndo()) { + if (undo.canUndo()) { setEnabled(true); putValue(Action.NAME, undo.getUndoPresentationName()); - } - else { + } else { setEnabled(false); putValue(Action.NAME, "Undo"); } } } + class RedoAction extends AbstractAction { + public RedoAction() { super("Redo"); setEnabled(false); @@ -570,31 +634,32 @@ class Notepad extends JPanel { try { undo.redo(); } catch (CannotRedoException ex) { - System.out.println("Unable to redo: " + ex); - ex.printStackTrace(); + Logger.getLogger(RedoAction.class.getName()).log(Level.SEVERE, + "Unable to redo", ex); } update(); undoAction.update(); } protected void update() { - if(undo.canRedo()) { + if (undo.canRedo()) { setEnabled(true); putValue(Action.NAME, undo.getRedoPresentationName()); - } - else { + } else { setEnabled(false); putValue(Action.NAME, "Redo"); } } } + class OpenAction extends NewAction { OpenAction() { super(openAction); } + @Override public void actionPerformed(ActionEvent e) { Frame frame = getFrame(); JFileChooser chooser = new JFileChooser(); @@ -607,8 +672,9 @@ class Notepad extends JPanel { File f = chooser.getSelectedFile(); if (f.isFile() && f.canRead()) { Document oldDoc = getEditor().getDocument(); - if(oldDoc != null) + if (oldDoc != null) { oldDoc.removeUndoableEditListener(undoHandler); + } if (elementTreePanel != null) { elementTreePanel.setEditor(null); } @@ -625,6 +691,7 @@ class Notepad extends JPanel { } } + class SaveAction extends AbstractAction { SaveAction() { @@ -647,6 +714,7 @@ class Notepad extends JPanel { } } + class NewAction extends AbstractAction { NewAction() { @@ -659,8 +727,9 @@ class Notepad extends JPanel { public void actionPerformed(ActionEvent e) { Document oldDoc = getEditor().getDocument(); - if(oldDoc != null) + if (oldDoc != null) { oldDoc.removeUndoableEditListener(undoHandler); + } getEditor().setDocument(new PlainDocument()); getEditor().getDocument().addUndoableEditListener(undoHandler); resetUndoManager(); @@ -669,6 +738,7 @@ class Notepad extends JPanel { } } + /** * Really lame implementation of an exit command */ @@ -683,6 +753,7 @@ class Notepad extends JPanel { } } + /** * Action that brings up a JFrame with a JTree showing the structure * of the document. @@ -698,18 +769,19 @@ class Notepad extends JPanel { } public void actionPerformed(ActionEvent e) { - if(elementTreeFrame == null) { + if (elementTreeFrame == null) { // Create a frame containing an instance of // ElementTreePanel. try { - String title = resources.getString - ("ElementTreeFrameTitle"); + String title = resources.getString("ElementTreeFrameTitle"); elementTreeFrame = new JFrame(title); } catch (MissingResourceException mre) { elementTreeFrame = new JFrame(); } elementTreeFrame.addWindowListener(new WindowAdapter() { + + @Override public void windowClosing(WindowEvent weeee) { elementTreeFrame.setVisible(false); } @@ -721,10 +793,11 @@ class Notepad extends JPanel { fContentPane.add(elementTreePanel); elementTreeFrame.pack(); } - elementTreeFrame.show(); + elementTreeFrame.setVisible(true); } } + /** * Thread to load a file into the text storage model */ @@ -736,6 +809,7 @@ class Notepad extends JPanel { this.doc = doc; } + @Override public void run() { try { // initialize the statusbar @@ -751,22 +825,22 @@ class Notepad extends JPanel { char[] buff = new char[4096]; int nch; while ((nch = in.read(buff, 0, buff.length)) != -1) { - doc.insertString(doc.getLength(), new String(buff, 0, nch), null); + doc.insertString(doc.getLength(), new String(buff, 0, nch), + null); progress.setValue(progress.getValue() + nch); } - } - catch (IOException e) { + } catch (IOException e) { final String msg = e.getMessage(); SwingUtilities.invokeLater(new Runnable() { + public void run() { JOptionPane.showMessageDialog(getFrame(), "Could not open file: " + msg, "Error opening file", JOptionPane.ERROR_MESSAGE); - } + } }); - } - catch (BadLocationException e) { + } catch (BadLocationException e) { System.err.println(e.getMessage()); } doc.addUndoableEditListener(undoHandler); @@ -778,21 +852,23 @@ class Notepad extends JPanel { if (elementTreePanel != null) { SwingUtilities.invokeLater(new Runnable() { + public void run() { elementTreePanel.setEditor(getEditor()); } }); } } - Document doc; File f; } + /** * Thread to save a document to file */ class FileSaver extends Thread { + Document doc; File f; @@ -802,13 +878,15 @@ class Notepad extends JPanel { this.doc = doc; } + @Override + @SuppressWarnings("SleepWhileHoldingLock") public void run() { try { // initialize the statusbar status.removeAll(); JProgressBar progress = new JProgressBar(); progress.setMinimum(0); - progress.setMaximum((int) doc.getLength()); + progress.setMaximum(doc.getLength()); status.add(progress); status.revalidate(); @@ -827,24 +905,25 @@ class Notepad extends JPanel { try { Thread.sleep(10); } catch (InterruptedException e) { - e.printStackTrace(); + Logger.getLogger(FileSaver.class.getName()).log( + Level.SEVERE, + null, e); } } out.flush(); out.close(); - } - catch (IOException e) { + } catch (IOException e) { final String msg = e.getMessage(); SwingUtilities.invokeLater(new Runnable() { + public void run() { JOptionPane.showMessageDialog(getFrame(), "Could not save file: " + msg, "Error saving file", JOptionPane.ERROR_MESSAGE); - } + } }); - } - catch (BadLocationException e) { + } catch (BadLocationException e) { System.err.println(e.getMessage()); } // we are done... get rid of progressbar From 12f9a0fc722a8f917fc30e047726dad8d5a4f0d5 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 13:27:21 +0100 Subject: [PATCH 046/168] 7027694: /jfc/FileChooserDemo demo needs to be improved Reviewed-by: rupashka --- .../ExampleFileSystemView.java | 13 +- .../jfc/FileChooserDemo/ExampleFileView.java | 32 +- .../jfc/FileChooserDemo/FileChooserDemo.java | 292 +++++++++++------- 3 files changed, 210 insertions(+), 127 deletions(-) diff --git a/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileSystemView.java b/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileSystemView.java index ec1ba0f6128..3a0897b1c4d 100644 --- a/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileSystemView.java +++ b/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileSystemView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,13 +29,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.io.File; import java.io.IOException; import javax.swing.filechooser.FileSystemView; + /** * This is a simple example that uses the FileSystemView class. * You can provide a superclass of the FileSystemView class with your own functionality. @@ -43,6 +42,7 @@ import javax.swing.filechooser.FileSystemView; * @author Pavel Porvatov */ public class ExampleFileSystemView extends FileSystemView { + /** * Creates a new folder with the default name "New folder". This method is invoked * when the user presses the "New folder" button. @@ -65,8 +65,9 @@ public class ExampleFileSystemView extends FileSystemView { * Returns a list which appears in a drop-down list of the FileChooser component. * In this implementation only the home directory is returned. */ + @Override public File[] getRoots() { - return new File[]{getHomeDirectory()}; + return new File[] { getHomeDirectory() }; } /** @@ -74,9 +75,11 @@ public class ExampleFileSystemView extends FileSystemView { * A string with all upper case letters is returned for a directory. * A string with all lower case letters is returned for a file. */ + @Override public String getSystemDisplayName(File f) { String displayName = super.getSystemDisplayName(f); - return f.isDirectory() ? displayName.toUpperCase() : displayName.toLowerCase(); + return f.isDirectory() ? displayName.toUpperCase() : displayName. + toLowerCase(); } } diff --git a/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileView.java b/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileView.java index 6add94197dc..cec4e721c1c 100644 --- a/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileView.java +++ b/jdk/src/share/demo/jfc/FileChooserDemo/ExampleFileView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,14 +29,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import javax.swing.*; import javax.swing.filechooser.*; - import java.io.File; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Map; + /** * A convenience implementation of the FileView interface that @@ -61,15 +60,19 @@ import java.util.Hashtable; * @author Jeff Dinkins */ public class ExampleFileView extends FileView { - private final Hashtable icons = new Hashtable(); - private final Hashtable fileDescriptions = new Hashtable(); - private final Hashtable typeDescriptions = new Hashtable(); + + private final Map icons = new HashMap(); + private final Map fileDescriptions = + new HashMap(); + private final Map typeDescriptions = + new HashMap(); /** * The name of the file. Do nothing special here. Let * the system file view handle this. * @see FileView#getName */ + @Override public String getName(File f) { return null; } @@ -86,6 +89,7 @@ public class ExampleFileView extends FileView { * * @see FileView#getDescription */ + @Override public String getDescription(File f) { return fileDescriptions.get(f); } @@ -112,6 +116,7 @@ public class ExampleFileView extends FileView { * * @see FileView#getTypeDescription */ + @Override public String getTypeDescription(File f) { return typeDescriptions.get(getExtension(f)); } @@ -122,12 +127,12 @@ public class ExampleFileView extends FileView { */ private String getExtension(File f) { String name = f.getName(); - if(name != null) { + if (name != null) { int extensionIndex = name.lastIndexOf('.'); - if(extensionIndex < 0) { + if (extensionIndex < 0) { return null; } - return name.substring(extensionIndex+1).toLowerCase(); + return name.substring(extensionIndex + 1).toLowerCase(); } return null; } @@ -147,10 +152,11 @@ public class ExampleFileView extends FileView { * * @see FileView#getIcon */ + @Override public Icon getIcon(File f) { Icon icon = null; String extension = getExtension(f); - if(extension != null) { + if (extension != null) { icon = icons.get(extension); } return icon; @@ -168,11 +174,11 @@ public class ExampleFileView extends FileView { * * @see FileView#isTraversable */ + @Override public Boolean isTraversable(File f) { // if (some_reason) { // return Boolean.FALSE; // } return null; // Use default from FileSystemView } - } diff --git a/jdk/src/share/demo/jfc/FileChooserDemo/FileChooserDemo.java b/jdk/src/share/demo/jfc/FileChooserDemo/FileChooserDemo.java index 97045fb84a5..67e1daee1e8 100644 --- a/jdk/src/share/demo/jfc/FileChooserDemo/FileChooserDemo.java +++ b/jdk/src/share/demo/jfc/FileChooserDemo/FileChooserDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,34 +29,75 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ -import javax.swing.*; -import javax.swing.filechooser.*; +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.UIManager.LookAndFeelInfo; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; +import javax.swing.JToggleButton; +import javax.swing.LookAndFeel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.WindowConstants; +import javax.swing.filechooser.FileFilter; +import javax.swing.filechooser.FileNameExtensionFilter; +import javax.swing.filechooser.FileSystemView; +import java.util.ArrayList; import javax.swing.plaf.FileChooserUI; import javax.swing.plaf.basic.BasicFileChooserUI; - -import java.awt.*; import java.io.File; -import java.awt.event.*; -import java.beans.*; -import java.util.Vector; - import static javax.swing.JFileChooser.*; + /** * * A demo which makes extensive use of the file chooser. * * @author Jeff Dinkins */ +@SuppressWarnings("serial") public class FileChooserDemo extends JPanel implements ActionListener { - private static JFrame frame; - private final Vector supportedLaFs = new Vector(); + public static final String NIMBUS_LAF_NAME = "Nimbus"; + private static JFrame frame; + private final List supportedLaFs = + new ArrayList(); + private static SupportedLaF nimbusLaF; + private static class SupportedLaF { + private final String name; private final LookAndFeel laf; @@ -65,18 +106,15 @@ public class FileChooserDemo extends JPanel implements ActionListener { this.laf = laf; } + @Override public String toString() { return name; } } - - private JButton showButton; - private JCheckBox showAllFilesFilterCheckBox; private JCheckBox showImageFilesFilterCheckBox; private JCheckBox showFullDescriptionCheckBox; - private JCheckBox useFileViewCheckBox; private JCheckBox useFileSystemViewCheckBox; private JCheckBox accessoryCheckBox; @@ -84,46 +122,44 @@ public class FileChooserDemo extends JPanel implements ActionListener { private JCheckBox useEmbedInWizardCheckBox; private JCheckBox useControlsCheckBox; private JCheckBox enableDragCheckBox; - private JRadioButton singleSelectionRadioButton; private JRadioButton multiSelectionRadioButton; - private JRadioButton openRadioButton; private JRadioButton saveRadioButton; private JRadioButton customButton; - private JComboBox lafComboBox; - private JRadioButton justFilesRadioButton; private JRadioButton justDirectoriesRadioButton; private JRadioButton bothFilesAndDirectoriesRadioButton; - private JTextField customField; - private final ExampleFileView fileView; - private final ExampleFileSystemView fileSystemView; - - private final static Dimension hpad10 = new Dimension(10,1); - private final static Dimension vpad20 = new Dimension(1,20); + private final static Dimension hpad10 = new Dimension(10, 1); + private final static Dimension vpad20 = new Dimension(1, 20); private final static Dimension vpad7 = new Dimension(1, 7); private final static Dimension vpad4 = new Dimension(1, 4); private final static Insets insets = new Insets(5, 10, 0, 10); - private final FilePreviewer previewer; private final JFileChooser chooser; + @SuppressWarnings("LeakingThisInConstructor") public FileChooserDemo() { - UIManager.LookAndFeelInfo[] installedLafs = UIManager.getInstalledLookAndFeels(); + UIManager.LookAndFeelInfo[] installedLafs = UIManager. + getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo lafInfo : installedLafs) { try { - Class lnfClass = Class.forName(lafInfo.getClassName()); - LookAndFeel laf = (LookAndFeel)(lnfClass.newInstance()); + Class lnfClass = Class.forName(lafInfo.getClassName()); + LookAndFeel laf = (LookAndFeel) (lnfClass.newInstance()); if (laf.isSupportedLookAndFeel()) { String name = lafInfo.getName(); - supportedLaFs.add(new SupportedLaF(name, laf)); + SupportedLaF supportedLaF = new SupportedLaF(name, laf); + supportedLaFs.add(supportedLaF); + if (NIMBUS_LAF_NAME.equals(name)) { + nimbusLaF = supportedLaF; + } } - } catch (Exception e) { // If ANYTHING weird happens, don't add it + } catch (Exception ignored) { + // If ANYTHING weird happens, don't add this L&F } } @@ -134,8 +170,10 @@ public class FileChooserDemo extends JPanel implements ActionListener { // Create Custom FileView fileView = new ExampleFileView(); - fileView.putIcon("jpg", new ImageIcon(getClass().getResource("/resources/images/jpgIcon.jpg"))); - fileView.putIcon("gif", new ImageIcon(getClass().getResource("/resources/images/gifIcon.gif"))); + fileView.putIcon("jpg", new ImageIcon(getClass().getResource( + "/resources/images/jpgIcon.jpg"))); + fileView.putIcon("gif", new ImageIcon(getClass().getResource( + "/resources/images/gifIcon.gif"))); // Create Custom FileSystemView fileSystemView = new ExampleFileSystemView(); @@ -155,8 +193,11 @@ public class FileChooserDemo extends JPanel implements ActionListener { customButton.addActionListener(optionListener); customField = new JTextField(8) { + + @Override public Dimension getMaximumSize() { - return new Dimension(getPreferredSize().width, getPreferredSize().height); + return new Dimension(getPreferredSize().width, + getPreferredSize().height); } }; customField.setText("Doit"); @@ -220,7 +261,8 @@ public class FileChooserDemo extends JPanel implements ActionListener { group3.add(justDirectoriesRadioButton); justDirectoriesRadioButton.addActionListener(optionListener); - bothFilesAndDirectoriesRadioButton = new JRadioButton("Select Files or Directories"); + bothFilesAndDirectoriesRadioButton = new JRadioButton( + "Select Files or Directories"); group3.add(bothFilesAndDirectoriesRadioButton); bothFilesAndDirectoriesRadioButton.addActionListener(optionListener); @@ -241,7 +283,8 @@ public class FileChooserDemo extends JPanel implements ActionListener { showButton.setMnemonic('s'); // Create laf combo box - lafComboBox = new JComboBox(supportedLaFs); + lafComboBox = new JComboBox(supportedLaFs.toArray()); + lafComboBox.setSelectedItem(nimbusLaF); lafComboBox.setEditable(false); lafComboBox.addActionListener(optionListener); @@ -317,7 +360,8 @@ public class FileChooserDemo extends JPanel implements ActionListener { // ************* File & Directory Options ***************** // ******************************************************** JPanel control4 = new InsetPanel(insets); - control4.setBorder(BorderFactory.createTitledBorder("File and Directory Options")); + control4.setBorder(BorderFactory.createTitledBorder( + "File and Directory Options")); control4.setLayout(new BoxLayout(control4, BoxLayout.Y_AXIS)); control4.add(Box.createRigidArea(vpad20)); control4.add(justFilesRadioButton); @@ -379,7 +423,7 @@ public class FileChooserDemo extends JPanel implements ActionListener { // clear the preview from the previous display of the chooser JComponent accessory = chooser.getAccessory(); if (accessory != null) { - ((FilePreviewer)accessory).loadImage(null); + ((FilePreviewer) accessory).loadImage(null); } if (useEmbedInWizardCheckBox.isSelected()) { @@ -393,25 +437,28 @@ public class FileChooserDemo extends JPanel implements ActionListener { if (retval == APPROVE_OPTION) { JOptionPane.showMessageDialog(frame, getResultString()); } else if (retval == CANCEL_OPTION) { - JOptionPane.showMessageDialog(frame, "User cancelled operation. No file was chosen."); + JOptionPane.showMessageDialog(frame, + "User cancelled operation. No file was chosen."); } else if (retval == ERROR_OPTION) { - JOptionPane.showMessageDialog(frame, "An error occured. No file was chosen."); + JOptionPane.showMessageDialog(frame, + "An error occured. No file was chosen."); } else { JOptionPane.showMessageDialog(frame, "Unknown operation occured."); } } private void resetFileFilters(boolean enableFilters, - boolean showExtensionInDescription) { + boolean showExtensionInDescription) { chooser.resetChoosableFileFilters(); if (enableFilters) { - FileFilter jpgFilter = createFileFilter("JPEG Compressed Image Files", - showExtensionInDescription, "jpg"); + FileFilter jpgFilter = createFileFilter( + "JPEG Compressed Image Files", + showExtensionInDescription, "jpg"); FileFilter gifFilter = createFileFilter("GIF Image Files", - showExtensionInDescription, "gif"); + showExtensionInDescription, "gif"); FileFilter bothFilter = createFileFilter("JPEG and GIF Image Files", - showExtensionInDescription, "jpg", - "gif"); + showExtensionInDescription, "jpg", + "gif"); chooser.addChoosableFileFilter(bothFilter); chooser.addChoosableFileFilter(jpgFilter); chooser.addChoosableFileFilter(gifFilter); @@ -419,7 +466,7 @@ public class FileChooserDemo extends JPanel implements ActionListener { } private FileFilter createFileFilter(String description, - boolean showExtensionInDescription, String...extensions) { + boolean showExtensionInDescription, String... extensions) { if (showExtensionInDescription) { description = createFileNameFilterDescriptionFromExtensions( description, extensions); @@ -429,8 +476,8 @@ public class FileChooserDemo extends JPanel implements ActionListener { private String createFileNameFilterDescriptionFromExtensions( String description, String[] extensions) { - String fullDescription = (description == null) ? - "(" : description + " ("; + String fullDescription = (description == null) ? "(" : description + + " ("; // build the description from the extension list fullDescription += "." + extensions[0]; for (int i = 1; i < extensions.length; i++) { @@ -441,12 +488,15 @@ public class FileChooserDemo extends JPanel implements ActionListener { return fullDescription; } + private class WizardDialog extends JDialog implements ActionListener { + CardLayout cardLayout; JPanel cardPanel; JLabel messageLabel; JButton backButton, nextButton, closeButton; + @SuppressWarnings("LeakingThisInConstructor") WizardDialog(JFrame frame, boolean modal) { super(frame, "Embedded JFileChooser Demo", modal); @@ -494,15 +544,16 @@ public class FileChooserDemo extends JPanel implements ActionListener { // Workaround for bug 4528663. This is necessary to // pick up the contents of the file chooser text field. // This will trigger an APPROVE_SELECTION action. - ((BasicFileChooserUI)ui).getApproveSelectionAction().actionPerformed(null); + ((BasicFileChooserUI) ui).getApproveSelectionAction(). + actionPerformed(null); } else { next(); } } else if (src == closeButton) { close(); - } else if (cmd == APPROVE_SELECTION) { + } else if (APPROVE_SELECTION.equals(cmd)) { next(); - } else if (cmd == CANCEL_SELECTION) { + } else if (CANCEL_SELECTION.equals(cmd)) { close(); } } @@ -528,6 +579,7 @@ public class FileChooserDemo extends JPanel implements ActionListener { setVisible(false); } + @Override public void dispose() { chooser.removeActionListener(this); @@ -542,13 +594,18 @@ public class FileChooserDemo extends JPanel implements ActionListener { private String getResultString() { String resultString; - String filter = chooser.getFileFilter().getDescription(); + String filter; + if (chooser.getFileFilter() == null) { + filter = ""; + } else { + filter = chooser.getFileFilter().getDescription(); + } String path = null; boolean isDirMode = (chooser.getFileSelectionMode() == DIRECTORIES_ONLY); boolean isMulti = chooser.isMultiSelectionEnabled(); if (isMulti) { - File [] files = chooser.getSelectedFiles(); + File[] files = chooser.getSelectedFiles(); if (files != null && files.length > 0) { path = ""; for (File file : files) { @@ -565,11 +622,10 @@ public class FileChooserDemo extends JPanel implements ActionListener { path = path.replace(" ", " "); filter = filter.replace(" ", " "); resultString = - "You chose " + (isMulti ? "these" : "this") + " " + - (isDirMode ? (isMulti ? "directories" : "directory") - : (isMulti ? "files" : "file")) + - ": " + path + - "

with filter:
" + filter; + "You chose " + (isMulti ? "these" : "this") + " " + (isDirMode ? (isMulti + ? "directories" : "directory") + : (isMulti ? "files" : "file")) + ": " + path + + "

with filter:
" + filter; } else { resultString = "Nothing was chosen"; } @@ -577,15 +633,14 @@ public class FileChooserDemo extends JPanel implements ActionListener { } - - /** An ActionListener that listens to the radio buttons. */ private class OptionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { JComponent c = (JComponent) e.getSource(); boolean selected = false; if (c instanceof JToggleButton) { - selected = ((JToggleButton)c).isSelected(); + selected = ((JToggleButton) c).isSelected(); } if (c == openRadioButton) { @@ -612,7 +667,7 @@ public class FileChooserDemo extends JPanel implements ActionListener { chooser.setAcceptAllFileFilterUsed(selected); } else if (c == showImageFilesFilterCheckBox) { resetFileFilters(selected, - showFullDescriptionCheckBox.isSelected()); + showFullDescriptionCheckBox.isSelected()); showFullDescriptionCheckBox.setEnabled(selected); } else if (c == setHiddenCheckBox) { chooser.setFileHidingEnabled(!selected); @@ -637,7 +692,7 @@ public class FileChooserDemo extends JPanel implements ActionListener { } } else if (c == showFullDescriptionCheckBox) { resetFileFilters(showImageFilesFilterCheckBox.isSelected(), - selected); + selected); } else if (c == justFilesRadioButton) { chooser.setFileSelectionMode(FILES_ONLY); } else if (c == justDirectoriesRadioButton) { @@ -653,27 +708,33 @@ public class FileChooserDemo extends JPanel implements ActionListener { chooser.setMultiSelectionEnabled(true); } } else if (c == lafComboBox) { - SupportedLaF supportedLaF = ((SupportedLaF)lafComboBox.getSelectedItem()); + SupportedLaF supportedLaF = ((SupportedLaF) lafComboBox. + getSelectedItem()); LookAndFeel laf = supportedLaF.laf; try { UIManager.setLookAndFeel(laf); SwingUtilities.updateComponentTreeUI(frame); - if(chooser != null) { + if (chooser != null) { SwingUtilities.updateComponentTreeUI(chooser); } frame.pack(); } catch (UnsupportedLookAndFeelException exc) { // This should not happen because we already checked - ((DefaultComboBoxModel)lafComboBox.getModel()).removeElement(supportedLaF); + ((DefaultComboBoxModel) lafComboBox.getModel()). + removeElement(supportedLaF); } } } } - private class FilePreviewer extends JComponent implements PropertyChangeListener { + + private class FilePreviewer extends JComponent implements + PropertyChangeListener { + ImageIcon thumbnail = null; + @SuppressWarnings("LeakingThisInConstructor") public FilePreviewer(JFileChooser fc) { setPreferredSize(new Dimension(100, 50)); fc.addPropertyChangeListener(this); @@ -684,9 +745,10 @@ public class FileChooserDemo extends JPanel implements ActionListener { thumbnail = null; } else { ImageIcon tmpIcon = new ImageIcon(f.getPath()); - if(tmpIcon.getIconWidth() > 90) { + if (tmpIcon.getIconWidth() > 90) { thumbnail = new ImageIcon( - tmpIcon.getImage().getScaledInstance(90, -1, Image.SCALE_DEFAULT)); + tmpIcon.getImage().getScaledInstance(90, -1, + Image.SCALE_DEFAULT)); } else { thumbnail = tmpIcon; } @@ -695,23 +757,24 @@ public class FileChooserDemo extends JPanel implements ActionListener { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); - if (prop == SELECTED_FILE_CHANGED_PROPERTY) { - if(isShowing()) { + if (SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { + if (isShowing()) { loadImage((File) e.getNewValue()); repaint(); } } } + @Override public void paint(Graphics g) { - if(thumbnail != null) { - int x = getWidth()/2 - thumbnail.getIconWidth()/2; - int y = getHeight()/2 - thumbnail.getIconHeight()/2; - if(y < 0) { + if (thumbnail != null) { + int x = getWidth() / 2 - thumbnail.getIconWidth() / 2; + int y = getHeight() / 2 - thumbnail.getIconHeight() / 2; + if (y < 0) { y = 0; } - if(x < 5) { + if (x < 5) { x = 5; } thumbnail.paintIcon(this, g, x, y); @@ -720,46 +783,57 @@ public class FileChooserDemo extends JPanel implements ActionListener { } public static void main(String s[]) { - /* - NOTE: By default, the look and feel will be set to the - Cross Platform Look and Feel (which is currently Metal). - The user may someday be able to override the default - via a system property. If you as the developer want to - be sure that a particular L&F is set, you can do so - by calling UIManager.setLookAndFeel(). For example, the - first code snippet below forcibly sets the UI to be the - System Look and Feel. The second code snippet forcibly - sets the look and feel to the Cross Platform L&F. + try { + SwingUtilities.invokeAndWait(new Runnable() { - Snippet 1: - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception exc) { - System.err.println("Error loading L&F: " + exc); - } + public void run() { + /* + * NOTE: By default, the look and feel will be set to the + * Cross Platform Look and Feel (which is currently Metal). + * The following code tries to set the Look and Feel to Nimbus. + * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html + */ + try { + for (LookAndFeelInfo info : UIManager. + getInstalledLookAndFeels()) { + if (NIMBUS_LAF_NAME.equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception ignored) { + } - Snippet 2: - try { - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - } catch (Exception exc) { - System.err.println("Error loading L&F: " + exc); - } - */ + FileChooserDemo panel = new FileChooserDemo(); - FileChooserDemo panel = new FileChooserDemo(); - - frame = new JFrame("FileChooserDemo"); - frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - frame.getContentPane().add("Center", panel); - frame.pack(); - frame.setVisible(true); + frame = new JFrame("FileChooserDemo"); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.getContentPane().add("Center", panel); + frame.pack(); + frame.setVisible(true); + } + }); + } catch (InterruptedException ex) { + Logger.getLogger(FileChooserDemo.class.getName()).log(Level.SEVERE, + null, + ex); + } catch (InvocationTargetException ex) { + Logger.getLogger(FileChooserDemo.class.getName()).log(Level.SEVERE, + null, + ex); + } } + private static class InsetPanel extends JPanel { + Insets i; + InsetPanel(Insets i) { this.i = i; } + + @Override public Insets getInsets() { return i; } From b540a63a843d4b03d1d1bebfb53849ba9ede69d3 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 25 Mar 2011 07:39:30 -0700 Subject: [PATCH 047/168] 7009599: javac build puts extraneous files into dist/lib/classes.jar Reviewed-by: ohair --- langtools/make/build.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/langtools/make/build.xml b/langtools/make/build.xml index d093d24f1de..6e9687bd114 100644 --- a/langtools/make/build.xml +++ b/langtools/make/build.xml @@ -806,6 +806,9 @@ + + + From f36dc58a6f2e7ff1a10b5909542ec5aa6e54ca4f Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 25 Mar 2011 07:58:53 -0700 Subject: [PATCH 048/168] 6437138: JSR 199: Compiler doesn't diagnose crash in user code 6482554: uncaught exception from annotation processor not reported through JavaCompiler.CompilationTask.call Reviewed-by: mcimadamore --- .../tools/javac/api/ClientCodeWrapper.java | 593 +++++++++++++++++ .../sun/tools/javac/api/JavacTaskImpl.java | 39 +- .../com/sun/tools/javac/api/JavacTool.java | 68 +- .../com/sun/tools/javac/main/Main.java | 24 +- .../JavacProcessingEnvironment.java | 7 + .../classes/com/sun/tools/javac/util/Log.java | 9 +- langtools/test/tools/javac/api/T6437138.java | 61 ++ .../javac/api/TestClientCodeWrapper.java | 604 ++++++++++++++++++ 8 files changed, 1329 insertions(+), 76 deletions(-) create mode 100644 langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java create mode 100644 langtools/test/tools/javac/api/T6437138.java create mode 100644 langtools/test/tools/javac/api/TestClientCodeWrapper.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java b/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java new file mode 100644 index 00000000000..88a279c9565 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java @@ -0,0 +1,593 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.tools.javac.api; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.lang.model.element.NestingKind; +import javax.tools.Diagnostic; +import javax.tools.FileObject; +import javax.tools.JavaFileManager; +import javax.tools.JavaFileManager.Location; +import javax.tools.JavaFileObject; + +import com.sun.source.util.TaskEvent; +import com.sun.source.util.TaskListener; +import com.sun.tools.javac.util.ClientCodeException; +import com.sun.tools.javac.util.Context; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.lang.model.element.Modifier; +import javax.tools.DiagnosticListener; +import javax.tools.JavaFileObject.Kind; + +/** + * Wrap objects to enable unchecked exceptions to be caught and handled. + * + * For each method, exceptions are handled as follows: + *

    + *
  • Checked exceptions are left alone and propogate upwards in the + * obvious way, since they are an expected aspect of the method's + * specification. + *
  • Unchecked exceptions which have already been caught and wrapped in + * ClientCodeException are left alone to continue propogating upwards. + *
  • All other unchecked exceptions (i.e. subtypes of RuntimeException + * and Error) and caught, and rethrown as a ClientCodeException with + * its cause set to the original exception. + *
+ * + * The intent is that ClientCodeException can be caught at an appropriate point + * in the program and can be distinguished from any unanticipated unchecked + * exceptions arising in the main body of the code (i.e. bugs.) When the + * ClientCodeException has been caught, either a suitable message can be + * generated, or if appropriate, the original cause can be rethrown. + * + *

This is NOT part of any supported API. + * 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. + */ +public class ClientCodeWrapper { + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE) + public @interface Trusted { } + + public static ClientCodeWrapper instance(Context context) { + ClientCodeWrapper instance = context.get(ClientCodeWrapper.class); + if (instance == null) + instance = new ClientCodeWrapper(context); + return instance; + } + + /** + * A map to cache the results of whether or not a specific classes can + * be "trusted", and thus does not need to be wrapped. + */ + Map, Boolean> trustedClasses; + + protected ClientCodeWrapper(Context context) { + trustedClasses = new HashMap, Boolean>(); + } + + public JavaFileManager wrap(JavaFileManager fm) { + if (isTrusted(fm)) + return fm; + return new WrappedJavaFileManager(fm); + } + + public FileObject wrap(FileObject fo) { + if (isTrusted(fo)) + return fo; + return new WrappedFileObject(fo); + } + + FileObject unwrap(FileObject fo) { + if (fo instanceof WrappedFileObject) + return ((WrappedFileObject) fo).clientFileObject; + else + return fo; + } + + public JavaFileObject wrap(JavaFileObject fo) { + if (isTrusted(fo)) + return fo; + return new WrappedJavaFileObject(fo); + } + + public Iterable wrapJavaFileObjects(Iterable list) { + List wrapped = new ArrayList(); + for (JavaFileObject fo : list) + wrapped.add(wrap(fo)); + return Collections.unmodifiableList(wrapped); + } + + JavaFileObject unwrap(JavaFileObject fo) { + if (fo instanceof WrappedJavaFileObject) + return ((JavaFileObject) ((WrappedJavaFileObject) fo).clientFileObject); + else + return fo; + } + + DiagnosticListener wrap(DiagnosticListener dl) { + if (isTrusted(dl)) + return dl; + return new WrappedDiagnosticListener(dl); + } + + TaskListener wrap(TaskListener tl) { + if (isTrusted(tl)) + return tl; + return new WrappedTaskListener(tl); + } + + protected boolean isTrusted(Object o) { + Class c = o.getClass(); + Boolean trusted = trustedClasses.get(c); + if (trusted == null) { + trusted = c.getName().startsWith("com.sun.tools.javac.") + || c.isAnnotationPresent(Trusted.class); + trustedClasses.put(c, trusted); + } + return trusted; + } + + // + + // FIXME: all these classes should be converted to use multi-catch when + // that is available in the bootstrap compiler. + + protected class WrappedJavaFileManager implements JavaFileManager { + protected JavaFileManager clientJavaFileManager; + WrappedJavaFileManager(JavaFileManager clientJavaFileManager) { + clientJavaFileManager.getClass(); // null check + this.clientJavaFileManager = clientJavaFileManager; + } + + @Override + public ClassLoader getClassLoader(Location location) { + try { + return clientJavaFileManager.getClassLoader(location); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public Iterable list(Location location, String packageName, Set kinds, boolean recurse) throws IOException { + try { + return wrapJavaFileObjects(clientJavaFileManager.list(location, packageName, kinds, recurse)); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public String inferBinaryName(Location location, JavaFileObject file) { + try { + return clientJavaFileManager.inferBinaryName(location, unwrap(file)); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public boolean isSameFile(FileObject a, FileObject b) { + try { + return clientJavaFileManager.isSameFile(unwrap(a), unwrap(b)); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public boolean handleOption(String current, Iterator remaining) { + try { + return clientJavaFileManager.handleOption(current, remaining); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public boolean hasLocation(Location location) { + try { + return clientJavaFileManager.hasLocation(location); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException { + try { + return wrap(clientJavaFileManager.getJavaFileForInput(location, className, kind)); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException { + try { + return wrap(clientJavaFileManager.getJavaFileForOutput(location, className, kind, unwrap(sibling))); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { + try { + return wrap(clientJavaFileManager.getFileForInput(location, packageName, relativeName)); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { + try { + return wrap(clientJavaFileManager.getFileForOutput(location, packageName, relativeName, unwrap(sibling))); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public void flush() throws IOException { + try { + clientJavaFileManager.flush(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public void close() throws IOException { + try { + clientJavaFileManager.close(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public int isSupportedOption(String option) { + try { + return clientJavaFileManager.isSupportedOption(option); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + } + + protected class WrappedFileObject implements FileObject { + protected FileObject clientFileObject; + WrappedFileObject(FileObject clientFileObject) { + clientFileObject.getClass(); // null check + this.clientFileObject = clientFileObject; + } + + @Override + public URI toUri() { + try { + return clientFileObject.toUri(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public String getName() { + try { + return clientFileObject.getName(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public InputStream openInputStream() throws IOException { + try { + return clientFileObject.openInputStream(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public OutputStream openOutputStream() throws IOException { + try { + return clientFileObject.openOutputStream(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public Reader openReader(boolean ignoreEncodingErrors) throws IOException { + try { + return clientFileObject.openReader(ignoreEncodingErrors); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { + try { + return clientFileObject.getCharContent(ignoreEncodingErrors); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public Writer openWriter() throws IOException { + try { + return clientFileObject.openWriter(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public long getLastModified() { + try { + return clientFileObject.getLastModified(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public boolean delete() { + try { + return clientFileObject.delete(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + } + + protected class WrappedJavaFileObject extends WrappedFileObject implements JavaFileObject { + WrappedJavaFileObject(JavaFileObject clientJavaFileObject) { + super(clientJavaFileObject); + } + + @Override + public Kind getKind() { + try { + return ((JavaFileObject)clientFileObject).getKind(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public boolean isNameCompatible(String simpleName, Kind kind) { + try { + return ((JavaFileObject)clientFileObject).isNameCompatible(simpleName, kind); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public NestingKind getNestingKind() { + try { + return ((JavaFileObject)clientFileObject).getNestingKind(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public Modifier getAccessLevel() { + try { + return ((JavaFileObject)clientFileObject).getAccessLevel(); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + } + + protected class WrappedDiagnosticListener implements DiagnosticListener { + protected DiagnosticListener clientDiagnosticListener; + WrappedDiagnosticListener(DiagnosticListener clientDiagnosticListener) { + clientDiagnosticListener.getClass(); // null check + this.clientDiagnosticListener = clientDiagnosticListener; + } + + @Override + public void report(Diagnostic diagnostic) { + try { + clientDiagnosticListener.report(diagnostic); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + } + + protected class WrappedTaskListener implements TaskListener { + protected TaskListener clientTaskListener; + WrappedTaskListener(TaskListener clientTaskListener) { + clientTaskListener.getClass(); // null check + this.clientTaskListener = clientTaskListener; + } + + @Override + public void started(TaskEvent ev) { + try { + clientTaskListener.started(ev); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + + @Override + public void finished(TaskEvent ev) { + try { + clientTaskListener.finished(ev); + } catch (ClientCodeException e) { + throw e; + } catch (RuntimeException e) { + throw new ClientCodeException(e); + } catch (Error e) { + throw new ClientCodeException(e); + } + } + } + + // +} diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java index 9a756e2007e..4a61f5a3397 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java @@ -65,7 +65,7 @@ import com.sun.tools.javac.main.JavaCompiler; * @author Jonathan Gibbons */ public class JavacTaskImpl extends JavacTask { - private JavacTool tool; + private ClientCodeWrapper ccw; private Main compilerMain; private JavaCompiler compiler; private Locale locale; @@ -80,12 +80,11 @@ public class JavacTaskImpl extends JavacTask { private Integer result = null; - JavacTaskImpl(JavacTool tool, - Main compilerMain, + JavacTaskImpl(Main compilerMain, String[] args, Context context, List fileObjects) { - this.tool = tool; + this.ccw = ClientCodeWrapper.instance(context); this.compilerMain = compilerMain; this.args = args; this.context = context; @@ -94,17 +93,15 @@ public class JavacTaskImpl extends JavacTask { // null checks compilerMain.getClass(); args.getClass(); - context.getClass(); fileObjects.getClass(); } - JavacTaskImpl(JavacTool tool, - Main compilerMain, + JavacTaskImpl(Main compilerMain, Iterable flags, Context context, Iterable classes, Iterable fileObjects) { - this(tool, compilerMain, toArray(flags, classes), context, toList(fileObjects)); + this(compilerMain, toArray(flags, classes), context, toList(fileObjects)); } static private String[] toArray(Iterable flags, Iterable classes) { @@ -131,7 +128,7 @@ public class JavacTaskImpl extends JavacTask { if (!used.getAndSet(true)) { initContext(); notYetEntered = new HashMap(); - compilerMain.setFatalErrors(true); + compilerMain.setAPIMode(true); result = compilerMain.compile(args, context, fileObjects, processors); cleanup(); return result == 0; @@ -185,32 +182,10 @@ public class JavacTaskImpl extends JavacTask { if (context.get(TaskListener.class) != null) context.put(TaskListener.class, (TaskListener)null); if (taskListener != null) - context.put(TaskListener.class, wrap(taskListener)); + context.put(TaskListener.class, ccw.wrap(taskListener)); //initialize compiler's default locale context.put(Locale.class, locale); } - // where - private TaskListener wrap(final TaskListener tl) { - tl.getClass(); // null check - return new TaskListener() { - public void started(TaskEvent e) { - try { - tl.started(e); - } catch (Throwable t) { - throw new ClientCodeException(t); - } - } - - public void finished(TaskEvent e) { - try { - tl.finished(e); - } catch (Throwable t) { - throw new ClientCodeException(t); - } - } - - }; - } void cleanup() { if (compiler != null) diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java index 5f46cadc715..8b015d244bf 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java @@ -49,6 +49,7 @@ import com.sun.tools.javac.main.JavacOption; import com.sun.tools.javac.main.Main; import com.sun.tools.javac.main.RecognizedOptions.GrumpyHelper; import com.sun.tools.javac.main.RecognizedOptions; +import com.sun.tools.javac.util.ClientCodeException; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Options; @@ -162,38 +163,45 @@ public final class JavacTool implements JavaCompiler { Iterable classes, Iterable compilationUnits) { - final String kindMsg = "All compilation units must be of SOURCE kind"; - if (options != null) - for (String option : options) - option.getClass(); // null check - if (classes != null) { - for (String cls : classes) - if (!SourceVersion.isName(cls)) // implicit null check - throw new IllegalArgumentException("Not a valid class name: " + cls); - } - if (compilationUnits != null) { - for (JavaFileObject cu : compilationUnits) { - if (cu.getKind() != JavaFileObject.Kind.SOURCE) // implicit null check - throw new IllegalArgumentException(kindMsg); + try { + Context context = new Context(); + ClientCodeWrapper ccw = ClientCodeWrapper.instance(context); + + final String kindMsg = "All compilation units must be of SOURCE kind"; + if (options != null) + for (String option : options) + option.getClass(); // null check + if (classes != null) { + for (String cls : classes) + if (!SourceVersion.isName(cls)) // implicit null check + throw new IllegalArgumentException("Not a valid class name: " + cls); } + if (compilationUnits != null) { + compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check + for (JavaFileObject cu : compilationUnits) { + if (cu.getKind() != JavaFileObject.Kind.SOURCE) + throw new IllegalArgumentException(kindMsg); + } + } + + if (diagnosticListener != null) + context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener)); + + if (out == null) + context.put(Log.outKey, new PrintWriter(System.err, true)); + else + context.put(Log.outKey, new PrintWriter(out, true)); + + if (fileManager == null) + fileManager = getStandardFileManager(diagnosticListener, null, null); + fileManager = ccw.wrap(fileManager); + context.put(JavaFileManager.class, fileManager); + processOptions(context, fileManager, options); + Main compiler = new Main("javacTask", context.get(Log.outKey)); + return new JavacTaskImpl(compiler, options, context, classes, compilationUnits); + } catch (ClientCodeException ex) { + throw new RuntimeException(ex.getCause()); } - - Context context = new Context(); - - if (diagnosticListener != null) - context.put(DiagnosticListener.class, diagnosticListener); - - if (out == null) - context.put(Log.outKey, new PrintWriter(System.err, true)); - else - context.put(Log.outKey, new PrintWriter(out, true)); - - if (fileManager == null) - fileManager = getStandardFileManager(diagnosticListener, null, null); - context.put(JavaFileManager.class, fileManager); - processOptions(context, fileManager, options); - Main compiler = new Main("javacTask", context.get(Log.outKey)); - return new JavacTaskImpl(this, compiler, options, context, classes, compilationUnits); } private static void processOptions(Context context, diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java index 2f445f885dd..012c2ce80ca 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java +++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java @@ -65,9 +65,11 @@ public class Main { PrintWriter out; /** - * If true, any command line arg errors will cause an exception. + * If true, certain errors will cause an exception, such as command line + * arg errors, or exceptions in user provided code. */ - boolean fatalErrors; + boolean apiMode; + /** Result codes. */ @@ -163,7 +165,7 @@ public class Main { /** Report a usage error. */ void error(String key, Object... args) { - if (fatalErrors) { + if (apiMode) { String msg = getLocalizedString(key, args); throw new PropagatedException(new IllegalStateException(msg)); } @@ -192,8 +194,8 @@ public class Main { this.options = options; } - public void setFatalErrors(boolean fatalErrors) { - this.fatalErrors = fatalErrors; + public void setAPIMode(boolean apiMode) { + this.apiMode = apiMode; } /** Process command line arguments: store all command line options @@ -440,7 +442,9 @@ public class Main { } catch (FatalError ex) { feMessage(ex); return EXIT_SYSERR; - } catch(AnnotationProcessingError ex) { + } catch (AnnotationProcessingError ex) { + if (apiMode) + throw new RuntimeException(ex.getCause()); apMessage(ex); return EXIT_SYSERR; } catch (ClientCodeException ex) { @@ -458,7 +462,13 @@ public class Main { bugMessage(ex); return EXIT_ABNORMAL; } finally { - if (comp != null) comp.close(); + if (comp != null) { + try { + comp.close(); + } catch (ClientCodeException ex) { + throw new RuntimeException(ex.getCause()); + } + } filenames = null; options = null; } diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index fcd80af41c0..bf70ee2f64d 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -67,6 +67,7 @@ import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree.*; import com.sun.tools.javac.util.Abort; import com.sun.tools.javac.util.Assert; +import com.sun.tools.javac.util.ClientCodeException; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Convert; import com.sun.tools.javac.util.FatalError; @@ -432,6 +433,8 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea log.error("proc.processor.cant.instantiate", processorName); return false; } + } catch(ClientCodeException e) { + throw e; } catch(Throwable t) { throw new AnnotationProcessingError(t); } @@ -527,6 +530,8 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea supportedOptionNames.add(optionName); } + } catch (ClientCodeException e) { + throw e; } catch (Throwable t) { throw new AnnotationProcessingError(t); } @@ -790,6 +795,8 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea ex.printStackTrace(new PrintWriter(out)); log.error("proc.cant.access", ex.sym, ex.getDetailValue(), out.toString()); return false; + } catch (ClientCodeException e) { + throw e; } catch (Throwable t) { throw new AnnotationProcessingError(t); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java index f5d1e7670b5..869da390d3b 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java @@ -425,13 +425,8 @@ public class Log extends AbstractLog { */ protected void writeDiagnostic(JCDiagnostic diag) { if (diagListener != null) { - try { - diagListener.report(diag); - return; - } - catch (Throwable t) { - throw new ClientCodeException(t); - } + diagListener.report(diag); + return; } PrintWriter writer = getWriterForDiagnosticType(diag.getType()); diff --git a/langtools/test/tools/javac/api/T6437138.java b/langtools/test/tools/javac/api/T6437138.java new file mode 100644 index 00000000000..d9dd2a08c00 --- /dev/null +++ b/langtools/test/tools/javac/api/T6437138.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6437138 + * @summary JSR 199: Compiler doesn't diagnose crash in user code + */ + +import java.net.URI; +import java.util.Arrays; +import javax.tools.*; +import static javax.tools.JavaFileObject.Kind.*; + + +public class T6437138 { + static class JFO extends SimpleJavaFileObject { + public JFO(URI uri, JavaFileObject.Kind kind) { + super(uri, kind); + } + // getCharContent not impl, will throw UnsupportedOperationException + } + + public static void main(String... arg) throws Exception { + try { + JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); + JavaFileObject jfo = new JFO(new URI("JFOTest04.java"),SOURCE); + JavaCompiler.CompilationTask ct = javac.getTask(null,null,null,null, + null, Arrays.asList(jfo)); + ct.call(); + throw new Exception("no exception thrown by JavaCompiler.CompilationTask"); + } catch (RuntimeException e) { + if (e.getCause() instanceof UnsupportedOperationException) { + System.err.println("RuntimeException(UnsupportedOperationException) caught as expected"); + return; + } + throw new Exception("unexpected exception caught", e); + } + } +} + diff --git a/langtools/test/tools/javac/api/TestClientCodeWrapper.java b/langtools/test/tools/javac/api/TestClientCodeWrapper.java new file mode 100644 index 00000000000..33d941cfb34 --- /dev/null +++ b/langtools/test/tools/javac/api/TestClientCodeWrapper.java @@ -0,0 +1,604 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6437138 6482554 + * @summary JSR 199: Compiler doesn't diagnose crash in user code + * @library ../lib + * @build JavacTestingAbstractProcessor TestClientCodeWrapper + * @run main TestClientCodeWrapper + */ + +import java.io.*; +import java.lang.reflect.Method; +import java.net.URI; +import java.util.*; +import javax.annotation.processing.*; +import javax.lang.model.*; +import javax.lang.model.element.*; +import javax.tools.*; +import com.sun.source.util.*; +import com.sun.tools.javac.api.*; +import javax.tools.JavaFileObject.Kind; + +public class TestClientCodeWrapper extends JavacTestingAbstractProcessor { + public static void main(String... args) throws Exception { + new TestClientCodeWrapper().run(); + } + + /** + * Run a series of compilations, each with a different user-provided object + * configured to throw an exception when a specific method is invoked. + * Then, verify the exception is thrown as expected. + * + * Some methods are not invoked from the compiler, and are excluded from the test. + */ + void run() throws Exception { + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + defaultFileManager = compiler.getStandardFileManager(null, null, null); + + for (Method m: getMethodsExcept(JavaFileManager.class, "close", "getJavaFileForInput")) { + test(m); + } + + for (Method m: getMethodsExcept(FileObject.class, "delete")) { + test(m); + } + + for (Method m: getMethods(JavaFileObject.class)) { + test(m); + } + + for (Method m: getMethodsExcept(Processor.class, "getCompletions")) { + test(m); + } + + for (Method m: DiagnosticListener.class.getDeclaredMethods()) { + test(m); + } + + for (Method m: TaskListener.class.getDeclaredMethods()) { + test(m); + } + + if (errors > 0) + throw new Exception(errors + " errors occurred"); + } + + /** Get a sorted set of the methods declared on a class. */ + Set getMethods(Class clazz) { + return getMethodsExcept(clazz, new String[0]); + } + + /** Get a sorted set of the methods declared on a class, excluding + * specified methods by name. */ + Set getMethodsExcept(Class clazz, String... exclude) { + Set methods = new TreeSet(new Comparator() { + public int compare(Method m1, Method m2) { + return m1.toString().compareTo(m2.toString()); + } + }); + Set e = new HashSet(Arrays.asList(exclude)); + for (Method m: clazz.getDeclaredMethods()) { + if (!e.contains(m.getName())) + methods.add(m); + } + return methods; + } + + /** + * Test a method in a user supplied component, to verify javac's handling + * of any exceptions thrown by that method. + */ + void test(Method m) throws Exception { + testNum++; + + File extDirs = new File("empty-extdirs"); + extDirs.mkdirs(); + + File testClasses = new File("test" + testNum); + testClasses.mkdirs(); + defaultFileManager.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(testClasses)); + + System.err.println("test " + testNum + ": " + + m.getDeclaringClass().getSimpleName() + "." + m.getName()); + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + + List javacOptions = Arrays.asList( + "-extdirs", extDirs.getPath(), // for use by filemanager handleOption + "-processor", TestClientCodeWrapper.class.getName() + ); + + List classes = Collections.emptyList(); + + JavacTool tool = JavacTool.create(); + try { + JavacTask task = tool.getTask(pw, + getFileManager(m, defaultFileManager), + getDiagnosticListener(m, pw), + javacOptions, + classes, + getCompilationUnits(m)); + + if (isDeclaredIn(m, Processor.class)) + task.setProcessors(getProcessors(m)); + + if (isDeclaredIn(m, TaskListener.class)) + task.setTaskListener(getTaskListener(m, pw)); + + boolean ok = task.call(); + error("compilation " + (ok ? "succeeded" : "failed") + " unexpectedly"); + } catch (RuntimeException e) { + System.err.println("caught " + e); + if (e.getClass() == RuntimeException.class) { + Throwable cause = e.getCause(); + if (cause instanceof UserError) { + String expect = m.getName(); + String found = cause.getMessage(); + checkEqual("exception messaqe", expect, found); + } else { + cause.printStackTrace(System.err); + error("Unexpected exception: " + cause); + } + } else { + e.printStackTrace(System.err); + error("Unexpected exception: " + e); + } + } + + pw.close(); + String out = sw.toString(); + System.err.println(out); + } + + /** Get a file manager to use for the test compilation. */ + JavaFileManager getFileManager(Method m, JavaFileManager defaultFileManager) { + return isDeclaredIn(m, JavaFileManager.class, FileObject.class, JavaFileObject.class) + ? new UserFileManager(m, defaultFileManager) + : defaultFileManager; + } + + /** Get a diagnostic listener to use for the test compilation. */ + DiagnosticListener getDiagnosticListener(Method m, PrintWriter out) { + return isDeclaredIn(m, DiagnosticListener.class) + ? new UserDiagnosticListener(m, out) + : null; + } + + /** Get a set of file objects to use for the test compilation. */ + Iterable getCompilationUnits(Method m) { + File testSrc = new File(System.getProperty("test.src")); + File thisSrc = new File(testSrc, TestClientCodeWrapper.class.getName() + ".java"); + Iterable files = defaultFileManager.getJavaFileObjects(thisSrc); + if (isDeclaredIn(m, FileObject.class, JavaFileObject.class)) + return Arrays.asList(new UserFileObject(m, files.iterator().next())); + else + return files; + } + + /** Get a set of annotation processors to use for the test compilation. */ + Iterable getProcessors(Method m) { + return Arrays.asList(new UserProcessor(m)); + } + + /** Get a task listener to use for the test compilation. */ + TaskListener getTaskListener(Method m, PrintWriter out) { + return new UserTaskListener(m, out); + } + + /** Check if two values are .equal, and report an error if not. */ + void checkEqual(String label, T expect, T found) { + if (!expect.equals(found)) + error("Unexpected value for " + label + ": " + found + "; expected: " + expect); + } + + /** Report an error. */ + void error(String msg) { + System.err.println("Error: " + msg); + errors++; + } + + /** Check if a method is declared in any of a set of classes */ + static boolean isDeclaredIn(Method m, Class... classes) { + Class dc = m.getDeclaringClass(); + for (Class c: classes) { + if (c == dc) return true; + } + return false; + } + + /** Throw an intentional error if the method has a given name. */ + static void throwUserExceptionIfNeeded(Method m, String name) { + if (m != null && m.getName().equals(name)) + throw new UserError(name); + } + + StandardJavaFileManager defaultFileManager; + int testNum; + int errors; + + //-------------------------------------------------------------------------- + + /** + * Processor used to trigger use of methods not normally used by javac. + */ + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + boolean firstRound = false; + for (Element e: roundEnv.getRootElements()) { + if (e.getSimpleName().contentEquals(TestClientCodeWrapper.class.getSimpleName())) + firstRound = true; + } + if (firstRound) { + try { + FileObject f1 = filer.getResource(StandardLocation.CLASS_PATH, "", + TestClientCodeWrapper.class.getName() + ".java"); + f1.openInputStream().close(); + f1.openReader(false).close(); + + FileObject f2 = filer.createResource( + StandardLocation.CLASS_OUTPUT, "", "f2.txt", (Element[]) null); + f2.openOutputStream().close(); + + FileObject f3 = filer.createResource( + StandardLocation.CLASS_OUTPUT, "", "f3.txt", (Element[]) null); + f3.openWriter().close(); + + JavaFileObject f4 = filer.createSourceFile("f4", (Element[]) null); + f4.openWriter().close(); + f4.getNestingKind(); + f4.getAccessLevel(); + + messager.printMessage(Diagnostic.Kind.NOTE, "informational note", + roundEnv.getRootElements().iterator().next()); + + } catch (IOException e) { + throw new UserError(e); + } + } + return true; + } + + //-------------------------------------------------------------------------- + + // + + static class UserError extends Error { + private static final long serialVersionUID = 1L; + UserError(String msg) { + super(msg); + } + UserError(Throwable t) { + super(t); + } + } + + static class UserFileManager extends ForwardingJavaFileManager { + Method fileManagerMethod; + Method fileObjectMethod; + + UserFileManager(Method m, JavaFileManager delegate) { + super(delegate); + if (isDeclaredIn(m, JavaFileManager.class)) { + fileManagerMethod = m; + } else if (isDeclaredIn(m, FileObject.class, JavaFileObject.class)) { + fileObjectMethod = m; + } else + assert false; + } + + @Override + public ClassLoader getClassLoader(Location location) { + throwUserExceptionIfNeeded(fileManagerMethod, "getClassLoader"); + return super.getClassLoader(location); + } + + @Override + public Iterable list(Location location, String packageName, Set kinds, boolean recurse) throws IOException { + throwUserExceptionIfNeeded(fileManagerMethod, "list"); + return wrap(super.list(location, packageName, kinds, recurse)); + } + + @Override + public String inferBinaryName(Location location, JavaFileObject file) { + throwUserExceptionIfNeeded(fileManagerMethod, "inferBinaryName"); + return super.inferBinaryName(location, unwrap(file)); + } + + @Override + public boolean isSameFile(FileObject a, FileObject b) { + throwUserExceptionIfNeeded(fileManagerMethod, "isSameFile"); + return super.isSameFile(unwrap(a), unwrap(b)); + } + + @Override + public boolean handleOption(String current, Iterator remaining) { + throwUserExceptionIfNeeded(fileManagerMethod, "handleOption"); + return super.handleOption(current, remaining); + } + + @Override + public boolean hasLocation(Location location) { + throwUserExceptionIfNeeded(fileManagerMethod, "hasLocation"); + return super.hasLocation(location); + } + + @Override + public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException { + throwUserExceptionIfNeeded(fileManagerMethod, "getJavaFileForInput"); + return wrap(super.getJavaFileForInput(location, className, kind)); + } + + @Override + public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException { + throwUserExceptionIfNeeded(fileManagerMethod, "getJavaFileForOutput"); + return wrap(super.getJavaFileForOutput(location, className, kind, sibling)); + } + + @Override + public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { + throwUserExceptionIfNeeded(fileManagerMethod, "getFileForInput"); + return wrap(super.getFileForInput(location, packageName, relativeName)); + } + + @Override + public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { + throwUserExceptionIfNeeded(fileManagerMethod, "getFileForOutput"); + return wrap(super.getFileForOutput(location, packageName, relativeName, sibling)); + } + + @Override + public void flush() throws IOException { + throwUserExceptionIfNeeded(fileManagerMethod, "flush"); + super.flush(); + } + + @Override + public void close() throws IOException { + throwUserExceptionIfNeeded(fileManagerMethod, "close"); + super.close(); + } + + @Override + public int isSupportedOption(String option) { + throwUserExceptionIfNeeded(fileManagerMethod, "isSupportedOption"); + return super.isSupportedOption(option); + } + + public FileObject wrap(FileObject fo) { + if (fileObjectMethod == null) + return fo; + return new UserFileObject(fileObjectMethod, (JavaFileObject)fo); + } + + FileObject unwrap(FileObject fo) { + if (fo instanceof UserFileObject) + return ((UserFileObject) fo).unwrap(); + else + return fo; + } + + public JavaFileObject wrap(JavaFileObject fo) { + if (fileObjectMethod == null) + return fo; + return new UserFileObject(fileObjectMethod, fo); + } + + public Iterable wrap(Iterable list) { + List wrapped = new ArrayList(); + for (JavaFileObject fo : list) + wrapped.add(wrap(fo)); + return Collections.unmodifiableList(wrapped); + } + + JavaFileObject unwrap(JavaFileObject fo) { + if (fo instanceof UserFileObject) + return ((UserFileObject) fo).unwrap(); + else + return fo; + } + } + + static class UserFileObject extends ForwardingJavaFileObject { + Method method; + + UserFileObject(Method m, JavaFileObject delegate) { + super(delegate); + assert isDeclaredIn(m, FileObject.class, JavaFileObject.class); + this.method = m; + } + + JavaFileObject unwrap() { + return fileObject; + } + + @Override + public Kind getKind() { + throwUserExceptionIfNeeded(method, "getKind"); + return super.getKind(); + } + + @Override + public boolean isNameCompatible(String simpleName, Kind kind) { + throwUserExceptionIfNeeded(method, "isNameCompatible"); + return super.isNameCompatible(simpleName, kind); + } + + @Override + public NestingKind getNestingKind() { + throwUserExceptionIfNeeded(method, "getNestingKind"); + return super.getNestingKind(); + } + + @Override + public Modifier getAccessLevel() { + throwUserExceptionIfNeeded(method, "getAccessLevel"); + return super.getAccessLevel(); + } + + @Override + public URI toUri() { + throwUserExceptionIfNeeded(method, "toUri"); + return super.toUri(); + } + + @Override + public String getName() { + throwUserExceptionIfNeeded(method, "getName"); + return super.getName(); + } + + @Override + public InputStream openInputStream() throws IOException { + throwUserExceptionIfNeeded(method, "openInputStream"); + return super.openInputStream(); + } + + @Override + public OutputStream openOutputStream() throws IOException { + throwUserExceptionIfNeeded(method, "openOutputStream"); + return super.openOutputStream(); + } + + @Override + public Reader openReader(boolean ignoreEncodingErrors) throws IOException { + throwUserExceptionIfNeeded(method, "openReader"); + return super.openReader(ignoreEncodingErrors); + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { + throwUserExceptionIfNeeded(method, "getCharContent"); + return super.getCharContent(ignoreEncodingErrors); + } + + @Override + public Writer openWriter() throws IOException { + throwUserExceptionIfNeeded(method, "openWriter"); + return super.openWriter(); + } + + @Override + public long getLastModified() { + throwUserExceptionIfNeeded(method, "getLastModified"); + return super.getLastModified(); + } + + @Override + public boolean delete() { + throwUserExceptionIfNeeded(method, "delete"); + return super.delete(); + } + + } + + static class UserProcessor extends JavacTestingAbstractProcessor { + Method method; + + UserProcessor(Method m) { + assert isDeclaredIn(m, Processor.class); + method = m; + } + + @Override + public Set getSupportedOptions() { + throwUserExceptionIfNeeded(method, "getSupportedOptions"); + return super.getSupportedOptions(); + } + + @Override + public Set getSupportedAnnotationTypes() { + throwUserExceptionIfNeeded(method, "getSupportedAnnotationTypes"); + return super.getSupportedAnnotationTypes(); + } + + @Override + public SourceVersion getSupportedSourceVersion() { + throwUserExceptionIfNeeded(method, "getSupportedSourceVersion"); + return super.getSupportedSourceVersion(); + } + + @Override + public void init(ProcessingEnvironment processingEnv) { + throwUserExceptionIfNeeded(method, "init"); + super.init(processingEnv); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + throwUserExceptionIfNeeded(method, "process"); + return true; + } + + @Override + public Iterable getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) { + throwUserExceptionIfNeeded(method, "getCompletions"); + return super.getCompletions(element, annotation, member, userText); + } + } + + static class UserDiagnosticListener implements DiagnosticListener { + Method method; + PrintWriter out; + + UserDiagnosticListener(Method m, PrintWriter out) { + assert isDeclaredIn(m, DiagnosticListener.class); + this.method = m; + this.out = out; + } + + @Override + public void report(Diagnostic diagnostic) { + throwUserExceptionIfNeeded(method, "report"); + out.println("report: " + diagnostic); + } + } + + static class UserTaskListener implements TaskListener { + Method method; + PrintWriter out; + + UserTaskListener(Method m, PrintWriter out) { + assert isDeclaredIn(m, TaskListener.class); + this.method = m; + this.out = out; + } + + @Override + public void started(TaskEvent e) { + throwUserExceptionIfNeeded(method, "started"); + out.println("started: " + e); + } + + @Override + public void finished(TaskEvent e) { + throwUserExceptionIfNeeded(method, "finished"); + out.println("finished: " + e); + } + } + + // +} From d6fce830423a6da7d230273de5f16b296633ed11 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Fri, 25 Mar 2011 16:38:09 +0000 Subject: [PATCH 049/168] 7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc) Reviewed-by: alanb, mduigou --- jdk/make/java/net/Makefile | 8 +- .../native/java/net/Inet6AddressImpl.c | 354 +++-- .../native/java/net/NetworkInterface.c | 203 +-- .../native/java/net/NetworkInterface.h | 334 +---- .../native/java/net/NetworkInterface_win9x.c | 1141 ----------------- .../native/java/net/NetworkInterface_winXP.c | 23 +- jdk/src/windows/native/java/net/net_util_md.c | 53 +- jdk/src/windows/native/java/net/net_util_md.h | 6 - .../sun/net/dns/ResolverConfigurationImpl.c | 532 +------- .../www/protocol/http/ntlm/NTLMAuthSequence.c | 72 +- 10 files changed, 272 insertions(+), 2454 deletions(-) delete mode 100644 jdk/src/windows/native/java/net/NetworkInterface_win9x.c diff --git a/jdk/make/java/net/Makefile b/jdk/make/java/net/Makefile index 6e865fa24ec..a23697ffb8f 100644 --- a/jdk/make/java/net/Makefile +++ b/jdk/make/java/net/Makefile @@ -37,10 +37,6 @@ include FILES_c.gmk AUTO_FILES_JAVA_DIRS = java/net ifeq ($(PLATFORM), windows) - # Windows 9x module only needed on 32-bit build - ifeq ($(ARCH_DATA_MODEL), 32) - FILES_c += NetworkInterface_win9x.c - endif FILES_c += NTLMAuthSequence.c FILES_c += NetworkInterface_winXP.c else @@ -96,7 +92,9 @@ include $(BUILDDIR)/common/Mapfile-vers.gmk include $(BUILDDIR)/common/Library.gmk ifeq ($(PLATFORM), windows) - OTHER_LDLIBS = ws2_32.lib $(JVMLIB) + OTHER_LDLIBS = ws2_32.lib $(JVMLIB) \ + secur32.lib iphlpapi.lib delayimp.lib \ + /DELAYLOAD:secur32.dll /DELAYLOAD:iphlpapi.dll else OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB) endif diff --git a/jdk/src/windows/native/java/net/Inet6AddressImpl.c b/jdk/src/windows/native/java/net/Inet6AddressImpl.c index 1f9a6779e6e..1e4373355e3 100644 --- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c +++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c @@ -90,6 +90,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, jobjectArray ret = 0; int retLen = 0; jboolean preferIPv6Address; + static jfieldID ia_preferIPv6AddressID; int error=0; struct addrinfo hints, *res, *resNew = NULL; @@ -116,166 +117,163 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE); CHECK_NULL_RETURN(hostname, NULL); - if (NET_addrtransAvailable()) { - static jfieldID ia_preferIPv6AddressID; - if (ia_preferIPv6AddressID == NULL) { - jclass c = (*env)->FindClass(env,"java/net/InetAddress"); - if (c) { - ia_preferIPv6AddressID = - (*env)->GetStaticFieldID(env, c, "preferIPv6Address", "Z"); - } - if (ia_preferIPv6AddressID == NULL) { - JNU_ReleaseStringPlatformChars(env, host, hostname); - return NULL; - } + if (ia_preferIPv6AddressID == NULL) { + jclass c = (*env)->FindClass(env,"java/net/InetAddress"); + if (c) { + ia_preferIPv6AddressID = + (*env)->GetStaticFieldID(env, c, "preferIPv6Address", "Z"); } - /* get the address preference */ - preferIPv6Address - = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID); - - /* Try once, with our static buffer. */ - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_CANONNAME; - hints.ai_family = AF_UNSPEC; - - error = (*getaddrinfo_ptr)(hostname, NULL, &hints, &res); - - if (error) { - /* report error */ - JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", - (char *)hostname); + if (ia_preferIPv6AddressID == NULL) { JNU_ReleaseStringPlatformChars(env, host, hostname); return NULL; - } else { - int i = 0; - int inetCount = 0, inet6Count = 0, inetIndex, inet6Index; - struct addrinfo *itr, *last, *iterator = res; - while (iterator != NULL) { - int skip = 0; - itr = resNew; - while (itr != NULL) { - if (iterator->ai_family == itr->ai_family && - iterator->ai_addrlen == itr->ai_addrlen) { - if (itr->ai_family == AF_INET) { /* AF_INET */ - struct sockaddr_in *addr1, *addr2; - addr1 = (struct sockaddr_in *)iterator->ai_addr; - addr2 = (struct sockaddr_in *)itr->ai_addr; - if (addr1->sin_addr.s_addr == - addr2->sin_addr.s_addr) { - skip = 1; - break; - } - } else { - int t; - struct sockaddr_in6 *addr1, *addr2; - addr1 = (struct sockaddr_in6 *)iterator->ai_addr; - addr2 = (struct sockaddr_in6 *)itr->ai_addr; + } + } + /* get the address preference */ + preferIPv6Address + = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID); - for (t = 0; t < 16; t++) { - if (addr1->sin6_addr.s6_addr[t] != - addr2->sin6_addr.s6_addr[t]) { - break; - } - } - if (t < 16) { - itr = itr->ai_next; - continue; - } else { - skip = 1; + /* Try once, with our static buffer. */ + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = AF_UNSPEC; + + error = getaddrinfo(hostname, NULL, &hints, &res); + + if (error) { + /* report error */ + JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", + (char *)hostname); + JNU_ReleaseStringPlatformChars(env, host, hostname); + return NULL; + } else { + int i = 0; + int inetCount = 0, inet6Count = 0, inetIndex, inet6Index; + struct addrinfo *itr, *last, *iterator = res; + while (iterator != NULL) { + int skip = 0; + itr = resNew; + while (itr != NULL) { + if (iterator->ai_family == itr->ai_family && + iterator->ai_addrlen == itr->ai_addrlen) { + if (itr->ai_family == AF_INET) { /* AF_INET */ + struct sockaddr_in *addr1, *addr2; + addr1 = (struct sockaddr_in *)iterator->ai_addr; + addr2 = (struct sockaddr_in *)itr->ai_addr; + if (addr1->sin_addr.s_addr == + addr2->sin_addr.s_addr) { + skip = 1; + break; + } + } else { + int t; + struct sockaddr_in6 *addr1, *addr2; + addr1 = (struct sockaddr_in6 *)iterator->ai_addr; + addr2 = (struct sockaddr_in6 *)itr->ai_addr; + + for (t = 0; t < 16; t++) { + if (addr1->sin6_addr.s6_addr[t] != + addr2->sin6_addr.s6_addr[t]) { break; } } - } else if (iterator->ai_family != AF_INET && - iterator->ai_family != AF_INET6) { - /* we can't handle other family types */ - skip = 1; - break; + if (t < 16) { + itr = itr->ai_next; + continue; + } else { + skip = 1; + break; + } } - itr = itr->ai_next; + } else if (iterator->ai_family != AF_INET && + iterator->ai_family != AF_INET6) { + /* we can't handle other family types */ + skip = 1; + break; } + itr = itr->ai_next; + } - if (!skip) { - struct addrinfo *next - = (struct addrinfo*) malloc(sizeof(struct addrinfo)); - if (!next) { - JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); - ret = NULL; - goto cleanupAndReturn; - } - memcpy(next, iterator, sizeof(struct addrinfo)); - next->ai_next = NULL; - if (resNew == NULL) { - resNew = next; - } else { - last->ai_next = next; - } - last = next; - i++; - if (iterator->ai_family == AF_INET) { - inetCount ++; - } else if (iterator->ai_family == AF_INET6) { - inet6Count ++; - } + if (!skip) { + struct addrinfo *next + = (struct addrinfo*) malloc(sizeof(struct addrinfo)); + if (!next) { + JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); + ret = NULL; + goto cleanupAndReturn; } - iterator = iterator->ai_next; - } - retLen = i; - iterator = resNew; - i = 0; - ret = (*env)->NewObjectArray(env, retLen, ni_iacls, NULL); - - if (IS_NULL(ret)) { - /* we may have memory to free at the end of this */ - goto cleanupAndReturn; - } - - if (preferIPv6Address) { - inetIndex = inet6Count; - inet6Index = 0; - } else { - inetIndex = 0; - inet6Index = inetCount; - } - - while (iterator != NULL) { + memcpy(next, iterator, sizeof(struct addrinfo)); + next->ai_next = NULL; + if (resNew == NULL) { + resNew = next; + } else { + last->ai_next = next; + } + last = next; + i++; if (iterator->ai_family == AF_INET) { - jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); - if (IS_NULL(iaObj)) { - ret = NULL; - goto cleanupAndReturn; - } - (*env)->SetIntField(env, iaObj, ni_iaaddressID, - ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); - (*env)->SetObjectField(env, iaObj, ni_iahostID, host); - (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); - inetIndex ++; + inetCount ++; } else if (iterator->ai_family == AF_INET6) { - jint scope = 0; - jbyteArray ipaddress; - jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); - if (IS_NULL(iaObj)) { - ret = NULL; - goto cleanupAndReturn; - } - ipaddress = (*env)->NewByteArray(env, 16); - if (IS_NULL(ipaddress)) { - ret = NULL; - goto cleanupAndReturn; - } - (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, - (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr)); - scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id; - if (scope != 0) { /* zero is default value, no need to set */ - (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); - } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); - (*env)->SetObjectField(env, iaObj, ni_iahostID, host); - (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); - inet6Index ++; + inet6Count ++; } - iterator = iterator->ai_next; } + iterator = iterator->ai_next; + } + retLen = i; + iterator = resNew; + i = 0; + ret = (*env)->NewObjectArray(env, retLen, ni_iacls, NULL); + + if (IS_NULL(ret)) { + /* we may have memory to free at the end of this */ + goto cleanupAndReturn; + } + + if (preferIPv6Address) { + inetIndex = inet6Count; + inet6Index = 0; + } else { + inetIndex = 0; + inet6Index = inetCount; + } + + while (iterator != NULL) { + if (iterator->ai_family == AF_INET) { + jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); + if (IS_NULL(iaObj)) { + ret = NULL; + goto cleanupAndReturn; + } + (*env)->SetIntField(env, iaObj, ni_iaaddressID, + ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); + (*env)->SetObjectField(env, iaObj, ni_iahostID, host); + (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); + inetIndex ++; + } else if (iterator->ai_family == AF_INET6) { + jint scope = 0; + jbyteArray ipaddress; + jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); + if (IS_NULL(iaObj)) { + ret = NULL; + goto cleanupAndReturn; + } + ipaddress = (*env)->NewByteArray(env, 16); + if (IS_NULL(ipaddress)) { + ret = NULL; + goto cleanupAndReturn; + } + (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, + (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr)); + scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id; + if (scope != 0) { /* zero is default value, no need to set */ + (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); + (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); + } + (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); + (*env)->SetObjectField(env, iaObj, ni_iahostID, host); + (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); + inet6Index ++; + } + iterator = iterator->ai_next; } } @@ -291,8 +289,7 @@ cleanupAndReturn: JNU_ReleaseStringPlatformChars(env, host, hostname); } - if (NET_addrtransAvailable()) - (*freeaddrinfo_ptr)(res); + freeaddrinfo(res); return ret; } @@ -312,44 +309,41 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this, int len = 0; jbyte caddr[16]; - if (NET_addrtransAvailable()) { - struct sockaddr_in him4; - struct sockaddr_in6 him6; - struct sockaddr *sa; + struct sockaddr_in him4; + struct sockaddr_in6 him6; + struct sockaddr *sa; + /* + * For IPv4 addresses construct a sockaddr_in structure. + */ + if ((*env)->GetArrayLength(env, addrArray) == 4) { + jint addr; + (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr); + addr = ((caddr[0]<<24) & 0xff000000); + addr |= ((caddr[1] <<16) & 0xff0000); + addr |= ((caddr[2] <<8) & 0xff00); + addr |= (caddr[3] & 0xff); + memset((char *) &him4, 0, sizeof(him4)); + him4.sin_addr.s_addr = (uint32_t) htonl(addr); + him4.sin_family = AF_INET; + sa = (struct sockaddr *) &him4; + len = sizeof(him4); + } else { /* - * For IPv4 addresses construct a sockaddr_in structure. + * For IPv6 address construct a sockaddr_in6 structure. */ - if ((*env)->GetArrayLength(env, addrArray) == 4) { - jint addr; - (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr); - addr = ((caddr[0]<<24) & 0xff000000); - addr |= ((caddr[1] <<16) & 0xff0000); - addr |= ((caddr[2] <<8) & 0xff00); - addr |= (caddr[3] & 0xff); - memset((char *) &him4, 0, sizeof(him4)); - him4.sin_addr.s_addr = (uint32_t) htonl(addr); - him4.sin_family = AF_INET; - sa = (struct sockaddr *) &him4; - len = sizeof(him4); - } else { - /* - * For IPv6 address construct a sockaddr_in6 structure. - */ - (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr); - memset((char *) &him6, 0, sizeof(him6)); - memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) ); - him6.sin6_family = AF_INET6; - sa = (struct sockaddr *) &him6 ; - len = sizeof(him6) ; - } + (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr); + memset((char *) &him6, 0, sizeof(him6)); + memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) ); + him6.sin6_family = AF_INET6; + sa = (struct sockaddr *) &him6 ; + len = sizeof(him6) ; + } - error = (*getnameinfo_ptr)(sa, len, host, NI_MAXHOST, NULL, 0, - NI_NAMEREQD); + error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD); - if (!error) { - ret = (*env)->NewStringUTF(env, host); - } + if (!error) { + ret = (*env)->NewStringUTF(env, host); } if (ret == NULL) { diff --git a/jdk/src/windows/native/java/net/NetworkInterface.c b/jdk/src/windows/native/java/net/NetworkInterface.c index 6a318722414..fa5dfc13f61 100644 --- a/jdk/src/windows/native/java/net/NetworkInterface.c +++ b/jdk/src/windows/native/java/net/NetworkInterface.c @@ -53,36 +53,6 @@ * order and this ensures consistent device number across invocations. */ - -/* IP helper library routines */ -int (PASCAL FAR *GetIpAddrTable_fn)(); -int (PASCAL FAR *GetIfTable_fn)(); -int (PASCAL FAR *GetFriendlyIfIndex_fn)(); -int (PASCAL FAR *GetAdaptersAddresses_fn)(); -int (PASCAL FAR *GetAdaptersInfo_fn)(); -int (PASCAL FAR *GetNumberOfInterfaces_fn)(); - -/* Enumeration routines */ -typedef int (*EnumerateNetInterfaces)(JNIEnv *, netif **); -typedef int(*EnumerateNetAddresses)(JNIEnv *, netif *, netaddr **); - -static EnumerateNetInterfaces enumInterfaces_fn; -static EnumerateNetAddresses enumAddresses_fn; - -/* Windows 9x routines are external (not needed on 64-bit) */ -#ifndef _WIN64 -extern int enumInterfaces_win9x(JNIEnv *, netif **); -extern int enumAddresses_win9x(JNIEnv *, netif *, netaddr **); -extern int init_win9x(void); -#endif - - -/* Windows 95/98/ME running */ -static jboolean isW9x; - -/* Windows version supports */ -static jboolean os_supports_ipv6; - /* various JNI ids */ jclass ni_class; /* NetworkInterface */ @@ -154,10 +124,10 @@ MIB_IFROW *getIF(jint index) { */ size = sizeof(MIB_IFTABLE); tableP = (MIB_IFTABLE *)malloc(size); - count = (*GetIfTable_fn)(tableP, &size, TRUE); + count = GetIfTable(tableP, &size, TRUE); if (count == ERROR_INSUFFICIENT_BUFFER || count == ERROR_BUFFER_OVERFLOW) { tableP = (MIB_IFTABLE *)realloc(tableP, size); - count = (*GetIfTable_fn)(tableP, &size, TRUE); + count = GetIfTable(tableP, &size, TRUE); } if (count != NO_ERROR) { @@ -172,7 +142,7 @@ MIB_IFROW *getIF(jint index) { /* * Warning the real index is obtained by GetFriendlyIfIndex() */ - ifindex = (*GetFriendlyIfIndex_fn)(ifrowP->dwIndex); + ifindex = GetFriendlyIfIndex(ifrowP->dwIndex); if (ifindex == index) { /* * Create a copy of the entry so that we can free the table. @@ -199,7 +169,7 @@ MIB_IFROW *getIF(jint index) { * occurs then netifPP be returned as list of netif structures or NULL * if no interfaces are found. */ -int enumInterfaces_win(JNIEnv *env, netif **netifPP) +int enumInterfaces(JNIEnv *env, netif **netifPP) { MIB_IFTABLE *tableP; MIB_IFROW *ifrowP; @@ -215,32 +185,16 @@ int enumInterfaces_win(JNIEnv *env, netif **netifPP) */ size = sizeof(MIB_IFTABLE); tableP = (MIB_IFTABLE *)malloc(size); - ret = (*GetIfTable_fn)(tableP, &size, TRUE); + ret = GetIfTable(tableP, &size, TRUE); if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) { tableP = (MIB_IFTABLE *)realloc(tableP, size); - ret = (*GetIfTable_fn)(tableP, &size, TRUE); + ret = GetIfTable(tableP, &size, TRUE); } if (ret != NO_ERROR) { if (tableP != NULL) free(tableP); -#ifndef _WIN64 - if (isW9x && ret == ERROR_NOT_SUPPORTED) { - /* - * If ERROR_NOT_SUPPORTED is returned on Windows 98 it means that - * IE5.0 has been installed. In this case we revert to the Windows 95 - * approach and avoid using the IP Helper Library. - * See: http://support.microsoft.com/support/kb/articles/q234/5/73.asp - */ - enumInterfaces_fn = enumInterfaces_win9x; - enumAddresses_fn = enumAddresses_win9x; - init_win9x(); - - return (*enumInterfaces_fn)(env, netifPP); - } -#endif - JNU_ThrowByName(env, "java/lang/Error", "IP Helper Library GetIfTable function failed"); @@ -328,7 +282,7 @@ int enumInterfaces_win(JNIEnv *env, netif **netifPP) curr->displayName[ifrowP->dwDescrLen] = '\0'; curr->dwIndex = ifrowP->dwIndex; curr->ifType = ifrowP->dwType; - curr->index = (*GetFriendlyIfIndex_fn)(ifrowP->dwIndex); + curr->index = GetFriendlyIfIndex(ifrowP->dwIndex); /* * Put the interface at tail of list as GetIfTable(,,TRUE) is @@ -384,10 +338,10 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP) size = sizeof(MIB_IPADDRTABLE); tableP = (MIB_IPADDRTABLE *)malloc(size); - ret = (*GetIpAddrTable_fn)(&tableP, &size, FALSE); + ret = GetIpAddrTable(tableP, &size, FALSE); if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) { tableP = (MIB_IPADDRTABLE *)realloc(tableP, size); - ret = (*GetIpAddrTable_fn)(tableP, &size, FALSE); + ret = GetIpAddrTable(tableP, &size, FALSE); } if (ret != NO_ERROR) { if (tableP) { @@ -477,71 +431,6 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP) JNIEXPORT void JNICALL Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) { - OSVERSIONINFO ver; - HANDLE h; - - /* - * First check if this is a Windows 9x machine. - */ - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx(&ver); - if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && ver.dwMajorVersion == 4) { - isW9x = JNI_TRUE; - } - - /* - * Try to load the IP Helper Library and obtain the entry points we - * require. This will succeed on 98, NT SP4+, 2000 & XP. It will - * fail on Windows 95 (if IE hasn't been updated) and old versions - * of NT (IP helper library only appeared at SP4). If it fails on - * Windows 9x we will use the registry approach, otherwise if it - * fails we throw an Error indicating that we have an incompatible - * IP helper library. - */ - h = LoadLibrary("iphlpapi.dll"); - if (h != NULL) { - GetIpAddrTable_fn = - (int (PASCAL FAR *)())GetProcAddress(h, "GetIpAddrTable"); - GetIfTable_fn = - (int (PASCAL FAR *)())GetProcAddress(h, "GetIfTable"); - GetFriendlyIfIndex_fn = - (int (PASCAL FAR *)())GetProcAddress(h, "GetFriendlyIfIndex"); - GetNumberOfInterfaces_fn = - (int (PASCAL FAR *)())GetProcAddress(h, "GetNumberOfInterfaces"); - GetAdaptersAddresses_fn = - (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersAddresses"); - GetAdaptersInfo_fn = - (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersInfo"); - } - - /* IPv6 is supported on Windows versions if the following APIs avail */ - - os_supports_ipv6 = (GetAdaptersAddresses_fn != NULL) && - (GetNumberOfInterfaces_fn != NULL) && - (GetAdaptersInfo_fn != NULL); - - if (GetIpAddrTable_fn == NULL || - GetIfTable_fn == NULL || - GetFriendlyIfIndex_fn == NULL) { - -#ifndef _WIN64 - if (isW9x) { - /* Use Windows 9x registry approach which requires initialization */ - enumInterfaces_fn = enumInterfaces_win9x; - enumAddresses_fn = enumAddresses_win9x; - init_win9x(); - } else -#endif - { - JNU_ThrowByName(env, "java/lang/Error", - "Incompatible IP helper library (iphlpapi.dll)"); - return; - } - } else { - enumInterfaces_fn = enumInterfaces_win; - enumAddresses_fn = enumAddresses_win; - } - /* * Get the various JNI ids that we require */ @@ -581,7 +470,8 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) * populate the InetAddress array based on the IP addresses for this * interface. */ -jobject createNetworkInterface(JNIEnv *env, netif *ifs, int netaddrCount, netaddr *netaddrP) +jobject createNetworkInterface + (JNIEnv *env, netif *ifs, int netaddrCount, netaddr *netaddrP) { jobject netifObj; jobject name, displayName; @@ -596,7 +486,8 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs, int netaddrCount, netadd netifObj = (*env)->NewObject(env, ni_class, ni_ctor); name = (*env)->NewStringUTF(env, ifs->name); if (ifs->dNameIsUnicode) { - displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, wcslen ((PWCHAR)ifs->displayName)); + displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, + (jsize)wcslen ((PWCHAR)ifs->displayName)); } else { displayName = (*env)->NewStringUTF(env, ifs->displayName); } @@ -612,7 +503,7 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs, int netaddrCount, netadd * Note that 0 is a valid number of addresses. */ if (netaddrCount < 0) { - netaddrCount = (*enumAddresses_fn)(env, ifs, &netaddrP); + netaddrCount = enumAddresses_win(env, ifs, &netaddrP); if ((*env)->ExceptionOccurred(env)) { free_netaddr(netaddrP); return NULL; @@ -725,12 +616,13 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0 const char *name_utf; jobject netifObj = NULL; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_getByName0_XP (env, cls, name); } /* get the list of interfaces */ - if ((*enumInterfaces_fn)(env, &ifList) < 0) { + if (enumInterfaces(env, &ifList) < 0) { return NULL; } @@ -771,12 +663,13 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0 netif *ifList, *curr; jobject netifObj = NULL; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_getByIndex0_XP (env, cls, index); } /* get the list of interfaces */ - if ((*enumInterfaces_fn)(env, &ifList) < 0) { + if (enumInterfaces(env, &ifList) < 0) { return NULL; } @@ -812,12 +705,13 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 jint addr = (*env)->GetIntField(env, iaObj, ni_iaAddr); jobject netifObj = NULL; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_getByInetAddress0_XP (env, cls, iaObj); } /* get the list of interfaces */ - if ((*enumInterfaces_fn)(env, &ifList) < 0) { + if (enumInterfaces(env, &ifList) < 0) { return NULL; } @@ -832,7 +726,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 netaddr *addrP; /* enumerate the addresses on this interface */ - count = (*enumAddresses_fn)(env, curr, &addrList); + count = enumAddresses_win(env, curr, &addrList); if (count < 0) { free_netif(ifList); return NULL; @@ -881,14 +775,15 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll jobjectArray netIFArr; jint arr_index; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_getAll_XP (env, cls); } /* * Get list of interfaces */ - count = (*enumInterfaces_fn)(env, &ifList); + count = enumInterfaces(env, &ifList); if (count < 0) { return NULL; } @@ -934,13 +829,16 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isUp0 (JNIEnv *env, jclass cls, jstring name, jint index) { jboolean ret = JNI_FALSE; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_isUp0_XP(env, cls, name, index); } else { MIB_IFROW *ifRowP; ifRowP = getIF(index); if (ifRowP != NULL) { - ret = ifRowP->dwAdminStatus == 1 && (ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL || ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED); + ret = ifRowP->dwAdminStatus == 1 && + (ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL || + ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED); free(ifRowP); } } @@ -952,11 +850,13 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isUp0 * Method: isP2P0 * Signature: (Ljava/lang/String;I)Z */ -JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isP2P0(JNIEnv *env, jclass cls, jstring name, jint index) { +JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isP2P0 + (JNIEnv *env, jclass cls, jstring name, jint index) { MIB_IFROW *ifRowP; jboolean ret = JNI_FALSE; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_isP2P0_XP(env, cls, name, index); } else { ifRowP = getIF(index); @@ -983,7 +883,8 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isLoopback0 MIB_IFROW *ifRowP; jboolean ret = JNI_FALSE; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_isLoopback0_XP(env, cls, name, index); } else { ifRowP = getIF(index); @@ -1003,22 +904,8 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isLoopback0 */ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_supportsMulticast0 (JNIEnv *env, jclass cls, jstring name, jint index) { - MIB_IFROW *ifRowP; - jboolean ret = JNI_TRUE; - - // Let's try to use the newer API (XP & 2003 only) - if (GetAdaptersAddresses_fn != NULL) { - ret = Java_java_net_NetworkInterface_supportsMulticast0_XP(env, cls, + return Java_java_net_NetworkInterface_supportsMulticast0_XP(env, cls, name, index); - return ret; - } - ifRowP = getIF(index); - if (ifRowP != NULL) { - if (ifRowP->dwType == MIB_IF_TYPE_LOOPBACK) - ret = JNI_FALSE; - free(ifRowP); - } - return ret; } /* @@ -1026,12 +913,14 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_supportsMulticast0 * Method: getMacAddr0 * Signature: ([bLjava/lang/String;I)[b */ -JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0(JNIEnv *env, jclass class, jbyteArray addrArray, jstring name, jint index) { +JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0 + (JNIEnv *env, jclass class, jbyteArray addrArray, jstring name, jint index) { jbyteArray ret = NULL; int len; MIB_IFROW *ifRowP; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_getMacAddr0_XP(env, class, name, index); } else { ifRowP = getIF(index); @@ -1058,11 +947,13 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0(JNIEnv * * Method: getMTU0 * Signature: ([bLjava/lang/String;I)I */ -JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclass class, jstring name, jint index) { +JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0 + (JNIEnv *env, jclass class, jstring name, jint index) { jint ret = -1; MIB_IFROW *ifRowP; - if (os_supports_ipv6 && ipv6_available()) { + // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack + if (ipv6_available()) { return Java_java_net_NetworkInterface_getMTU0_XP(env, class, name, index); } else { ifRowP = getIF(index); diff --git a/jdk/src/windows/native/java/net/NetworkInterface.h b/jdk/src/windows/native/java/net/NetworkInterface.h index 6d3e1c1a957..262e15a0db0 100644 --- a/jdk/src/windows/native/java/net/NetworkInterface.h +++ b/jdk/src/windows/native/java/net/NetworkInterface.h @@ -87,338 +87,6 @@ extern jfieldID ni_ibaddressID; /* InterfaceAddress.address */ extern jfieldID ni_ibbroadcastID; /* InterfaceAddress.broadcast */ extern jfieldID ni_ibmaskID; /* InterfaceAddress.maskLength */ -int enumInterfaces_win(JNIEnv *env, netif **netifPP); - -/* We have included iphlpapi.h which includes iptypes.h which has the definition - * for MAX_ADAPTER_DESCRIPTION_LENGTH (along with the other definitions in this - * ifndef block). Therefore if MAX_ADAPTER_DESCRIPTION_LENGTH is defined we can - * be sure that the other definitions are also defined */ -#ifndef MAX_ADAPTER_DESCRIPTION_LENGTH - -/* - * Following includes come from iptypes.h - */ - -#pragma warning(push) -#pragma warning(disable:4201) - -#include - -// Definitions and structures used by getnetworkparams and getadaptersinfo apis - -#define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb. -#define MAX_ADAPTER_NAME_LENGTH 256 // arb. -#define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb. -#define DEFAULT_MINIMUM_ENTITIES 32 // arb. -#define MAX_HOSTNAME_LEN 128 // arb. -#define MAX_DOMAIN_NAME_LEN 128 // arb. -#define MAX_SCOPE_ID_LEN 256 // arb. - -// -// types -// - -// Node Type - -#define BROADCAST_NODETYPE 1 -#define PEER_TO_PEER_NODETYPE 2 -#define MIXED_NODETYPE 4 -#define HYBRID_NODETYPE 8 - -// -// IP_ADDRESS_STRING - store an IP address as a dotted decimal string -// - -typedef struct { - char String[4 * 4]; -} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING; - -// -// IP_ADDR_STRING - store an IP address with its corresponding subnet mask, -// both as dotted decimal strings -// - -typedef struct _IP_ADDR_STRING { - struct _IP_ADDR_STRING* Next; - IP_ADDRESS_STRING IpAddress; - IP_MASK_STRING IpMask; - DWORD Context; -} IP_ADDR_STRING, *PIP_ADDR_STRING; - -// -// ADAPTER_INFO - per-adapter information. All IP addresses are stored as -// strings -// - -typedef struct _IP_ADAPTER_INFO { - struct _IP_ADAPTER_INFO* Next; - DWORD ComboIndex; - char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; - char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; - UINT AddressLength; - BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]; - DWORD Index; - UINT Type; - UINT DhcpEnabled; - PIP_ADDR_STRING CurrentIpAddress; - IP_ADDR_STRING IpAddressList; - IP_ADDR_STRING GatewayList; - IP_ADDR_STRING DhcpServer; - BOOL HaveWins; - IP_ADDR_STRING PrimaryWinsServer; - IP_ADDR_STRING SecondaryWinsServer; - time_t LeaseObtained; - time_t LeaseExpires; -} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO; - -#ifdef _WINSOCK2API_ - -// -// The following types require Winsock2. -// - -typedef enum { - IpPrefixOriginOther = 0, - IpPrefixOriginManual, - IpPrefixOriginWellKnown, - IpPrefixOriginDhcp, - IpPrefixOriginRouterAdvertisement, -} IP_PREFIX_ORIGIN; - -typedef enum { - IpSuffixOriginOther = 0, - IpSuffixOriginManual, - IpSuffixOriginWellKnown, - IpSuffixOriginDhcp, - IpSuffixOriginLinkLayerAddress, - IpSuffixOriginRandom, -} IP_SUFFIX_ORIGIN; - -typedef enum { - IpDadStateInvalid = 0, - IpDadStateTentative, - IpDadStateDuplicate, - IpDadStateDeprecated, - IpDadStatePreferred, -} IP_DAD_STATE; - -typedef struct _IP_ADAPTER_UNICAST_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - }; - }; - struct _IP_ADAPTER_UNICAST_ADDRESS *Next; - SOCKET_ADDRESS Address; - - IP_PREFIX_ORIGIN PrefixOrigin; - IP_SUFFIX_ORIGIN SuffixOrigin; - IP_DAD_STATE DadState; - - ULONG ValidLifetime; - ULONG PreferredLifetime; - ULONG LeaseLifetime; -} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS; - -typedef struct _IP_ADAPTER_ANYCAST_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - }; - }; - struct _IP_ADAPTER_ANYCAST_ADDRESS *Next; - SOCKET_ADDRESS Address; -} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS; - -typedef struct _IP_ADAPTER_MULTICAST_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - }; - }; - struct _IP_ADAPTER_MULTICAST_ADDRESS *Next; - SOCKET_ADDRESS Address; -} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS; - -// -// Per-address Flags -// -#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x01 -#define IP_ADAPTER_ADDRESS_TRANSIENT 0x02 - -typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Reserved; - }; - }; - struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next; - SOCKET_ADDRESS Address; -} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS; - -typedef struct _IP_ADAPTER_PREFIX { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD Flags; - }; - }; - struct _IP_ADAPTER_PREFIX *Next; - SOCKET_ADDRESS Address; - ULONG PrefixLength; -} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX; - -// -// Per-adapter Flags -// -#define IP_ADAPTER_DDNS_ENABLED 0x01 -#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x02 -#define IP_ADAPTER_DHCP_ENABLED 0x04 -#define IP_ADAPTER_RECEIVE_ONLY 0x08 -#define IP_ADAPTER_NO_MULTICAST 0x10 -#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x20 - -// -// OperStatus values from RFC 2863 -// -typedef enum { - IfOperStatusUp = 1, - IfOperStatusDown, - IfOperStatusTesting, - IfOperStatusUnknown, - IfOperStatusDormant, - IfOperStatusNotPresent, - IfOperStatusLowerLayerDown -} IF_OPER_STATUS; - -// -// Scope levels from RFC 2373 used with ZoneIndices array. -// -typedef enum { - ScopeLevelInterface = 1, - ScopeLevelLink = 2, - ScopeLevelSubnet = 3, - ScopeLevelAdmin = 4, - ScopeLevelSite = 5, - ScopeLevelOrganization = 8, - ScopeLevelGlobal = 14 -} SCOPE_LEVEL; - -typedef struct _IP_ADAPTER_ADDRESSES { - union { - ULONGLONG Alignment; - struct { - ULONG Length; - DWORD IfIndex; - }; - }; - struct _IP_ADAPTER_ADDRESSES *Next; - PCHAR AdapterName; - PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress; - PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress; - PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress; - PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress; - PWCHAR DnsSuffix; - PWCHAR Description; - PWCHAR FriendlyName; - BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH]; - DWORD PhysicalAddressLength; - DWORD Flags; - DWORD Mtu; - DWORD IfType; - IF_OPER_STATUS OperStatus; - DWORD Ipv6IfIndex; - DWORD ZoneIndices[16]; - PIP_ADAPTER_PREFIX FirstPrefix; -} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES; - -// -// Flags used as argument to GetAdaptersAddresses(). -// "SKIP" flags are added when the default is to include the information. -// "INCLUDE" flags are added when the default is to skip the information. -// -#define GAA_FLAG_SKIP_UNICAST 0x0001 -#define GAA_FLAG_SKIP_ANYCAST 0x0002 -#define GAA_FLAG_SKIP_MULTICAST 0x0004 -#define GAA_FLAG_SKIP_DNS_SERVER 0x0008 -#define GAA_FLAG_INCLUDE_PREFIX 0x0010 -#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020 - -#endif /* _WINSOCK2API_ */ - -// -// IP_PER_ADAPTER_INFO - per-adapter IP information such as DNS server list. -// - -typedef struct _IP_PER_ADAPTER_INFO { - UINT AutoconfigEnabled; - UINT AutoconfigActive; - PIP_ADDR_STRING CurrentDnsServer; - IP_ADDR_STRING DnsServerList; -} IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO; - -// -// FIXED_INFO - the set of IP-related information which does not depend on DHCP -// - -typedef struct { - char HostName[MAX_HOSTNAME_LEN + 4] ; - char DomainName[MAX_DOMAIN_NAME_LEN + 4]; - PIP_ADDR_STRING CurrentDnsServer; - IP_ADDR_STRING DnsServerList; - UINT NodeType; - char ScopeId[MAX_SCOPE_ID_LEN + 4]; - UINT EnableRouting; - UINT EnableProxy; - UINT EnableDns; -} FIXED_INFO, *PFIXED_INFO; - -#pragma warning(pop) - -#endif /*!MAX_ADAPTER_DESCRIPTION_LENGTH*/ - -#ifndef IP_INTERFACE_NAME_INFO_DEFINED -#define IP_INTERFACE_NAME_INFO_DEFINED - -typedef struct ip_interface_name_info { - ULONG Index; // Interface Index - ULONG MediaType; // Interface Types - see ipifcons.h - UCHAR ConnectionType; - UCHAR AccessType; - GUID DeviceGuid; // Device GUID is the guid of the device - // that IP exposes - GUID InterfaceGuid; // Interface GUID, if not GUID_NULL is the - // GUID for the interface mapped to the device. -} IP_INTERFACE_NAME_INFO, *PIP_INTERFACE_NAME_INFO; - -#endif - - -/* from ipifcons.h */ - -#ifndef IF_TYPE_PPP -#define IF_TYPE_PPP 23 -#endif - -#ifndef IF_TYPE_SOFTWARE_LOOPBACK -#define IF_TYPE_SOFTWARE_LOOPBACK 24 -#endif - -#ifndef IF_TYPE_SLIP -#define IF_TYPE_SLIP 28 -#endif - -#ifndef IF_TYPE_TUNNEL -#define IF_TYPE_TUNNEL 131 -#endif +int enumInterfaces(JNIEnv *env, netif **netifPP); #endif diff --git a/jdk/src/windows/native/java/net/NetworkInterface_win9x.c b/jdk/src/windows/native/java/net/NetworkInterface_win9x.c deleted file mode 100644 index deac1eb7f3d..00000000000 --- a/jdk/src/windows/native/java/net/NetworkInterface_win9x.c +++ /dev/null @@ -1,1141 +0,0 @@ -/* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include -#include - -#include "jni_util.h" - -#include "NetworkInterface.h" - -/* - * Windows 9x specific routines to enumerate network interfaces and the - * IP addresses bound to those interfaces. - * - * Windows 95 does not include IP helper library support by default. - * Additionally Windows 98 can have its IP helper library support - * trashed by certain IE installations. For these environments we - * combine information from the registry with the list of IP addresses - * obtained via SIO_GET_INTERFACE_LIST. - */ - -/* - * Header files are missing these - */ -#if !defined(SIO_GET_INTERFACE_LIST) -#define SIO_GET_INTERFACE_LIST _IOR('t', 127, u_long) - -struct in_addr6 { - u_char s6_addr[16]; -}; - -struct sockaddr_in6 { - short sin6_family; - u_short sin6_port; - u_long sin6_flowinfo; - struct in_addr6 sin6_addr; -}; - -typedef union sockaddr_gen{ - struct sockaddr Address; - struct sockaddr_in AddressIn; - struct sockaddr_in6 AddressIn6; -} sockaddr_gen; - -typedef struct _INTERFACE_INFO -{ - u_long iiFlags; - sockaddr_gen iiAddress; - sockaddr_gen iiBroadcastAddress; - sockaddr_gen iiNetmask; -} INTERFACE_INFO; - -#define IFF_UP 0x00000001 -#endif - - -#define MAX_STR_LEN 256 - - -/* - * A network adapter (similiar to the netif structure except contains - * Windows 9x specific fields). - */ -typedef struct _adapter { - char *name; - char *displayName; - int index; - char *reg_key; - int is_wan_driver; - netaddr *addrs; - struct _adapter *next; -} adapter; - - -/* - * Cached adapter list. - */ -static CRITICAL_SECTION cacheLock; -static adapter *cachedAdapterList; - -/* - * Initialize cache - */ -void init_win9x() { - InitializeCriticalSection(&cacheLock); -} - - -/* - * Free adapter list and any addresses bound to the adpater. - */ -static void free_adapters(adapter *adapterP) { - adapter *curr = adapterP; - while (curr != NULL) { - if (curr->name != NULL) - free(curr->name); - - if (curr->displayName != NULL) - free(curr->displayName); - - if (curr->reg_key != NULL) - free(curr->reg_key); - - if (curr->addrs != NULL) - free_netaddr(curr->addrs); - - adapterP = adapterP->next; - free(curr); - curr = adapterP; - } -} - - -/* - * Returns the SIO_GET_INTERFACE_LIST output - */ -static int getInterfaceList(JNIEnv *env, INTERFACE_INFO *infoP, DWORD dwSize) { - SOCKET sock; - DWORD ret; - - /* create a socket and do the ioctl */ - sock = socket(AF_INET, SOCK_DGRAM, 0); - if (sock == INVALID_SOCKET) { - JNU_ThrowByName(env, "java/lang/Error", "socket failed"); - return -1; - } - ret = WSAIoctl(sock, SIO_GET_INTERFACE_LIST, NULL, 0, - infoP, dwSize, &dwSize, NULL, NULL); - closesocket(sock); - if (ret == SOCKET_ERROR) { - JNU_ThrowByName(env, "java/lang/Error", "WSAIoctl failed"); - return -1; - } - return dwSize; -} - - -/* - * Gross, ugly, and crude way of guessing if this is a WAN (dial-up) driver. - * Returns 1 if it's the normal PPCMAC VxD, otherwise 0. - */ -static int isWanDriver(char *driver) { - LONG ret; - HKEY hKey; - DWORD dwLen; - ULONG ulType; - char key[MAX_STR_LEN]; - char vxd[MAX_STR_LEN]; - - sprintf(key, "System\\CurrentControlSet\\Services\\Class\\%s", driver); - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey); - if (ret != ERROR_SUCCESS) { - return 0; - } - dwLen = sizeof(vxd); - ret = RegQueryValueEx(hKey, "DeviceVxDs", NULL, &ulType, - (LPBYTE)vxd, &dwLen); - RegCloseKey(hKey); - if (ret != ERROR_SUCCESS) { - return 0; - } - return (strcmp(vxd, "pppmac.vxd") == 0); -} - -/* - * Windows 9x routine to get the network adapters using the registry. - * We enumerate HKEY_LOCAL_MACHINE\Enum and iterate through the tree - * looking for devices of class "Net". As these devices may not have a - * unique name we assign them a generated name. - * - * Returns a list of adapters without IP addresses (addrs member is NULL). - */ -static int getAdapters(JNIEnv *env, adapter **adapterPP) -{ - LONG ret; - HKEY enumKey; - DWORD dwLen; - DWORD dwEnumKeys; - DWORD enumIndex; - ULONG ulType; - int adapterCount = 0; - adapter *adapterP = NULL; - adapter *curr; - - /* - * Start at HKEY_LOCAL_MACHINE\Enum - */ - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Enum", 0, KEY_READ, (PHKEY)&enumKey); - if (ret != ERROR_SUCCESS) { - return -1; - } - ret = RegQueryInfoKey(enumKey, NULL, NULL, NULL, &dwEnumKeys, - NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (ret != ERROR_SUCCESS) { - RegCloseKey(enumKey); - return -1; - } - - /* - * Iterate through the sub-keys (PCI, Root, ...) - */ - for(enumIndex = 0; enumIndexis_wan_driver = wan_device; - curr->name = (char *)malloc(strlen(ps_name) + 1); - if (curr->name) { - curr->displayName = (char *)malloc(strlen(deviceDesc) + 1); - if (curr->displayName) { - curr->reg_key = (char *)malloc(strlen(key_name)+1); - if (curr->reg_key == NULL) { - free(curr->displayName); - free(curr->name); - free(curr); - curr = NULL; - } - } else { - free(curr->name); - free(curr); - curr = NULL; - } - } else { - free(curr); - curr = NULL; - } - } - - /* At OutOfMemory occurred */ - if (curr == NULL) { - JNU_ThrowOutOfMemoryError(env, "heap allocation failure"); - free_adapters(adapterP); - RegCloseKey(clsKey); - RegCloseKey(nameKey); - RegCloseKey(deviceKey); - RegCloseKey(enumKey); - return -1; - } - - /* index starts at 1 (not 0) */ - curr->index = ++adapterCount; - - strcpy(curr->name, ps_name); - strcpy(curr->displayName, deviceDesc); - strcpy(curr->reg_key, key_name); - - /* - * Put the adapter at the end of the list. - */ - if (adapterP == NULL) { - adapterP = curr; - } else { - adapter *tail = adapterP; - while (tail->next != NULL) { - tail = tail->next; - } - tail->next = curr; - } - } - } - } - } - RegCloseKey(clsKey); - } - RegCloseKey(nameKey); - } - RegCloseKey(deviceKey); - } - RegCloseKey(enumKey); - - /* - * Insert an entry for the loopback interface - */ - curr = (adapter *)calloc(1, sizeof(adapter)); - if (curr == NULL) { - JNU_ThrowOutOfMemoryError(env, "heap allocation failure"); - free_adapters(adapterP); - return -1; - } - curr->index = ++adapterCount; - curr->name = _strdup("lo"); - curr->displayName = _strdup("TCP Loopback interface"); - curr->next = adapterP; - *adapterPP = curr; - - return adapterCount; -} - -/* - * Windows 9x routine to obtain any static addresses for a specified - * TCP/IP binding. - * - * We first open Enum\Network\${binding} and check that the driver - * is TCP/IP. If so we pick up the driver and check for any IP addresses - * in System\\CurrentControlSet\\Services\\Class\\${driver} - * - * Returns 0 if found, otherwise -1. - */ -static int getStaticAddressEntry(char *binding, char *addresses) { - LONG ret; - HKEY hKey; - char name[255]; - char desc[255]; - char driver[255]; - char ipaddr[255]; - DWORD dwName; - ULONG ulType; - - /* assume nothing will be returned */ - strcpy(addresses, ""); - - /* - * Open the binding and check that it's TCP/IP - */ - sprintf(name, "Enum\\Network\\%s", binding); - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, name, 0, KEY_READ, (PHKEY)&hKey); - if (ret != ERROR_SUCCESS) { - return -1; - } - dwName = sizeof(desc); - ret = RegQueryValueEx(hKey, "DeviceDesc", NULL, &ulType, - (LPBYTE)desc, &dwName); - if (ret != ERROR_SUCCESS) { - RegCloseKey(hKey); - return -1; - } - if (strcmp(desc, "TCP/IP") != 0) { - /* ignore non-TCP/IP bindings */ - RegCloseKey(hKey); - return -1; - } - - /* - * Get the driver for this TCP/IP binding - */ - dwName = sizeof(driver); - ret = RegQueryValueEx(hKey, "Driver", NULL, &ulType, - (LPBYTE)driver, &dwName); - RegCloseKey(hKey); - if (ret != ERROR_SUCCESS) { - return -1; - } - - /* - * Finally check if there is an IPAddress value for this driver. - */ - sprintf(name, "System\\CurrentControlSet\\Services\\Class\\%s", driver); - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, name, 0, KEY_READ, (PHKEY)&hKey); - if (ret != ERROR_SUCCESS) { - return -1; - } - dwName = sizeof(ipaddr); - ret = RegQueryValueEx(hKey, "IPAddress", NULL, &ulType, - (LPBYTE)ipaddr, &dwName); - RegCloseKey(hKey); - if (ret != ERROR_SUCCESS) { - return -1; - } - - /* Return the address(es) */ - strcpy( addresses, ipaddr ); - return 0; -} - -/* - * Windows 9x routine to enumerate the static IP addresses on a - * particular interface using the registry. - * - * Returns a count of the number of addresses found. - */ -static int getStaticAddresses(JNIEnv *env, char *reg_key, netaddr **netaddrPP) -{ - LONG ret; - HKEY enumKey, bindingKey; - DWORD dwLen; - ULONG ulType; - char addresses[MAX_STR_LEN]; - unsigned long addr; /* IPv4 address */ - unsigned char byte; - netaddr *netaddrP, *curr; - int i, addrCount; - - /* - * Open the HKEY_LOCAL_MACHINE\Enum\%s\%s\%s key - */ - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_key, 0, KEY_READ, - (PHKEY)&enumKey); - if (ret != ERROR_SUCCESS) { - /* interface has been removed */ - *netaddrPP = NULL; - return 0; - } - - /* - * Iterate through each of the bindings to find any TCP/IP bindings - * and any static address assoicated with the binding. - */ - strcpy(addresses, ""); - addrCount = 0; - netaddrP = NULL; - - ret = RegOpenKeyEx(enumKey, "Bindings", 0, KEY_READ, (PHKEY)&bindingKey); - if (ret == ERROR_SUCCESS) { - DWORD dwBindingKeys; - DWORD dwBindingIndex; - - ret = RegQueryInfoKey(bindingKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwBindingKeys, - NULL, NULL, NULL, NULL); - if (ret == ERROR_SUCCESS) { - TCHAR binding[MAX_STR_LEN]; - - dwBindingIndex=0; - while (dwBindingIndexaddr.him4.sin_family = AF_INET; - curr->addr.him4.sin_addr.s_addr = htonl(addr); - curr->next = netaddrP; - - netaddrP = curr; - addrCount++; - - /* reset the address for the next iteration */ - addr = 0; - } - byte = 0; - } else { - if (addresses[i] == '.') { - addr = (addr << 8) | byte; - byte = 0; - } else { - byte = (byte * 10) + (addresses[i] - '0'); - } - } - i++; - } - } - } - if (addrCount > 0) { - break; - } - dwBindingIndex++; - } - } - RegCloseKey(bindingKey); - } - - /* close the registry */ - RegCloseKey(enumKey); - - - /* return the list */ - *netaddrPP = netaddrP; - return addrCount; -} - -/* - * Windows 9x routine to probe the registry for a DHCP allocated address. - * This routine is only useful if we know that only one interface has its - * address allocated using DHCP. Returns 0.0.0.0 if none or multiple - * addresses found.0 - */ -static DWORD getDHCPAddress() -{ - LONG ret; - HKEY hKey; - DWORD dwLen; - ULONG ulType; - char key[MAX_STR_LEN]; - int index; - DWORD dhcp_addr = 0; - - index = 0; - while (index < 99) { - DWORD addr; - - sprintf(key, "SYSTEM\\CurrentControlSet\\Services\\VxD\\DHCP\\DhcpInfo%02d", index); - - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey); - if (ret != ERROR_SUCCESS) { - return dhcp_addr; - } - - /* - * On Windows 9x the DHCP address is in the DhcpIPAddress key. We - * are assuming here that this is Windows Socket 2. If Windows - * Sockets is the original 1.1 release then this doesn't work because - * the IP address if in the DhcpInfo key (a blob with the first 4 - * bytes set to the IP address). - */ - dwLen = sizeof(addr); - ret = RegQueryValueEx(hKey, "DhcpIPAddress", NULL, &ulType, - (LPBYTE)&addr, &dwLen); - RegCloseKey(hKey); - - if (ret == ERROR_SUCCESS) { - if (addr) { - /* more than 1 DHCP address in registry */ - if (dhcp_addr) { - return 0; - } - dhcp_addr = htonl(addr); - } - } - index++; - } - - /* if we get here it means we've examined 100 registry entries */ - return 0; -} - - -/* - * Attempt to allocate the remaining addresses on addrList to the adpaters - * on adapterList. Returns the number of address remaining. - */ -int allocateRemaining(adapter *adapterList, int address_count, netaddr *addrList) { - adapter *adapterP = adapterList; - adapter *nobindingsP = NULL; - - /* - * If all addresses have been assigned there's nothing to do. - */ - if (address_count == 0) { - return 0; - } - - /* - * Determine if there is only one adapter without an address - */ - while (adapterP != NULL) { - if (adapterP->addrs == NULL) { - if (nobindingsP == NULL) { - nobindingsP = adapterP; - } else { - nobindingsP = NULL; - break; - } - } - adapterP = adapterP->next; - } - - /* - * Found (only one) - */ - if (nobindingsP) { - nobindingsP->addrs = addrList; - address_count = 0; - } - - return address_count; -} - - -/* - * 1. Network adapters are enumerated by traversing through the - * HKEY_LOCAL_MACHINE\Enum tree and picking out class "Net" devices. - * - * 2. Address enumeration starts with the list of IP addresses returned - * by SIO_GET_INTERFACE_LIST and then we "allocate" the addresses to - * the network adapters enumerated in step 1. Allocation works as - * follows :- - * - * i. Loopback address is assigned to the loopback interface. If there - * is one network adapter then all other addresses must be bound - * to that adapter. - * - * ii. Enumerate all static IP addresses using the registry. This allows - * us to allocate all static IP address to the corresponding adapter. - * - * iii. After step ii. if there is one network adapter that has not been - * allocated an IP address then we know that the remaining IP addresses - * must be bound to this adapter. - * - * iv. If we get to this step it means we are dealing with a complex - * configuration whereby multiple network adapters have their address - * configured dynamically (eg: NIC using DHCP plus modem using PPP). - * We employ a gross hack based on a crude determination done in step 1. - * If there is a DHCP address configured and if one remaining - * network adapter that is not a WAN adapter then the DHCP address - * must be bound to it. - */ -static adapter *loadConfig(JNIEnv *env) { - adapter *adapterList; - int adapter_count; - INTERFACE_INFO interfaceInfo[8]; - DWORD dwSize; - int address_count, i; - netaddr *addrList; - - /* - * Enumerate the network adapters - */ - adapter_count = getAdapters(env, &adapterList); - if (adapter_count < 0) { - return NULL; - } - /* minimum of loopback interface */ - assert(adapter_count >= 1); - - /* - * Enumerate all IP addresses as known to winsock - */ - dwSize = getInterfaceList(env, interfaceInfo, sizeof(interfaceInfo)); - if (dwSize < 0) { - free_adapters(adapterList); - return NULL; - } - address_count = dwSize/sizeof(INTERFACE_INFO); - - /* minimum of loopback address */ - assert(address_count >= 1); - - /* - * Create an address list (addrList) from the INTERFACE_INFO - * structure. - */ - addrList = NULL; - for (i=0; iaddr.him4.sin_family = AF_INET; - addrP->addr.him4.sin_addr.s_addr = - ((SOCKADDR_IN *)&(interfaceInfo[i].iiAddress))->sin_addr.S_un.S_addr; - - addrP->next = addrList; - addrList = addrP; - } - - - /* - * First we assign the loopback address to the lo adapter. - * If lo is the only adapter then we are done. - */ - { - adapter *loopbackAdapter; - netaddr *addrP, *prevP; - - /* find the loopback adapter */ - loopbackAdapter = adapterList; - while (strcmp(loopbackAdapter->name, "lo") != 0) { - loopbackAdapter = loopbackAdapter->next; - } - assert(loopbackAdapter != NULL); - - /* find the loopback address and move it to the loopback adapter */ - addrP = addrList; - prevP = NULL; - while (addrP != NULL) { - if (addrP->addr.him4.sin_addr.s_addr == htonl(0x7f000001)) { - loopbackAdapter->addrs = addrP; - if (prevP == NULL) { - addrList = addrP->next; - } else { - prevP->next = addrP->next; - } - loopbackAdapter->addrs->next = NULL; - address_count--; - break; - } - prevP = addrP; - addrP = addrP->next; - } - } - - - /* - * Special case. If there's only one network adapter then all remaining - * IP addresses must be bound to that adapter. - */ - address_count = allocateRemaining(adapterList, address_count, addrList); - if (address_count == 0) { - return adapterList; - } - - /* - * Locate any static IP addresses defined in the registry. Validate the - * addresses against the SIO_GET_INTERFACE_LIST (as registry may have - * stale settings). If valid we move the addresses from addrList to - * the adapter. - */ - { - adapter *adapterP; - - adapterP = adapterList; - while (adapterP != NULL) { - int cnt; - netaddr *static_addrP; - - /* - * Skip loopback - */ - if (strcmp(adapterP->name, "lo") == 0) { - adapterP = adapterP->next; - continue; - } - - /* - * Get the static addresses for this adapter. - */ - cnt = getStaticAddresses(env, adapterP->reg_key, &static_addrP); - if (cnt < 0) { - free_netaddr(addrList); - free(adapterList); - return NULL; - } - - /* - * Validate against the SIO_GET_INTERFACE_LIST. - * (avoids stale registry settings). - */ - while (static_addrP != NULL) { - netaddr *addrP = addrList; - netaddr *prev = NULL; - - while (addrP != NULL) { - if (addrP->addr.him4.sin_addr.s_addr == static_addrP->addr.him4.sin_addr.s_addr) - break; - - prev = addrP; - addrP = addrP->next; - } - - /* - * if addrP is not NULL it means we have a match - * (ie: address from the registry is valid). - */ - if (addrP != NULL) { - /* remove from addrList */ - if (prev == NULL) { - addrList = addrP->next; - } else { - prev->next = addrP->next; - } - address_count--; - - /* add to adapter list */ - addrP->next = adapterP->addrs; - adapterP->addrs = addrP; - } - - /* - * On the next static address. - */ - static_addrP = static_addrP->next; - } - - /* not needed */ - free_netaddr(static_addrP); - - adapterP = adapterP->next; - } - } - - - /* - * Static addresses are now assigned so try again to allocate the - * remaining addresses. This will succeed if there is one adapter - * with a dynamically assigned address (DHCP or PPP). - */ - address_count = allocateRemaining(adapterList, address_count, addrList); - if (address_count == 0) { - return adapterList; - } - - /* - * Next we see if there is a DHCP address in the registry. If there is - * an address (and it's valid) then we know it must be bound to a LAN - * adapter. Additionally, when we enumerate the network adapters - * we made a crude determination on if an adapter is dial-up. Thus if - * we know there is one remaining LAN adapter without an IP address - * then the DHCP address must be bound to it. - */ - { - long dhcp_addr = getDHCPAddress(); /* returns in network order */ - if (dhcp_addr) { - netaddr *addrP, *prevP; - - /* - * Check that the DHCP address is valid - */ - addrP = addrList; - prevP = NULL; - while (addrP != NULL) { - if (addrP->addr.him4.sin_addr.s_addr == dhcp_addr) { - break; - } - prevP = addrP; - addrP = addrP->next; - } - - /* - * Address is valid - now check how many non-WAN adapters - * don't have addresses yet. - */ - if (addrP != NULL) { - adapter *adapterP = adapterList; - adapter *nobindingsP = NULL; - - while (adapterP != NULL) { - if (adapterP->addrs == NULL && !adapterP->is_wan_driver) { - if (nobindingsP == NULL) { - nobindingsP = adapterP; - } else { - /* already found one */ - nobindingsP = NULL; - break; - } - } - adapterP = adapterP->next; - } - - /* - * One non-WAN adapter remaining - */ - if (nobindingsP != NULL) { - nobindingsP->addrs = addrP; - - /* remove from addrList */ - if (prevP == NULL) { - addrList = addrP->next; - } else { - prevP->next = addrP->next; - } - addrP->next = NULL; - address_count--; - } - } - } - } - - /* - * Finally we do one final attempt to re-assign any remaining - * addresses. This catches the case of 2 adapters that have their - * addresses dynamically assigned (specifically NIC with DHCP, and - * Modem using RAS/PPP). - */ - address_count = allocateRemaining(adapterList, address_count, addrList); - if (address_count == 0) { - return adapterList; - } - - /* - * Free any unallocated addresses - */ - if (address_count > 0) { - free_netaddr(addrList); - } - - /* - * Return the adapter List. - */ - return adapterList; - -} - - -/* - * Enumerate network interfaces. If successful returns the number of - * network interfaces and netifPP returning a list of netif structures. - * Returns -1 with exception thrown if error. - */ -int enumInterfaces_win9x(JNIEnv *env, netif **netifPP) { - adapter *adapters, *adapterP; - int cnt = 0; - netif *netifP = NULL; - - /* enumerate network configuration */ - adapters = loadConfig(env); - if (adapters == NULL) { - return -1; - } - - /* - * loadConfig returns an adapter list - we need to create a corresponding - * list of netif structures. - */ - adapterP = adapters; - while (adapterP != NULL) { - netif *ifs = (netif *)calloc(1, sizeof(netif)); - - if (ifs == NULL) { - JNU_ThrowOutOfMemoryError(env, "heap allocation failure"); - free_adapters(adapters); - free_netif(netifP); - return -1; - } - - ifs->name = _strdup(adapterP->name); - ifs->displayName = _strdup(adapterP->displayName); - ifs->dwIndex = adapterP->index; - ifs->index = adapterP->index; - ifs->next = netifP; - netifP = ifs; - - if (ifs->name == NULL || ifs->displayName == NULL) { - JNU_ThrowOutOfMemoryError(env, "heap allocation failure"); - free_adapters(adapters); - free_netif(netifP); - return -1; - } - - cnt++; - adapterP = adapterP->next; - } - - /* - * Put the adapter list in the cache - */ - EnterCriticalSection(&cacheLock); - { - if (cachedAdapterList != NULL) { - free_adapters(cachedAdapterList); - } - cachedAdapterList = adapters; - } - LeaveCriticalSection(&cacheLock); - - /* - * Return the netif list - */ - *netifPP = netifP; - return cnt; -} - -/* - * Enumerate the addresses for the specified network interface. If successful - * returns the number of addresses bound to the interface and sets netaddrPP - * to be a list of netaddr structures. Returns -1 if error. - */ -int enumAddresses_win9x(JNIEnv *env, netif *netifP, netaddr **netaddrPP) { - - EnterCriticalSection(&cacheLock); - { - adapter *adapterP = cachedAdapterList; - while (adapterP != NULL) { - if (strcmp(adapterP->name, netifP->name) == 0) { - - netaddr *newlist = NULL; - netaddr *curr = adapterP->addrs; - int cnt = 0; - - while (curr != NULL) { - /* - * Clone the netaddr and add it to newlist. - */ - netaddr *tmp = (netaddr *)calloc(1, sizeof(netaddr)); - if (tmp == NULL) { - LeaveCriticalSection(&cacheLock); - JNU_ThrowOutOfMemoryError(env, "heap allocation failure"); - free_netaddr(newlist); - return -1; - } - tmp->addr = curr->addr; - tmp->next = newlist; - newlist = tmp; - - cnt++; - curr = curr->next; - } - - *netaddrPP = newlist; - LeaveCriticalSection(&cacheLock); - return cnt; - } - adapterP = adapterP->next; - } - } - LeaveCriticalSection(&cacheLock); - - *netaddrPP = NULL; - return 0; -} diff --git a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c index 283be81b89a..ecfab4967db 100644 --- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c +++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c @@ -43,14 +43,6 @@ extern int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP); int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP); -/* IP helper library routines */ -int (PASCAL FAR *GetIpAddrTable_fn)(); -int (PASCAL FAR *GetIfTable_fn)(); -int (PASCAL FAR *GetFriendlyIfIndex_fn)(); -int (PASCAL FAR *GetAdaptersAddresses_fn)(); -int (PASCAL FAR *GetAdaptersInfo_fn)(); -int (PASCAL FAR *GetNumberOfInterfaces_fn)(); - #ifdef DEBUG void printnif (netif *nif) { #ifdef _WIN64 @@ -96,14 +88,14 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) { flags = GAA_FLAG_SKIP_DNS_SERVER; flags |= GAA_FLAG_SKIP_MULTICAST; flags |= GAA_FLAG_INCLUDE_PREFIX; - ret = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len); + ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len); if (ret == ERROR_BUFFER_OVERFLOW) { adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len); if (adapterInfo == 0) { return -1; } bufsize = len; - ret = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len); + ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len); } if (ret != ERROR_SUCCESS) { free (adapterInfo); @@ -133,7 +125,7 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) { flags = GAA_FLAG_SKIP_DNS_SERVER; flags |= GAA_FLAG_SKIP_MULTICAST; flags |= GAA_FLAG_INCLUDE_PREFIX; - val = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len); + val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len); if (val == ERROR_BUFFER_OVERFLOW) { adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len); if (adapterInfo == 0) { @@ -141,7 +133,7 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) { return NULL; } bufsize = len; - val = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len); + val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len); } if (val != ERROR_SUCCESS) { free (adapterInfo); @@ -182,7 +174,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) * as what previous JDK versions would return. */ - ret = enumInterfaces_win (env, netifPP); + ret = enumInterfaces(env, netifPP); if (ret == -1) { return -1; } else { @@ -221,7 +213,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP) * (b) IPv6 information for IPv6 only interfaces (probably tunnels) * * For compatibility with previous releases we use the naming - * information gotten from enumInterfaces_win() for (a) entries + * information gotten from enumInterfaces() for (a) entries * However, the index numbers are taken from the new API. * * The procedure is to go through the list of adapters returned @@ -439,7 +431,8 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) netifObj = (*env)->NewObject(env, ni_class, ni_ctor); name = (*env)->NewStringUTF(env, ifs->name); if (ifs->dNameIsUnicode) { - displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, wcslen ((PWCHAR)ifs->displayName)); + displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, + (jsize)wcslen ((PWCHAR)ifs->displayName)); } else { displayName = (*env)->NewStringUTF(env, ifs->displayName); } diff --git a/jdk/src/windows/native/java/net/net_util_md.c b/jdk/src/windows/native/java/net/net_util_md.c index ffaf52078aa..4bb9d26041d 100644 --- a/jdk/src/windows/native/java/net/net_util_md.c +++ b/jdk/src/windows/native/java/net/net_util_md.c @@ -39,10 +39,6 @@ /* true if SO_RCVTIMEO is supported */ jboolean isRcvTimeoutSupported = JNI_TRUE; -LPFN_GETADDRINFO getaddrinfo_ptr = NULL; -LPFN_FREEADDRINFO freaddrinfo_ptr = NULL; -LPFN_GETNAMEINFO getnameinfo_ptr = NULL; - /* * Table of Windows Sockets errors, the specific exception we * throw for the error, and the error text. @@ -233,38 +229,15 @@ NET_GetFileDescriptorID(JNIEnv *env) jint IPv6_supported() { - HMODULE lib; - int fd = socket(AF_INET6, SOCK_STREAM, 0) ; - if (fd < 0) { + SOCKET s = socket(AF_INET6, SOCK_STREAM, 0) ; + if (s < 0) { return JNI_FALSE; } - closesocket (fd); - - if ((lib = LoadLibrary ("ws2_32.dll")) == NULL) { - return JNI_FALSE; - } - if ((getaddrinfo_ptr = (LPFN_GETADDRINFO)GetProcAddress (lib, "getaddrinfo")) == NULL) { - FreeLibrary (lib); - return JNI_FALSE; - } - if ((freeaddrinfo_ptr = (LPFN_FREEADDRINFO)GetProcAddress (lib, "freeaddrinfo")) == NULL) { - FreeLibrary (lib); - return JNI_FALSE; - } - if ((getnameinfo_ptr = (LPFN_GETNAMEINFO)GetProcAddress (lib, "getnameinfo")) == NULL) { - FreeLibrary (lib); - return JNI_FALSE; - } - FreeLibrary(lib); + closesocket(s); return JNI_TRUE; } -jboolean NET_addrtransAvailable() { - return (jboolean)(getaddrinfo_ptr != NULL); -} - - /* * Return the default TOS value */ @@ -664,7 +637,7 @@ NET_BindV6(struct ipv6bind* b) { if (family == AF_INET && (b->addr->him4.sin_addr.s_addr != INADDR_ANY)) { /* bind to v4 only */ int ret; - ret = NET_Bind (b->ipv4_fd, (struct sockaddr *)b->addr, + ret = NET_Bind ((int)b->ipv4_fd, (struct sockaddr *)b->addr, sizeof (struct sockaddr_in)); if (ret == SOCKET_ERROR) { CLOSE_SOCKETS_AND_RETURN; @@ -676,7 +649,7 @@ NET_BindV6(struct ipv6bind* b) { if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->him6.sin6_addr))) { /* bind to v6 only */ int ret; - ret = NET_Bind (b->ipv6_fd, (struct sockaddr *)b->addr, + ret = NET_Bind ((int)b->ipv6_fd, (struct sockaddr *)b->addr, sizeof (struct SOCKADDR_IN6)); if (ret == SOCKET_ERROR) { CLOSE_SOCKETS_AND_RETURN; @@ -691,15 +664,15 @@ NET_BindV6(struct ipv6bind* b) { memset (&oaddr, 0, sizeof(oaddr)); if (family == AF_INET) { ofamily = AF_INET6; - fd = b->ipv4_fd; - ofd = b->ipv6_fd; + fd = (int)b->ipv4_fd; + ofd = (int)b->ipv6_fd; port = (u_short)GET_PORT (b->addr); IN6ADDR_SETANY (&oaddr.him6); oaddr.him6.sin6_port = port; } else { ofamily = AF_INET; - ofd = b->ipv4_fd; - fd = b->ipv6_fd; + ofd = (int)b->ipv4_fd; + fd = (int)b->ipv6_fd; port = (u_short)GET_PORT (b->addr); oaddr.him4.sin_family = AF_INET; oaddr.him4.sin_port = port; @@ -744,11 +717,11 @@ NET_BindV6(struct ipv6bind* b) { b->ipv6_fd = SOCKET_ERROR; /* create two new sockets */ - fd = socket (family, sotype, 0); + fd = (int)socket (family, sotype, 0); if (fd == SOCKET_ERROR) { CLOSE_SOCKETS_AND_RETURN; } - ofd = socket (ofamily, sotype, 0); + ofd = (int)socket (ofamily, sotype, 0); if (ofd == SOCKET_ERROR) { CLOSE_SOCKETS_AND_RETURN; } @@ -1001,10 +974,10 @@ NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout) } int NET_Socket (int domain, int type, int protocol) { - int sock; + SOCKET sock; sock = socket (domain, type, protocol); if (sock != INVALID_SOCKET) { SetHandleInformation((HANDLE)(uintptr_t)sock, HANDLE_FLAG_INHERIT, FALSE); } - return sock; + return (int)sock; } diff --git a/jdk/src/windows/native/java/net/net_util_md.h b/jdk/src/windows/native/java/net/net_util_md.h index b1a37e9b826..e764260bb24 100644 --- a/jdk/src/windows/native/java/net/net_util_md.h +++ b/jdk/src/windows/native/java/net/net_util_md.h @@ -209,10 +209,6 @@ int ); #endif -LPFN_GETADDRINFO getaddrinfo_ptr; -LPFN_FREEADDRINFO freeaddrinfo_ptr; -LPFN_GETNAMEINFO getnameinfo_ptr; - /* used to disable connection reset messages on Windows XP */ #ifndef SIO_UDP_CONNRESET #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) @@ -302,8 +298,6 @@ void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, void NET_ThrowSocketException(JNIEnv *env, char* msg); -jboolean NET_addrtransAvailable(); - /* * differs from NET_Timeout() as follows: * diff --git a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c index 21a87afa25e..8885bdc7902 100644 --- a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c +++ b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -30,6 +30,7 @@ #include #include #include +#include #include "jni_util.h" @@ -42,93 +43,17 @@ #define IS_SL_FOUND(sts) (sts & STS_SL_FOUND) #define IS_NS_FOUND(sts) (sts & STS_NS_FOUND) -/* - * Visual C++ SP3 (as required by J2SE 1.4.0) is missing some of - * the definitions required for the IP helper library routines that - * were added in Windows 98 & Windows 2000. - */ -#ifndef MAX_ADAPTER_NAME_LENGTH - -#define MAX_ADAPTER_ADDRESS_LENGTH 8 -#define MAX_ADAPTER_DESCRIPTION_LENGTH 128 -#define MAX_ADAPTER_NAME_LENGTH 256 -#define MAX_HOSTNAME_LEN 128 -#define MAX_DOMAIN_NAME_LEN 128 -#define MAX_SCOPE_ID_LEN 256 - -typedef struct { - char String[4 * 4]; -} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING; - -typedef struct _IP_ADDR_STRING { - struct _IP_ADDR_STRING* Next; - IP_ADDRESS_STRING IpAddress; - IP_MASK_STRING IpMask; - DWORD Context; -} IP_ADDR_STRING, *PIP_ADDR_STRING; - -typedef struct _IP_ADAPTER_INFO { - struct _IP_ADAPTER_INFO* Next; - DWORD ComboIndex; - char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; - char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; - UINT AddressLength; - BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]; - DWORD Index; - UINT Type; - UINT DhcpEnabled; - PIP_ADDR_STRING CurrentIpAddress; - IP_ADDR_STRING IpAddressList; - IP_ADDR_STRING GatewayList; - IP_ADDR_STRING DhcpServer; - BOOL HaveWins; - IP_ADDR_STRING PrimaryWinsServer; - IP_ADDR_STRING SecondaryWinsServer; - time_t LeaseObtained; - time_t LeaseExpires; -} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO; - -typedef struct _FIXED_INFO { - char HostName[MAX_HOSTNAME_LEN + 4] ; - char DomainName[MAX_DOMAIN_NAME_LEN + 4]; - PIP_ADDR_STRING CurrentDnsServer; - IP_ADDR_STRING DnsServerList; - UINT NodeType; - char ScopeId[MAX_SCOPE_ID_LEN + 4]; - UINT EnableRouting; - UINT EnableProxy; - UINT EnableDns; -} FIXED_INFO, *PFIXED_INFO; - -#endif - - -/* IP helper library routine used on 98/2000/XP */ -static int (PASCAL FAR *GetNetworkParams_fn)(); -static int (PASCAL FAR *GetAdaptersInfo_fn)(); -static int (PASCAL FAR *NotifyAddrChange_fn)(); - -/* - * Routines to obtain domain name and name servers are OS specific - */ -typedef int (*LoadConfig)(char *sl, char *ns); -static LoadConfig loadconfig_fn; - - -/* - * JNI ids - */ +/* JNI ids */ static jfieldID searchlistID; static jfieldID nameserversID; - /* * Utility routine to append s2 to s1 with a space delimiter. * strappend(s1="abc", "def") => "abc def" * strappend(s1="", "def") => "def */ void strappend(char *s1, char *s2) { - int len; + size_t len; if (s2[0] == '\0') /* nothing to append */ return; @@ -145,356 +70,6 @@ void strappend(char *s1, char *s2) { strcat(s1, s2); } - -/* - * Windows 95/98/ME for static TCP/IP configuration. - * - * Use registry approach for statically configured TCP/IP settings. - * Registry entries described in "MS TCP/IP and Windows 95 Networking" - * (Microsoft TechNet site). - */ -static int loadStaticConfig9x(char *sl, char *ns) { - LONG ret; - HANDLE hKey; - DWORD dwLen; - ULONG ulType; - char result[MAX_STR_LEN]; - int sts = STS_NO_CONFIG; - - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", - 0, - KEY_READ, - (PHKEY)&hKey); - if (ret == ERROR_SUCCESS) { - /* - * Determine suffix list - */ - result[0] = '\0'; - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "SearchList", NULL, &ulType, - (LPBYTE)&result, &dwLen); - if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) { - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "Domain", NULL, &ulType, - (LPBYTE)&result, &dwLen); - } - if (ret == ERROR_SUCCESS) { - assert(ulType == REG_SZ); - if (strlen(result) > 0) { - strappend(sl, result); - sts |= STS_SL_FOUND; - } - } - - /* - * Determine DNS name server(s) - */ - result[0] = '\0'; - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "NameServer", NULL, &ulType, - (LPBYTE)&result, &dwLen); - if (ret == ERROR_SUCCESS) { - assert(ulType == REG_SZ); - if (strlen(result) > 0) { - strappend(ns, result); - sts |= STS_NS_FOUND; - } - } - - RegCloseKey(hKey); - } - - return sts; -} - - -/* - * Windows 95 - * - * Use registry approach for statically configured TCP/IP settings - * (see loadStaticConfig9x). - * - * If DHCP is used we examine the DHCP vendor specific extensions. We parse - * this based on format described in RFC 2132. - * - * If Dial-up Networking (DUN) is used then this TCP/IP settings cannot - * be determined here. - */ -static int loadConfig95(char *sl, char *ns) { - int sts; - int index; - LONG ret; - HANDLE hKey; - DWORD dwLen; - ULONG ulType; - char optionInfo[MAX_STR_LEN]; - - /* - * First try static configuration - if found we are done. - */ - sts = loadStaticConfig9x(sl, ns); - if (IS_SL_FOUND(sts) && IS_NS_FOUND(sts)) { - return sts; - } - - /* - * Try DHCP. DHCP information is stored in :- - * SYSTEM\CurrentControlSet\Services\VxD\DHCP\DhcpInfoXX - * - * The key is normally DhcpInfo00\OptionInfo (see Article Q255245 on - * Microsoft site). However when multiple cards are added & removed we - * have observed that it can be located in DhcpInfo{01,02, ...}. - * As a hack we search all DhcpInfoXX keys until we find OptionInfo. - */ - for (index=0; index<99; index++) { - char key[MAX_STR_LEN]; - sprintf(key, "SYSTEM\\CurrentControlSet\\Services\\VxD\\DHCP\\DhcpInfo%02d", - index); - - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey); - if (ret != ERROR_SUCCESS) { - /* end of DhcpInfoXX entries */ - break; - } - - dwLen = sizeof(optionInfo); - ret = RegQueryValueEx(hKey, "OptionInfo", NULL, &ulType, - (LPBYTE)optionInfo, &dwLen); - RegCloseKey(hKey); - - if (ret == ERROR_SUCCESS) { - /* OptionInfo found */ - break; - } - } - - /* - * If OptionInfo was found then we parse (as the 'options' field of - * the DHCP packet - see RFC 2132). - */ - if (ret == ERROR_SUCCESS) { - unsigned int pos = 0; - - while (pos < dwLen) { - int code, len; - - code = optionInfo[pos]; - pos++; - if (pos >= dwLen) break; /* bad packet */ - - len = optionInfo[pos]; - pos++; - - if (pos+len > dwLen) break; /* bad packet */ - - /* - * Domain Name - see RFC 2132 section 3.17 - */ - if (!IS_SL_FOUND(sts)) { - if (code == 0xf) { - char domain[MAX_STR_LEN]; - - assert(len < MAX_STR_LEN); - - memcpy((void *)domain, (void *)&(optionInfo[pos]), (size_t)len); - domain[len] = '\0'; - - strappend(sl, domain); - sts |= STS_SL_FOUND; - } - } - - /* - * DNS Option - see RFC 2132 section 3.8 - */ - if (!IS_NS_FOUND(sts)) { - if (code == 6 && (len % 4) == 0) { - while (len > 0 && pos < dwLen) { - char addr[32]; - sprintf(addr, "%d.%d.%d.%d", - (unsigned char)optionInfo[pos], - (unsigned char)optionInfo[pos+1], - (unsigned char)optionInfo[pos+2], - (unsigned char)optionInfo[pos+3]); - pos += 4; - len -= 4; - - /* - * Append to list of name servers - */ - strappend(ns, addr); - sts |= STS_NS_FOUND; - } - } - } - - /* - * Onto the next options - */ - pos += len; - } - } - - return sts; -} - -/* - * Windows 98/ME - * - * Use registry approach for statically configured TCP/IP settings - * (see loadStaticConfig9x). - * - * If configuration is not static then use IP helper library routine - * GetNetworkParams to obtain the network settings which include the - * domain name and the DNS servers. Note that we use the registry in - * preference to GetNetworkParams as the domain name is not populated - * by GetNetworkParams if the configuration is static. - */ -static int loadConfig98(char *sl, char *ns) { - FIXED_INFO *infoP; - ULONG size; - DWORD ret; - int sts; - - /* - * Use registry approach to pick up static configuation. - */ - sts = loadStaticConfig9x(sl, ns); - if (IS_SL_FOUND(sts) && IS_NS_FOUND(sts)) { - return sts; - } - - /* - * Use IP helper library to obtain dynamic configuration (DHCP and - * DUN). - */ - size = sizeof(FIXED_INFO); - infoP = (FIXED_INFO *)malloc(size); - if (infoP) { - ret = (*GetNetworkParams_fn)(infoP, &size); - if (ret == ERROR_BUFFER_OVERFLOW) { - infoP = (FIXED_INFO *)realloc(infoP, size); - if (infoP != NULL) - ret = (*GetNetworkParams_fn)(infoP, &size); - } - } - if (infoP == NULL) { - return sts; - } - if (ret == ERROR_SUCCESS) { - /* - * Use DomainName if search-list not specified. - */ - if (!IS_SL_FOUND(sts)) { - strappend(sl, infoP->DomainName); - sts |= STS_SL_FOUND; - } - - /* - * Use DnsServerList if not statically configured. - */ - if (!IS_NS_FOUND(sts)) { - PIP_ADDR_STRING dnsP = &(infoP->DnsServerList); - do { - strappend(ns, (char *)&(dnsP->IpAddress)); - dnsP = dnsP->Next; - } while (dnsP != NULL); - sts |= STS_NS_FOUND; - } - } - - free(infoP); - - return sts; -} - - -/* - * Windows NT - * - * Use registry approach based on settings described in "TCP/IP and - * NBT Configuration Parameters for Windows" - Article Q12062 on - * Microsoft site. - * - * All non-RAS TCP/IP settings are stored in HKEY_LOCAL_MACHINE in - * the SYSTEM\CurrentControlSet\Services\Tcpip\Parameters key. - * - * If SearchList if not provided then return Domain or DhcpDomain. - * If Domain is specified it overrides DhcpDomain even if DHCP is - * enabled. - * - * DNS name servers based on NameServer or DhcpNameServer settings. - * NameServer overrides DhcpNameServer even if DHCP is enabled. - */ -static int loadConfigNT(char *sl, char *ns) { - LONG ret; - HANDLE hKey; - DWORD dwLen; - ULONG ulType; - char result[MAX_STR_LEN]; - int sts = STS_NO_CONFIG; - - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - 0, - KEY_READ, - (PHKEY)&hKey); - if (ret != ERROR_SUCCESS) { - return sts; - } - - /* - * Determine search list - */ - result[0] = '\0'; - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "SearchList", NULL, &ulType, - (LPBYTE)&result, &dwLen); - if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) { - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "Domain", NULL, &ulType, - (LPBYTE)&result, &dwLen); - if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) { - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "DhcpDomain", NULL, &ulType, - (LPBYTE)&result, &dwLen); - } - } - if (ret == ERROR_SUCCESS) { - assert(ulType == REG_SZ); - if (strlen(result) > 0) { - strappend(sl, result); - sts |= STS_SL_FOUND; - } - } - - /* - * Determine DNS name server(s) - */ - result[0] = '\0'; - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "NameServer", NULL, &ulType, - (LPBYTE)&result, &dwLen); - if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) { - dwLen = sizeof(result); - ret = RegQueryValueEx(hKey, "DhcpNameServer", NULL, &ulType, - (LPBYTE)&result, &dwLen); - } - if (ret == ERROR_SUCCESS) { - assert(ulType == REG_SZ); - if (strlen(result) > 0) { - strappend(ns, result); - sts |= STS_NS_FOUND; - } - } - - RegCloseKey(hKey); - - return sts; -} - - /* * Windows 2000/XP * @@ -510,7 +85,7 @@ static int loadConfigNT(char *sl, char *ns) { * names of each adapter and then query the corresponding registry * settings to obtain NameServer/DhcpNameServer and Domain/DhcpDomain. */ -static int loadConfig2000(char *sl, char *ns) { +static int loadConfig(char *sl, char *ns) { IP_ADAPTER_INFO *adapterP; ULONG size; DWORD ret; @@ -547,10 +122,10 @@ static int loadConfig2000(char *sl, char *ns) { */ size = sizeof(IP_ADAPTER_INFO); adapterP = (IP_ADAPTER_INFO *)malloc(size); - ret = (*GetAdaptersInfo_fn)(adapterP, &size); + ret = GetAdaptersInfo(adapterP, &size); if (ret == ERROR_BUFFER_OVERFLOW) { adapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size); - ret = (*GetAdaptersInfo_fn)(adapterP, &size); + ret = GetAdaptersInfo(adapterP, &size); } /* @@ -648,87 +223,15 @@ static int loadConfig2000(char *sl, char *ns) { /* - * Initialization :- - * - * 1. Based on OS version set the function pointer for OS specific load - * configuration routine. - * - * 2. On 98/2000/XP load the IP helper library. - * - * 3. Initialize JNI field IDs. - * + * Initialize JNI field IDs. */ JNIEXPORT void JNICALL Java_sun_net_dns_ResolverConfigurationImpl_init0(JNIEnv *env, jclass cls) { - OSVERSIONINFO ver; - jboolean loadHelperLibrary = JNI_TRUE; - - /* - * First we figure out which OS is running - */ - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx(&ver); - - if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - if ((ver.dwMajorVersion == 4) && (ver.dwMinorVersion == 0)) { - /* - * Windows 95 - */ - loadHelperLibrary = JNI_FALSE; - loadconfig_fn = loadConfig95; - } else { - /* - * Windows 98/ME - */ - loadHelperLibrary = JNI_TRUE; - loadconfig_fn = loadConfig98; - } - } - - if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { - if (ver.dwMajorVersion <= 4) { - /* - * Windows NT - */ - loadHelperLibrary = JNI_FALSE; - loadconfig_fn = loadConfigNT; - } else { - /* - * Windows 2000/XP - */ - loadHelperLibrary = JNI_TRUE; - loadconfig_fn = loadConfig2000; - } - } - - /* - * On 98/2000/XP we load the IP Helper Library. - */ - if (loadHelperLibrary) { - HANDLE h = LoadLibrary("iphlpapi.dll"); - - if (h != NULL) { - GetNetworkParams_fn = (int (PASCAL FAR *)())GetProcAddress(h, "GetNetworkParams"); - GetAdaptersInfo_fn = (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersInfo"); - - NotifyAddrChange_fn = (int (PASCAL FAR *)())GetProcAddress(h, "NotifyAddrChange"); - } - - if (GetNetworkParams_fn == NULL || GetAdaptersInfo_fn == NULL) { - JNU_ThrowByName(env, "java/lang/UnsatisfiedLinkError", "iphlpapi.dll"); - return; - } - } - - /* - * Get JNI ids - */ searchlistID = (*env)->GetStaticFieldID(env, cls, "os_searchlist", "Ljava/lang/String;"); nameserversID = (*env)->GetStaticFieldID(env, cls, "os_nameservers", "Ljava/lang/String;"); - } /* @@ -746,8 +249,7 @@ Java_sun_net_dns_ResolverConfigurationImpl_loadDNSconfig0(JNIEnv *env, jclass cl searchlist[0] = '\0'; nameservers[0] = '\0'; - /* call OS specific routine */ - (void)(*loadconfig_fn)(searchlist, nameservers); + loadConfig(searchlist, nameservers); /* * Populate static fields in sun.net.DefaultResolverConfiguration @@ -772,17 +274,15 @@ Java_sun_net_dns_ResolverConfigurationImpl_notifyAddrChange0(JNIEnv *env, jclass HANDLE h; DWORD rc, xfer; - if (NotifyAddrChange_fn != NULL) { - ol.hEvent = (HANDLE)0; - rc = (*NotifyAddrChange_fn)(&h, &ol); - if (rc == ERROR_IO_PENDING) { - rc = GetOverlappedResult(h, &ol, &xfer, TRUE); - if (rc != 0) { - return 0; /* address changed */ - } + ol.hEvent = (HANDLE)0; + rc = NotifyAddrChange(&h, &ol); + if (rc == ERROR_IO_PENDING) { + rc = GetOverlappedResult(h, &ol, &xfer, TRUE); + if (rc != 0) { + return 0; /* address changed */ } } - /* NotifyAddrChange not support or error */ + /* error */ return -1; } diff --git a/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c b/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c index fca399d3206..86af0a877a1 100644 --- a/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c +++ b/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c @@ -41,18 +41,6 @@ #define SECURITY_WIN32 #include "sspi.h" - -/* - * OS calls loaded from DLL on intialization - */ - -static FREE_CREDENTIALS_HANDLE_FN pFreeCredentialsHandle; -static ACQUIRE_CREDENTIALS_HANDLE_FN pAcquireCredentialsHandle; -static FREE_CONTEXT_BUFFER_FN pFreeContextBuffer; -static INITIALIZE_SECURITY_CONTEXT_FN pInitializeSecurityContext; -static COMPLETE_AUTH_TOKEN_FN pCompleteAuthToken; -static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext; - static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle); static jfieldID ntlm_ctxHandleID; @@ -63,48 +51,8 @@ static HINSTANCE lib = NULL; JNIEXPORT void JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_initFirst (JNIEnv *env, jclass clazz) { - OSVERSIONINFO version; - UCHAR libName[MAX_PATH]; - ntlm_ctxHandleID = (*env)->GetFieldID(env, clazz, "ctxHandle", "J"); ntlm_crdHandleID = (*env)->GetFieldID(env, clazz, "crdHandle", "J"); - - version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - GetVersionEx (&version); - - if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { - strcpy (libName, "security.dll" ); - } - else if (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - strcpy (libName, "secur32.dll" ); - } - - lib = LoadLibrary (libName); - - pFreeCredentialsHandle - = (FREE_CREDENTIALS_HANDLE_FN) GetProcAddress( - lib, "FreeCredentialsHandle" ); - - pAcquireCredentialsHandle - = (ACQUIRE_CREDENTIALS_HANDLE_FN) GetProcAddress( - lib, "AcquireCredentialsHandleA" ); - - pFreeContextBuffer - = (FREE_CONTEXT_BUFFER_FN) GetProcAddress( - lib, "FreeContextBuffer" ); - - pInitializeSecurityContext - = (INITIALIZE_SECURITY_CONTEXT_FN) GetProcAddress( - lib, "InitializeSecurityContextA" ); - - pCompleteAuthToken - = (COMPLETE_AUTH_TOKEN_FN) GetProcAddress( - lib, "CompleteAuthToken" ); - - pDeleteSecurityContext - = (DELETE_SECURITY_CONTEXT_FN) GetProcAddress( - lib, "DeleteSecurityContext" ); - } /* @@ -158,17 +106,17 @@ JNIEXPORT jlong JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_get if ( pUser != NULL ) { AuthId.User = (unsigned char *) pUser; - AuthId.UserLength = strlen( pUser ); + AuthId.UserLength = (unsigned long) strlen( pUser ); } if ( pPassword != NULL ) { AuthId.Password = (unsigned char *) pPassword; - AuthId.PasswordLength = strlen( pPassword ); + AuthId.PasswordLength = (unsigned long) strlen( pPassword ); } if ( pDomain != NULL ) { AuthId.Domain = (unsigned char *) pDomain; - AuthId.DomainLength = strlen( pDomain ); + AuthId.DomainLength = (unsigned long) strlen( pDomain ); } AuthId.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI; @@ -176,7 +124,7 @@ JNIEXPORT jlong JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_get pAuthId = NULL; } - ss = pAcquireCredentialsHandle( + ss = AcquireCredentialsHandleA( NULL, "NTLM", SECPKG_CRED_OUTBOUND, NULL, pAuthId, NULL, NULL, pCred, <ime @@ -258,7 +206,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc * need to send the out buffer if there are bytes to send */ - ss = pInitializeSecurityContext( + ss = InitializeSecurityContextA( pCred, pCtx, NULL, 0, 0, SECURITY_NATIVE_DREP, lastToken ? &InBuffDesc : NULL, 0, newContext, &OutBuffDesc, &ContextAttributes, <ime @@ -274,7 +222,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc } if ((ss == SEC_I_COMPLETE_NEEDED) || (ss == SEC_I_COMPLETE_AND_CONTINUE) ) { - ss = pCompleteAuthToken( pCtx, &OutBuffDesc ); + ss = CompleteAuthToken( pCtx, &OutBuffDesc ); if (ss < 0) { endSequence (pCred, pCtx); @@ -300,12 +248,12 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle) { if (credHand != 0) { - pFreeCredentialsHandle (credHand); - free (credHand); + FreeCredentialsHandle(credHand); + free(credHand); } if (ctxHandle != 0) { - pDeleteSecurityContext(ctxHandle); - free (ctxHandle); + DeleteSecurityContext(ctxHandle); + free(ctxHandle); } } From 68002d40984f33fedbc401c0574becfdacf102a5 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 17:52:51 +0100 Subject: [PATCH 050/168] 7027675: /applets/Blink demo needs to be improved Reviewed-by: alexp --- jdk/src/share/demo/applets/Blink/Blink.java | 68 +++++++++++++-------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/jdk/src/share/demo/applets/Blink/Blink.java b/jdk/src/share/demo/applets/Blink/Blink.java index 3495dc9ef0c..ab6f9795cc6 100644 --- a/jdk/src/share/demo/applets/Blink/Blink.java +++ b/jdk/src/share/demo/applets/Blink/Blink.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,92 +29,106 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ /** * I love blinking things. * * @author Arthur van Hoff - * @modified 04/24/96 Jim Hagen use getBackground - * @modified 02/05/98 Mike McCloskey removed use of deprecated methods - * @modified 04/23/99 Josh Bloch, use timer instead of explicit multithreading. - * @modified 07/10/00 Daniel Peek brought to code conventions, minor changes + * @author 04/24/96 Jim Hagen use getBackground + * @author 02/05/98 Mike McCloskey removed use of deprecated methods + * @author 04/23/99 Josh Bloch, use timer instead of explicit multithreading. + * @author 07/10/00 Daniel Peek brought to code conventions, minor changes */ +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.util.StringTokenizer; +import java.util.Timer; +import java.util.TimerTask; -import java.awt.*; -import java.util.*; public class Blink extends java.applet.Applet { + + private static final long serialVersionUID = -775844794477507646L; private Timer timer; // Schedules the blinking private String labelString; // The label for the window private int delay; // the delay time between blinks + @Override public void init() { String blinkFrequency = getParameter("speed"); - delay = (blinkFrequency == null) ? 400 : - (1000 / Integer.parseInt(blinkFrequency)); + delay = (blinkFrequency == null) ? 400 + : (1000 / Integer.parseInt(blinkFrequency)); labelString = getParameter("lbl"); - if (labelString == null) + if (labelString == null) { labelString = "Blink"; + } Font font = new java.awt.Font("Serif", Font.PLAIN, 24); setFont(font); } + @Override public void start() { timer = new Timer(); //creates a new timer to schedule the blinking timer.schedule(new TimerTask() { //creates a timertask to schedule + // overrides the run method to provide functionality + @Override public void run() { repaint(); } - } - , delay, delay); + }, delay, delay); } + @Override public void paint(Graphics g) { int fontSize = g.getFont().getSize(); int x = 0, y = fontSize, space; - int red = (int) ( 50 * Math.random()); - int green = (int) ( 50 * Math.random()); - int blue = (int) (256 * Math.random()); + int red = (int) (50 * Math.random()); + int green = (int) (50 * Math.random()); + int blue = (int) (256 * Math.random()); Dimension d = getSize(); g.setColor(Color.black); FontMetrics fm = g.getFontMetrics(); space = fm.stringWidth(" "); for (StringTokenizer t = new StringTokenizer(labelString); - t.hasMoreTokens();) { + t.hasMoreTokens();) { String word = t.nextToken(); int w = fm.stringWidth(word) + space; if (x + w > d.width) { x = 0; y += fontSize; //move word to next line if it doesn't fit } - if (Math.random() < 0.5) - g.setColor(new java.awt.Color((red + y*30) % 256, - (green + x/3) % 256, blue)); - else + if (Math.random() < 0.5) { + g.setColor(new java.awt.Color((red + y * 30) % 256, + (green + x / 3) % 256, blue)); + } else { g.setColor(getBackground()); + } g.drawString(word, x, y); x += w; //shift to the right to draw the next word } } + @Override public void stop() { timer.cancel(); //stops the timer } + @Override public String getAppletInfo() { return "Title: Blinker\n" - + "Author: Arthur van Hoff\n" - + "Displays multicolored blinking text."; + + "Author: Arthur van Hoff\n" + + "Displays multicolored blinking text."; } + @Override public String[][] getParameterInfo() { String pinfo[][] = { - {"speed", "string", "The blink frequency"}, - {"lbl", "string", "The text to blink."}, - }; + { "speed", "string", "The blink frequency" }, + { "lbl", "string", "The text to blink." }, }; return pinfo; } } From 359dffbbeb89c8059484e1a07d5213b489360415 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 17:55:34 +0100 Subject: [PATCH 051/168] 7027683: /applets/GraphicsTest demo needs to be improved Reviewed-by: alexp --- .../applets/GraphicsTest/AppletFrame.java | 99 ++-- .../applets/GraphicsTest/GraphicsTest.java | 541 +++++++++--------- 2 files changed, 308 insertions(+), 332 deletions(-) diff --git a/jdk/src/share/demo/applets/GraphicsTest/AppletFrame.java b/jdk/src/share/demo/applets/GraphicsTest/AppletFrame.java index a4970b1f1f8..bf61a181a78 100644 --- a/jdk/src/share/demo/applets/GraphicsTest/AppletFrame.java +++ b/jdk/src/share/demo/applets/GraphicsTest/AppletFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.awt.Frame; import java.awt.Event; @@ -38,66 +36,67 @@ import java.awt.Dimension; import java.applet.Applet; import java.awt.AWTEvent; -// Applet to Application Frame window -class AppletFrame extends Frame -{ + +/** + * Applet to Application Frame window + */ +@SuppressWarnings("serial") +class AppletFrame extends Frame { public static void startApplet(String className, - String title, - String args[]) - { - // local variables - Applet a; - Dimension appletSize; + String title, + String args[]) { + // local variables + Applet a; + Dimension appletSize; - try - { - // create an instance of your applet class - a = (Applet) Class.forName(className).newInstance(); - } - catch (ClassNotFoundException e) { return; } - catch (InstantiationException e) { return; } - catch (IllegalAccessException e) { return; } + try { + // create an instance of your applet class + a = (Applet) Class.forName(className).newInstance(); + } catch (ClassNotFoundException e) { + return; + } catch (InstantiationException e) { + return; + } catch (IllegalAccessException e) { + return; + } - // initialize the applet - a.init(); - a.start(); + // initialize the applet + a.init(); + a.start(); - // create new application frame window - AppletFrame f = new AppletFrame(title); + // create new application frame window + AppletFrame f = new AppletFrame(title); - // add applet to frame window - f.add("Center", a); + // add applet to frame window + f.add("Center", a); - // resize frame window to fit applet - // assumes that the applet sets its own size - // otherwise, you should set a specific size here. - appletSize = a.getSize(); - f.pack(); - f.setSize(appletSize); + // resize frame window to fit applet + // assumes that the applet sets its own size + // otherwise, you should set a specific size here. + appletSize = a.getSize(); + f.pack(); + f.setSize(appletSize); - // show the window - f.show(); + // show the window + f.setVisible(true); } // end startApplet() - // constructor needed to pass window title to class Frame - public AppletFrame(String name) - { - // call java.awt.Frame(String) constructor - super(name); + public AppletFrame(String name) { + // call java.awt.Frame(String) constructor + super(name); } // needed to allow window close - public void processEvent(AWTEvent e) - { - // Window Destroy event - if (e.getID() == Event.WINDOW_DESTROY) - { - // exit the program - System.exit(0); - } - } // end handleEvent() - + @Override + public void processEvent(AWTEvent e) { + // Window Destroy event + if (e.getID() == Event.WINDOW_DESTROY) { + // exit the program + System.exit(0); + } + } // end handleEvent() } // end class AppletFrame + diff --git a/jdk/src/share/demo/applets/GraphicsTest/GraphicsTest.java b/jdk/src/share/demo/applets/GraphicsTest/GraphicsTest.java index e34c9e8c4e4..821b119e50a 100644 --- a/jdk/src/share/demo/applets/GraphicsTest/GraphicsTest.java +++ b/jdk/src/share/demo/applets/GraphicsTest/GraphicsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,22 +29,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.awt.*; import java.util.*; import java.awt.event.*; import java.applet.Applet; + +@SuppressWarnings("serial") class GraphicsPanel extends Panel { + ActionListener al; ItemListener il; public GraphicsCards cards; - GraphicsPanel(EventListener listener) { - al = (ActionListener)listener; - il = (ItemListener)listener; + GraphicsPanel(EventListener listener) { + al = (ActionListener) listener; + il = (ItemListener) listener; setLayout(new BorderLayout()); @@ -78,62 +79,75 @@ class GraphicsPanel extends Panel { setSize(400, 400); } + @Override public Dimension getPreferredSize() { return new Dimension(200, 100); } } + +@SuppressWarnings("serial") public class GraphicsTest extends Applet -implements ActionListener, ItemListener { + implements ActionListener, ItemListener { + GraphicsPanel mainPanel; + @Override public void init() { setLayout(new BorderLayout()); add("Center", mainPanel = new GraphicsPanel(this)); } + @Override public void destroy() { remove(mainPanel); } + @Override public void actionPerformed(ActionEvent e) { String arg = e.getActionCommand(); if ("next".equals(arg)) { - ((CardLayout)mainPanel.cards.getLayout()).next(mainPanel.cards); - } - else if ("previous".equals(arg)) { - ((CardLayout)mainPanel.cards.getLayout()).previous(mainPanel.cards); + ((CardLayout) mainPanel.cards.getLayout()).next(mainPanel.cards); + } else if ("previous".equals(arg)) { + ((CardLayout) mainPanel.cards.getLayout()).previous(mainPanel.cards); } } + @Override public void itemStateChanged(ItemEvent e) { - ((CardLayout)mainPanel.cards.getLayout()).show(mainPanel.cards,(String)e.getItem()); + ((CardLayout) mainPanel.cards.getLayout()).show(mainPanel.cards, + (String) e.getItem()); } public static void main(String args[]) { AppletFrame.startApplet("GraphicsTest", "Graphics Test", args); } + @Override public String getAppletInfo() { return "An interactive demonstration of some graphics."; } } // end class GraphicsTest +@SuppressWarnings("serial") class GraphicsCards extends Panel { + public GraphicsCards() { setLayout(new CardLayout()); add("Arc", new ArcCard()); - add("Oval", new ShapeTest( new OvalShape() ) ); - add("Polygon", new ShapeTest( new PolygonShape() ) ); - add("Rect", new ShapeTest( new RectShape() ) ); - add("RoundRect", new ShapeTest( new RoundRectShape() ) ); + add("Oval", new ShapeTest(new OvalShape())); + add("Polygon", new ShapeTest(new PolygonShape())); + add("Rect", new ShapeTest(new RectShape())); + add("RoundRect", new ShapeTest(new RoundRectShape())); } } // end class GraphicsCards +@SuppressWarnings("serial") class ArcCard extends Panel { + public ArcCard() { setLayout(new GridLayout(0, 2)); add(new ArcPanel(true)); @@ -144,7 +158,9 @@ class ArcCard extends Panel { } // end class ArcCard +@SuppressWarnings("serial") class ArcDegreePanel extends Panel { + boolean filled; public ArcDegreePanel(boolean filled) { @@ -152,290 +168,262 @@ class ArcDegreePanel extends Panel { } void arcSteps(Graphics g, - int step, - int x, - int y, - int w, - int h, - Color c1, - Color c2) { - int a1 = 0; - int a2 = step; - int progress = 0; - g.setColor(c1); - for (; (a1+a2) <= 360; a1 = a1+a2, a2 += 1) { - if (g.getColor() == c1) { - g.setColor(c2); - } - else { - g.setColor(c1); - } + int step, + int x, + int y, + int w, + int h, + Color c1, + Color c2) { + int a1 = 0; + int a2 = step; + int progress = 0; + g.setColor(c1); + for (; (a1 + a2) <= 360; a1 = a1 + a2, a2 += 1) { + if (g.getColor() == c1) { + g.setColor(c2); + } else { + g.setColor(c1); + } - if (filled) { - g.fillArc(x, y, w, h, a1, a2); - } - else { - g.drawArc(x, y, w, h, a1, a2); - } + if (filled) { + g.fillArc(x, y, w, h, a1, a2); + } else { + g.drawArc(x, y, w, h, a1, a2); + } - progress = a1+a2; - } // end for + progress = a1 + a2; + } // end for - if (progress != 360) { - if (filled) { - g.fillArc(x, y, w, h, a1, 360 - progress); - } - else { - g.drawArc(x, y, w, h, a1, 360 - progress); - } - } // end if - } // end arcSteps() + if (progress != 360) { + if (filled) { + g.fillArc(x, y, w, h, a1, 360 - progress); + } else { + g.drawArc(x, y, w, h, a1, 360 - progress); + } + } // end if + } // end arcSteps() + @Override public void paint(Graphics g) { Rectangle r = getBounds(); arcSteps(g, 3, 0, 0, r.width, r.height, Color.orange, Color.blue); arcSteps(g, - 2, - r.width / 4, - r.height / 4, - r.width / 2, - r.height / 2, - Color.yellow, - Color.green); + 2, + r.width / 4, + r.height / 4, + r.width / 2, + r.height / 2, + Color.yellow, + Color.green); arcSteps(g, - 1, - (r.width * 3) / 8, - (r.height * 3) / 8, - r.width / 4, - r.height / 4, - Color.magenta, - Color.white); + 1, + (r.width * 3) / 8, + (r.height * 3) / 8, + r.width / 4, + r.height / 4, + Color.magenta, + Color.white); - } // end paint() + } // end paint() } // end class ArcDegreePanel +@SuppressWarnings("serial") class ArcPanel extends Panel { + boolean filled; public ArcPanel(boolean filled) { - this.filled = filled; - } + this.filled = filled; + } - public void paint(Graphics g) - { - Rectangle r = getBounds(); + @Override + public void paint(Graphics g) { + Rectangle r = getBounds(); - g.setColor(Color.yellow); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, 0, 45); - } - else - { - g.drawArc(0, 0, r.width, r.height, 0, 45); - } + g.setColor(Color.yellow); + if (filled) { + g.fillArc(0, 0, r.width, r.height, 0, 45); + } else { + g.drawArc(0, 0, r.width, r.height, 0, 45); + } - g.setColor(Color.green); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, 90, -45); - } - else - { - g.drawArc(0, 0, r.width, r.height, 90, -45); - } + g.setColor(Color.green); + if (filled) { + g.fillArc(0, 0, r.width, r.height, 90, -45); + } else { + g.drawArc(0, 0, r.width, r.height, 90, -45); + } - g.setColor(Color.orange); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, 135, -45); - } - else - { - g.drawArc(0, 0, r.width, r.height, 135, -45); - } + g.setColor(Color.orange); + if (filled) { + g.fillArc(0, 0, r.width, r.height, 135, -45); + } else { + g.drawArc(0, 0, r.width, r.height, 135, -45); + } - g.setColor(Color.magenta); + g.setColor(Color.magenta); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, -225, 45); - } - else - { - g.drawArc(0, 0, r.width, r.height, -225, 45); - } + if (filled) { + g.fillArc(0, 0, r.width, r.height, -225, 45); + } else { + g.drawArc(0, 0, r.width, r.height, -225, 45); + } - g.setColor(Color.yellow); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, 225, -45); - } - else - { - g.drawArc(0, 0, r.width, r.height, 225, -45); - } + g.setColor(Color.yellow); + if (filled) { + g.fillArc(0, 0, r.width, r.height, 225, -45); + } else { + g.drawArc(0, 0, r.width, r.height, 225, -45); + } - g.setColor(Color.green); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, -135, 45); - } - else - { - g.drawArc(0, 0, r.width, r.height, -135, 45); - } + g.setColor(Color.green); + if (filled) { + g.fillArc(0, 0, r.width, r.height, -135, 45); + } else { + g.drawArc(0, 0, r.width, r.height, -135, 45); + } - g.setColor(Color.orange); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, -45, -45); - } - else - { - g.drawArc(0, 0, r.width, r.height, -45, -45); - } + g.setColor(Color.orange); + if (filled) { + g.fillArc(0, 0, r.width, r.height, -45, -45); + } else { + g.drawArc(0, 0, r.width, r.height, -45, -45); + } - g.setColor(Color.magenta); - if (filled) - { - g.fillArc(0, 0, r.width, r.height, 315, 45); - } - else - { - g.drawArc(0, 0, r.width, r.height, 315, 45); - } - - } // end paint() + g.setColor(Color.magenta); + if (filled) { + g.fillArc(0, 0, r.width, r.height, 315, 45); + } else { + g.drawArc(0, 0, r.width, r.height, 315, 45); + } + } // end paint() } // end class ArcPanel -abstract class Shape -{ - abstract void draw(Graphics g, int x, int y, int w, int h); - abstract void fill(Graphics g, int x, int y, int w, int h); +abstract class Shape { + + abstract void draw(Graphics g, int x, int y, int w, int h); + + abstract void fill(Graphics g, int x, int y, int w, int h); } -class RectShape extends Shape -{ - void draw(Graphics g, int x, int y, int w, int h) - { - g.drawRect(x, y, w, h); - } +class RectShape extends Shape { - void fill(Graphics g, int x, int y, int w, int h) - { - g.fillRect(x, y, w, h); - } -} - - -class OvalShape extends Shape -{ - void draw(Graphics g, int x, int y, int w, int h) - { - g.drawOval(x, y, w, h); - } - - void fill(Graphics g, int x, int y, int w, int h) - { - g.fillOval(x, y, w, h); - } -} - - -class RoundRectShape extends Shape -{ - void draw(Graphics g, int x, int y, int w, int h) - { - g.drawRoundRect(x, y, w, h, 10, 10); - } - - void fill(Graphics g, int x, int y, int w, int h) - { - g.fillRoundRect(x, y, w, h, 10, 10); - } -} - -class PolygonShape extends Shape -{ - // class variables - Polygon p; - Polygon pBase; - - public PolygonShape() - { - pBase = new Polygon(); - pBase.addPoint(0, 0); - pBase.addPoint(10, 0); - pBase.addPoint(5, 15); - pBase.addPoint(10, 20); - pBase.addPoint(5, 20); - pBase.addPoint(0, 10); - pBase.addPoint(0, 0); - } - - void scalePolygon(float w, float h) - { - p = new Polygon(); - for (int i = 0; i < pBase.npoints; ++i) - { - p.addPoint( (int) (pBase.xpoints[i] * w), - (int) (pBase.ypoints[i] * h) ); - } - - } - - void draw(Graphics g, int x, int y, int w, int h) - { - Graphics ng = g.create(); - try { - ng.translate(x, y); - scalePolygon( (float) ( (float) w / (float) 10 ), - (float) ( (float) h / (float) 20 ) ); - ng.drawPolygon(p); - } finally { - ng.dispose(); + @Override + void draw(Graphics g, int x, int y, int w, int h) { + g.drawRect(x, y, w, h); } - } - void fill(Graphics g, int x, int y, int w, int h) - { - Graphics ng = g.create(); - try { - ng.translate(x, y); - scalePolygon( (float) ( (float) w / (float) 10 ), - (float) ( (float) h / (float) 20 ) ); - ng.fillPolygon(p); - } finally { - ng.dispose(); + @Override + void fill(Graphics g, int x, int y, int w, int h) { + g.fillRect(x, y, w, h); } - } } -class ShapeTest extends Panel -{ - Shape shape; - int step; +class OvalShape extends Shape { - public ShapeTest(Shape shape, int step) - { - this.shape = shape; - this.step = step; - } + @Override + void draw(Graphics g, int x, int y, int w, int h) { + g.drawOval(x, y, w, h); + } - public ShapeTest(Shape shape) - { - this(shape, 10); - } + @Override + void fill(Graphics g, int x, int y, int w, int h) { + g.fillOval(x, y, w, h); + } +} + +class RoundRectShape extends Shape { + + @Override + void draw(Graphics g, int x, int y, int w, int h) { + g.drawRoundRect(x, y, w, h, 10, 10); + } + + @Override + void fill(Graphics g, int x, int y, int w, int h) { + g.fillRoundRect(x, y, w, h, 10, 10); + } +} + + +class PolygonShape extends Shape { + // class variables + + Polygon p; + Polygon pBase; + + public PolygonShape() { + pBase = new Polygon(); + pBase.addPoint(0, 0); + pBase.addPoint(10, 0); + pBase.addPoint(5, 15); + pBase.addPoint(10, 20); + pBase.addPoint(5, 20); + pBase.addPoint(0, 10); + pBase.addPoint(0, 0); + } + + void scalePolygon(float w, float h) { + p = new Polygon(); + for (int i = 0; i < pBase.npoints; ++i) { + p.addPoint((int) (pBase.xpoints[i] * w), + (int) (pBase.ypoints[i] * h)); + } + + } + + @Override + void draw(Graphics g, int x, int y, int w, int h) { + Graphics ng = g.create(); + try { + ng.translate(x, y); + scalePolygon(((float) w / 10f), ((float) h / 20f)); + ng.drawPolygon(p); + } finally { + ng.dispose(); + } + } + + @Override + void fill(Graphics g, int x, int y, int w, int h) { + Graphics ng = g.create(); + try { + ng.translate(x, y); + scalePolygon(((float) w / 10f), ((float) h / 20f)); + ng.fillPolygon(p); + } finally { + ng.dispose(); + } + } +} + + +@SuppressWarnings("serial") +class ShapeTest extends Panel { + + Shape shape; + int step; + + public ShapeTest(Shape shape, int step) { + this.shape = shape; + this.step = step; + } + + public ShapeTest(Shape shape) { + this(shape, 10); + } + + @Override public void paint(Graphics g) { Rectangle bounds = getBounds(); @@ -443,35 +431,22 @@ class ShapeTest extends Panel Color color; - for (color=Color.red, - cx=bounds.x, - cy=bounds.y, - cw=bounds.width / 2, - ch=bounds.height; - cw > 0 && ch > 0; - - cx+=step, - cy += step, - cw -= (step * 2), - ch -= (step * 2), - color=ColorUtils.darker(color, 0.9) ) { + for (color = Color.red, cx = bounds.x, cy = bounds.y, + cw = bounds.width / 2, ch = bounds.height; + cw > 0 && ch > 0; + cx += step, cy += step, cw -= (step * 2), ch -= (step * 2), + color = ColorUtils.darker(color, 0.9)) { g.setColor(color); shape.draw(g, cx, cy, cw, ch); } - for (cx=bounds.x + bounds.width / 2, - cy=bounds.y, - cw=bounds.width / 2, ch=bounds.height; - cw > 0 && ch > 0; - - cx+=step, - cy += step, - cw -= (step * 2), - ch -= (step * 2) ) { + for (cx = bounds.x + bounds.width / 2, cy = bounds.y, + cw = bounds.width / 2, ch = bounds.height; + cw > 0 && ch > 0; + cx += step, cy += step, cw -= (step * 2), ch -= (step * 2)) { if (g.getColor() == Color.red) { g.setColor(Color.blue); - } - else { + } else { g.setColor(Color.red); } @@ -480,16 +455,18 @@ class ShapeTest extends Panel } // end paint() } // end class ShapeTest + class ColorUtils { + static Color brighter(Color c, double factor) { - return new Color( Math.min((int)(c.getRed() *(1/factor)), 255), - Math.min((int)(c.getGreen()*(1/factor)), 255), - Math.min((int)(c.getBlue() *(1/factor)), 255) ); + return new Color(Math.min((int) (c.getRed() * (1 / factor)), 255), + Math.min((int) (c.getGreen() * (1 / factor)), 255), + Math.min((int) (c.getBlue() * (1 / factor)), 255)); } static Color darker(Color c, double factor) { - return new Color( Math.max((int)(c.getRed() *factor), 0), - Math.max((int)(c.getGreen()*factor), 0), - Math.max((int)(c.getBlue() *factor), 0) ); + return new Color(Math.max((int) (c.getRed() * factor), 0), + Math.max((int) (c.getGreen() * factor), 0), + Math.max((int) (c.getBlue() * factor), 0)); } } From e41a51b3b800ba484777e023d8ad329fa458f765 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 17:56:52 +0100 Subject: [PATCH 052/168] 7027686: /applets/MoleculeViewer demo needs to be improved Reviewed-by: alexp --- .../demo/applets/MoleculeViewer/Matrix3D.java | 28 +- .../demo/applets/MoleculeViewer/XYZApp.java | 435 ++++++++++-------- .../demo/applets/MoleculeViewer/example1.html | 2 +- .../demo/applets/MoleculeViewer/example2.html | 2 +- .../demo/applets/MoleculeViewer/example3.html | 8 +- 5 files changed, 266 insertions(+), 209 deletions(-) diff --git a/jdk/src/share/demo/applets/MoleculeViewer/Matrix3D.java b/jdk/src/share/demo/applets/MoleculeViewer/Matrix3D.java index bc5939d54bd..0dda042c3c9 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/Matrix3D.java +++ b/jdk/src/share/demo/applets/MoleculeViewer/Matrix3D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,22 +29,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ /** A fairly conventional 3D matrix object that can transform sets of - 3D points and perform a variety of manipulations on the transform */ +3D points and perform a variety of manipulations on the transform */ class Matrix3D { + float xx, xy, xz, xo; float yx, yy, yz, yo; float zx, zy, zz, zo; static final double pi = 3.14159265; + /** Create a new unit matrix */ - Matrix3D () { + Matrix3D() { xx = 1.0f; yy = 1.0f; zz = 1.0f; } + /** Scale by f in all dimensions */ void scale(float f) { xx *= f; @@ -60,6 +61,7 @@ class Matrix3D { zz *= f; zo *= f; } + /** Scale along each axis independently */ void scale(float xf, float yf, float zf) { xx *= xf; @@ -75,12 +77,14 @@ class Matrix3D { zz *= zf; zo *= zf; } + /** Translate the origin */ void translate(float x, float y, float z) { xo += x; yo += y; zo += z; } + /** rotate theta degrees about the y axis */ void yrot(double theta) { theta *= (pi / 180); @@ -106,6 +110,7 @@ class Matrix3D { zy = Nzy; zz = Nzz; } + /** rotate theta degrees about the x axis */ void xrot(double theta) { theta *= (pi / 180); @@ -131,6 +136,7 @@ class Matrix3D { zy = Nzy; zz = Nzz; } + /** rotate theta degrees about the z axis */ void zrot(double theta) { theta *= (pi / 180); @@ -156,6 +162,7 @@ class Matrix3D { xy = Nxy; xz = Nxz; } + /** Multiply this matrix by a second: M = M*R */ void mult(Matrix3D rhs) { float lxx = xx * rhs.xx + yx * rhs.xy + zx * rhs.xz; @@ -204,10 +211,11 @@ class Matrix3D { zy = 0; zz = 1; } + /** Transform nvert points from v into tv. v contains the input - coordinates in floating point. Three successive entries in - the array constitute a point. tv ends up holding the transformed - points as integers; three successive entries per point */ + coordinates in floating point. Three successive entries in + the array constitute a point. tv ends up holding the transformed + points as integers; three successive entries per point */ void transform(float v[], int tv[], int nvert) { float lxx = xx, lxy = xy, lxz = xz, lxo = xo; float lyx = yx, lyy = yy, lyz = yz, lyo = yo; @@ -216,11 +224,13 @@ class Matrix3D { float x = v[i]; float y = v[i + 1]; float z = v[i + 2]; - tv[i ] = (int) (x * lxx + y * lxy + z * lxz + lxo); + tv[i] = (int) (x * lxx + y * lxy + z * lxz + lxo); tv[i + 1] = (int) (x * lyx + y * lyy + z * lyz + lyo); tv[i + 2] = (int) (x * lzx + y * lzy + z * lzz + lzo); } } + + @Override public String toString() { return ("[" + xo + "," + xx + "," + xy + "," + xz + ";" + yo + "," + yx + "," + yy + "," + yz + ";" diff --git a/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java b/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java index 719e6f55ef5..78717bef21f 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java +++ b/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,37 +29,43 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ + +import java.applet.Applet; +import java.awt.Image; +import java.awt.Graphics; +import java.awt.Dimension; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.net.URL; +import java.awt.image.IndexColorModel; +import java.awt.image.MemoryImageSource; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StreamTokenizer; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + /* * A set of classes to parse, represent and display Chemical compounds in * .xyz format (see http://chem.leeds.ac.uk/Project/MIME.html) */ - -import java.applet.Applet; -import java.awt.Image; -import java.awt.Event; -import java.awt.Graphics; -import java.awt.Dimension; -import java.io.*; -import java.net.URL; -import java.util.Hashtable; -import java.awt.image.IndexColorModel; -import java.awt.image.ColorModel; -import java.awt.image.MemoryImageSource; -import java.awt.event.*; - /** The representation of a Chemical .xyz model */ -class XYZChemModel { +final class XYZChemModel { + float vert[]; Atom atoms[]; int tvert[]; int ZsortMap[]; int nvert, maxvert; - - static Hashtable atomTable = new Hashtable(); + static final Map atomTable = new HashMap(); static Atom defaultAtom; + static { atomTable.put("c", new Atom(0, 0, 0)); atomTable.put("h", new Atom(210, 210, 210)); @@ -70,77 +76,72 @@ class XYZChemModel { atomTable.put("hn", new Atom(150, 255, 150)); /* !!*/ defaultAtom = new Atom(255, 100, 200); } - boolean transformed; Matrix3D mat; - float xmin, xmax, ymin, ymax, zmin, zmax; - - XYZChemModel () { + XYZChemModel() { mat = new Matrix3D(); mat.xrot(20); mat.yrot(30); } + /** Create a Chemical model by parsing an input stream */ + XYZChemModel(InputStream is) throws Exception { + this(); + StreamTokenizer st = new StreamTokenizer( + new BufferedReader(new InputStreamReader(is, "UTF-8"))); + st.eolIsSignificant(true); + st.commentChar('#'); - /** Create a Cehmical model by parsing an input stream */ - XYZChemModel (InputStream is) throws Exception - { - this(); - StreamTokenizer st = new StreamTokenizer( - new BufferedReader(new InputStreamReader(is, "UTF-8"))); - st.eolIsSignificant(true); - st.commentChar('#'); - int slot = 0; + try { + scan: + while (true) { + switch (st.nextToken()) { + case StreamTokenizer.TT_EOF: + break scan; + default: + break; + case StreamTokenizer.TT_WORD: + String name = st.sval; + double x = 0, + y = 0, + z = 0; + if (st.nextToken() == StreamTokenizer.TT_NUMBER) { + x = st.nval; + if (st.nextToken() == StreamTokenizer.TT_NUMBER) { + y = st.nval; + if (st.nextToken() == StreamTokenizer.TT_NUMBER) { + z = st.nval; + } + } + } + addVert(name, (float) x, (float) y, (float) z); + while (st.ttype != StreamTokenizer.TT_EOL + && st.ttype != StreamTokenizer.TT_EOF) { + st.nextToken(); + } - try - { -scan: - while (true) - { - switch ( st.nextToken() ) - { - case StreamTokenizer.TT_EOF: - break scan; - default: - break; - case StreamTokenizer.TT_WORD: - String name = st.sval; - double x = 0, y = 0, z = 0; - if (st.nextToken() == StreamTokenizer.TT_NUMBER) - { - x = st.nval; - if (st.nextToken() == StreamTokenizer.TT_NUMBER) - { - y = st.nval; - if (st.nextToken() == StreamTokenizer.TT_NUMBER) - z = st.nval; - } - } - addVert(name, (float) x, (float) y, (float) z); - while( st.ttype != StreamTokenizer.TT_EOL && - st.ttype != StreamTokenizer.TT_EOF ) - st.nextToken(); + } // end Switch - } // end Switch + } // end while - } // end while + is.close(); - is.close(); + } // end Try + catch (IOException e) { + } - } // end Try - catch( IOException e) {} - - if (st.ttype != StreamTokenizer.TT_EOF) - throw new Exception(st.toString()); + if (st.ttype != StreamTokenizer.TT_EOF) { + throw new Exception(st.toString()); + } } // end XYZChemModel() /** Add a vertex to this model */ int addVert(String name, float x, float y, float z) { int i = nvert; - if (i >= maxvert) + if (i >= maxvert) { if (vert == null) { maxvert = 100; vert = new float[maxvert * 3]; @@ -154,8 +155,11 @@ scan: System.arraycopy(atoms, 0, na, 0, atoms.length); atoms = na; } - Atom a = (Atom) atomTable.get(name.toLowerCase()); - if (a == null) a = defaultAtom; + } + Atom a = atomTable.get(name.toLowerCase()); + if (a == null) { + a = defaultAtom; + } atoms[i] = a; i *= 3; vert[i] = x; @@ -166,29 +170,32 @@ scan: /** Transform all the points in this model */ void transform() { - if (transformed || nvert <= 0) + if (transformed || nvert <= 0) { return; - if (tvert == null || tvert.length < nvert * 3) + } + if (tvert == null || tvert.length < nvert * 3) { tvert = new int[nvert * 3]; + } mat.transform(vert, tvert, nvert); transformed = true; } - /** Paint this model to a graphics context. It uses the matrix associated - with this model to map from model space to screen space. - The next version of the browser should have double buffering, - which will make this *much* nicer */ + with this model to map from model space to screen space. + The next version of the browser should have double buffering, + which will make this *much* nicer */ void paint(Graphics g) { - if (vert == null || nvert <= 0) + if (vert == null || nvert <= 0) { return; + } transform(); int v[] = tvert; int zs[] = ZsortMap; if (zs == null) { ZsortMap = zs = new int[nvert]; - for (int i = nvert; --i >= 0;) + for (int i = nvert; --i >= 0;) { zs[i] = i * 3; + } } /* @@ -209,24 +216,26 @@ scan: flipped = true; } } - if (!flipped) + if (!flipped) { break; + } } - int lg = 0; int lim = nvert; - Atom ls[] = atoms; - if (lim <= 0 || nvert <= 0) + if (lim <= 0 || nvert <= 0) { return; + } for (int i = 0; i < lim; i++) { int j = zs[i]; int grey = v[j + 2]; - if (grey < 0) + if (grey < 0) { grey = 0; - if (grey > 15) + } + if (grey > 15) { grey = 15; + } // g.drawString(names[i], v[j], v[j+1]); - atoms[j/3].paint(g, v[j], v[j + 1], grey); + atoms[j / 3].paint(g, v[j], v[j + 1], grey); // g.drawImage(iBall, v[j] - (iBall.width >> 1), v[j + 1] - // (iBall.height >> 1)); } @@ -234,47 +243,55 @@ scan: /** Find the bounding box of this model */ void findBB() { - if (nvert <= 0) + if (nvert <= 0) { return; + } float v[] = vert; - float xmin = v[0], xmax = xmin; - float ymin = v[1], ymax = ymin; - float zmin = v[2], zmax = zmin; + float _xmin = v[0], _xmax = _xmin; + float _ymin = v[1], _ymax = _ymin; + float _zmin = v[2], _zmax = _zmin; for (int i = nvert * 3; (i -= 3) > 0;) { float x = v[i]; - if (x < xmin) - xmin = x; - if (x > xmax) - xmax = x; + if (x < _xmin) { + _xmin = x; + } + if (x > _xmax) { + _xmax = x; + } float y = v[i + 1]; - if (y < ymin) - ymin = y; - if (y > ymax) - ymax = y; + if (y < _ymin) { + _ymin = y; + } + if (y > _ymax) { + _ymax = y; + } float z = v[i + 2]; - if (z < zmin) - zmin = z; - if (z > zmax) - zmax = z; + if (z < _zmin) { + _zmin = z; + } + if (z > _zmax) { + _zmax = z; + } } - this.xmax = xmax; - this.xmin = xmin; - this.ymax = ymax; - this.ymin = ymin; - this.zmax = zmax; - this.zmin = zmin; + this.xmax = _xmax; + this.xmin = _xmin; + this.ymax = _ymax; + this.ymin = _ymin; + this.zmax = _zmax; + this.zmin = _zmin; } } + /** An applet to put a Chemical model into a page */ -public class XYZApp - extends Applet - implements Runnable, MouseListener, MouseMotionListener { +@SuppressWarnings("serial") +public class XYZApp extends Applet implements Runnable, MouseListener, + MouseMotionListener { + XYZChemModel md; boolean painted = true; float xfac; int prevx, prevy; - float xtheta, ytheta; float scalefudge = 1; Matrix3D amat = new Matrix3D(), tmat = new Matrix3D(); String mdname = null; @@ -283,7 +300,6 @@ public class XYZApp Graphics backGC; Dimension backSize; - private synchronized void newBackBuffer() { backBuffer = createImage(getSize().width, getSize().height); if (backGC != null) { @@ -293,164 +309,190 @@ public class XYZApp backSize = getSize(); } + @Override public void init() { mdname = getParameter("model"); try { scalefudge = Float.valueOf(getParameter("scale")).floatValue(); - } catch(Exception e) { - }; + } catch (Exception ignored) { + } amat.yrot(20); amat.xrot(20); - if (mdname == null) + if (mdname == null) { mdname = "model.obj"; + } resize(getSize().width <= 20 ? 400 : getSize().width, - getSize().height <= 20 ? 400 : getSize().height); + getSize().height <= 20 ? 400 : getSize().height); newBackBuffer(); addMouseListener(this); addMouseMotionListener(this); } + @Override public void destroy() { removeMouseListener(this); removeMouseMotionListener(this); } + @Override public void run() { InputStream is = null; try { Thread.currentThread().setPriority(Thread.MIN_PRIORITY); is = new URL(getDocumentBase(), mdname).openStream(); - XYZChemModel m = new XYZChemModel (is); + XYZChemModel m = new XYZChemModel(is); Atom.setApplet(this); md = m; m.findBB(); float xw = m.xmax - m.xmin; float yw = m.ymax - m.ymin; float zw = m.zmax - m.zmin; - if (yw > xw) + if (yw > xw) { xw = yw; - if (zw > xw) + } + if (zw > xw) { xw = zw; + } float f1 = getSize().width / xw; float f2 = getSize().height / xw; xfac = 0.7f * (f1 < f2 ? f1 : f2) * scalefudge; - } catch(Exception e) { - e.printStackTrace(); + } catch (Exception e) { + Logger.getLogger(XYZApp.class.getName()).log(Level.SEVERE, null, e); md = null; message = e.toString(); } try { - if (is != null) + if (is != null) { is.close(); - } catch(Exception e) { + } + } catch (Exception ignored) { } repaint(); } + + @Override public void start() { - if (md == null && message == null) + if (md == null && message == null) { new Thread(this).start(); + } } + + @Override public void stop() { } - /* event handling */ - public void mouseClicked(MouseEvent e) { - } - public void mousePressed(MouseEvent e) { - prevx = e.getX(); - prevy = e.getY(); - e.consume(); - } - public void mouseReleased(MouseEvent e) { - } - public void mouseEntered(MouseEvent e) { - } - public void mouseExited(MouseEvent e) { - } - public void mouseDragged(MouseEvent e) { - int x = e.getX(); - int y = e.getY(); - tmat.unit(); - float xtheta = (prevy - y) * (360.0f / getSize().width); - float ytheta = (x - prevx) * (360.0f / getSize().height); - tmat.xrot(xtheta); - tmat.yrot(ytheta); - amat.mult(tmat); - if (painted) { - painted = false; - repaint(); - } - prevx = x; - prevy = y; - e.consume(); - } - public void mouseMoved(MouseEvent e) { - } + /* event handling */ + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mousePressed(MouseEvent e) { + prevx = e.getX(); + prevy = e.getY(); + e.consume(); + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void mouseDragged(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + tmat.unit(); + float xtheta = (prevy - y) * (360.0f / getSize().width); + float ytheta = (x - prevx) * (360.0f / getSize().height); + tmat.xrot(xtheta); + tmat.yrot(ytheta); + amat.mult(tmat); + if (painted) { + painted = false; + repaint(); + } + prevx = x; + prevy = y; + e.consume(); + } + + @Override + public void mouseMoved(MouseEvent e) { + } + + @Override public void update(Graphics g) { - if (backBuffer == null) + if (backBuffer == null) { g.clearRect(0, 0, getSize().width, getSize().height); + } paint(g); } + @Override public void paint(Graphics g) { if (md != null) { md.mat.unit(); md.mat.translate(-(md.xmin + md.xmax) / 2, - -(md.ymin + md.ymax) / 2, - -(md.zmin + md.zmax) / 2); + -(md.ymin + md.ymax) / 2, + -(md.zmin + md.zmax) / 2); md.mat.mult(amat); // md.mat.scale(xfac, -xfac, 8 * xfac / getSize().width); md.mat.scale(xfac, -xfac, 16 * xfac / getSize().width); md.mat.translate(getSize().width / 2, getSize().height / 2, 8); md.transformed = false; if (backBuffer != null) { - if (!backSize.equals(getSize())) + if (!backSize.equals(getSize())) { newBackBuffer(); + } backGC.setColor(getBackground()); - backGC.fillRect(0,0,getSize().width,getSize().height); + backGC.fillRect(0, 0, getSize().width, getSize().height); md.paint(backGC); g.drawImage(backBuffer, 0, 0, this); - } - else + } else { md.paint(g); + } setPainted(); } else if (message != null) { g.drawString("Error in model:", 3, 20); g.drawString(message, 10, 40); } } + private synchronized void setPainted() { painted = true; notifyAll(); } - private synchronized void waitPainted() - { - while (!painted) - { - try - { - wait(); - } - catch (InterruptedException e) {} - } - painted = false; + @Override + public String getAppletInfo() { + return "Title: XYZApp \nAuthor: James Gosling \nAn applet to put" + + " a Chemical model into a page."; } - public String getAppletInfo() { - return "Title: XYZApp \nAuthor: James Gosling \nAn applet to put a Chemical model into a page."; - } - - public String[][] getParameterInfo() { - String[][] info = { - {"model", "path string", "The path to the model to be displayed in .xyz format (see http://chem.leeds.ac.uk/Project/MIME.html). Default is model.obj."}, - {"scale", "float", "Scale factor. Default is 1 (i.e. no scale)."} - }; - return info; - } + @Override + public String[][] getParameterInfo() { + String[][] info = { + { "model", "path string", "The path to the model to be displayed" + + " in .xyz format " + + "(see http://chem.leeds.ac.uk/Project/MIME.html)." + + " Default is model.obj." }, + { "scale", "float", "Scale factor. Default is 1 (i.e. no scale)." } + }; + return info; + } } // end class XYZApp + class Atom { + private static Applet applet; private static byte[] data; private final static int R = 40; @@ -459,7 +501,6 @@ class Atom { private final static int bgGrey = 192; private final static int nBalls = 16; private static int maxr; - private int Rl; private int Gl; private int Bl; @@ -475,24 +516,29 @@ class Atom { int x = X + hx; int y = Y - R + hy; int r = (int) (Math.sqrt(x * x + y * y) + 0.5); - if (r > mr) + if (r > mr) { mr = r; + } data[p++] = r <= 0 ? 1 : (byte) r; } } maxr = mr; } + static void setApplet(Applet app) { applet = app; } + Atom(int Rl, int Gl, int Bl) { this.Rl = Rl; this.Gl = Gl; this.Bl = Bl; } - private final int blend(int fg, int bg, float fgfactor) { + + private int blend(int fg, int bg, float fgfactor) { return (int) (bg + (fg - bg) * fgfactor); } + private void Setup() { balls = new Image[nBalls]; byte red[] = new byte[256]; @@ -502,7 +548,7 @@ class Atom { byte blue[] = new byte[256]; blue[0] = (byte) bgGrey; for (int r = 0; r < nBalls; r++) { - float b = (float) (r+1) / nBalls; + float b = (float) (r + 1) / nBalls; for (int i = maxr; i >= 1; --i) { float d = (float) i / maxr; red[i] = (byte) blend(blend(Rl, 255, d), bgGrey, b); @@ -510,11 +556,12 @@ class Atom { blue[i] = (byte) blend(blend(Bl, 255, d), bgGrey, b); } IndexColorModel model = new IndexColorModel(8, maxr + 1, - red, green, blue, 0); + red, green, blue, 0); balls[r] = applet.createImage( - new MemoryImageSource(R*2, R*2, model, data, 0, R*2)); + new MemoryImageSource(R * 2, R * 2, model, data, 0, R * 2)); } } + void paint(Graphics gc, int x, int y, int r) { Image ba[] = balls; if (ba == null) { diff --git a/jdk/src/share/demo/applets/MoleculeViewer/example1.html b/jdk/src/share/demo/applets/MoleculeViewer/example1.html index f8b708136c3..de2e84b0943 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/example1.html +++ b/jdk/src/share/demo/applets/MoleculeViewer/example1.html @@ -6,7 +6,7 @@

MoleculeViewer (example 1)


- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/MoleculeViewer/example2.html b/jdk/src/share/demo/applets/MoleculeViewer/example2.html index 55701809088..bb8f93a0b31 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/example2.html +++ b/jdk/src/share/demo/applets/MoleculeViewer/example2.html @@ -6,7 +6,7 @@

MoleculeViewer (example 2)


- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/MoleculeViewer/example3.html b/jdk/src/share/demo/applets/MoleculeViewer/example3.html index 2542706f1bf..952bc8d5cbd 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/example3.html +++ b/jdk/src/share/demo/applets/MoleculeViewer/example3.html @@ -6,25 +6,25 @@

MoleculeViewer (example 3)


- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! From 29e2bcd7aff25ac08279ad9fd6735959be171cfa Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 17:57:57 +0100 Subject: [PATCH 053/168] 7027674: /applets/BarChart demo needs to be improved Reviewed-by: alexp --- .../share/demo/applets/BarChart/BarChart.java | 82 ++++++++++--------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/jdk/src/share/demo/applets/BarChart/BarChart.java b/jdk/src/share/demo/applets/BarChart/BarChart.java index dce59b51c57..81cab8fcf3b 100644 --- a/jdk/src/share/demo/applets/BarChart/BarChart.java +++ b/jdk/src/share/demo/applets/BarChart/BarChart.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,28 +29,26 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.awt.*; + /** * A simple bar chart demo * @author Sami Shaio * @modified 06/21/00 Daniel Peek : refactored, comments */ +@SuppressWarnings("serial") public class BarChart extends java.applet.Applet { + private static final int VERTICAL = 0; private static final int HORIZONTAL = 1; - private static final int SOLID = 0; private static final int STRIPED = 1; - private int orientation; private String title; private Font font; private FontMetrics metrics; - private int fontHeight = 15; private int columns; private int values[]; private Color colors[]; @@ -61,6 +59,7 @@ public class BarChart extends java.applet.Applet { private int barSpacing = 10; private int maxValue = 0; + @Override public void init() { getSettings(); @@ -70,7 +69,7 @@ public class BarChart extends java.applet.Applet { styles = new int[columns]; colors = new Color[columns]; - for (int i=0; i < columns; i++) { + for (int i = 0; i < columns; i++) { parseValue(i); parseLabel(i); parseStyle(i); @@ -112,7 +111,7 @@ public class BarChart extends java.applet.Applet { } private void parseValue(int i) { - String temp = getParameter("C" + (i+1)); + String temp = getParameter("C" + (i + 1)); try { values[i] = Integer.parseInt(temp); } catch (NumberFormatException e) { @@ -124,18 +123,17 @@ public class BarChart extends java.applet.Applet { } private void parseLabel(int i) { - String temp = getParameter("C" + (i+1) + "_label"); - if (temp==null) { + String temp = getParameter("C" + (i + 1) + "_label"); + if (temp == null) { labels[i] = ""; } else { labels[i] = temp; } - maxLabelWidth = Math.max(metrics.stringWidth - ((String) (labels[i])), maxLabelWidth); + maxLabelWidth = Math.max(metrics.stringWidth(labels[i]), maxLabelWidth); } private void parseStyle(int i) { - String temp = getParameter("C" + (i+1) + "_style"); + String temp = getParameter("C" + (i + 1) + "_style"); if (temp == null || temp.equalsIgnoreCase("solid")) { styles[i] = SOLID; } else if (temp.equalsIgnoreCase("striped")) { @@ -146,7 +144,7 @@ public class BarChart extends java.applet.Applet { } private void parseColor(int i) { - String temp = getParameter("C" + (i+1) + "_color"); + String temp = getParameter("C" + (i + 1) + "_color"); if (temp != null) { temp = temp.toLowerCase(); if (temp.equals("red")) { @@ -179,6 +177,7 @@ public class BarChart extends java.applet.Applet { } } + @Override public void paint(Graphics g) { // draw the title centered at the bottom of the bar graph g.setColor(Color.black); @@ -192,7 +191,7 @@ public class BarChart extends java.applet.Applet { g.drawString(title, cx, cy); // draw the bars and their titles - if(orientation == HORIZONTAL) { + if (orientation == HORIZONTAL) { paintHorizontal(g); } else { // VERTICAL paintVertical(g); @@ -208,12 +207,13 @@ public class BarChart extends java.applet.Applet { // set the X coordinate for this bar and label and center it int widthOfItems = maxLabelWidth + 3 + (maxValue * scale) + 5 - + metrics.stringWidth(Integer.toString(maxValue)); + + metrics.stringWidth(Integer.toString(maxValue)); cx = Math.max((getSize().width - widthOfItems) / 2, 0); // set the Y coordinate for this bar and label cy = getSize().height - metrics.getDescent() - metrics.getHeight() - - barSpacing - ((columns - i - 1) * (barSpacing + barHeight)); + - barSpacing + - ((columns - i - 1) * (barSpacing + barHeight)); // draw the label g.setColor(Color.black); @@ -223,7 +223,7 @@ public class BarChart extends java.applet.Applet { // draw the shadow g.fillRect(cx + 4, cy - barHeight + 4, - (values[i] * scale), barHeight); + (values[i] * scale), barHeight); // draw the bar g.setColor(colors[i]); @@ -233,7 +233,7 @@ public class BarChart extends java.applet.Applet { } } else { // SOLID g.fillRect(cx, cy - barHeight, - (values[i] * scale) + 1, barHeight + 1); + (values[i] * scale) + 1, barHeight + 1); } cx += (values[i] * scale) + 4; @@ -255,7 +255,7 @@ public class BarChart extends java.applet.Applet { // Y coordinate for this label and bar int cy = getSize().height - metrics.getHeight() - - metrics.getDescent() - 4; + - metrics.getDescent() - 4; // draw the label g.setColor(Color.black); @@ -264,18 +264,18 @@ public class BarChart extends java.applet.Applet { // draw the shadow g.fillRect(cx + 4, cy - (values[i] * scale) - 4, - barWidth, (values[i] * scale)); + barWidth, (values[i] * scale)); // draw the bar g.setColor(colors[i]); if (styles[i] == STRIPED) { - for (int k=0; k <= values[i] * scale; k+=2) { + for (int k = 0; k <= values[i] * scale; k += 2) { g.drawLine(cx, cy - k, - cx + barWidth, cy - k); + cx + barWidth, cy - k); } } else { g.fillRect(cx, cy - (values[i] * scale), - barWidth + 1, (values[i] * scale) + 1); + barWidth + 1, (values[i] * scale) + 1); } cy -= (values[i] * scale) + 5; @@ -285,28 +285,30 @@ public class BarChart extends java.applet.Applet { } } + @Override public String getAppletInfo() { return "Title: Bar Chart \n" - + "Author: Sami Shaio \n" - + "A simple bar chart demo."; + + "Author: Sami Shaio \n" + + "A simple bar chart demo."; } + @Override public String[][] getParameterInfo() { String[][] info = { - {"title", "string", "The title of bar graph. Default is 'Chart'"}, - {"scale", "int", "The scale of the bar graph. Default is 10."}, - {"columns", "int", "The number of columns/rows. Default is 5."}, - {"orientation", "{VERTICAL, HORIZONTAL}", - "The orienation of the bar graph. Default is VERTICAL."}, - {"c#", "int", "Subsitute a number for #. " - + "The value/size of bar #. Default is 0."}, - {"c#_label", "string", "The label for bar #. " - + "Default is an empty label."}, - {"c#_style", "{SOLID, STRIPED}", "The style of bar #. " - + "Default is SOLID."}, - {"c#_color", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, " - + "WHITE, YELLOW, GRAY, DARKGRAY}", - "The color of bar #. Default is GRAY."} + { "title", "string", "The title of bar graph. Default is 'Chart'" }, + { "scale", "int", "The scale of the bar graph. Default is 10." }, + { "columns", "int", "The number of columns/rows. Default is 5." }, + { "orientation", "{VERTICAL, HORIZONTAL}", + "The orienation of the bar graph. Default is VERTICAL." }, + { "c#", "int", "Subsitute a number for #. " + + "The value/size of bar #. Default is 0." }, + { "c#_label", "string", "The label for bar #. " + + "Default is an empty label." }, + { "c#_style", "{SOLID, STRIPED}", "The style of bar #. " + + "Default is SOLID." }, + { "c#_color", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, " + + "WHITE, YELLOW, GRAY, DARKGRAY}", + "The color of bar #. Default is GRAY." } }; return info; } From e2d98d99c3d95b3451316f05f2798193fbf016a6 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 17:59:02 +0100 Subject: [PATCH 054/168] 7027692: /applets/WireFrame demo needs to be improved Reviewed-by: alexp --- .../demo/applets/WireFrame/Matrix3D.java | 28 +- .../share/demo/applets/WireFrame/ThreeD.java | 407 ++++++++++-------- .../demo/applets/WireFrame/example1.html | 2 +- .../demo/applets/WireFrame/example2.html | 2 +- .../demo/applets/WireFrame/example3.html | 2 +- .../demo/applets/WireFrame/example4.html | 2 +- 6 files changed, 250 insertions(+), 193 deletions(-) diff --git a/jdk/src/share/demo/applets/WireFrame/Matrix3D.java b/jdk/src/share/demo/applets/WireFrame/Matrix3D.java index bc5939d54bd..0dda042c3c9 100644 --- a/jdk/src/share/demo/applets/WireFrame/Matrix3D.java +++ b/jdk/src/share/demo/applets/WireFrame/Matrix3D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,22 +29,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ /** A fairly conventional 3D matrix object that can transform sets of - 3D points and perform a variety of manipulations on the transform */ +3D points and perform a variety of manipulations on the transform */ class Matrix3D { + float xx, xy, xz, xo; float yx, yy, yz, yo; float zx, zy, zz, zo; static final double pi = 3.14159265; + /** Create a new unit matrix */ - Matrix3D () { + Matrix3D() { xx = 1.0f; yy = 1.0f; zz = 1.0f; } + /** Scale by f in all dimensions */ void scale(float f) { xx *= f; @@ -60,6 +61,7 @@ class Matrix3D { zz *= f; zo *= f; } + /** Scale along each axis independently */ void scale(float xf, float yf, float zf) { xx *= xf; @@ -75,12 +77,14 @@ class Matrix3D { zz *= zf; zo *= zf; } + /** Translate the origin */ void translate(float x, float y, float z) { xo += x; yo += y; zo += z; } + /** rotate theta degrees about the y axis */ void yrot(double theta) { theta *= (pi / 180); @@ -106,6 +110,7 @@ class Matrix3D { zy = Nzy; zz = Nzz; } + /** rotate theta degrees about the x axis */ void xrot(double theta) { theta *= (pi / 180); @@ -131,6 +136,7 @@ class Matrix3D { zy = Nzy; zz = Nzz; } + /** rotate theta degrees about the z axis */ void zrot(double theta) { theta *= (pi / 180); @@ -156,6 +162,7 @@ class Matrix3D { xy = Nxy; xz = Nxz; } + /** Multiply this matrix by a second: M = M*R */ void mult(Matrix3D rhs) { float lxx = xx * rhs.xx + yx * rhs.xy + zx * rhs.xz; @@ -204,10 +211,11 @@ class Matrix3D { zy = 0; zz = 1; } + /** Transform nvert points from v into tv. v contains the input - coordinates in floating point. Three successive entries in - the array constitute a point. tv ends up holding the transformed - points as integers; three successive entries per point */ + coordinates in floating point. Three successive entries in + the array constitute a point. tv ends up holding the transformed + points as integers; three successive entries per point */ void transform(float v[], int tv[], int nvert) { float lxx = xx, lxy = xy, lxz = xz, lxo = xo; float lyx = yx, lyy = yy, lyz = yz, lyo = yo; @@ -216,11 +224,13 @@ class Matrix3D { float x = v[i]; float y = v[i + 1]; float z = v[i + 2]; - tv[i ] = (int) (x * lxx + y * lxy + z * lxz + lxo); + tv[i] = (int) (x * lxx + y * lxy + z * lxz + lxo); tv[i + 1] = (int) (x * lyx + y * lyy + z * lyz + lyo); tv[i + 2] = (int) (x * lzx + y * lzy + z * lzz + lzo); } } + + @Override public String toString() { return ("[" + xo + "," + xx + "," + xy + "," + xz + ";" + yo + "," + yx + "," + yy + "," + yz + ";" diff --git a/jdk/src/share/demo/applets/WireFrame/ThreeD.java b/jdk/src/share/demo/applets/WireFrame/ThreeD.java index 81aa0d04c6e..7f228331f7e 100644 --- a/jdk/src/share/demo/applets/WireFrame/ThreeD.java +++ b/jdk/src/share/demo/applets/WireFrame/ThreeD.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,28 +29,29 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ - -/* A set of classes to parse, represent and display 3D wireframe models - represented in Wavefront .obj format. */ import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; -import java.awt.Event; import java.awt.event.*; import java.io.*; import java.net.URL; + +/* A set of classes to parse, represent and display 3D wireframe models +represented in Wavefront .obj format. */ +@SuppressWarnings("serial") class FileFormatException extends Exception { + public FileFormatException(String s) { super(s); } } + /** The representation of a 3D model */ -class Model3D { +final class Model3D { + float vert[]; int tvert[]; int nvert, maxvert; @@ -58,78 +59,90 @@ class Model3D { int ncon, maxcon; boolean transformed; Matrix3D mat; - float xmin, xmax, ymin, ymax, zmin, zmax; - Model3D () { - mat = new Matrix3D (); + Model3D() { + mat = new Matrix3D(); mat.xrot(20); mat.yrot(30); } + /** Create a 3D model by parsing an input stream */ - Model3D (InputStream is) throws IOException, FileFormatException { - this(); - StreamTokenizer st = new StreamTokenizer( - new BufferedReader(new InputStreamReader(is, "UTF-8"))); - st.eolIsSignificant(true); - st.commentChar('#'); - scan: + Model3D(InputStream is) throws IOException, FileFormatException { + this(); + StreamTokenizer st = new StreamTokenizer( + new BufferedReader(new InputStreamReader(is, "UTF-8"))); + st.eolIsSignificant(true); + st.commentChar('#'); + scan: while (true) { switch (st.nextToken()) { - default: - break scan; - case StreamTokenizer.TT_EOL: - break; - case StreamTokenizer.TT_WORD: - if ("v".equals(st.sval)) { - double x = 0, y = 0, z = 0; - if (st.nextToken() == StreamTokenizer.TT_NUMBER) { - x = st.nval; + default: + break scan; + case StreamTokenizer.TT_EOL: + break; + case StreamTokenizer.TT_WORD: + if ("v".equals(st.sval)) { + double x = 0, y = 0, z = 0; if (st.nextToken() == StreamTokenizer.TT_NUMBER) { - y = st.nval; - if (st.nextToken() == StreamTokenizer.TT_NUMBER) - z = st.nval; + x = st.nval; + if (st.nextToken() == StreamTokenizer.TT_NUMBER) { + y = st.nval; + if (st.nextToken() == StreamTokenizer.TT_NUMBER) { + z = st.nval; + } + } + } + addVert((float) x, (float) y, (float) z); + while (st.ttype != StreamTokenizer.TT_EOL && st.ttype + != StreamTokenizer.TT_EOF) { + st.nextToken(); + } + } else if ("f".equals(st.sval) || "fo".equals(st.sval) || "l". + equals(st.sval)) { + int start = -1; + int prev = -1; + int n = -1; + while (true) { + if (st.nextToken() == StreamTokenizer.TT_NUMBER) { + n = (int) st.nval; + if (prev >= 0) { + add(prev - 1, n - 1); + } + if (start < 0) { + start = n; + } + prev = n; + } else if (st.ttype == '/') { + st.nextToken(); + } else { + break; + } + } + if (start >= 0) { + add(start - 1, prev - 1); + } + if (st.ttype != StreamTokenizer.TT_EOL) { + break scan; + } + } else { + while (st.nextToken() != StreamTokenizer.TT_EOL + && st.ttype != StreamTokenizer.TT_EOF) { + // no-op } } - addVert((float) x, (float) y, (float) z); - while (st.ttype != StreamTokenizer.TT_EOL && - st.ttype != StreamTokenizer.TT_EOF) - st.nextToken(); - } else if ("f".equals(st.sval) || "fo".equals(st.sval) || "l".equals(st.sval)) { - int start = -1; - int prev = -1; - int n = -1; - while (true) - if (st.nextToken() == StreamTokenizer.TT_NUMBER) { - n = (int) st.nval; - if (prev >= 0) - add(prev - 1, n - 1); - if (start < 0) - start = n; - prev = n; - } else if (st.ttype == '/') - st.nextToken(); - else - break; - if (start >= 0) - add(start - 1, prev - 1); - if (st.ttype != StreamTokenizer.TT_EOL) - break scan; - } else { - while (st.nextToken() != StreamTokenizer.TT_EOL - && st.ttype != StreamTokenizer.TT_EOF); - } } } is.close(); - if (st.ttype != StreamTokenizer.TT_EOF) + if (st.ttype != StreamTokenizer.TT_EOF) { throw new FileFormatException(st.toString()); + } } /** Add a vertex to this model */ int addVert(float x, float y, float z) { int i = nvert; - if (i >= maxvert) + if (i >= maxvert) { if (vert == null) { maxvert = 100; vert = new float[maxvert * 3]; @@ -139,18 +152,21 @@ class Model3D { System.arraycopy(vert, 0, nv, 0, vert.length); vert = nv; } + } i *= 3; vert[i] = x; vert[i + 1] = y; vert[i + 2] = z; return nvert++; } + /** Add a line from vertex p1 to vertex p2 */ void add(int p1, int p2) { int i = ncon; - if (p1 >= nvert || p2 >= nvert) + if (p1 >= nvert || p2 >= nvert) { return; - if (i >= maxcon) + } + if (i >= maxcon) { if (con == null) { maxcon = 100; con = new int[maxcon]; @@ -160,6 +176,7 @@ class Model3D { System.arraycopy(con, 0, nv, 0, con.length); con = nv; } + } if (p1 > p2) { int t = p1; p1 = p2; @@ -168,79 +185,79 @@ class Model3D { con[i] = (p1 << 16) | p2; ncon = i + 1; } + /** Transform all the points in this model */ void transform() { - if (transformed || nvert <= 0) + if (transformed || nvert <= 0) { return; - if (tvert == null || tvert.length < nvert * 3) - tvert = new int[nvert*3]; + } + if (tvert == null || tvert.length < nvert * 3) { + tvert = new int[nvert * 3]; + } mat.transform(vert, tvert, nvert); transformed = true; } - /* Quick Sort implementation - */ - private void quickSort(int a[], int left, int right) - { - int leftIndex = left; - int rightIndex = right; - int partionElement; - if ( right > left) - { + /* Quick Sort implementation + */ + private void quickSort(int a[], int left, int right) { + int leftIndex = left; + int rightIndex = right; + int partionElement; + if (right > left) { - /* Arbitrarily establishing partition element as the midpoint of - * the array. - */ - partionElement = a[ ( left + right ) / 2 ]; - - // loop through the array until indices cross - while( leftIndex <= rightIndex ) - { - /* find the first element that is greater than or equal to - * the partionElement starting from the leftIndex. + /* Arbitrarily establishing partition element as the midpoint of + * the array. */ - while( ( leftIndex < right ) && ( a[leftIndex] < partionElement ) ) - ++leftIndex; + partionElement = a[(left + right) / 2]; - /* find an element that is smaller than or equal to - * the partionElement starting from the rightIndex. - */ - while( ( rightIndex > left ) && - ( a[rightIndex] > partionElement ) ) - --rightIndex; + // loop through the array until indices cross + while (leftIndex <= rightIndex) { + /* find the first element that is greater than or equal to + * the partionElement starting from the leftIndex. + */ + while ((leftIndex < right) && (a[leftIndex] < partionElement)) { + ++leftIndex; + } - // if the indexes have not crossed, swap - if( leftIndex <= rightIndex ) - { - swap(a, leftIndex, rightIndex); - ++leftIndex; - --rightIndex; + /* find an element that is smaller than or equal to + * the partionElement starting from the rightIndex. + */ + while ((rightIndex > left) && (a[rightIndex] > partionElement)) { + --rightIndex; + } + + // if the indexes have not crossed, swap + if (leftIndex <= rightIndex) { + swap(a, leftIndex, rightIndex); + ++leftIndex; + --rightIndex; + } } - } - /* If the right index has not reached the left side of array - * must now sort the left partition. - */ - if( left < rightIndex ) - quickSort( a, left, rightIndex ); + /* If the right index has not reached the left side of array + * must now sort the left partition. + */ + if (left < rightIndex) { + quickSort(a, left, rightIndex); + } - /* If the left index has not reached the right side of array - * must now sort the right partition. - */ - if( leftIndex < right ) - quickSort( a, leftIndex, right ); + /* If the left index has not reached the right side of array + * must now sort the right partition. + */ + if (leftIndex < right) { + quickSort(a, leftIndex, right); + } - } - } - - private void swap(int a[], int i, int j) - { - int T; - T = a[i]; - a[i] = a[j]; - a[j] = T; - } + } + } + private void swap(int a[], int i, int j) { + int T; + T = a[i]; + a[i] = a[j]; + a[j] = T; + } /** eliminate duplicate lines */ void compress() { @@ -259,21 +276,21 @@ class Model3D { } ncon = d; } - static Color gr[]; /** Paint this model to a graphics context. It uses the matrix associated - with this model to map from model space to screen space. - The next version of the browser should have double buffering, - which will make this *much* nicer */ + with this model to map from model space to screen space. + The next version of the browser should have double buffering, + which will make this *much* nicer */ void paint(Graphics g) { - if (vert == null || nvert <= 0) + if (vert == null || nvert <= 0) { return; + } transform(); if (gr == null) { gr = new Color[16]; for (int i = 0; i < 16; i++) { - int grey = (int) (170*(1-Math.pow(i/15.0, 2.3))); + int grey = (int) (170 * (1 - Math.pow(i / 15.0, 2.3))); gr[i] = new Color(grey, grey, grey); } } @@ -281,151 +298,181 @@ class Model3D { int lim = ncon; int c[] = con; int v[] = tvert; - if (lim <= 0 || nvert <= 0) + if (lim <= 0 || nvert <= 0) { return; + } for (int i = 0; i < lim; i++) { int T = c[i]; int p1 = ((T >> 16) & 0xFFFF) * 3; int p2 = (T & 0xFFFF) * 3; int grey = v[p1 + 2] + v[p2 + 2]; - if (grey < 0) + if (grey < 0) { grey = 0; - if (grey > 15) + } + if (grey > 15) { grey = 15; + } if (grey != lg) { lg = grey; g.setColor(gr[grey]); } g.drawLine(v[p1], v[p1 + 1], - v[p2], v[p2 + 1]); + v[p2], v[p2 + 1]); } } /** Find the bounding box of this model */ void findBB() { - if (nvert <= 0) + if (nvert <= 0) { return; + } float v[] = vert; - float xmin = v[0], xmax = xmin; - float ymin = v[1], ymax = ymin; - float zmin = v[2], zmax = zmin; + float _xmin = v[0], _xmax = _xmin; + float _ymin = v[1], _ymax = _ymin; + float _zmin = v[2], _zmax = _zmin; for (int i = nvert * 3; (i -= 3) > 0;) { float x = v[i]; - if (x < xmin) - xmin = x; - if (x > xmax) - xmax = x; + if (x < _xmin) { + _xmin = x; + } + if (x > _xmax) { + _xmax = x; + } float y = v[i + 1]; - if (y < ymin) - ymin = y; - if (y > ymax) - ymax = y; + if (y < _ymin) { + _ymin = y; + } + if (y > _ymax) { + _ymax = y; + } float z = v[i + 2]; - if (z < zmin) - zmin = z; - if (z > zmax) - zmax = z; + if (z < _zmin) { + _zmin = z; + } + if (z > _zmax) { + _zmax = z; + } } - this.xmax = xmax; - this.xmin = xmin; - this.ymax = ymax; - this.ymin = ymin; - this.zmax = zmax; - this.zmin = zmin; + this.xmax = _xmax; + this.xmin = _xmin; + this.ymax = _ymax; + this.ymin = _ymin; + this.zmax = _zmax; + this.zmin = _zmin; } } + /** An applet to put a 3D model into a page */ +@SuppressWarnings("serial") public class ThreeD extends Applet - implements Runnable, MouseListener, MouseMotionListener { + implements Runnable, MouseListener, MouseMotionListener { + Model3D md; boolean painted = true; float xfac; int prevx, prevy; - float xtheta, ytheta; float scalefudge = 1; Matrix3D amat = new Matrix3D(), tmat = new Matrix3D(); String mdname = null; String message = null; + @Override public void init() { mdname = getParameter("model"); try { scalefudge = Float.valueOf(getParameter("scale")).floatValue(); - }catch(Exception e){}; + } catch (Exception ignored) { + // fall back to default scalefudge = 1 + } amat.yrot(20); amat.xrot(20); - if (mdname == null) + if (mdname == null) { mdname = "model.obj"; + } resize(getSize().width <= 20 ? 400 : getSize().width, - getSize().height <= 20 ? 400 : getSize().height); + getSize().height <= 20 ? 400 : getSize().height); addMouseListener(this); addMouseMotionListener(this); } + @Override public void destroy() { removeMouseListener(this); removeMouseMotionListener(this); } + @Override public void run() { InputStream is = null; try { Thread.currentThread().setPriority(Thread.MIN_PRIORITY); is = new URL(getDocumentBase(), mdname).openStream(); - Model3D m = new Model3D (is); + Model3D m = new Model3D(is); md = m; m.findBB(); m.compress(); float xw = m.xmax - m.xmin; float yw = m.ymax - m.ymin; float zw = m.zmax - m.zmin; - if (yw > xw) + if (yw > xw) { xw = yw; - if (zw > xw) + } + if (zw > xw) { xw = zw; + } float f1 = getSize().width / xw; float f2 = getSize().height / xw; xfac = 0.7f * (f1 < f2 ? f1 : f2) * scalefudge; - } catch(Exception e) { + } catch (Exception e) { md = null; message = e.toString(); } try { - if (is != null) + if (is != null) { is.close(); - } catch(Exception e) { + } + } catch (Exception e) { } repaint(); } + @Override public void start() { - if (md == null && message == null) + if (md == null && message == null) { new Thread(this).start(); + } } + @Override public void stop() { } - public void mouseClicked(MouseEvent e) { + @Override + public void mouseClicked(MouseEvent e) { } - public void mousePressed(MouseEvent e) { + @Override + public void mousePressed(MouseEvent e) { prevx = e.getX(); prevy = e.getY(); e.consume(); } - public void mouseReleased(MouseEvent e) { + @Override + public void mouseReleased(MouseEvent e) { } - public void mouseEntered(MouseEvent e) { + @Override + public void mouseEntered(MouseEvent e) { } - public void mouseExited(MouseEvent e) { + @Override + public void mouseExited(MouseEvent e) { } - public void mouseDragged(MouseEvent e) { + @Override + public void mouseDragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); @@ -444,15 +491,17 @@ public class ThreeD extends Applet e.consume(); } - public void mouseMoved(MouseEvent e) { + @Override + public void mouseMoved(MouseEvent e) { } + @Override public void paint(Graphics g) { if (md != null) { md.mat.unit(); md.mat.translate(-(md.xmin + md.xmax) / 2, - -(md.ymin + md.ymax) / 2, - -(md.zmin + md.zmax) / 2); + -(md.ymin + md.ymax) / 2, + -(md.zmin + md.zmax) / 2); md.mat.mult(amat); md.mat.scale(xfac, -xfac, 16 * xfac / getSize().width); md.mat.translate(getSize().width / 2, getSize().height / 2, 8); @@ -469,20 +518,18 @@ public class ThreeD extends Applet painted = true; notifyAll(); } -// private synchronized void waitPainted() { -// while (!painted) -// wait(); -// painted = false; -// } + @Override public String getAppletInfo() { - return "Title: ThreeD \nAuthor: James Gosling? \nAn applet to put a 3D model into a page."; + return "Title: ThreeD \nAuthor: James Gosling? \n" + + "An applet to put a 3D model into a page."; } + @Override public String[][] getParameterInfo() { String[][] info = { - {"model", "path string", "The path to the model to be displayed."}, - {"scale", "float", "The scale of the model. Default is 1."} + { "model", "path string", "The path to the model to be displayed." }, + { "scale", "float", "The scale of the model. Default is 1." } }; return info; } diff --git a/jdk/src/share/demo/applets/WireFrame/example1.html b/jdk/src/share/demo/applets/WireFrame/example1.html index bd909f46c2a..1992ee53a26 100644 --- a/jdk/src/share/demo/applets/WireFrame/example1.html +++ b/jdk/src/share/demo/applets/WireFrame/example1.html @@ -6,7 +6,7 @@

3D Model: Cube


- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/WireFrame/example2.html b/jdk/src/share/demo/applets/WireFrame/example2.html index 7e5fd621523..eec2b1d429f 100644 --- a/jdk/src/share/demo/applets/WireFrame/example2.html +++ b/jdk/src/share/demo/applets/WireFrame/example2.html @@ -6,7 +6,7 @@

3D Model: Dinosaur


- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/WireFrame/example3.html b/jdk/src/share/demo/applets/WireFrame/example3.html index 9fdd0a57305..2b49d118ec7 100644 --- a/jdk/src/share/demo/applets/WireFrame/example3.html +++ b/jdk/src/share/demo/applets/WireFrame/example3.html @@ -6,7 +6,7 @@

3D Model: Hughes


- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/WireFrame/example4.html b/jdk/src/share/demo/applets/WireFrame/example4.html index e8db8830773..faf409254a1 100644 --- a/jdk/src/share/demo/applets/WireFrame/example4.html +++ b/jdk/src/share/demo/applets/WireFrame/example4.html @@ -6,7 +6,7 @@

3D Model: knoxS


- + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! From 99ff1b58f472983fd514c45232fe6573dca392d9 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Fri, 25 Mar 2011 18:00:42 +0100 Subject: [PATCH 055/168] 7027673: /applets/ArcTest demo needs to be improved Reviewed-by: alexp --- .../share/demo/applets/ArcTest/ArcTest.java | 58 +++++++++++++------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/jdk/src/share/demo/applets/ArcTest/ArcTest.java b/jdk/src/share/demo/applets/ArcTest/ArcTest.java index d02fd0e377f..d58ef44b340 100644 --- a/jdk/src/share/demo/applets/ArcTest/ArcTest.java +++ b/jdk/src/share/demo/applets/ArcTest/ArcTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,22 +29,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.awt.*; import java.awt.event.*; import java.applet.*; + /** * An interactive test of the Graphics.drawArc and Graphics.fillArc * routines. Can be run either as a standalone application by * typing "java ArcTest" or as an applet in the AppletViewer. */ +@SuppressWarnings("serial") public class ArcTest extends Applet { + ArcControls controls; // The controls for marking and filling arcs ArcCanvas canvas; // The drawing area to display arcs + @Override public void init() { setLayout(new BorderLayout()); canvas = new ArcCanvas(); @@ -52,19 +54,23 @@ public class ArcTest extends Applet { add("South", controls = new ArcControls(canvas)); } + @Override public void destroy() { remove(controls); remove(canvas); } + @Override public void start() { controls.setEnabled(true); } + @Override public void stop() { controls.setEnabled(false); } + @Override public void processEvent(AWTEvent e) { if (e.getID() == Event.WINDOW_DESTROY) { System.exit(0); @@ -80,20 +86,28 @@ public class ArcTest extends Applet { f.add("Center", arcTest); f.setSize(300, 300); - f.show(); + f.setVisible(true); } + @Override public String getAppletInfo() { - return "An interactive test of the Graphics.drawArc and \nGraphics.fillArc routines. Can be run \neither as a standalone application by typing 'java ArcTest' \nor as an applet in the AppletViewer."; + return "An interactive test of the Graphics.drawArc and \nGraphics." + + "fillArc routines. Can be run \neither as a standalone " + + "application by typing 'java ArcTest' \nor as an applet in " + + "the AppletViewer."; } } -class ArcCanvas extends Canvas { - int startAngle = 0; - int extent = 45; - boolean filled = false; - Font font = new java.awt.Font("SansSerif", Font.PLAIN, 12); +@SuppressWarnings("serial") +class ArcCanvas extends Canvas { + + int startAngle = 0; + int extent = 45; + boolean filled = false; + Font font = new java.awt.Font("SansSerif", Font.PLAIN, 12); + + @Override public void paint(Graphics g) { Rectangle r = getBounds(); int hlines = r.height / 10; @@ -134,12 +148,16 @@ class ArcCanvas extends Canvas { } } + +@SuppressWarnings("serial") class ArcControls extends Panel - implements ActionListener { + implements ActionListener { + TextField startTF; TextField extentTF; ArcCanvas canvas; + @SuppressWarnings("LeakingThisInConstructor") public ArcControls(ArcCanvas canvas) { Button b = null; @@ -154,18 +172,19 @@ class ArcControls extends Panel add(b); } + @Override public void actionPerformed(ActionEvent ev) { String label = ev.getActionCommand(); int start, extent; try { start = Integer.parseInt(startTF.getText().trim()); - } catch (NumberFormatException nfe) { + } catch (NumberFormatException ignored) { start = 0; } try { extent = Integer.parseInt(extentTF.getText().trim()); - } catch (NumberFormatException nfe) { + } catch (NumberFormatException ignored) { extent = 0; } @@ -173,6 +192,8 @@ class ArcControls extends Panel } } + +@SuppressWarnings("serial") class IntegerTextField extends TextField { String oldText = null; @@ -188,6 +209,7 @@ class IntegerTextField extends TextField { // function, but this is neater, since ideally, it would prevent // the text from appearing at all. Sigh. See bugid 4100317/4114565. // + @Override protected void processEvent(AWTEvent evt) { int id = evt.getID(); if (id != KeyEvent.KEY_TYPED) { @@ -200,8 +222,8 @@ class IntegerTextField extends TextField { // Digits, backspace, and delete are okay // Note that the minus sign is allowed, but not the decimal - if (Character.isDigit(c) || (c == '\b') || (c == '\u007f') || - (c == '\u002d')) { + if (Character.isDigit(c) || (c == '\b') || (c == '\u007f') || (c + == '\u002d')) { super.processEvent(evt); return; } @@ -215,6 +237,7 @@ class IntegerTextField extends TextField { // so we can revert to it on a TextEvent (paste, or // legal key in the wrong location) with bad text // + @Override protected void processTextEvent(TextEvent te) { // The empty string is okay, too String newText = getText(); @@ -233,12 +256,11 @@ class IntegerTextField extends TextField { // Note that the empty string is not allowed. // private boolean textIsInteger(String textToCheck) { - int value = -1; try { - value = Integer.parseInt(textToCheck, 10); + Integer.parseInt(textToCheck, 10); return true; - } catch (NumberFormatException nfe) { + } catch (NumberFormatException ignored) { return false; } } From 2afb191a2fc4003a2894d531cdb39b6ce415ef8d Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Fri, 25 Mar 2011 11:24:06 -0700 Subject: [PATCH 056/168] 7030442: Add missing @param tag for Collections.reverseOrder() Reviewed-by: darcy, alanb --- .../share/classes/java/util/Collections.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/jdk/src/share/classes/java/util/Collections.java b/jdk/src/share/classes/java/util/Collections.java index 1ea0ecb04c0..826cbe759c9 100644 --- a/jdk/src/share/classes/java/util/Collections.java +++ b/jdk/src/share/classes/java/util/Collections.java @@ -3533,20 +3533,20 @@ public class Collections { } /** - * Returns a comparator that imposes the reverse of the natural - * ordering on a collection of objects that implement the - * Comparable interface. (The natural ordering is the ordering - * imposed by the objects' own compareTo method.) This enables a + * Returns a comparator that imposes the reverse of the natural + * ordering on a collection of objects that implement the + * {@code Comparable} interface. (The natural ordering is the ordering + * imposed by the objects' own {@code compareTo} method.) This enables a * simple idiom for sorting (or maintaining) collections (or arrays) of - * objects that implement the Comparable interface in - * reverse-natural-order. For example, suppose a is an array of + * objects that implement the {@code Comparable} interface in + * reverse-natural-order. For example, suppose {@code a} is an array of * strings. Then:
      *          Arrays.sort(a, Collections.reverseOrder());
      * 
sorts the array in reverse-lexicographic (alphabetical) order.

* * The returned comparator is serializable. * - * @return a comparator that imposes the reverse of the natural + * @return A comparator that imposes the reverse of the natural * ordering on a collection of objects that implement * the Comparable interface. * @see Comparable @@ -3575,16 +3575,18 @@ public class Collections { /** * Returns a comparator that imposes the reverse ordering of the specified - * comparator. If the specified comparator is null, this method is + * comparator. If the specified comparator is {@code null}, this method is * equivalent to {@link #reverseOrder()} (in other words, it returns a - * comparator that imposes the reverse of the natural ordering on a - * collection of objects that implement the Comparable interface). + * comparator that imposes the reverse of the natural ordering on + * a collection of objects that implement the Comparable interface). * *

The returned comparator is serializable (assuming the specified - * comparator is also serializable or null). + * comparator is also serializable or {@code null}). * - * @return a comparator that imposes the reverse ordering of the - * specified comparator + * @param cmp a comparator who's ordering is to be reversed by the returned + * comparator or {@code null} + * @return A comparator that imposes the reverse ordering of the + * specified comparator. * @since 1.5 */ public static Comparator reverseOrder(Comparator cmp) { From f6a0d5983e28c8ae90aedebb17f8c17c6a3861dd Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Fri, 25 Mar 2011 11:29:30 -0700 Subject: [PATCH 057/168] 7025708: Assertion if using "-XX:+CITraceTypeFlow -XX:+Verbose" together Reviewed-by: never --- hotspot/src/share/vm/ci/ciTypeFlow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp index 5986df0abaf..a5042d9676f 100644 --- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp +++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp @@ -1871,7 +1871,8 @@ void ciTypeFlow::Block::print_value_on(outputStream* st) const { // ------------------------------------------------------------------ // ciTypeFlow::Block::print_on void ciTypeFlow::Block::print_on(outputStream* st) const { - if ((Verbose || WizardMode)) { + if ((Verbose || WizardMode) && (limit() >= 0)) { + // Don't print 'dummy' blocks (i.e. blocks with limit() '-1') outer()->method()->print_codes_on(start(), limit(), st); } st->print_cr(" ==================================================== "); From d5fd66ab02a604147db74266193297a46198551a Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Fri, 25 Mar 2011 15:17:52 -0700 Subject: [PATCH 058/168] 7001086: NLS: un-used resources should be removed from standard.properties and improper concatenation Reviewed-by: jjg --- .../formats/html/FrameOutputWriter.java | 9 +-- .../html/resources/standard.properties | 6 +- .../TestNonFrameWarning.java | 71 +++++++++++++++++++ .../javadoc/testNonFrameWarning/pkg/C.java | 30 ++++++++ 4 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java create mode 100644 langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java index aac67c9385c..1d7ac273338 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java @@ -114,13 +114,10 @@ public class FrameOutputWriter extends HtmlDocletWriter { Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, getResource("doclet.Frame_Alert")); noframes.addContent(noframesHead); - Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message")); + Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message", + getHyperLinkString(configuration.topFile, + configuration.getText("doclet.Non_Frame_Version")))); noframes.addContent(p); - noframes.addContent(new HtmlTree(HtmlTag.BR)); - noframes.addContent(getResource("doclet.Link_To")); - Content link = getHyperLink(configuration.topFile, - getResource("doclet.Non_Frame_Version")); - noframes.addContent(link); contentTree.addContent(noframes); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties index c645c10a608..edd3dcc1a11 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties @@ -114,11 +114,10 @@ doclet.Hierarchy_For_All_Packages=Hierarchy For All Packages doclet.Cannot_handle_no_packages=Cannot handle no packages. doclet.Frame_Alert=Frame Alert doclet.Overview-Member-Frame=Overview Member Frame -doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to {0}. doclet.No_Script_Message=JavaScript is disabled on your browser. -doclet.Non_Frame_Version=Non-frame version. +doclet.Non_Frame_Version=Non-frame version doclet.Frame_Version=Frame version -doclet.Link_To=Link to doclet.Following_From_Class=Following copied from class: {0} doclet.Following_From_Interface=Following copied from interface: {0} doclet.Description_From_Interface=Description copied from interface: @@ -167,7 +166,6 @@ doclet.Help_enum_line_3=Enum description doclet.Help_annotation_type_line_1=Each annotation type has its own separate page with the following sections: doclet.Help_annotation_type_line_2=Annotation Type declaration doclet.Help_annotation_type_line_3=Annotation Type description -doclet.The=The doclet.Style_line_1=Javadoc style sheet doclet.Style_line_2=Define colors, fonts and other style attributes here to override the defaults doclet.Style_line_3=Page background color diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java b/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java new file mode 100644 index 00000000000..de17bb45f4f --- /dev/null +++ b/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7001086 + * @summary Test Non-frame warning. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestNonFrameWarning + * @run main TestNonFrameWarning + */ + +public class TestNonFrameWarning extends JavadocTester { + + private static final String BUG_ID = "7001086"; + private static final String[][] TEST = { + {BUG_ID + FS + "index.html", + "

This document is designed to be viewed using the frames feature. " + + "If you see this message, you are using a non-frame-capable web client. " + + "Link to Non-frame version.

" + } + }; + private static final String[] ARGS = new String[]{ + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg" + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestNonFrameWarning tester = new TestNonFrameWarning(); + run(tester, ARGS, TEST, NO_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java b/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java new file mode 100644 index 00000000000..d24a6e7b633 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +/** + * Source file for C + */ +public class C { +} From 46e71698c99e1b8640a1be78c7c2c77900eb9a09 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Fri, 25 Mar 2011 18:26:19 -0700 Subject: [PATCH 059/168] 7031371: Clarify javadoc of Throwable, including addSuppressed Reviewed-by: smarks, mduigou --- .../share/classes/java/lang/Throwable.java | 99 ++++++++----------- 1 file changed, 41 insertions(+), 58 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Throwable.java b/jdk/src/share/classes/java/lang/Throwable.java index c77868e366e..2b80259d0b8 100644 --- a/jdk/src/share/classes/java/lang/Throwable.java +++ b/jdk/src/share/classes/java/lang/Throwable.java @@ -46,13 +46,16 @@ import java.util.*; * are freshly created in the context of the exceptional situation so * as to include relevant information (such as stack trace data). * - *

A throwable contains a snapshot of the execution stack of its thread at - * the time it was created. It can also contain a message string that gives - * more information about the error. Finally, it can contain a cause: - * another throwable that caused this throwable to get thrown. The cause - * facility is new in release 1.4. It is also known as the chained - * exception facility, as the cause can, itself, have a cause, and so on, - * leading to a "chain" of exceptions, each caused by another. + *

A throwable contains a snapshot of the execution stack of its + * thread at the time it was created. It can also contain a message + * string that gives more information about the error. Over time, a + * throwable can {@linkplain Throwable#addSuppressed suppress} other + * throwables from being propagated. Finally, the throwable can also + * contain a cause: another throwable that caused this + * throwable to get thrown. The recording of this causal information + * is referred to as the chained exception facility, as the + * cause can, itself, have a cause, and so on, leading to a "chain" of + * exceptions, each caused by another. * *

One reason that a throwable may have a cause is that the class that * throws it is built atop a lower layered abstraction, and an operation on @@ -86,47 +89,12 @@ import java.util.*; * {@link #initCause(Throwable)} method. New throwable classes that * wish to allow causes to be associated with them should provide constructors * that take a cause and delegate (perhaps indirectly) to one of the - * {@code Throwable} constructors that takes a cause. For example: - *

- *     try {
- *         lowLevelOp();
- *     } catch (LowLevelException le) {
- *         throw new HighLevelException(le);  // Chaining-aware constructor
- *     }
- * 
+ * {@code Throwable} constructors that takes a cause. + * * Because the {@code initCause} method is public, it allows a cause to be * associated with any throwable, even a "legacy throwable" whose * implementation predates the addition of the exception chaining mechanism to - * {@code Throwable}. For example: - *
- *     try {
- *         lowLevelOp();
- *     } catch (LowLevelException le) {
- *         throw (HighLevelException)
- *               new HighLevelException().initCause(le);  // Legacy constructor
- *     }
- * 
- * - *

Prior to release 1.4, there were many throwables that had their own - * non-standard exception chaining mechanisms ( - * {@link ExceptionInInitializerError}, {@link ClassNotFoundException}, - * {@link java.lang.reflect.UndeclaredThrowableException}, - * {@link java.lang.reflect.InvocationTargetException}, - * {@link java.io.WriteAbortedException}, - * {@link java.security.PrivilegedActionException}, - * {@link java.awt.print.PrinterIOException}, - * {@link java.rmi.RemoteException} and - * {@link javax.naming.NamingException}). - * All of these throwables have been retrofitted to - * use the standard exception chaining mechanism, while continuing to - * implement their "legacy" chaining mechanisms for compatibility. - * - *

Further, as of release 1.4, many general purpose {@code Throwable} - * classes (for example {@link Exception}, {@link RuntimeException}, - * {@link Error}) have been retrofitted with constructors that take - * a cause. This was not strictly necessary, due to the existence of the - * {@code initCause} method, but it is more convenient and expressive to - * delegate to a constructor that takes a cause. + * {@code Throwable}. * *

By convention, class {@code Throwable} and its subclasses have two * constructors, one that takes no arguments and one that takes a @@ -137,14 +105,6 @@ import java.util.*; * {@code String} (the detail message) and a {@code Throwable} (the * cause). * - *

Also introduced in release 1.4 is the {@link #getStackTrace()} method, - * which allows programmatic access to the stack trace information that was - * previously available only in text form, via the various forms of the - * {@link #printStackTrace()} method. This information has been added to the - * serialized representation of this class so {@code getStackTrace} - * and {@code printStackTrace} will operate properly on a throwable that - * was obtained by deserialization. - * * @author unascribed * @author Josh Bloch (Added exception chaining and programmatic access to * stack trace in 1.4.) @@ -881,11 +841,34 @@ public class Throwable implements Serializable { *

Note that when one exception {@linkplain * #initCause(Throwable) causes} another exception, the first * exception is usually caught and then the second exception is - * thrown in response. In contrast, when one exception suppresses - * another, two exceptions are thrown in sibling code blocks, such - * as in a {@code try} block and in its {@code finally} block, and - * control flow can only continue with one exception so the second - * is recorded as a suppressed exception of the first. + * thrown in response. In other words, there is a causal + * connection between the two exceptions. + * + * In contrast, there are situations where two independent + * exceptions can be thrown in sibling code blocks, in particular + * in the {@code try} block of a {@code try}-with-resources + * statement and the compiler-generated {@code finally} block + * which closes the resource. + * + * In these situations, only one of the thrown exceptions can be + * propagated. In the {@code try}-with-resources statement, when + * there are two such exceptions, the exception originating from + * the {@code try} block is propagated and the exception from the + * {@code finally} block is added to the list of exceptions + * suppressed by the exception from the {@code try} block. As an + * exception unwinds the stack, it can accumulate multiple + * suppressed exceptions. + * + *

An exception may have suppressed exceptions while also being + * caused by another exception. Whether or not an exception has a + * cause is semantically known at the time of its creation, unlike + * whether or not an exception will suppress other exceptions + * which is typically only determined after an exception is + * thrown. + * + *

Note that programmer written code is also able to take + * advantage of calling this method in situations where there are + * multiple sibling exceptions and only one can be propagated. * * @param exception the exception to be added to the list of * suppressed exceptions From 29627db74652586d9925e1f3d6c6483b002f571d Mon Sep 17 00:00:00 2001 From: Joshua Bloch Date: Fri, 25 Mar 2011 18:47:57 -0700 Subject: [PATCH 060/168] 7031376: Typos in javadoc of TimSort classes Reviewed-by: darcy --- jdk/src/share/classes/java/util/ComparableTimSort.java | 2 +- jdk/src/share/classes/java/util/TimSort.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/util/ComparableTimSort.java b/jdk/src/share/classes/java/util/ComparableTimSort.java index f78ee9a2efc..22427a2d353 100644 --- a/jdk/src/share/classes/java/util/ComparableTimSort.java +++ b/jdk/src/share/classes/java/util/ComparableTimSort.java @@ -241,7 +241,7 @@ class ComparableTimSort { * pivot < all in [left, start), so pivot belongs at left. Note * that if there are elements equal to pivot, left points to the * first slot after them -- that's why this sort is stable. - * Slide elements over to make room to make room for pivot. + * Slide elements over to make room for pivot. */ int n = start - left; // The number of elements to move // Switch is just an optimization for arraycopy in default case diff --git a/jdk/src/share/classes/java/util/TimSort.java b/jdk/src/share/classes/java/util/TimSort.java index f55a6b2136a..0c2e1ec25c4 100644 --- a/jdk/src/share/classes/java/util/TimSort.java +++ b/jdk/src/share/classes/java/util/TimSort.java @@ -274,7 +274,7 @@ class TimSort { * pivot < all in [left, start), so pivot belongs at left. Note * that if there are elements equal to pivot, left points to the * first slot after them -- that's why this sort is stable. - * Slide elements over to make room to make room for pivot. + * Slide elements over to make room for pivot. */ int n = start - left; // The number of elements to move // Switch is just an optimization for arraycopy in default case From e4e3b2b0d7215a7f8ef9f1b42d947299c67ec61d Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Fri, 25 Mar 2011 18:50:10 -0700 Subject: [PATCH 061/168] 7022204: LogFile wildcarding should use %p instead of star Reviewed-by: coleenp, jrose --- hotspot/src/share/vm/utilities/ostream.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp index 26e630a187c..02fda35daaf 100644 --- a/hotspot/src/share/vm/utilities/ostream.cpp +++ b/hotspot/src/share/vm/utilities/ostream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -424,6 +424,15 @@ static const char* make_log_name(const char* log_name, const char* force_directo const char* star = strchr(basename, '*'); int star_pos = (star == NULL) ? -1 : (star - nametail); + int skip = 1; + if (star == NULL) { + // Try %p + star = strstr(basename, "%p"); + if (star != NULL) { + skip = 2; + } + } + star_pos = (star == NULL) ? -1 : (star - nametail); char pid[32]; if (star_pos >= 0) { @@ -442,11 +451,11 @@ static const char* make_log_name(const char* log_name, const char* force_directo } if (star_pos >= 0) { - // convert foo*bar.log to foo123bar.log + // convert foo*bar.log or foo%pbar.log to foo123bar.log int buf_pos = (int) strlen(buf); strncpy(&buf[buf_pos], nametail, star_pos); strcpy(&buf[buf_pos + star_pos], pid); - nametail += star_pos + 1; // skip prefix and star + nametail += star_pos + skip; // skip prefix and pid format } strcat(buf, nametail); // append rest of name, or all of name @@ -466,7 +475,7 @@ void defaultStream::init_log() { // Note: This feature is for maintainer use only. No need for L10N. jio_print(warnbuf); FREE_C_HEAP_ARRAY(char, try_name); - try_name = make_log_name("hs_pid*.log", os::get_temp_directory()); + try_name = make_log_name("hs_pid%p.log", os::get_temp_directory()); jio_snprintf(warnbuf, sizeof(warnbuf), "Warning: Forcing option -XX:LogFile=%s\n", try_name); jio_print(warnbuf); From 5387ee459e7846fdc75b387b9fa9634e84ae671f Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Sun, 27 Mar 2011 00:00:14 -0700 Subject: [PATCH 062/168] 7024475: loop doesn't terminate when compiled Reviewed-by: kvn --- .../src/share/vm/compiler/compileBroker.cpp | 8 +++ .../src/share/vm/opto/idealGraphPrinter.cpp | 48 ++++++++++++- .../src/share/vm/opto/idealGraphPrinter.hpp | 11 +-- hotspot/src/share/vm/opto/loopTransform.cpp | 47 +++++++++--- hotspot/src/share/vm/opto/loopnode.cpp | 6 +- hotspot/src/share/vm/opto/node.cpp | 28 ++++---- hotspot/src/share/vm/runtime/globals.hpp | 3 + .../test/compiler/7024475/Test7024475.java | 71 +++++++++++++++++++ 8 files changed, 185 insertions(+), 37 deletions(-) create mode 100644 hotspot/test/compiler/7024475/Test7024475.java diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 0d90e11d289..2e08de058f0 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -874,6 +874,14 @@ void CompileBroker::compile_method_base(methodHandle method, return; } +#ifndef PRODUCT + if (osr_bci != -1 && !FLAG_IS_DEFAULT(OSROnlyBCI)) { + if ((OSROnlyBCI > 0) ? (OSROnlyBCI != osr_bci) : (-OSROnlyBCI == osr_bci)) { + // Positive OSROnlyBCI means only compile that bci. Negative means don't compile that BCI. + return; + } + } +#endif // If this method is already in the compile queue, then // we do not block the current thread. diff --git a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp index 212880c0718..40874ba7ded 100644 --- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp +++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -599,11 +599,35 @@ void IdealGraphPrinter::visit_node(Node *n, void *param) { if (caller != NULL) { stringStream bciStream; + ciMethod* last = NULL; + int last_bci; while(caller) { + if (caller->has_method()) { + last = caller->method(); + last_bci = caller->bci(); + } bciStream.print("%d ", caller->bci()); caller = caller->caller(); } print_prop("bci", bciStream.as_string()); + if (last != NULL && last->has_linenumber_table() && last_bci >= 0) { + print_prop("line", last->line_number_from_bci(last_bci)); + } + } + + if (node->debug_orig() != NULL) { + stringStream dorigStream; + Node* dorig = node->debug_orig(); + if (dorig) { + dorigStream.print("%d ", dorig->_idx); + Node* first = dorig; + dorig = first->debug_orig(); + while (dorig && dorig != first) { + dorigStream.print("%d ", dorig->_idx); + dorig = dorig->debug_orig(); + } + } + print_prop("debug_orig", dorigStream.as_string()); } if (_chaitin && _chaitin != (PhaseChaitin *)0xdeadbeef) { @@ -628,6 +652,17 @@ void IdealGraphPrinter::walk_nodes(Node *start, void *param) { GrowableArray nodeStack(Thread::current()->resource_area(), 0, 0, NULL); nodeStack.push(start); visited.test_set(start->_idx); + if (C->cfg() != NULL) { + // once we have a CFG there are some nodes that aren't really + // reachable but are in the CFG so add them here. + for (uint i = 0; i < C->cfg()->_blocks.size(); i++) { + Block *b = C->cfg()->_blocks[i]; + for (uint s = 0; s < b->_nodes.size(); s++) { + nodeStack.push(b->_nodes[s]); + } + } + } + while(nodeStack.length() > 0) { Node *n = nodeStack.pop(); @@ -686,16 +721,23 @@ void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, in end_head(); head(SUCCESSORS_ELEMENT); - for (uint s = 0; s < C->cfg()->_blocks[i]->_num_succs; s++) { + for (uint s = 0; s < b->_num_succs; s++) { begin_elem(SUCCESSOR_ELEMENT); print_attr(BLOCK_NAME_PROPERTY, b->_succs[s]->_pre_order); end_elem(); } tail(SUCCESSORS_ELEMENT); + head(NODES_ELEMENT); + for (uint s = 0; s < b->_nodes.size(); s++) { + begin_elem(NODE_ELEMENT); + print_attr(NODE_ID_PROPERTY, get_node_id(b->_nodes[s])); + end_elem(); + } + tail(NODES_ELEMENT); + tail(BLOCK_ELEMENT); } - tail(CONTROL_FLOW_ELEMENT); } tail(GRAPH_ELEMENT); diff --git a/hotspot/src/share/vm/opto/idealGraphPrinter.hpp b/hotspot/src/share/vm/opto/idealGraphPrinter.hpp index 9c8807a4721..6115e6d385c 100644 --- a/hotspot/src/share/vm/opto/idealGraphPrinter.hpp +++ b/hotspot/src/share/vm/opto/idealGraphPrinter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -43,15 +43,6 @@ class ciMethod; class IdealGraphPrinter { -private: - - enum State - { - Invalid, - Valid, - New - }; - private: static const char *INDENT; diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index dfccee43d48..ce4a028058a 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -1608,15 +1608,7 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) { return false; // Malformed loop if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue)))) return false; // Infinite loop -#ifndef PRODUCT - if (PrintOpto) { - tty->print("Removing empty loop"); - this->dump_head(); - } else if (TraceLoopOpts) { - tty->print("Empty "); - this->dump_head(); - } -#endif + #ifdef ASSERT // Ensure only one phi which is the iv. Node* iv = NULL; @@ -1629,6 +1621,43 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) { } assert(iv == cl->phi(), "Wrong phi" ); #endif + + // main and post loops have explicitly created zero trip guard + bool needs_guard = !cl->is_main_loop() && !cl->is_post_loop(); + if (needs_guard) { + // Check for an obvious zero trip guard. + Node* inctrl = cl->in(LoopNode::EntryControl); + if (inctrl->Opcode() == Op_IfTrue) { + // The test should look like just the backedge of a CountedLoop + Node* iff = inctrl->in(0); + if (iff->is_If()) { + Node* bol = iff->in(1); + if (bol->is_Bool() && bol->as_Bool()->_test._test == cl->loopexit()->test_trip()) { + Node* cmp = bol->in(1); + if (cmp->is_Cmp() && cmp->in(1) == cl->init_trip() && cmp->in(2) == cl->limit()) { + needs_guard = false; + } + } + } + } + } + +#ifndef PRODUCT + if (PrintOpto) { + tty->print("Removing empty loop with%s zero trip guard", needs_guard ? "out" : ""); + this->dump_head(); + } else if (TraceLoopOpts) { + tty->print("Empty with%s zero trip guard ", needs_guard ? "out" : ""); + this->dump_head(); + } +#endif + + if (needs_guard) { + // Peel the loop to ensure there's a zero trip guard + Node_List old_new; + phase->do_peeling(this, old_new); + } + // Replace the phi at loop head with the final value of the last // iteration. Then the CountedLoopEnd will collapse (backedge never // taken) and all loop-invariant uses of the exit values will be correct. diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp index cfcea4c6f09..894a105e841 100644 --- a/hotspot/src/share/vm/opto/loopnode.cpp +++ b/hotspot/src/share/vm/opto/loopnode.cpp @@ -1064,8 +1064,6 @@ bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) { // Cache parts in locals for easy PhaseIterGVN &igvn = phase->_igvn; - phase->C->print_method("Before beautify loops", 3); - igvn.hash_delete(_head); // Yank from hash before hacking edges // Check for multiple fall-in paths. Peel off a landing pad if need be. @@ -1547,6 +1545,7 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) { ResourceMark rm; int old_progress = C->major_progress(); + uint orig_worklist_size = _igvn._worklist.size(); // Reset major-progress flag for the driver's heuristics C->clear_major_progress(); @@ -1610,6 +1609,7 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) { // Split shared headers and insert loop landing pads. // Do not bother doing this on the Root loop of course. if( !_verify_me && !_verify_only && _ltree_root->_child ) { + C->print_method("Before beautify loops", 3); if( _ltree_root->_child->beautify_loops( this ) ) { // Re-build loop tree! _ltree_root->_child = NULL; @@ -1694,7 +1694,7 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) { for (int i = 0; i < old_progress; i++) C->set_major_progress(); assert(C->unique() == unique, "verification mode made Nodes? ? ?"); - assert(_igvn._worklist.size() == 0, "shouldn't push anything"); + assert(_igvn._worklist.size() == orig_worklist_size, "shouldn't push anything"); return; } diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index 8174605f4e5..a6d87f06ae2 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -1373,12 +1373,12 @@ static inline bool NotANode(const Node* n) { //------------------------------find------------------------------------------ // Find a neighbor of this Node with the given _idx // If idx is negative, find its absolute value, following both _in and _out. -static void find_recur( Node* &result, Node *n, int idx, bool only_ctrl, - VectorSet &old_space, VectorSet &new_space ) { +static void find_recur(Compile* C, Node* &result, Node *n, int idx, bool only_ctrl, + VectorSet* old_space, VectorSet* new_space ) { int node_idx = (idx >= 0) ? idx : -idx; if (NotANode(n)) return; // Gracefully handle NULL, -1, 0xabababab, etc. - // Contained in new_space or old_space? - VectorSet *v = Compile::current()->node_arena()->contains(n) ? &new_space : &old_space; + // Contained in new_space or old_space? Check old_arena first since it's mostly empty. + VectorSet *v = C->old_arena()->contains(n) ? old_space : new_space; if( v->test(n->_idx) ) return; if( (int)n->_idx == node_idx debug_only(|| n->debug_idx() == node_idx) ) { @@ -1390,19 +1390,23 @@ static void find_recur( Node* &result, Node *n, int idx, bool only_ctrl, v->set(n->_idx); for( uint i=0; ilen(); i++ ) { if( only_ctrl && !(n->is_Region()) && (n->Opcode() != Op_Root) && (i != TypeFunc::Control) ) continue; - find_recur( result, n->in(i), idx, only_ctrl, old_space, new_space ); + find_recur(C, result, n->in(i), idx, only_ctrl, old_space, new_space ); } // Search along forward edges also: if (idx < 0 && !only_ctrl) { for( uint j=0; joutcnt(); j++ ) { - find_recur( result, n->raw_out(j), idx, only_ctrl, old_space, new_space ); + find_recur(C, result, n->raw_out(j), idx, only_ctrl, old_space, new_space ); } } #ifdef ASSERT - // Search along debug_orig edges last: - for (Node* orig = n->debug_orig(); orig != NULL && n != orig; orig = orig->debug_orig()) { - if (NotANode(orig)) break; - find_recur( result, orig, idx, only_ctrl, old_space, new_space ); + // Search along debug_orig edges last, checking for cycles + Node* orig = n->debug_orig(); + if (orig != NULL) { + do { + if (NotANode(orig)) break; + find_recur(C, result, orig, idx, only_ctrl, old_space, new_space ); + orig = orig->debug_orig(); + } while (orig != NULL && orig != n->debug_orig()); } #endif //ASSERT } @@ -1417,7 +1421,7 @@ Node* Node::find(int idx) const { ResourceArea *area = Thread::current()->resource_area(); VectorSet old_space(area), new_space(area); Node* result = NULL; - find_recur( result, (Node*) this, idx, false, old_space, new_space ); + find_recur(Compile::current(), result, (Node*) this, idx, false, &old_space, &new_space ); return result; } @@ -1427,7 +1431,7 @@ Node* Node::find_ctrl(int idx) const { ResourceArea *area = Thread::current()->resource_area(); VectorSet old_space(area), new_space(area); Node* result = NULL; - find_recur( result, (Node*) this, idx, true, old_space, new_space ); + find_recur(Compile::current(), result, (Node*) this, idx, true, &old_space, &new_space ); return result; } #endif diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index cd320ba6fc8..10c687879fe 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -2377,6 +2377,9 @@ class CommandLineFlags { develop(intx, CICloneLoopTestLimit, 100, \ "size limit for blocks heuristically cloned in ciTypeFlow") \ \ + develop(intx, OSROnlyBCI, -1, \ + "OSR only at this bci. Negative values mean exclude that bci") \ + \ /* temp diagnostics */ \ \ diagnostic(bool, TraceRedundantCompiles, false, \ diff --git a/hotspot/test/compiler/7024475/Test7024475.java b/hotspot/test/compiler/7024475/Test7024475.java new file mode 100644 index 00000000000..2f3b2e06c9f --- /dev/null +++ b/hotspot/test/compiler/7024475/Test7024475.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/** + * @test + * @bug 7024475 + * @summary loop doesn't terminate when compiled + * + * @run main Test7024475 + */ + +public class Test7024475 { + + static int i; + static int x1; + static int[] bucket_B; + + static void test(Test7024475 test, int i, int c0, int j, int c1) { + for (;;) { + if (c1 > c0) { + if (c0 > 253) { + throw new InternalError("c0 = " + c0); + } + int index = c0 * 256 + c1; + if (index == -1) return; + i = bucket_B[index]; + if (1 < j - i && test != null) + x1 = 0; + j = i; + c1--; + } else { + c0--; + if (j <= 0) + break; + c1 = 255; + } + } + } + + public static void main(String args[]) { + Test7024475 t = new Test7024475(); + bucket_B = new int[256*256]; + for (int i = 1; i < 256*256; i++) { + bucket_B[i] = 1; + } + for (int n = 0; n < 100000; n++) { + test(t, 2, 85, 1, 134); + } + } +} From ab263062ef5e9382f4279e15fe660ddc362c94fe Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Sun, 27 Mar 2011 15:51:44 +0400 Subject: [PATCH 063/168] 6985593: Crash in Java_sun_java2d_loops_MaskBlit_MaskBlit on oel5.5-x64 Reviewed-by: ceisserer, jgodinez, prr --- .../classes/sun/java2d/xr/XRPMBlitLoops.java | 3 +- jdk/test/sun/java2d/XRenderBlitsTest.java | 94 +++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 jdk/test/sun/java2d/XRenderBlitsTest.java diff --git a/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java b/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java index 7b5d37d95d4..aaa48af2e16 100644 --- a/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java +++ b/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java @@ -143,7 +143,8 @@ public class XRPMBlitLoops { Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType); XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface(); - swToSurfaceBlit.Blit(src, vImgSurface, null, null, sx, sy, 0, 0, w, h); + swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null, + sx, sy, 0, 0, w, h); return vImgSurface; } diff --git a/jdk/test/sun/java2d/XRenderBlitsTest.java b/jdk/test/sun/java2d/XRenderBlitsTest.java new file mode 100644 index 00000000000..bcab57e71f9 --- /dev/null +++ b/jdk/test/sun/java2d/XRenderBlitsTest.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* +* @test +* @bug 6985593 +* @summary Test verifies that rendering standard images to screen does +* not caiuse a crash in case of XRender. +* @run main/othervm -Dsun.java2d.xrender=True XRenderBlitsTest +*/ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.concurrent.CountDownLatch; + +public class XRenderBlitsTest { + + private static final int w = 10; + private static final int h = 10; + + public static void main(String[] args) { + final CountDownLatch done = new CountDownLatch(1); + + final ArrayList images = new ArrayList(); + + int type = BufferedImage.TYPE_INT_RGB; + do { + BufferedImage img = new BufferedImage(w, h, type++); + Graphics2D g2d = img.createGraphics(); + g2d.setColor(Color.pink); + g2d.fillRect(0, 0, w, h); + g2d.dispose(); + + images.add(img); + } while (type <= BufferedImage.TYPE_BYTE_INDEXED); + + Frame f = new Frame("Draw images"); + Component c = new Component() { + + @Override + public Dimension getPreferredSize() { + return new Dimension(w * images.size(), h); + } + + @Override + public void paint(Graphics g) { + int x = 0; + for (BufferedImage img : images) { + System.out.println("Draw image " + img.getType()); + g.drawImage(img, x, 0, this); + x += w; + } + done.countDown(); + } + }; + f.add("Center", c); + f.pack(); + f.setVisible(true); + + // now wait for test results + try { + done.await(); + } catch (InterruptedException e) { + } + System.out.println("Test passed"); + f.dispose(); + } +} From 36303f61b69f5e672e7da3812e03e8337ee66f82 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Sun, 27 Mar 2011 13:17:37 -0700 Subject: [PATCH 064/168] 6964776: c2 should ensure the polling page is reachable on 64 bit Materialize the pointer to the polling page in a register instead of using rip-relative addressing when the distance from the code cache is larger than disp32. Reviewed-by: never, kvn --- hotspot/src/cpu/x86/vm/assembler_x86.cpp | 25 +- hotspot/src/cpu/x86/vm/assembler_x86.hpp | 8 +- .../src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 36 ++- hotspot/src/cpu/x86/vm/nativeInst_x86.hpp | 31 ++- hotspot/src/cpu/x86/vm/relocInfo_x86.cpp | 59 ++--- hotspot/src/cpu/x86/vm/x86_64.ad | 222 +++++++++--------- 6 files changed, 204 insertions(+), 177 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index d621a3cbff9..884dcc26985 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -3510,7 +3510,6 @@ bool Assembler::reachable(AddressLiteral adr) { // anywhere in the codeCache then we are always reachable. // This would have to change if we ever save/restore shared code // to be more pessimistic. - disp = (int64_t)adr._target - ((int64_t)CodeCache::low_bound() + sizeof(int)); if (!is_simm32(disp)) return false; disp = (int64_t)adr._target - ((int64_t)CodeCache::high_bound() + sizeof(int)); @@ -3534,6 +3533,14 @@ bool Assembler::reachable(AddressLiteral adr) { return is_simm32(disp); } +// Check if the polling page is not reachable from the code cache using rip-relative +// addressing. +bool Assembler::is_polling_page_far() { + intptr_t addr = (intptr_t)os::get_polling_page(); + return !is_simm32(addr - (intptr_t)CodeCache::low_bound()) || + !is_simm32(addr - (intptr_t)CodeCache::high_bound()); +} + void Assembler::emit_data64(jlong data, relocInfo::relocType rtype, int format) { @@ -6886,6 +6893,11 @@ void MacroAssembler::sign_extend_short(Register reg) { } } +void MacroAssembler::testl(Register dst, AddressLiteral src) { + assert(reachable(src), "Address should be reachable"); + testl(dst, as_Address(src)); +} + ////////////////////////////////////////////////////////////////////////////////// #ifndef SERIALGC @@ -7121,17 +7133,6 @@ void MacroAssembler::subptr(Register dst, Register src) { LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src)); } -void MacroAssembler::test32(Register src1, AddressLiteral src2) { - // src2 must be rval - - if (reachable(src2)) { - testl(src1, as_Address(src2)); - } else { - lea(rscratch1, src2); - testl(src1, Address(rscratch1, 0)); - } -} - // C++ bool manipulation void MacroAssembler::testbool(Register dst) { if(sizeof(bool) == 1) diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index 807559e06d1..6a69a260822 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -580,7 +580,6 @@ private: void emit_data64(jlong data, relocInfo::relocType rtype, int format = 0); void emit_data64(jlong data, RelocationHolder const& rspec, int format = 0); - bool reachable(AddressLiteral adr) NOT_LP64({ return true;}); // These are all easily abused and hence protected @@ -683,6 +682,8 @@ private: static bool is_simm32(int32_t x) { return true; } #endif // _LP64 + static bool is_polling_page_far() NOT_LP64({ return false;}); + // Generic instructions // Does 32bit or 64bit as needed for the platform. In some sense these // belong in macro assembler but there is no need for both varieties to exist @@ -2094,7 +2095,10 @@ class MacroAssembler: public Assembler { void leal32(Register dst, Address src) { leal(dst, src); } - void test32(Register src1, AddressLiteral src2); + // Import other testl() methods from the parent class or else + // they will be hidden by the following overriding declaration. + using Assembler::testl; + void testl(Register dst, AddressLiteral src); void orptr(Register dst, Address src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); } void orptr(Register dst, Register src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); } diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index 206edd52b6f..7ac7255c126 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -648,12 +648,13 @@ void LIR_Assembler::return_op(LIR_Opr result) { AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), relocInfo::poll_return_type); - // NOTE: the requires that the polling page be reachable else the reloc - // goes to the movq that loads the address and not the faulting instruction - // which breaks the signal handler code - - __ test32(rax, polling_page); - + if (Assembler::is_polling_page_far()) { + __ lea(rscratch1, polling_page); + __ relocate(relocInfo::poll_return_type); + __ testl(rax, Address(rscratch1, 0)); + } else { + __ testl(rax, polling_page); + } __ ret(0); } @@ -661,20 +662,17 @@ void LIR_Assembler::return_op(LIR_Opr result) { int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) { AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), relocInfo::poll_type); - - if (info != NULL) { - add_debug_info_for_branch(info); - } else { - ShouldNotReachHere(); - } - + guarantee(info != NULL, "Shouldn't be NULL"); int offset = __ offset(); - - // NOTE: the requires that the polling page be reachable else the reloc - // goes to the movq that loads the address and not the faulting instruction - // which breaks the signal handler code - - __ test32(rax, polling_page); + if (Assembler::is_polling_page_far()) { + __ lea(rscratch1, polling_page); + offset = __ offset(); + add_debug_info_for_branch(info); + __ testl(rax, Address(rscratch1, 0)); + } else { + add_debug_info_for_branch(info); + __ testl(rax, polling_page); + } return offset; } diff --git a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp index d41bcccdb31..fc7a1ab0753 100644 --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -519,7 +519,11 @@ class NativeReturnX: public NativeInstruction { class NativeTstRegMem: public NativeInstruction { public: enum Intel_specific_constants { - instruction_code_memXregl = 0x85 + instruction_rex_prefix_mask = 0xF0, + instruction_rex_prefix = Assembler::REX, + instruction_code_memXregl = 0x85, + modrm_mask = 0x38, // select reg from the ModRM byte + modrm_reg = 0x00 // rax }; }; @@ -533,12 +537,25 @@ inline bool NativeInstruction::is_cond_jump() { return (int_at(0) & 0xF0FF) = (ubyte_at(0) & 0xF0) == 0x70; /* short jump */ } inline bool NativeInstruction::is_safepoint_poll() { #ifdef AMD64 - if ( ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && - ubyte_at(1) == 0x05 ) { // 00 rax 101 - address fault = addr_at(6) + int_at(2); - return os::is_poll_address(fault); + if (Assembler::is_polling_page_far()) { + // two cases, depending on the choice of the base register in the address. + if (((ubyte_at(0) & NativeTstRegMem::instruction_rex_prefix_mask) == NativeTstRegMem::instruction_rex_prefix && + ubyte_at(1) == NativeTstRegMem::instruction_code_memXregl && + (ubyte_at(2) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) || + ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && + (ubyte_at(1) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) { + return true; + } else { + return false; + } } else { - return false; + if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl && + ubyte_at(1) == 0x05) { // 00 rax 101 + address fault = addr_at(6) + int_at(2); + return os::is_poll_address(fault); + } else { + return false; + } } #else return ( ubyte_at(0) == NativeMovRegMem::instruction_code_mem2reg || diff --git a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp index 1f907533d48..67c98e26ce9 100644 --- a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp +++ b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 @@ -198,41 +198,44 @@ void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { #ifdef _LP64 - typedef Assembler::WhichOperand WhichOperand; - WhichOperand which = (WhichOperand) format(); - // This format is imm but it is really disp32 - which = Assembler::disp32_operand; - address orig_addr = old_addr_for(addr(), src, dest); - NativeInstruction* oni = nativeInstruction_at(orig_addr); - int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); - // This poll_addr is incorrect by the size of the instruction it is irrelevant - intptr_t poll_addr = (intptr_t)oni + *orig_disp; + if (!Assembler::is_polling_page_far()) { + typedef Assembler::WhichOperand WhichOperand; + WhichOperand which = (WhichOperand) format(); + // This format is imm but it is really disp32 + which = Assembler::disp32_operand; + address orig_addr = old_addr_for(addr(), src, dest); + NativeInstruction* oni = nativeInstruction_at(orig_addr); + int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); + // This poll_addr is incorrect by the size of the instruction it is irrelevant + intptr_t poll_addr = (intptr_t)oni + *orig_disp; - NativeInstruction* ni = nativeInstruction_at(addr()); - intptr_t new_disp = poll_addr - (intptr_t) ni; - - int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); - * disp = (int32_t)new_disp; + NativeInstruction* ni = nativeInstruction_at(addr()); + intptr_t new_disp = poll_addr - (intptr_t) ni; + int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); + * disp = (int32_t)new_disp; + } #endif // _LP64 } void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { #ifdef _LP64 - typedef Assembler::WhichOperand WhichOperand; - WhichOperand which = (WhichOperand) format(); - // This format is imm but it is really disp32 - which = Assembler::disp32_operand; - address orig_addr = old_addr_for(addr(), src, dest); - NativeInstruction* oni = nativeInstruction_at(orig_addr); - int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); - // This poll_addr is incorrect by the size of the instruction it is irrelevant - intptr_t poll_addr = (intptr_t)oni + *orig_disp; + if (!Assembler::is_polling_page_far()) { + typedef Assembler::WhichOperand WhichOperand; + WhichOperand which = (WhichOperand) format(); + // This format is imm but it is really disp32 + which = Assembler::disp32_operand; + address orig_addr = old_addr_for(addr(), src, dest); + NativeInstruction* oni = nativeInstruction_at(orig_addr); + int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); + // This poll_addr is incorrect by the size of the instruction it is irrelevant + intptr_t poll_addr = (intptr_t)oni + *orig_disp; - NativeInstruction* ni = nativeInstruction_at(addr()); - intptr_t new_disp = poll_addr - (intptr_t) ni; + NativeInstruction* ni = nativeInstruction_at(addr()); + intptr_t new_disp = poll_addr - (intptr_t) ni; - int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); - * disp = (int32_t)new_disp; + int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); + * disp = (int32_t)new_disp; + } #endif // _LP64 } diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index b0835d208de..a4ec7f6cfbf 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -574,12 +574,11 @@ int MachCallDynamicJavaNode::ret_addr_offset() // In os_cpu .ad file // int MachCallRuntimeNode::ret_addr_offset() -// Indicate if the safepoint node needs the polling page as an input. -// Since amd64 does not have absolute addressing but RIP-relative -// addressing and the polling page is within 2G, it doesn't. +// Indicate if the safepoint node needs the polling page as an input, +// it does if the polling page is more than disp32 away. bool SafePointNode::needs_polling_address_input() { - return false; + return Assembler::is_polling_page_far(); } // @@ -992,15 +991,21 @@ void MachEpilogNode::format(PhaseRegAlloc* ra_, outputStream* st) const framesize -= 2*wordSize; if (framesize) { - st->print_cr("addq\trsp, %d\t# Destroy frame", framesize); + st->print_cr("addq rsp, %d\t# Destroy frame", framesize); st->print("\t"); } - st->print_cr("popq\trbp"); + st->print_cr("popq rbp"); if (do_polling() && C->is_method_compilation()) { - st->print_cr("\ttestl\trax, [rip + #offset_to_poll_page]\t" - "# Safepoint: poll for GC"); st->print("\t"); + if (Assembler::is_polling_page_far()) { + st->print_cr("movq rscratch1, #polling_page_address\n\t" + "testl rax, [rscratch1]\t" + "# Safepoint: poll for GC"); + } else { + st->print_cr("testl rax, [rip + #offset_to_poll_page]\t" + "# Safepoint: poll for GC"); + } } } #endif @@ -1033,45 +1038,22 @@ void MachEpilogNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const emit_opcode(cbuf, 0x58 | RBP_enc); if (do_polling() && C->is_method_compilation()) { - // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes - // XXX reg_mem doesn't support RIP-relative addressing yet - cbuf.set_insts_mark(); - cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_return_type, 0); // XXX - emit_opcode(cbuf, 0x85); // testl - emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5 - // cbuf.insts_mark() is beginning of instruction - emit_d32_reloc(cbuf, os::get_polling_page()); -// relocInfo::poll_return_type, + MacroAssembler _masm(&cbuf); + AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type); + if (Assembler::is_polling_page_far()) { + __ lea(rscratch1, polling_page); + __ relocate(relocInfo::poll_return_type); + __ testl(rax, Address(rscratch1, 0)); + } else { + __ testl(rax, polling_page); + } } } uint MachEpilogNode::size(PhaseRegAlloc* ra_) const { - Compile* C = ra_->C; - int framesize = C->frame_slots() << LogBytesPerInt; - assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); - // Remove word for return adr already pushed - // and RBP - framesize -= 2*wordSize; - - uint size = 0; - - if (do_polling() && C->is_method_compilation()) { - size += 6; - } - - // count popq rbp - size++; - - if (framesize) { - if (framesize < 0x80) { - size += 4; - } else if (framesize) { - size += 7; - } - } - - return size; + return MachNode::size(ra_); // too many variables; just compute it + // the hard way } int MachEpilogNode::reloc() const @@ -3410,8 +3392,8 @@ encode %{ } if (EmitSync & 1) { // Without cast to int32_t a movptr will destroy r10 which is typically obj - masm.movptr (Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ; - masm.cmpptr(rsp, (int32_t)NULL_WORD) ; + masm.movptr (Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ; + masm.cmpptr(rsp, (int32_t)NULL_WORD) ; } else if (EmitSync & 2) { Label DONE_LABEL; @@ -3439,10 +3421,10 @@ encode %{ } else { Label DONE_LABEL, IsInflated, Egress; - masm.movptr(tmpReg, Address(objReg, 0)) ; + masm.movptr(tmpReg, Address(objReg, 0)) ; masm.testl (tmpReg, 0x02) ; // inflated vs stack-locked|neutral|biased - masm.jcc (Assembler::notZero, IsInflated) ; - + masm.jcc (Assembler::notZero, IsInflated) ; + // it's stack-locked, biased or neutral // TODO: optimize markword triage order to reduce the number of // conditional branches in the most common cases. @@ -3456,9 +3438,9 @@ encode %{ } // was q will it destroy high? - masm.orl (tmpReg, 1) ; - masm.movptr(Address(boxReg, 0), tmpReg) ; - if (os::is_MP()) { masm.lock(); } + masm.orl (tmpReg, 1) ; + masm.movptr(Address(boxReg, 0), tmpReg) ; + if (os::is_MP()) { masm.lock(); } masm.cmpxchgptr(boxReg, Address(objReg, 0)); // Updates tmpReg if (_counters != NULL) { masm.cond_inc32(Assembler::equal, @@ -3485,16 +3467,16 @@ encode %{ // fetched _owner. If the CAS is successful we may // avoid an RTO->RTS upgrade on the $line. // Without cast to int32_t a movptr will destroy r10 which is typically obj - masm.movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ; + masm.movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ; - masm.mov (boxReg, tmpReg) ; - masm.movptr (tmpReg, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; - masm.testptr(tmpReg, tmpReg) ; - masm.jcc (Assembler::notZero, DONE_LABEL) ; + masm.mov (boxReg, tmpReg) ; + masm.movptr (tmpReg, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; + masm.testptr(tmpReg, tmpReg) ; + masm.jcc (Assembler::notZero, DONE_LABEL) ; // It's inflated and appears unlocked - if (os::is_MP()) { masm.lock(); } - masm.cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; + if (os::is_MP()) { masm.lock(); } + masm.cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; // Intentional fall-through into DONE_LABEL ... masm.bind (DONE_LABEL) ; @@ -3513,8 +3495,8 @@ encode %{ Register tmpReg = as_Register($tmp$$reg); MacroAssembler masm(&cbuf); - if (EmitSync & 4) { - masm.cmpptr(rsp, 0) ; + if (EmitSync & 4) { + masm.cmpptr(rsp, 0) ; } else if (EmitSync & 8) { Label DONE_LABEL; @@ -3541,25 +3523,25 @@ encode %{ if (UseBiasedLocking && !UseOptoBiasInlining) { masm.biased_locking_exit(objReg, tmpReg, DONE_LABEL); } - - masm.movptr(tmpReg, Address(objReg, 0)) ; - masm.cmpptr(Address(boxReg, 0), (int32_t)NULL_WORD) ; - masm.jcc (Assembler::zero, DONE_LABEL) ; - masm.testl (tmpReg, 0x02) ; - masm.jcc (Assembler::zero, Stacked) ; - + + masm.movptr(tmpReg, Address(objReg, 0)) ; + masm.cmpptr(Address(boxReg, 0), (int32_t)NULL_WORD) ; + masm.jcc (Assembler::zero, DONE_LABEL) ; + masm.testl (tmpReg, 0x02) ; + masm.jcc (Assembler::zero, Stacked) ; + // It's inflated - masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; - masm.xorptr(boxReg, r15_thread) ; - masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ; - masm.jcc (Assembler::notZero, DONE_LABEL) ; - masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; - masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; - masm.jcc (Assembler::notZero, CheckSucc) ; - masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD) ; - masm.jmp (DONE_LABEL) ; - - if ((EmitSync & 65536) == 0) { + masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; + masm.xorptr(boxReg, r15_thread) ; + masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ; + masm.jcc (Assembler::notZero, DONE_LABEL) ; + masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; + masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; + masm.jcc (Assembler::notZero, CheckSucc) ; + masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD) ; + masm.jmp (DONE_LABEL) ; + + if ((EmitSync & 65536) == 0) { Label LSuccess, LGoSlowPath ; masm.bind (CheckSucc) ; masm.cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD) ; @@ -3591,9 +3573,9 @@ encode %{ masm.jmp (DONE_LABEL) ; } - masm.bind (Stacked) ; + masm.bind (Stacked) ; masm.movptr(tmpReg, Address (boxReg, 0)) ; // re-fetch - if (os::is_MP()) { masm.lock(); } + if (os::is_MP()) { masm.lock(); } masm.cmpxchgptr(tmpReg, Address(objReg, 0)); // Uses RAX which is box if (EmitSync & 65536) { @@ -3914,22 +3896,6 @@ encode %{ // done: %} - - // Safepoint Poll. This polls the safepoint page, and causes an - // exception if it is not readable. Unfortunately, it kills - // RFLAGS in the process. - enc_class enc_safepoint_poll - %{ - // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes - // XXX reg_mem doesn't support RIP-relative addressing yet - cbuf.set_insts_mark(); - cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0); // XXX - emit_opcode(cbuf, 0x85); // testl - emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5 - // cbuf.insts_mark() is beginning of instruction - emit_d32_reloc(cbuf, os::get_polling_page()); -// relocInfo::poll_type, - %} %} @@ -4233,6 +4199,15 @@ operand immP0() interface(CONST_INTER); %} +operand immP_poll() %{ + predicate(n->get_ptr() != 0 && n->get_ptr() == (intptr_t)os::get_polling_page()); + match(ConP); + + // formats are generated automatically for constants and base registers + format %{ %} + interface(CONST_INTER); +%} + // Pointer Immediate operand immN() %{ match(ConN); @@ -4840,7 +4815,7 @@ operand regF() %} // Double register operands -operand regD() +operand regD() %{ constraint(ALLOC_IN_RC(double_reg)); match(RegD); @@ -6568,6 +6543,16 @@ instruct loadConP0(rRegP dst, immP0 src, rFlagsReg cr) ins_pipe(ialu_reg); %} +instruct loadConP_poll(rRegP dst, immP_poll src) %{ + match(Set dst src); + format %{ "movq $dst, $src\t!ptr" %} + ins_encode %{ + AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type); + __ lea($dst$$Register, polling_page); + %} + ins_pipe(ialu_reg_fat); +%} + instruct loadConP31(rRegP dst, immP31 src, rFlagsReg cr) %{ match(Set dst src); @@ -7241,11 +7226,11 @@ instruct bytes_reverse_long(rRegL dst) %{ instruct bytes_reverse_unsigned_short(rRegI dst) %{ match(Set dst (ReverseBytesUS dst)); - format %{ "bswapl $dst\n\t" + format %{ "bswapl $dst\n\t" "shrl $dst,16\n\t" %} ins_encode %{ __ bswapl($dst$$Register); - __ shrl($dst$$Register, 16); + __ shrl($dst$$Register, 16); %} ins_pipe( ialu_reg ); %} @@ -7253,11 +7238,11 @@ instruct bytes_reverse_unsigned_short(rRegI dst) %{ instruct bytes_reverse_short(rRegI dst) %{ match(Set dst (ReverseBytesS dst)); - format %{ "bswapl $dst\n\t" + format %{ "bswapl $dst\n\t" "sar $dst,16\n\t" %} ins_encode %{ __ bswapl($dst$$Register); - __ sarl($dst$$Register, 16); + __ sarl($dst$$Register, 16); %} ins_pipe( ialu_reg ); %} @@ -7480,7 +7465,7 @@ instruct membar_volatile(rFlagsReg cr) %{ effect(KILL cr); ins_cost(400); - format %{ + format %{ $$template if (os::is_MP()) { $$emit$$"lock addl [rsp + #0], 0\t! membar_volatile" @@ -8291,7 +8276,7 @@ instruct storePConditional(memory heap_top_ptr, rFlagsReg cr) %{ match(Set cr (StorePConditional heap_top_ptr (Binary oldval newval))); - + format %{ "cmpxchgq $heap_top_ptr, $newval\t# (ptr) " "If rax == $heap_top_ptr then store $newval into $heap_top_ptr" %} opcode(0x0F, 0xB1); @@ -9854,9 +9839,9 @@ instruct xorI_rReg(rRegI dst, rRegI src, rFlagsReg cr) // Xor Register with Immediate -1 instruct xorI_rReg_im1(rRegI dst, immI_M1 imm) %{ - match(Set dst (XorI dst imm)); + match(Set dst (XorI dst imm)); - format %{ "not $dst" %} + format %{ "not $dst" %} ins_encode %{ __ notl($dst$$Register); %} @@ -10097,9 +10082,9 @@ instruct xorL_rReg(rRegL dst, rRegL src, rFlagsReg cr) // Xor Register with Immediate -1 instruct xorL_rReg_im1(rRegL dst, immL_M1 imm) %{ - match(Set dst (XorL dst imm)); + match(Set dst (XorL dst imm)); - format %{ "notq $dst" %} + format %{ "notq $dst" %} ins_encode %{ __ notq($dst$$Register); %} @@ -12473,14 +12458,33 @@ instruct cmpFastUnlock(rFlagsReg cr, // Safepoint Instructions instruct safePoint_poll(rFlagsReg cr) %{ + predicate(!Assembler::is_polling_page_far()); match(SafePoint); effect(KILL cr); - format %{ "testl rax, [rip + #offset_to_poll_page]\t" + format %{ "testl rax, [rip + #offset_to_poll_page]\t" "# Safepoint: poll for GC" %} - size(6); // Opcode + ModRM + Disp32 == 6 bytes ins_cost(125); - ins_encode(enc_safepoint_poll); + ins_encode %{ + AddressLiteral addr(os::get_polling_page(), relocInfo::poll_type); + __ testl(rax, addr); + %} + ins_pipe(ialu_reg_mem); +%} + +instruct safePoint_poll_far(rFlagsReg cr, rRegP poll) +%{ + predicate(Assembler::is_polling_page_far()); + match(SafePoint poll); + effect(KILL cr, USE poll); + + format %{ "testl rax, [$poll]\t" + "# Safepoint: poll for GC" %} + ins_cost(125); + ins_encode %{ + __ relocate(relocInfo::poll_type); + __ testl(rax, Address($poll$$Register, 0)); + %} ins_pipe(ialu_reg_mem); %} From e7b397be03a9051961cd3df0ca3505d6cec5d626 Mon Sep 17 00:00:00 2001 From: Yuka Kamiya Date: Mon, 28 Mar 2011 18:00:32 +0900 Subject: [PATCH 065/168] 6957870: Monospaced font mapped to proportional font (David) for Hebrew Reviewed-by: okutsu --- .../windows/classes/sun/awt/windows/fontconfig.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties b/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties index a7f59e52b8d..2a43e6e90d0 100644 --- a/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties +++ b/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties @@ -102,28 +102,28 @@ sansserif.bolditalic.korean=Gulim monospaced.plain.alphabetic=Courier New monospaced.plain.chinese-ms950=MingLiU monospaced.plain.chinese-ms950-extb=MingLiU-ExtB -monospaced.plain.hebrew=David +monospaced.plain.hebrew=Courier New monospaced.plain.japanese=MS Gothic monospaced.plain.korean=GulimChe monospaced.bold.alphabetic=Courier New Bold monospaced.bold.chinese-ms950=PMingLiU monospaced.bold.chinese-ms950-extb=PMingLiU-ExtB -monospaced.bold.hebrew=David Bold +monospaced.bold.hebrew=Courier New Bold monospaced.bold.japanese=MS Gothic monospaced.bold.korean=GulimChe monospaced.italic.alphabetic=Courier New Italic monospaced.italic.chinese-ms950=PMingLiU monospaced.italic.chinese-ms950-extb=PMingLiU-ExtB -monospaced.italic.hebrew=David +monospaced.italic.hebrew=Courier New monospaced.italic.japanese=MS Gothic monospaced.italic.korean=GulimChe monospaced.bolditalic.alphabetic=Courier New Bold Italic monospaced.bolditalic.chinese-ms950=PMingLiU monospaced.bolditalic.chinese-ms950-extb=PMingLiU-ExtB -monospaced.bolditalic.hebrew=David Bold +monospaced.bolditalic.hebrew=Courier New Bold monospaced.bolditalic.japanese=MS Gothic monospaced.bolditalic.korean=GulimChe From 1ce7eeaa523237c16b5133c9686015866987544d Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 28 Mar 2011 18:04:10 +0800 Subject: [PATCH 066/168] 7019384: Realm.getRealmsList returns realms list in wrong (reverse) order Reviewed-by: xuelei --- .../classes/sun/security/krb5/Realm.java | 32 +++++++++---------- jdk/test/sun/security/krb5/ParseCAPaths.java | 22 ++++++++----- jdk/test/sun/security/krb5/krb5-capaths.conf | 10 ++++++ 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/jdk/src/share/classes/sun/security/krb5/Realm.java b/jdk/src/share/classes/sun/security/krb5/Realm.java index f7b450ec6be..f148f868049 100644 --- a/jdk/src/share/classes/sun/security/krb5/Realm.java +++ b/jdk/src/share/classes/sun/security/krb5/Realm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -362,19 +362,15 @@ public class Realm implements Cloneable { Stack iStack = new Stack<>(); /* - * I don't expect any more than a handful of intermediaries. + * The half-established reversed-path, starting from the final target + * (sRealm), each item can be connected to by the next one. + * Might contains wrong item, if found, a bad track is performed */ Vector tempList = new Vector<>(8, 8); - - /* - * The initiator at first location. - */ - tempList.add(cRealm); + tempList.add(sRealm); int count = 0; // For debug only - if (DEBUG) { - tempTarget = sRealm; - } + tempTarget = sRealm; out: do { if (DEBUG) { @@ -384,8 +380,8 @@ public class Realm implements Cloneable { } if (intermediaries != null && - !intermediaries.equals(PrincipalName.REALM_COMPONENT_SEPARATOR_STR)) - { + !intermediaries.equals(".") && + !intermediaries.equals(cRealm)) { if (DEBUG) { System.out.println(">>> Realm parseCapaths: loop " + count + ": intermediaries=[" + @@ -466,11 +462,15 @@ public class Realm implements Cloneable { } while (true); + if (tempList.isEmpty()) { + return null; + } + + // From (SREALM, T1, T2) to (CREALM, T2, T1) retList = new String[tempList.size()]; - try { - retList = tempList.toArray(retList); - } catch (ArrayStoreException exc) { - retList = null; + retList[0] = cRealm; + for (int i=1; i " + to); diff --git a/jdk/test/sun/security/krb5/krb5-capaths.conf b/jdk/test/sun/security/krb5/krb5-capaths.conf index db672820b7d..eead02c0b34 100644 --- a/jdk/test/sun/security/krb5/krb5-capaths.conf +++ b/jdk/test/sun/security/krb5/krb5-capaths.conf @@ -85,3 +85,13 @@ I1.COM = { I3.COM = I2.COM I4.COM = I2.COM I5.COM } + +J1.COM = { + J2.COM=J1.COM +} + +A9.PRAGUE.XXX.CZ = { + PRAGUE.XXX.CZ = . + ROOT.XXX.CZ = PRAGUE.XXX.CZ + SERVIS.XXX.CZ = ROOT.XXX.CZ +} From 680370af5b0b872b27f5311b9ea529e260608c80 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 28 Mar 2011 18:04:17 +0800 Subject: [PATCH 067/168] 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports Reviewed-by: xuelei --- jdk/test/sun/security/jgss/GssNPE.java | 3 +- .../jgss/spnego/NoSpnegoAsDefMech.java | 3 +- jdk/test/sun/security/krb5/ConfPlusProp.java | 3 +- .../security/krb5/ConfigWithQuotations.java | 3 +- jdk/test/sun/security/krb5/DnsFallback.java | 3 +- jdk/test/sun/security/krb5/IPv6.java | 3 +- jdk/test/sun/security/krb5/ParseConfig.java | 3 +- jdk/test/sun/security/krb5/RFC396xTest.java | 3 +- jdk/test/sun/security/krb5/TimeInCCache.java | 3 +- .../krb5/auto/HttpNegotiateServer.java | 33 +++++++++---------- .../sun/security/krb5/etype/ETypeOrder.java | 3 +- .../sun/security/krb5/ktab/HighestKvno.java | 3 +- 12 files changed, 37 insertions(+), 29 deletions(-) diff --git a/jdk/test/sun/security/jgss/GssNPE.java b/jdk/test/sun/security/jgss/GssNPE.java index bacf60c5f34..d2723ba625c 100644 --- a/jdk/test/sun/security/jgss/GssNPE.java +++ b/jdk/test/sun/security/jgss/GssNPE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 @@ -24,6 +24,7 @@ /* * @test * @bug 6345338 + * @run main/othervm GssNPE * @summary GSS throws NPE when the JAAS config file does not exist */ diff --git a/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java b/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java index 13b9ee9d47b..998f50d339f 100644 --- a/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java +++ b/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -24,6 +24,7 @@ /* * @test * @bug 6770883 + * @run main/othervm NoSpnegoAsDefMech * @summary Infinite loop if SPNEGO specified as sun.security.jgss.mechanism */ diff --git a/jdk/test/sun/security/krb5/ConfPlusProp.java b/jdk/test/sun/security/krb5/ConfPlusProp.java index e29637b1b15..9fe1adcf455 100644 --- a/jdk/test/sun/security/krb5/ConfPlusProp.java +++ b/jdk/test/sun/security/krb5/ConfPlusProp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -25,6 +25,7 @@ * @bug 6857795 * @bug 6858589 * @bug 6972005 + * @run main/othervm ConfPlusProp * @summary krb5.conf ignored if system properties on realm and kdc are provided */ diff --git a/jdk/test/sun/security/krb5/ConfigWithQuotations.java b/jdk/test/sun/security/krb5/ConfigWithQuotations.java index adf3919b9a0..c1286f8cb3a 100644 --- a/jdk/test/sun/security/krb5/ConfigWithQuotations.java +++ b/jdk/test/sun/security/krb5/ConfigWithQuotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -23,6 +23,7 @@ /* * @test * @bug 6714845 + * @run main/othervm ConfigWithQuotations * @summary Quotes in Kerberos configuration file are included in the values */ diff --git a/jdk/test/sun/security/krb5/DnsFallback.java b/jdk/test/sun/security/krb5/DnsFallback.java index e305ac85699..3a48b05d837 100644 --- a/jdk/test/sun/security/krb5/DnsFallback.java +++ b/jdk/test/sun/security/krb5/DnsFallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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 @@ -24,6 +24,7 @@ * @test * @bug 6673164 * @bug 6552334 + * @run main/othervm DnsFallback * @summary fix dns_fallback parse error, and use dns by default */ diff --git a/jdk/test/sun/security/krb5/IPv6.java b/jdk/test/sun/security/krb5/IPv6.java index 4b4f2a88767..d1a8bf260bc 100644 --- a/jdk/test/sun/security/krb5/IPv6.java +++ b/jdk/test/sun/security/krb5/IPv6.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -24,6 +24,7 @@ /* * @test * @bug 6877357 6885166 + * @run main/othervm IPv6 * @summary IPv6 address does not work */ diff --git a/jdk/test/sun/security/krb5/ParseConfig.java b/jdk/test/sun/security/krb5/ParseConfig.java index d4aa590eb2a..43c5ce39f3a 100644 --- a/jdk/test/sun/security/krb5/ParseConfig.java +++ b/jdk/test/sun/security/krb5/ParseConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -23,6 +23,7 @@ /* * @test * @bug 6319046 + * @run main/othervm ParseConfig * @summary Problem with parsing krb5.conf */ diff --git a/jdk/test/sun/security/krb5/RFC396xTest.java b/jdk/test/sun/security/krb5/RFC396xTest.java index 2bd3f235a9f..76016c38817 100644 --- a/jdk/test/sun/security/krb5/RFC396xTest.java +++ b/jdk/test/sun/security/krb5/RFC396xTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -23,6 +23,7 @@ /* * @test * @bug 6862679 + * @run main/othervm RFC396xTest * @summary ESC: AD Authentication with user with umlauts fails */ diff --git a/jdk/test/sun/security/krb5/TimeInCCache.java b/jdk/test/sun/security/krb5/TimeInCCache.java index e0e420f33e0..6c33d2eae3f 100644 --- a/jdk/test/sun/security/krb5/TimeInCCache.java +++ b/jdk/test/sun/security/krb5/TimeInCCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -23,6 +23,7 @@ /* * @test * @bug 6590930 + * @run main/othervm TimeInCCache * @summary read/write does not match for ccache */ diff --git a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java index 423ef0d853d..aab6b92137e 100644 --- a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java +++ b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java @@ -74,11 +74,10 @@ public class HttpNegotiateServer { final static char[] WEB_PASS = "webby".toCharArray(); final static String PROXY_USER = "pro"; final static char[] PROXY_PASS = "proxy".toCharArray(); - final static int WEB_PORT = 17840; + final static String WEB_HOST = "host.web.domain"; final static String PROXY_HOST = "host.proxy.domain"; - final static int PROXY_PORT = 17841; // web page content final static String CONTENT = "Hello, World!"; @@ -86,18 +85,11 @@ public class HttpNegotiateServer { // For 6829283, count how many times the Authenticator is called. static int count = 0; + static int webPort, proxyPort; + // URLs for web test, proxy test. The proxy server is not a real proxy // since it fakes the same content for any URL. :) - final static URL webUrl, proxyUrl; - static { - URL u1 = null, u2 = null; - try { - u1 = new URL("http://" + WEB_HOST +":" + WEB_PORT + "/a/b/c"); - u2 = new URL("http://nosuchplace/a/b/c"); - } catch (Exception e) { - } - webUrl = u1; proxyUrl = u2; - } + static URL webUrl, proxyUrl; /** * This Authenticator checks everything: @@ -127,7 +119,7 @@ public class HttpNegotiateServer { if (!this.getRequestingHost().equalsIgnoreCase(PROXY_HOST)) { throw new RuntimeException("Bad host"); } - if (this.getRequestingPort() != PROXY_PORT) { + if (this.getRequestingPort() != proxyPort) { throw new RuntimeException("Bad port"); } if (!this.getRequestingURL().equals(proxyUrl)) { @@ -188,10 +180,15 @@ public class HttpNegotiateServer { fos.close(); f.deleteOnExit(); - HttpServer h1 = httpd(WEB_PORT, "Negotiate", false, + HttpServer h1 = httpd("Negotiate", false, "HTTP/" + WEB_HOST + "@" + REALM_WEB, KRB5_TAB); - HttpServer h2 = httpd(PROXY_PORT, "Negotiate", true, + webPort = h1.getAddress().getPort(); + HttpServer h2 = httpd("Negotiate", true, "HTTP/" + PROXY_HOST + "@" + REALM_PROXY, KRB5_TAB); + proxyPort = h2.getAddress().getPort(); + + webUrl = new URL("http://" + WEB_HOST +":" + webPort + "/a/b/c"); + proxyUrl = new URL("http://nosuchplace/a/b/c"); try { Exception e1 = null, e2 = null; @@ -230,7 +227,7 @@ public class HttpNegotiateServer { reader = new BufferedReader(new InputStreamReader( proxyUrl.openConnection( new Proxy(Proxy.Type.HTTP, - new InetSocketAddress(PROXY_HOST, PROXY_PORT))) + new InetSocketAddress(PROXY_HOST, proxyPort))) .getInputStream())); if (!reader.readLine().equals(CONTENT)) { throw new RuntimeException("Bad content"); @@ -258,10 +255,10 @@ public class HttpNegotiateServer { * @param principal the krb5 service principal the server runs with * @return the server */ - public static HttpServer httpd(int port, String scheme, boolean proxy, + public static HttpServer httpd(String scheme, boolean proxy, String principal, String ktab) throws Exception { MyHttpHandler h = new MyHttpHandler(); - HttpServer server = HttpServer.create(new InetSocketAddress(port), 0); + HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); HttpContext hc = server.createContext("/", h); hc.setAuthenticator(new MyServerAuthenticator( proxy, scheme, principal, ktab)); diff --git a/jdk/test/sun/security/krb5/etype/ETypeOrder.java b/jdk/test/sun/security/krb5/etype/ETypeOrder.java index cb854acf7f5..9437b16ed05 100644 --- a/jdk/test/sun/security/krb5/etype/ETypeOrder.java +++ b/jdk/test/sun/security/krb5/etype/ETypeOrder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -23,6 +23,7 @@ /* * @test * @bug 6844907 + * @run main/othervm ETypeOrder * @summary krb5 etype order should be from strong to weak */ diff --git a/jdk/test/sun/security/krb5/ktab/HighestKvno.java b/jdk/test/sun/security/krb5/ktab/HighestKvno.java index 9636bb1b576..92e3aebd630 100644 --- a/jdk/test/sun/security/krb5/ktab/HighestKvno.java +++ b/jdk/test/sun/security/krb5/ktab/HighestKvno.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -24,6 +24,7 @@ * @test * @bug 6867665 * @bug 6875033 + * @run main/othervm HighestKvno * @summary Problem with keytabs with multiple kvno's (key versions) */ From 66a08540c2eb6afd3d66bbbba30e90144bd13433 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Mon, 28 Mar 2011 12:48:08 +0200 Subject: [PATCH 068/168] 7031571: Generate native VS2010 project files Reviewed-by: hosterda, stefank, brutisso --- hotspot/make/windows/create.bat | 7 +- .../windows/makefiles/projectcreator.make | 5 +- hotspot/make/windows/makefiles/rules.make | 4 +- .../src/share/tools/ProjectCreator/Util.java | 12 - .../ProjectCreator/WinGammaPlatform.java | 7 +- .../ProjectCreator/WinGammaPlatformVC10.java | 545 ++++++++++++++++++ .../ProjectCreator/WinGammaPlatformVC7.java | 86 ++- 7 files changed, 597 insertions(+), 69 deletions(-) create mode 100644 hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java diff --git a/hotspot/make/windows/create.bat b/hotspot/make/windows/create.bat index 8d9c83aefab..ee4a1865e51 100644 --- a/hotspot/make/windows/create.bat +++ b/hotspot/make/windows/create.bat @@ -93,16 +93,15 @@ if "%MSC_VER%" == "1500" ( echo Will generate VC9 {Visual Studio 2008} ) else ( if "%MSC_VER%" == "1600" ( -echo Detected Visual Studio 2010, but -echo will generate VC9 {Visual Studio 2008} -echo Use conversion wizard in VS 2010. +echo Will generate VC10 {Visual Studio 2010} +set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj ) else ( echo Will generate VC7 project {Visual Studio 2003 .NET} ) ) ) ) -echo %ProjectFile% +echo %ProjectFile% echo ************************************************************** REM Test all variables to see whether the directories they diff --git a/hotspot/make/windows/makefiles/projectcreator.make b/hotspot/make/windows/makefiles/projectcreator.make index e7a9528c605..c73c215851d 100644 --- a/hotspot/make/windows/makefiles/projectcreator.make +++ b/hotspot/make/windows/makefiles/projectcreator.make @@ -27,10 +27,6 @@ # This is used externally by both batch and IDE builds, so can't # reference any of the HOTSPOTWORKSPACE, HOTSPOTBUILDSPACE, # HOTSPOTRELEASEBINDEST, or HOTSPOTDEBUGBINDEST environment variables. -# -# NOTE: unfortunately the ProjectCreatorSources list must be kept -# synchronized between this and the Solaris version -# (make/solaris/makefiles/projectcreator.make). ProjectCreatorSources=\ $(WorkSpace)\src\share\tools\ProjectCreator\DirectoryTree.java \ @@ -42,6 +38,7 @@ ProjectCreatorSources=\ $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC7.java \ $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC8.java \ $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC9.java \ + $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC10.java \ $(WorkSpace)\src\share\tools\ProjectCreator\Util.java \ $(WorkSpace)\src\share\tools\ProjectCreator\BuildConfig.java \ $(WorkSpace)\src\share\tools\ProjectCreator\ArgsParser.java diff --git a/hotspot/make/windows/makefiles/rules.make b/hotspot/make/windows/makefiles/rules.make index 4d884c1b71d..14bc0d5351a 100644 --- a/hotspot/make/windows/makefiles/rules.make +++ b/hotspot/make/windows/makefiles/rules.make @@ -65,8 +65,8 @@ VcVersion=VC9 !elseif "$(MSC_VER)" == "1600" -# for compatibility - we don't yet have a ProjectCreator for VC10 -VcVersion=VC9 +VcVersion=VC10 +ProjectFile=jvm.vcxproj !else diff --git a/hotspot/src/share/tools/ProjectCreator/Util.java b/hotspot/src/share/tools/ProjectCreator/Util.java index 18b2f57b7b8..466a099749d 100644 --- a/hotspot/src/share/tools/ProjectCreator/Util.java +++ b/hotspot/src/share/tools/ProjectCreator/Util.java @@ -47,18 +47,6 @@ public class Util { return sb.toString(); } - static String join(String padder, String v[]) { - StringBuffer sb = new StringBuffer(); - - for (int i=0; i allConfigs) throws IOException { throw new RuntimeException("use compiler version specific version"); } } diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java new file mode 100644 index 00000000000..4096beac88a --- /dev/null +++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java @@ -0,0 +1,545 @@ +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.TreeSet; +import java.util.UUID; +import java.util.Vector; + +public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 { + + @Override + protected String getProjectExt() { + return ".vcxproj"; + } + + @Override + public void writeProjectFile(String projectFileName, String projectName, + Vector allConfigs) throws IOException { + System.out.println(); + System.out.print(" Writing .vcxproj file: " + projectFileName); + + String projDir = Util.normalize(new File(projectFileName).getParent()); + + printWriter = new PrintWriter(projectFileName, "UTF-8"); + printWriter.println(""); + startTag("Project", + "DefaultTargets", "Build", + "ToolsVersion", "4.0", + "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); + startTag("ItemGroup", + "Label", "ProjectConfigurations"); + for (BuildConfig cfg : allConfigs) { + startTag("ProjectConfiguration", + "Include", cfg.get("Name")); + tagData("Configuration", cfg.get("Id")); + tagData("Platform", cfg.get("PlatformName")); + endTag("ProjectConfiguration"); + } + endTag("ItemGroup"); + + startTag("PropertyGroup", "Label", "Globals"); + tagData("ProjectGuid", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}"); + tag("SccProjectName"); + tag("SccLocalPath"); + endTag("PropertyGroup"); + + tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); + + for (BuildConfig cfg : allConfigs) { + startTag(cfg, "PropertyGroup", "Label", "Configuration"); + tagData("ConfigurationType", "DynamicLibrary"); + tagData("UseOfMfc", "false"); + endTag("PropertyGroup"); + } + + tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); + startTag("ImportGroup", "Label", "ExtensionSettings"); + endTag("ImportGroup"); + for (BuildConfig cfg : allConfigs) { + startTag(cfg, "ImportGroup", "Label", "PropertySheets"); + tag("Import", + "Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props", + "Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')", + "Label", "LocalAppDataPlatform"); + endTag("ImportGroup"); + } + + tag("PropertyGroup", "Label", "UserMacros"); + + startTag("PropertyGroup"); + tagData("_ProjectFileVersion", "10.0.30319.1"); + for (BuildConfig cfg : allConfigs) { + tagData(cfg, "OutDir", cfg.get("OutputDir") + Util.sep); + tagData(cfg, "IntDir", cfg.get("OutputDir") + Util.sep); + tagData(cfg, "LinkIncremental", "false"); + } + for (BuildConfig cfg : allConfigs) { + tagData(cfg, "CodeAnalysisRuleSet", "AllRules.ruleset"); + tag(cfg, "CodeAnalysisRules"); + tag(cfg, "CodeAnalysisRuleAssemblies"); + } + endTag("PropertyGroup"); + + for (BuildConfig cfg : allConfigs) { + startTag(cfg, "ItemDefinitionGroup"); + startTag("ClCompile"); + tagV(cfg.getV("CompilerFlags")); + endTag("ClCompile"); + + startTag("Link"); + tagV(cfg.getV("LinkerFlags")); + endTag("Link"); + + startTag("PostBuildEvent"); + tagData("Message", BuildConfig.getFieldString(null, "PostbuildDescription")); + tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PostbuildCommand").replace("\t", "\r\n"))); + endTag("PostBuildEvent"); + + startTag("PreLinkEvent"); + tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription")); + tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n"))); + endTag("PreLinkEvent"); + + endTag("ItemDefinitionGroup"); + } + + writeFiles(allConfigs, projDir); + + tag("Import", "Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); + startTag("ImportGroup", "Label", "ExtensionTargets"); + endTag("ImportGroup"); + + endTag("Project"); + printWriter.close(); + System.out.println(" Done."); + + writeFilterFile(projectFileName, projectName, allConfigs, projDir); + writeUserFile(projectFileName, allConfigs); + } + + + private void writeUserFile(String projectFileName, Vector allConfigs) throws FileNotFoundException, UnsupportedEncodingException { + String userFileName = projectFileName + ".user"; + if (new File(userFileName).exists()) { + return; + } + System.out.print(" Writing .vcxproj.user file: " + userFileName); + printWriter = new PrintWriter(userFileName, "UTF-8"); + + printWriter.println(""); + startTag("Project", + "ToolsVersion", "4.0", + "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); + + for (BuildConfig cfg : allConfigs) { + startTag(cfg, "PropertyGroup"); + tagData("LocalDebuggerCommand", "$(TargetDir)/hotspot.exe"); + endTag("PropertyGroup"); + } + + endTag("Project"); + printWriter.close(); + System.out.println(" Done."); + } + + private void writeFilterFile(String projectFileName, String projectName, + Vector allConfigs, String base) throws FileNotFoundException, UnsupportedEncodingException { + String filterFileName = projectFileName + ".filters"; + System.out.print(" Writing .vcxproj.filters file: " + filterFileName); + printWriter = new PrintWriter(filterFileName, "UTF-8"); + + printWriter.println(""); + startTag("Project", + "ToolsVersion", "4.0", + "xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); + + Hashtable allFiles = computeAttributedFiles(allConfigs); + TreeSet sortedFiles = sortFiles(allFiles); + Vector filters = makeFilters(sortedFiles); + + // first all filters + startTag("ItemGroup"); + for (NameFilter filter : filters) { + doWriteFilter(filter, ""); + } + startTag("Filter", "Include", "Resource Files"); + UUID uuid = UUID.randomUUID(); + tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); + tagData("Extensions", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"); + endTag("Filter"); + endTag("ItemGroup"); + + // then all cpp files + startTag("ItemGroup"); + for (NameFilter filter : filters) { + doWriteFiles(sortedFiles, filter, "", "ClCompile", new Evaluator() { + public boolean pick(FileInfo fi) { + return fi.isCpp(); + } + }, base); + } + endTag("ItemGroup"); + + // then all header files + startTag("ItemGroup"); + for (NameFilter filter : filters) { + doWriteFiles(sortedFiles, filter, "", "ClInclude", new Evaluator() { + public boolean pick(FileInfo fi) { + return fi.isHeader(); + } + }, base); + } + endTag("ItemGroup"); + + // then all other files + startTag("ItemGroup"); + for (NameFilter filter : filters) { + doWriteFiles(sortedFiles, filter, "", "None", new Evaluator() { + public boolean pick(FileInfo fi) { + return true; + } + }, base); + } + endTag("ItemGroup"); + + endTag("Project"); + printWriter.close(); + System.out.println(" Done."); + } + + + private void doWriteFilter(NameFilter filter, String start) { + startTag("Filter", "Include", start + filter.fname); + UUID uuid = UUID.randomUUID(); + tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); + endTag("Filter"); + if (filter instanceof ContainerFilter) { + Iterator i = ((ContainerFilter)filter).babies(); + while (i.hasNext()) { + doWriteFilter((NameFilter)i.next(), start + filter.fname + "\\"); + } + } + } + + interface Evaluator { + boolean pick(FileInfo fi); + } + + private void doWriteFiles(TreeSet allFiles, NameFilter filter, String start, String tool, Evaluator eval, String base) { + if (filter instanceof ContainerFilter) { + Iterator i = ((ContainerFilter)filter).babies(); + while (i.hasNext()) { + doWriteFiles(allFiles, (NameFilter)i.next(), start + filter.fname + "\\", tool, eval, base); + } + } + else { + Iterator i = allFiles.iterator(); + while (i.hasNext()) { + FileInfo fi = (FileInfo)i.next(); + + if (!filter.match(fi)) { + continue; + } + if (eval.pick(fi)) { + startTag(tool, "Include", rel(fi.full, base)); + tagData("Filter", start + filter.fname); + endTag(tool); + + // we not gonna look at this file anymore (sic!) + i.remove(); + } + } + } + } + + + void writeFiles(Vector allConfigs, String projDir) { + Hashtable allFiles = computeAttributedFiles(allConfigs); + TreeSet sortedFiles = sortFiles(allFiles); + + // first cpp-files + startTag("ItemGroup"); + for (FileInfo fi : sortedFiles) { + if (!fi.isCpp()) { + continue; + } + writeFile("ClCompile", allConfigs, fi, projDir); + } + endTag("ItemGroup"); + + // then header-files + startTag("ItemGroup"); + for (FileInfo fi : sortedFiles) { + if (!fi.isHeader()) { + continue; + } + writeFile("ClInclude", allConfigs, fi, projDir); + } + endTag("ItemGroup"); + + // then others + startTag("ItemGroup"); + for (FileInfo fi : sortedFiles) { + if (fi.isHeader() || fi.isCpp()) { + continue; + } + writeFile("None", allConfigs, fi, projDir); + } + endTag("ItemGroup"); + } + + /** + * Make "path" into a relative path using "base" as the base. + * + * path and base are assumed to be normalized with / as the file separator. + * returned path uses "\\" as file separator + */ + private String rel(String path, String base) + { + if(!base.endsWith("/")) { + base += "/"; + } + String[] pathTok = path.split("/"); + String[] baseTok = base.split("/"); + int pi = 0; + int bi = 0; + StringBuilder newPath = new StringBuilder(); + + // first step past all path components that are the same + while (pi < pathTok.length && + bi < baseTok.length && + pathTok[pi].equals(baseTok[bi])) { + pi++; + bi++; + } + + // for each path component left in base, add "../" + while (bi < baseTok.length) { + bi++; + newPath.append("..\\"); + } + + // now add everything left in path + while (pi < pathTok.length) { + newPath.append(pathTok[pi]); + pi++; + if (pi != pathTok.length) { + newPath.append("\\"); + } + } + return newPath.toString(); + } + + private void writeFile(String tool, Vector allConfigs, FileInfo fi, String base) { + if (fi.attr.configs == null && fi.attr.pchRoot == false && fi.attr.noPch == false) { + tag(tool, "Include", rel(fi.full, base)); + } + else { + startTag(tool, "Include", rel(fi.full, base)); + for (BuildConfig cfg : allConfigs) { + if (fi.attr.configs != null && !fi.attr.configs.contains(cfg.get("Name"))) { + tagData(cfg, "ExcludedFromBuild", "true"); + } + if (fi.attr.pchRoot) { + tagData(cfg, "PrecompiledHeader", "Create"); + } + if (fi.attr.noPch) { + startTag(cfg, "PrecompiledHeader"); + endTag("PrecompiledHeader"); + } + } + endTag(tool); + } + } + + String buildCond(BuildConfig cfg) { + return "'$(Configuration)|$(Platform)'=='"+cfg.get("Name")+"'"; + } + + + void tagV(Vector v) { + Iterator i = v.iterator(); + while(i.hasNext()) { + String name = i.next(); + String data = i.next(); + tagData(name, data); + } + } + + void tagData(BuildConfig cfg, String name, String data) { + tagData(name, data, "Condition", buildCond(cfg)); + } + + void tag(BuildConfig cfg, String name, String... attrs) { + String[] ss = new String[attrs.length + 2]; + ss[0] = "Condition"; + ss[1] = buildCond(cfg); + System.arraycopy(attrs, 0, ss, 2, attrs.length); + + tag(name, ss); + } + + void startTag(BuildConfig cfg, String name, String... attrs) { + String[] ss = new String[attrs.length + 2]; + ss[0] = "Condition"; + ss[1] = buildCond(cfg); + System.arraycopy(attrs, 0, ss, 2, attrs.length); + + startTag(name, ss); + } +} + +class CompilerInterfaceVC10 extends CompilerInterface { + + @Override + Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { + Vector rv = new Vector(); + + addAttr(rv, "AdditionalIncludeDirectories", Util.join(";", includes)); + addAttr(rv, "PreprocessorDefinitions", + Util.join(";", defines).replace("\\\"", "\"")); + addAttr(rv, "PrecompiledHeaderFile", "precompiled.hpp"); + addAttr(rv, "PrecompiledHeaderOutputFile", outDir+Util.sep+"vm.pch"); + addAttr(rv, "AssemblerListingLocation", outDir); + addAttr(rv, "ObjectFileName", outDir+Util.sep); + addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"jvm.pdb"); + // Set /nologo option + addAttr(rv, "SuppressStartupBanner", "true"); + // Surpass the default /Tc or /Tp. + addAttr(rv, "CompileAs", "Default"); + // Set /W3 option. + addAttr(rv, "WarningLevel", "Level3"); + // Set /WX option, + addAttr(rv, "TreatWarningAsError", "true"); + // Set /GS option + addAttr(rv, "BufferSecurityCheck", "false"); + // Set /Zi option. + addAttr(rv, "DebugInformationFormat", "ProgramDatabase"); + // Set /Yu option. + addAttr(rv, "PrecompiledHeader", "Use"); + // Set /EHsc- option + addAttr(rv, "ExceptionHandling", ""); + + addAttr(rv, "MultiProcessorCompilation", "true"); + + return rv; + } + + @Override + Vector getDebugCompilerFlags(String opt) { + Vector rv = new Vector(); + + // Set /On option + addAttr(rv, "Optimization", opt); + // Set /FR option. + addAttr(rv, "BrowseInformation", "true"); + addAttr(rv, "BrowseInformationFile", "$(IntDir)"); + // Set /MD option. + addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL"); + // Set /Oy- option + addAttr(rv, "OmitFramePointers", "false"); + + return rv; + } + + @Override + Vector getProductCompilerFlags() { + Vector rv = new Vector(); + + // Set /O2 option. + addAttr(rv, "Optimization", "MaxSpeed"); + // Set /Oy- option + addAttr(rv, "OmitFramePointers", "false"); + // Set /Ob option. 1 is expandOnlyInline + addAttr(rv, "InlineFunctionExpansion", "OnlyExplicitInline"); + // Set /GF option. + addAttr(rv, "StringPooling", "true"); + // Set /MD option. 2 is rtMultiThreadedDLL + addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL"); + // Set /Gy option + addAttr(rv, "FunctionLevelLinking", "true"); + + return rv; + } + + @Override + Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { + Vector rv = new Vector(); + + addAttr(rv, "AdditionalOptions", + "/export:JNI_GetDefaultJavaVMInitArgs " + + "/export:JNI_CreateJavaVM " + + "/export:JVM_FindClassFromBootLoader "+ + "/export:JNI_GetCreatedJavaVMs "+ + "/export:jio_snprintf /export:jio_printf "+ + "/export:jio_fprintf /export:jio_vfprintf "+ + "/export:jio_vsnprintf "+ + "/export:JVM_GetVersionInfo "+ + "/export:JVM_GetThreadStateNames "+ + "/export:JVM_GetThreadStateValues "+ + "/export:JVM_InitAgentProperties"); + addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib"); + addAttr(rv, "OutputFile", outDll); + addAttr(rv, "SuppressStartupBanner", "true"); + addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def"); + addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"jvm.pdb"); + addAttr(rv, "SubSystem", "Windows"); + addAttr(rv, "BaseAddress", "0x8000000"); + addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib"); + + if(platformName.equals("Win32")) { + addAttr(rv, "TargetMachine", "MachineX86"); + } else { + addAttr(rv, "TargetMachine", "MachineX64"); + } + + return rv; + } + + @Override + Vector getDebugLinkerFlags() { + Vector rv = new Vector(); + + // /DEBUG option + addAttr(rv, "GenerateDebugInformation", "true"); + + return rv; + } + + @Override + Vector getProductLinkerFlags() { + Vector rv = new Vector(); + + // Set /OPT:REF option. + addAttr(rv, "OptimizeReferences", "true"); + // Set /OPT:ICF option. + addAttr(rv, "EnableCOMDATFolding", "true"); + + return rv; + } + + @Override + void getAdditionalNonKernelLinkerFlags(Vector rv) { + extAttr(rv, "AdditionalOptions", " /export:AsyncGetCallTrace"); + } + + @Override + String getOptFlag() { + return "MaxSpeed"; + } + + @Override + String getNoOptFlag() { + return "Disabled"; + } + + @Override + String makeCfgName(String flavourBuild, String platform) { + return flavourBuild + "|" + platform; + } + +} diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java index fd6fbfea83e..d1d63c84734 100644 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java +++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java @@ -35,7 +35,7 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { String projectVersion() {return "7.10";}; public void writeProjectFile(String projectFileName, String projectName, - Vector allConfigs) throws IOException { + Vector allConfigs) throws IOException { System.out.println(); System.out.println(" Writing .vcproj file: "+projectFileName); // If we got this far without an error, we're safe to actually @@ -54,11 +54,11 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { "SccLocalPath", "" } ); - startTag("Platforms", null); + startTag("Platforms"); tag("Platform", new String[] {"Name", (String) BuildConfig.getField(null, "PlatformName")}); endTag("Platforms"); - startTag("Configurations", null); + startTag("Configurations"); for (Iterator i = allConfigs.iterator(); i.hasNext(); ) { writeConfiguration((BuildConfig)i.next()); @@ -66,11 +66,11 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { endTag("Configurations"); - tag("References", null); + tag("References"); writeFiles(allConfigs); - tag("Globals", null); + tag("Globals"); endTag("VisualStudioProject"); printWriter.close(); @@ -190,28 +190,6 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { } } - class TypeFilter extends NameFilter { - String[] exts; - - TypeFilter(String fname, String[] exts) { - this.fname = fname; - this.exts = exts; - } - - boolean match(FileInfo fi) { - for (int i=0; i files) { - Vector rv = new Vector(); + Vector makeFilters(TreeSet files) { + Vector rv = new Vector(); String sbase = Util.normalize(BuildConfig.getFieldString(null, "SourceBase")+"/src/"); String currentDir = ""; @@ -370,13 +348,12 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { rv.add(new SpecificNameFilter("Precompiled Header", new String[] {"precompiled.hpp"})); // this one is to catch files not caught by other filters - //rv.add(new TypeFilter("Header Files", new String[] {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"})); rv.add(new TerminatorFilter("Source Files")); return rv; } - void writeFiles(Vector allConfigs) { + void writeFiles(Vector allConfigs) { Hashtable allFiles = computeAttributedFiles(allConfigs); @@ -387,7 +364,7 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { TreeSet sortedFiles = sortFiles(allFiles); - startTag("Files", null); + startTag("Files"); for (Iterator i = makeFilters(sortedFiles).iterator(); i.hasNext(); ) { doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next()); @@ -555,35 +532,40 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { int indent; + private void startTagPrim(String name, + String[] attrs, + boolean close) { + startTagPrim(name, attrs, close, true); + } + private void startTagPrim(String name, String[] attrs, - boolean close) { + boolean close, + boolean newline) { doIndent(); printWriter.print("<"+name); indent++; - if (attrs != null) { - printWriter.println(); + if (attrs != null && attrs.length > 0) { for (int i=0; i"); + printWriter.print(" />"); } else { - //doIndent(); - printWriter.println(">"); + printWriter.print(">"); + } + if(newline) { + printWriter.println(); } } - void startTag(String name, String[] attrs) { + void startTag(String name, String... attrs) { startTagPrim(name, attrs, false); } @@ -601,11 +583,25 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { printWriter.println(""); } - void tag(String name, String[] attrs) { + void tag(String name, String... attrs) { startTagPrim(name, attrs, true); } - void tagV(String name, Vector attrs) { + void tagData(String name, String data) { + doIndent(); + printWriter.print("<"+name+">"); + printWriter.print(data); + printWriter.println(""); + } + + void tagData(String name, String data, String... attrs) { + startTagPrim(name, attrs, false, false); + printWriter.print(data); + printWriter.println(""); + indent--; + } + + void tagV(String name, Vector attrs) { String s[] = new String [attrs.size()]; for (int i=0; i Date: Mon, 28 Mar 2011 03:58:07 -0700 Subject: [PATCH 069/168] 7022998: JSR 292 recursive method handle calls inline themselves infinitely Reviewed-by: never, kvn --- .../src/cpu/sparc/vm/sharedRuntime_sparc.cpp | 4 +- .../src/cpu/x86/vm/sharedRuntime_x86_32.cpp | 2 + .../src/cpu/x86/vm/sharedRuntime_x86_64.cpp | 2 + hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 20 +-- hotspot/src/share/vm/code/nmethod.cpp | 88 +++---------- hotspot/src/share/vm/code/nmethod.hpp | 12 +- .../src/share/vm/compiler/compileBroker.cpp | 124 +++++++++++++++--- .../src/share/vm/compiler/compileBroker.hpp | 21 ++- hotspot/src/share/vm/opto/bytecodeInfo.cpp | 49 ++++--- hotspot/src/share/vm/opto/doCall.cpp | 25 ++-- hotspot/src/share/vm/opto/library_call.cpp | 7 +- .../src/share/vm/runtime/sharedRuntime.cpp | 17 +-- .../src/share/vm/runtime/sharedRuntime.hpp | 5 +- 13 files changed, 203 insertions(+), 173 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp index df6aa841838..1dc9de76f60 100644 --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 @@ -1769,6 +1769,7 @@ static void create_inner_frame(MacroAssembler* masm, bool* already_created) { // returns. nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm, methodHandle method, + int compile_id, int total_in_args, int comp_args_on_stack, // in VMRegStackSlots BasicType *in_sig_bt, @@ -2462,6 +2463,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ flush(); nmethod *nm = nmethod::new_native_nmethod(method, + compile_id, masm->code(), vep_offset, frame_complete, diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp index 181d4c2c62c..149bc7c9ea4 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp @@ -1111,6 +1111,7 @@ void SharedRuntime::restore_native_result(MacroAssembler *masm, BasicType ret_ty // returns. nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, methodHandle method, + int compile_id, int total_in_args, int comp_args_on_stack, BasicType *in_sig_bt, @@ -1854,6 +1855,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, __ flush(); nmethod *nm = nmethod::new_native_nmethod(method, + compile_id, masm->code(), vep_offset, frame_complete, diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp index dea7fb948da..c017cf86d47 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp @@ -1174,6 +1174,7 @@ static void restore_args(MacroAssembler *masm, int arg_count, int first_arg, VMR // returns. nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, methodHandle method, + int compile_id, int total_in_args, int comp_args_on_stack, BasicType *in_sig_bt, @@ -1881,6 +1882,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, __ flush(); nmethod *nm = nmethod::new_native_nmethod(method, + compile_id, masm->code(), vep_offset, frame_complete, diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index 4e5f4edf0e6..e956b6bb4be 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -30,6 +30,7 @@ #include "c1/c1_InstructionPrinter.hpp" #include "ci/ciField.hpp" #include "ci/ciKlass.hpp" +#include "compiler/compileBroker.hpp" #include "interpreter/bytecode.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/bitMap.inline.hpp" @@ -3775,24 +3776,7 @@ void GraphBuilder::append_unsafe_CAS(ciMethod* callee) { #ifndef PRODUCT void GraphBuilder::print_inline_result(ciMethod* callee, bool res) { - const char sync_char = callee->is_synchronized() ? 's' : ' '; - const char exception_char = callee->has_exception_handlers() ? '!' : ' '; - const char monitors_char = callee->has_monitor_bytecodes() ? 'm' : ' '; - tty->print(" %c%c%c ", sync_char, exception_char, monitors_char); - for (int i = 0; i < scope()->level(); i++) tty->print(" "); - if (res) { - tty->print(" "); - } else { - tty->print("- "); - } - tty->print("@ %d ", bci()); - callee->print_short_name(); - tty->print(" (%d bytes)", callee->code_size()); - if (_inline_bailout_msg) { - tty->print(" %s", _inline_bailout_msg); - } - tty->cr(); - + CompileTask::print_inlining(callee, scope()->level(), bci(), _inline_bailout_msg); if (res && CIPrintMethodCodes) { callee->print_codes(); } diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index 40a1360c98e..6ba2cde5b00 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -28,6 +28,7 @@ #include "code/nmethod.hpp" #include "code/scopeDesc.hpp" #include "compiler/abstractCompiler.hpp" +#include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" #include "compiler/compilerOracle.hpp" #include "compiler/disassembler.hpp" @@ -469,6 +470,7 @@ void nmethod::init_defaults() { nmethod* nmethod::new_native_nmethod(methodHandle method, + int compile_id, CodeBuffer *code_buffer, int vep_offset, int frame_complete, @@ -485,7 +487,7 @@ nmethod* nmethod::new_native_nmethod(methodHandle method, offsets.set_value(CodeOffsets::Verified_Entry, vep_offset); offsets.set_value(CodeOffsets::Frame_Complete, frame_complete); nm = new (native_nmethod_size) - nmethod(method(), native_nmethod_size, &offsets, + nmethod(method(), native_nmethod_size, compile_id, &offsets, code_buffer, frame_size, basic_lock_owner_sp_offset, basic_lock_sp_offset, oop_maps); @@ -610,6 +612,7 @@ nmethod* nmethod::new_nmethod(methodHandle method, nmethod::nmethod( methodOop method, int nmethod_size, + int compile_id, CodeOffsets* offsets, CodeBuffer* code_buffer, int frame_size, @@ -644,7 +647,7 @@ nmethod::nmethod( _handler_table_offset = _dependencies_offset; _nul_chk_table_offset = _handler_table_offset; _nmethod_end_offset = _nul_chk_table_offset; - _compile_id = 0; // default + _compile_id = compile_id; _comp_level = CompLevel_none; _entry_point = code_begin() + offsets->value(CodeOffsets::Entry); _verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry); @@ -930,72 +933,11 @@ void nmethod::log_new_nmethod() const { #undef LOG_OFFSET -void nmethod::print_compilation(outputStream *st, const char *method_name, const char *title, - methodOop method, bool is_blocking, int compile_id, int bci, int comp_level) { - bool is_synchronized = false, has_xhandler = false, is_native = false; - int code_size = -1; - if (method != NULL) { - is_synchronized = method->is_synchronized(); - has_xhandler = method->has_exception_handler(); - is_native = method->is_native(); - code_size = method->code_size(); - } - // print compilation number - st->print("%7d %3d", (int)tty->time_stamp().milliseconds(), compile_id); - - // print method attributes - const bool is_osr = bci != InvocationEntryBci; - const char blocking_char = is_blocking ? 'b' : ' '; - const char compile_type = is_osr ? '%' : ' '; - const char sync_char = is_synchronized ? 's' : ' '; - const char exception_char = has_xhandler ? '!' : ' '; - const char native_char = is_native ? 'n' : ' '; - st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char); - if (TieredCompilation) { - st->print("%d ", comp_level); - } - - // print optional title - bool do_nl = false; - if (title != NULL) { - int tlen = (int) strlen(title); - bool do_nl = false; - if (tlen > 0 && title[tlen-1] == '\n') { tlen--; do_nl = true; } - st->print("%.*s", tlen, title); - } else { - do_nl = true; - } - - // print method name string if given - if (method_name != NULL) { - st->print(method_name); - } else { - // otherwise as the method to print itself - if (method != NULL && !Universe::heap()->is_gc_active()) { - method->print_short_name(st); - } else { - st->print("(method)"); - } - } - - if (method != NULL) { - // print osr_bci if any - if (is_osr) st->print(" @ %d", bci); - // print method size - st->print(" (%d bytes)", code_size); - } - if (do_nl) st->cr(); -} - // Print out more verbose output usually for a newly created nmethod. -void nmethod::print_on(outputStream* st, const char* title) const { +void nmethod::print_on(outputStream* st, const char* msg) const { if (st != NULL) { ttyLocker ttyl; - print_compilation(st, /*method_name*/NULL, title, - method(), /*is_blocking*/false, - compile_id(), - is_osr_method() ? osr_entry_bci() : InvocationEntryBci, - comp_level()); + CompileTask::print_compilation(st, this, msg); if (WizardMode) st->print(" (" INTPTR_FORMAT ")", this); } } @@ -1309,8 +1251,7 @@ void nmethod::log_state_change() const { } } if (PrintCompilation && _state != unloaded) { - print_on(tty, _state == zombie ? "made zombie " : "made not entrant "); - tty->cr(); + print_on(tty, _state == zombie ? "made zombie" : "made not entrant"); } } @@ -1816,7 +1757,7 @@ bool nmethod::test_set_oops_do_mark() { break; } // Mark was clear when we first saw this guy. - NOT_PRODUCT(if (TraceScavenge) print_on(tty, "oops_do, mark\n")); + NOT_PRODUCT(if (TraceScavenge) print_on(tty, "oops_do, mark")); return false; } } @@ -1841,7 +1782,7 @@ void nmethod::oops_do_marking_epilogue() { nmethod* next = cur->_oops_do_mark_link; cur->_oops_do_mark_link = NULL; cur->fix_oop_relocations(); - NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark\n")); + NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark")); cur = next; } void* required = _oops_do_mark_nmethods; @@ -2396,7 +2337,7 @@ void nmethod::print() const { ResourceMark rm; ttyLocker ttyl; // keep the following output all in one block - tty->print("Compiled "); + tty->print("Compiled method "); if (is_compiled_by_c1()) { tty->print("(c1) "); @@ -2408,8 +2349,8 @@ void nmethod::print() const { tty->print("(nm) "); } - print_on(tty, "nmethod"); - tty->cr(); + print_on(tty, NULL); + if (WizardMode) { tty->print("((nmethod*) "INTPTR_FORMAT ") ", this); tty->print(" for method " INTPTR_FORMAT , (address)method()); @@ -2796,7 +2737,8 @@ void nmethod::print_code_comment_on(outputStream* st, int column, u_char* begin, #ifndef PRODUCT void nmethod::print_value_on(outputStream* st) const { - print_on(st, "nmethod"); + st->print("nmethod"); + print_on(st, NULL); } void nmethod::print_calls(outputStream* st) { diff --git a/hotspot/src/share/vm/code/nmethod.hpp b/hotspot/src/share/vm/code/nmethod.hpp index 6bf5672eb37..36f51ed1264 100644 --- a/hotspot/src/share/vm/code/nmethod.hpp +++ b/hotspot/src/share/vm/code/nmethod.hpp @@ -229,6 +229,7 @@ class nmethod : public CodeBlob { // For native wrappers nmethod(methodOop method, int nmethod_size, + int compile_id, CodeOffsets* offsets, CodeBuffer *code_buffer, int frame_size, @@ -299,6 +300,7 @@ class nmethod : public CodeBlob { int comp_level); static nmethod* new_native_nmethod(methodHandle method, + int compile_id, CodeBuffer *code_buffer, int vep_offset, int frame_complete, @@ -500,8 +502,8 @@ public: address continuation_for_implicit_exception(address pc); // On-stack replacement support - int osr_entry_bci() const { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); return _entry_bci; } - address osr_entry() const { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); return _osr_entry_point; } + int osr_entry_bci() const { assert(is_osr_method(), "wrong kind of nmethod"); return _entry_bci; } + address osr_entry() const { assert(is_osr_method(), "wrong kind of nmethod"); return _osr_entry_point; } void invalidate_osr_method(); nmethod* osr_link() const { return _osr_link; } void set_osr_link(nmethod *n) { _osr_link = n; } @@ -608,10 +610,6 @@ public: void verify_scopes(); void verify_interrupt_point(address interrupt_point); - // print compilation helper - static void print_compilation(outputStream *st, const char *method_name, const char *title, - methodOop method, bool is_blocking, int compile_id, int bci, int comp_level); - // printing support void print() const; void print_code(); @@ -627,7 +625,7 @@ public: // need to re-define this from CodeBlob else the overload hides it virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); } - void print_on(outputStream* st, const char* title) const; + void print_on(outputStream* st, const char* msg) const; // Logging void log_identity(xmlStream* log) const; diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 2e08de058f0..50683647638 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -268,11 +268,6 @@ void CompileTask::print() { } -void CompileTask::print_compilation(outputStream *st, methodOop method, char* method_name) { - nmethod::print_compilation(st, method_name,/*title*/ NULL, method, - is_blocking(), compile_id(), osr_bci(), comp_level()); -} - // ------------------------------------------------------------------ // CompileTask::print_line_on_error // @@ -284,32 +279,116 @@ void CompileTask::print_compilation(outputStream *st, methodOop method, char* me // Otherwise it's the same as CompileTask::print_line() // void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) { - methodOop method = (methodOop)JNIHandles::resolve(_method); // print compiler name st->print("%s:", CompileBroker::compiler(comp_level())->name()); - char* method_name = NULL; - if (method != NULL) { - method_name = method->name_and_sig_as_C_string(buf, buflen); - } - print_compilation(st, method, method_name); + print_compilation(st); } // ------------------------------------------------------------------ // CompileTask::print_line void CompileTask::print_line() { - Thread *thread = Thread::current(); - methodHandle method(thread, - (methodOop)JNIHandles::resolve(method_handle())); - ResourceMark rm(thread); - ttyLocker ttyl; // keep the following output all in one block - // print compiler name if requested if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler(comp_level())->name()); - print_compilation(tty, method(), NULL); + print_compilation(); } +// ------------------------------------------------------------------ +// CompileTask::print_compilation_impl +void CompileTask::print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method, int osr_bci, bool is_blocking, const char* msg) { + st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp + st->print("%4d ", compile_id); // print compilation number + + // method attributes + const char compile_type = is_osr_method ? '%' : ' '; + const char sync_char = method->is_synchronized() ? 's' : ' '; + const char exception_char = method->has_exception_handler() ? '!' : ' '; + const char blocking_char = is_blocking ? 'b' : ' '; + const char native_char = method->is_native() ? 'n' : ' '; + + // print method attributes + st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char); + + if (TieredCompilation) { + if (comp_level != -1) st->print("%d ", comp_level); + else st->print("- "); + } + st->print(" "); // more indent + + method->print_short_name(st); + if (is_osr_method) { + st->print(" @ %d", osr_bci); + } + st->print(" (%d bytes)", method->code_size()); + + if (msg != NULL) { + st->print(" %s", msg); + } + st->cr(); +} + +// ------------------------------------------------------------------ +// CompileTask::print_inlining +void CompileTask::print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) { + // 1234567 + st->print(" "); // print timestamp + // 1234 + st->print(" "); // print compilation number + + // method attributes + const char sync_char = method->is_synchronized() ? 's' : ' '; + const char exception_char = method->has_exception_handlers() ? '!' : ' '; + const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' '; + + // print method attributes + st->print(" %c%c%c ", sync_char, exception_char, monitors_char); + + if (TieredCompilation) { + st->print(" "); + } + st->print(" "); // more indent + st->print(" "); // initial inlining indent + + for (int i = 0; i < inline_level; i++) st->print(" "); + + st->print("@ %d ", bci); // print bci + method->print_short_name(st); + st->print(" (%d bytes)", method->code_size()); + + if (msg != NULL) { + st->print(" %s", msg); + } + st->cr(); +} + +// ------------------------------------------------------------------ +// CompileTask::print_inline_indent +void CompileTask::print_inline_indent(int inline_level, outputStream* st) { + // 1234567 + st->print(" "); // print timestamp + // 1234 + st->print(" "); // print compilation number + // %s!bn + st->print(" "); // print method attributes + if (TieredCompilation) { + st->print(" "); + } + st->print(" "); // more indent + st->print(" "); // initial inlining indent + for (int i = 0; i < inline_level; i++) st->print(" "); +} + +// ------------------------------------------------------------------ +// CompileTask::print_compilation +void CompileTask::print_compilation(outputStream* st) { + oop rem = JNIHandles::resolve(method_handle()); + assert(rem != NULL && rem->is_method(), "must be"); + methodOop method = (methodOop) rem; + bool is_osr_method = osr_bci() != InvocationEntryBci; + print_compilation_impl(st, method, compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking()); +} + // ------------------------------------------------------------------ // CompileTask::log_task void CompileTask::log_task(xmlStream* log) { @@ -1086,7 +1165,13 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, // do the compilation if (method->is_native()) { if (!PreferInterpreterNativeStubs) { - (void) AdapterHandlerLibrary::create_native_wrapper(method); + // Acquire our lock. + int compile_id; + { + MutexLocker locker(MethodCompileQueue_lock, THREAD); + compile_id = assign_compile_id(method, standard_entry_bci); + } + (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id); } else { return NULL; } @@ -1194,7 +1279,6 @@ uint CompileBroker::assign_compile_id(methodHandle method, int osr_bci) { assert(MethodCompileQueue_lock->owner() == Thread::current(), "must hold the compilation queue lock"); bool is_osr = (osr_bci != standard_entry_bci); - assert(!method->is_native(), "no longer compile natives"); uint id; if (CICountOSR && is_osr) { id = ++_osr_compilation_id; diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp index 515bfb4052e..eb571eebba3 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.hpp +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 @@ -56,7 +56,6 @@ class CompileTask : public CHeapObj { int _hot_count; // information about its invocation counter const char* _comment; // more info about the task - void print_compilation(outputStream *st, methodOop method, char* method_name); public: CompileTask() { _lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock"); @@ -96,10 +95,26 @@ class CompileTask : public CHeapObj { CompileTask* prev() const { return _prev; } void set_prev(CompileTask* prev) { _prev = prev; } +private: + static void print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false, const char* msg = NULL); + +public: + void print_compilation(outputStream* st = tty); + static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL) { + print_compilation_impl(st, nm->method(), nm->compile_id(), nm->comp_level(), nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false, msg); + } + + static void print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL); + static void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) { + print_inlining(tty, method, inline_level, bci, msg); + } + + static void print_inline_indent(int inline_level, outputStream* st = tty); + void print(); void print_line(); - void print_line_on_error(outputStream* st, char* buf, int buflen); + void log_task(xmlStream* log); void log_task_queued(); void log_task_start(CompileLog* log); diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp index 6443bc16bf9..3ab401de6d7 100644 --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" #include "interpreter/linkResolver.hpp" #include "oops/objArrayKlass.hpp" @@ -75,13 +76,6 @@ InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvm assert(!UseOldInlining, "do not use for old stuff"); } - - -static void print_indent(int depth) { - tty->print(" "); - for (int i = depth; i != 0; --i) tty->print(" "); -} - static bool is_init_with_ea(ciMethod* callee_method, ciMethod* caller_method, Compile* C) { // True when EA is ON and a java constructor is called or @@ -100,7 +94,7 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m if(callee_method->should_inline()) { *wci_result = *(WarmCallInfo::always_hot()); if (PrintInlining && Verbose) { - print_indent(inline_depth()); + CompileTask::print_inline_indent(inline_depth()); tty->print_cr("Inlined method is hot: "); } return NULL; @@ -116,7 +110,7 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m size < InlineThrowMaxSize ) { wci_result->set_profit(wci_result->profit() * 100); if (PrintInlining && Verbose) { - print_indent(inline_depth()); + CompileTask::print_inline_indent(inline_depth()); tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count()); } return NULL; @@ -138,9 +132,9 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m max_size = C->freq_inline_size(); if (size <= max_size && TraceFrequencyInlining) { - print_indent(inline_depth()); + CompileTask::print_inline_indent(inline_depth()); tty->print_cr("Inlined frequent method (freq=%d count=%d):", freq, call_site_count); - print_indent(inline_depth()); + CompileTask::print_inline_indent(inline_depth()); callee_method->print(); tty->cr(); } @@ -315,8 +309,25 @@ const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_ if( inline_depth() > MaxInlineLevel ) { return "inlining too deep"; } - if( method() == callee_method && - inline_depth() > MaxRecursiveInlineLevel ) { + + // We need to detect recursive inlining of method handle targets: if + // the current method is a method handle adapter and one of the + // callers is the same method as the callee, we bail out if + // MaxRecursiveInlineLevel is hit. + if (method()->is_method_handle_adapter()) { + JVMState* jvms = caller_jvms(); + int inline_level = 0; + while (jvms != NULL && jvms->has_method()) { + if (jvms->method() == callee_method) { + inline_level++; + if (inline_level > MaxRecursiveInlineLevel) + return "recursively inlining too deep"; + } + jvms = jvms->caller(); + } + } + + if (method() == callee_method && inline_depth() > MaxRecursiveInlineLevel) { return "recursively inlining too deep"; } @@ -368,18 +379,14 @@ bool pass_initial_checks(ciMethod* caller_method, int caller_bci, ciMethod* call #ifndef PRODUCT //------------------------------print_inlining--------------------------------- // Really, the failure_msg can be a success message also. -void InlineTree::print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const { - print_indent(inline_depth()); - tty->print("@ %d ", caller_bci); - if( callee_method ) callee_method->print_short_name(); - else tty->print(" callee not monotonic or profiled"); - tty->print(" %s", (failure_msg ? failure_msg : "inline")); - if( Verbose && callee_method ) { +void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const { + CompileTask::print_inlining(callee_method, inline_depth(), caller_bci, failure_msg ? failure_msg : "inline"); + if (callee_method == NULL) tty->print(" callee not monotonic or profiled"); + if (Verbose && callee_method) { const InlineTree *top = this; while( top->caller_tree() != NULL ) { top = top->caller_tree(); } tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count()); } - tty->cr(); } #endif diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index 4c19678ea24..e7cdaf47e86 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 @@ -27,6 +27,7 @@ #include "ci/ciCallSite.hpp" #include "ci/ciMethodHandle.hpp" #include "classfile/vmSymbols.hpp" +#include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" #include "interpreter/linkResolver.hpp" #include "opto/addnode.hpp" @@ -43,17 +44,17 @@ #ifndef PRODUCT void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { if (TraceTypeProfile || PrintInlining || PrintOptoInlining) { - tty->print(" "); - for( int i = 0; i < depth; i++ ) tty->print(" "); - if (!PrintOpto) { - method->print_short_name(); - tty->print(" ->"); + if (!PrintInlining) { + if (!PrintOpto && !PrintCompilation) { + method->print_short_name(); + tty->cr(); + } + CompileTask::print_inlining(prof_method, depth, bci); } - tty->print(" @ %d ", bci); - prof_method->print_short_name(); - tty->print(" >>TypeProfile (%d/%d counts) = ", receiver_count, site_count); + CompileTask::print_inline_indent(depth); + tty->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); prof_klass->name()->print_symbol(); - tty->print_cr(" (%d bytes)", prof_method->code_size()); + tty->cr(); } } #endif @@ -269,13 +270,13 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, } if (miss_cg != NULL) { if (next_hit_cg != NULL) { - NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1))); + NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1))); // We don't need to record dependency on a receiver here and below. // Whenever we inline, the dependency is added by Parse::Parse(). miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); } if (miss_cg != NULL) { - NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count)); + NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count)); cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); if (cg != NULL) return cg; } diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 024955215e6..be8136bf598 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" #include "oops/objArrayKlass.hpp" #include "opto/addnode.hpp" @@ -388,11 +389,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { #endif if (kit.try_to_inline()) { if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { - tty->print("Inlining intrinsic %s%s at bci:%d in", - vmIntrinsics::name_at(intrinsic_id()), - (is_virtual() ? " (virtual)" : ""), kit.bci()); - kit.caller()->print_short_name(tty); - tty->print_cr(" (%d bytes)", kit.caller()->code_size()); + CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); if (C->log()) { diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index 4d21ca0b1e5..63d0b7b667d 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -2479,20 +2479,10 @@ bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length, int to // java compiled calling convention to the native convention, handlizes // arguments, and transitions to native. On return from the native we transition // back to java blocking if a safepoint is in progress. -nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) { +nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method, int compile_id) { ResourceMark rm; nmethod* nm = NULL; - if (PrintCompilation) { - ttyLocker ttyl; - tty->print("--- n%s ", (method->is_synchronized() ? "s" : " ")); - method->print_short_name(tty); - if (method->is_static()) { - tty->print(" (static)"); - } - tty->cr(); - } - assert(method->has_native_function(), "must have something valid to call!"); { @@ -2537,6 +2527,7 @@ nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) { // Generate the compiled-to-native wrapper code nm = SharedRuntime::generate_native_wrapper(&_masm, method, + compile_id, total_args_passed, comp_args_on_stack, sig_bt,regs, @@ -2548,6 +2539,10 @@ nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) { // Install the generated code. if (nm != NULL) { + if (PrintCompilation) { + ttyLocker ttyl; + CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : ""); + } method->set_code(method, nm); nm->post_compiled_method_load_event(); } else { diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp index 57ee0966182..268bd3a2f4e 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -438,6 +438,7 @@ class SharedRuntime: AllStatic { // returns. static nmethod *generate_native_wrapper(MacroAssembler* masm, methodHandle method, + int compile_id, int total_args_passed, int max_arg, BasicType *sig_bt, @@ -659,7 +660,7 @@ class AdapterHandlerLibrary: public AllStatic { static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry); - static nmethod* create_native_wrapper(methodHandle method); + static nmethod* create_native_wrapper(methodHandle method, int compile_id); static AdapterHandlerEntry* get_adapter(methodHandle method); #ifdef HAVE_DTRACE_H From a1a5907f794ecc62df6ab19be6cc0b0b0e1e6ac0 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Mon, 28 Mar 2011 13:50:01 -0700 Subject: [PATCH 070/168] 7031166: (pack200) tools/pack200/CommandLineTests.java fail with testsdk on RO filesystem Reviewed-by: alanb --- jdk/test/tools/pack200/CommandLineTests.java | 4 +- jdk/test/tools/pack200/TimeStamp.java | 2 +- jdk/test/tools/pack200/Utils.java | 47 ++++---------------- 3 files changed, 11 insertions(+), 42 deletions(-) diff --git a/jdk/test/tools/pack200/CommandLineTests.java b/jdk/test/tools/pack200/CommandLineTests.java index fefefd2a860..74a1524fa39 100644 --- a/jdk/test/tools/pack200/CommandLineTests.java +++ b/jdk/test/tools/pack200/CommandLineTests.java @@ -120,9 +120,9 @@ public class CommandLineTests { // make a backup copy for re-use File bakFile = new File(f.getName() + ".bak"); if (!bakFile.exists()) { // backup - Utils.copyFile(f.getAbsoluteFile(), bakFile.getAbsoluteFile()); + Utils.copyFile(f, bakFile); } else { // restore - Utils.copyFile(bakFile.getAbsoluteFile(), f.getAbsoluteFile()); + Utils.copyFile(bakFile, f); } cmdsList.clear(); cmdsList.add(Utils.getPack200Cmd()); diff --git a/jdk/test/tools/pack200/TimeStamp.java b/jdk/test/tools/pack200/TimeStamp.java index 3d099e2141c..aa82fbb4e16 100644 --- a/jdk/test/tools/pack200/TimeStamp.java +++ b/jdk/test/tools/pack200/TimeStamp.java @@ -56,7 +56,7 @@ public class TimeStamp { // make a local copy of our test file File srcFile = Utils.locateJar("golden.jar"); File goldenFile = new File("golden.jar"); - Utils.copyFile(srcFile, goldenFile.getAbsoluteFile()); + Utils.copyFile(srcFile, goldenFile); JarFile goldenJarFile = new JarFile(goldenFile); File packFile = new File("golden.pack"); diff --git a/jdk/test/tools/pack200/Utils.java b/jdk/test/tools/pack200/Utils.java index 5cf7663d201..53c1a1baa0b 100644 --- a/jdk/test/tools/pack200/Utils.java +++ b/jdk/test/tools/pack200/Utils.java @@ -21,18 +21,18 @@ * questions. */ +import java.nio.file.Path; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.File; import java.io.FileFilter; -import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; -import java.nio.channels.FileChannel; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -44,6 +44,8 @@ import java.util.jar.Pack200; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import static java.nio.file.StandardCopyOption.*; + /** * * @author ksrini @@ -180,45 +182,12 @@ class Utils { } }; - private static void setFileAttributes(File src, File dst) throws IOException { - dst.setExecutable(src.canExecute()); - dst.setReadable(src.canRead()); - dst.setWritable(src.canWrite()); - dst.setLastModified(src.lastModified()); - } - static void copyFile(File src, File dst) throws IOException { - if (src.isDirectory()) { - dst.mkdirs(); - setFileAttributes(src, dst); - return; - } else { - File baseDirFile = dst.getParentFile(); - if (!baseDirFile.exists()) { - baseDirFile.mkdirs(); - } + Path parent = dst.toPath().getParent(); + if (parent != null) { + Files.createDirectories(parent); } - FileInputStream in = null; - FileOutputStream out = null; - FileChannel srcChannel = null; - FileChannel dstChannel = null; - try { - in = new FileInputStream(src); - out = new FileOutputStream(dst); - srcChannel = in.getChannel(); - dstChannel = out.getChannel(); - - long retval = srcChannel.transferTo(0, src.length(), dstChannel); - if (src.length() != dst.length()) { - throw new IOException("file copy failed for " + src); - } - } finally { - close(srcChannel); - close(dstChannel); - close(in); - close(out); - } - setFileAttributes(src, dst); + Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING); } static String baseName(File file, String extension) { From c8d5601a8a39f6a03e9fb18676f6458ea2ec5f1f Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Tue, 29 Mar 2011 13:10:09 +0400 Subject: [PATCH 071/168] 7030147: java.awt.image.SampleModel.setDataElements() does't throw ArrayIndexOutOfBoundsEx for Integer.MAX_VA Reviewed-by: jgodinez, prr --- .../classes/java/awt/image/SampleModel.java | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/jdk/src/share/classes/java/awt/image/SampleModel.java b/jdk/src/share/classes/java/awt/image/SampleModel.java index e1437645e70..ab81b78d984 100644 --- a/jdk/src/share/classes/java/awt/image/SampleModel.java +++ b/jdk/src/share/classes/java/awt/image/SampleModel.java @@ -361,8 +361,8 @@ public abstract class SampleModel int x1 = x + w; int y1 = y + h; - if (x < 0 || x1 < x || x1 > width || - y < 0 || y1 < y || y1 > height) + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) { throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); } @@ -588,6 +588,15 @@ public abstract class SampleModel int type = getTransferType(); int numDataElems = getNumDataElements(); + int x1 = x + w; + int y1 = y + h; + + if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || + y < 0 || y >= height || h > height || y1 < 0 || y1 > height) + { + throw new ArrayIndexOutOfBoundsException("Invalid coordinates."); + } + switch(type) { case DataBuffer.TYPE_BYTE: @@ -595,8 +604,8 @@ public abstract class SampleModel byte[] barray = (byte[])obj; byte[] btemp = new byte[numDataElems]; - for (int i=y; i Date: Tue, 29 Mar 2011 08:15:16 -0400 Subject: [PATCH 072/168] 7031929: Variable names typos in Release-embedded.gmk Reviewed-by: alanb --- jdk/make/common/Release-embedded.gmk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/make/common/Release-embedded.gmk b/jdk/make/common/Release-embedded.gmk index 0d7875fd339..f7a87f28421 100644 --- a/jdk/make/common/Release-embedded.gmk +++ b/jdk/make/common/Release-embedded.gmk @@ -152,10 +152,10 @@ endif @# Remove all of the files that are not needed for the @# reduced JRE @# - for l in $(NOT_JREREDUCED_BIN) ; do \ + for l in $(NOT_REDUCEDJRE_BIN) ; do \ $(RM) $(JRE_REDUCED_IMAGE_DIR)/bin/$$l ; \ done - for l in $(NOT_JREREDUCED_LIB) ; do \ + for l in $(NOT_REDUCEDJRE_LIB) ; do \ $(RM) $(JRE_REDUCED_IMAGE_DIR)/lib/$$l ; \ done From 6dcd5b2414accfad168c55031573f105b2c2dc05 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Tue, 29 Mar 2011 17:11:35 +0400 Subject: [PATCH 073/168] 7003516: Methods java.awt.geom.Line2D.Double/Float.getBounds2D() don't satisfy inherited spec Reviewed-by: flar, prr --- jdk/src/share/classes/java/awt/Shape.java | 62 +++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Shape.java b/jdk/src/share/classes/java/awt/Shape.java index e037d0aa271..e478ea7f3d8 100644 --- a/jdk/src/share/classes/java/awt/Shape.java +++ b/jdk/src/share/classes/java/awt/Shape.java @@ -43,7 +43,7 @@ import java.awt.geom.Rectangle2D; * object that describes the trajectory path of the Shape * outline. *

- * Definition of insideness: + * Definition of insideness: * A point is considered to lie inside a * Shape if and only if: *

    @@ -88,6 +88,32 @@ public interface Shape { * getBounds2D method generally returns a * tighter bounding box due to its greater flexibility in * representation. + * + *

    + * Note that the + * definition of insideness can lead to situations where points + * on the defining outline of the {@code shape} may not be considered + * contained in the returned {@code bounds} object, but only in cases + * where those points are also not considered contained in the original + * {@code shape}. + *

    + *

    + * If a {@code point} is inside the {@code shape} according to the + * {@link #contains(double x, double y) contains(point)} method, then + * it must be inside the returned {@code Rectangle} bounds object + * according to the {@link #contains(double x, double y) contains(point)} + * method of the {@code bounds}. Specifically: + *

    + *

    + * {@code shape.contains(x,y)} requires {@code bounds.contains(x,y)} + *

    + *

    + * If a {@code point} is not inside the {@code shape}, then it might + * still be contained in the {@code bounds} object: + *

    + *

    + * {@code bounds.contains(x,y)} does not imply {@code shape.contains(x,y)} + *

    * @return an integer Rectangle that completely encloses * the Shape. * @see #getBounds2D @@ -107,6 +133,32 @@ public interface Shape { * to overflow problems since the return value can be an instance of * the Rectangle2D that uses double precision values to * store the dimensions. + * + *

    + * Note that the + * definition of insideness can lead to situations where points + * on the defining outline of the {@code shape} may not be considered + * contained in the returned {@code bounds} object, but only in cases + * where those points are also not considered contained in the original + * {@code shape}. + *

    + *

    + * If a {@code point} is inside the {@code shape} according to the + * {@link #contains(Point2D p) contains(point)} method, then it must + * be inside the returned {@code Rectangle2D} bounds object according + * to the {@link #contains(Point2D p) contains(point)} method of the + * {@code bounds}. Specifically: + *

    + *

    + * {@code shape.contains(p)} requires {@code bounds.contains(p)} + *

    + *

    + * If a {@code point} is not inside the {@code shape}, then it might + * still be contained in the {@code bounds} object: + *

    + *

    + * {@code bounds.contains(p)} does not imply {@code shape.contains(p)} + *

    * @return an instance of Rectangle2D that is a * high-precision bounding box of the Shape. * @see #getBounds @@ -116,7 +168,9 @@ public interface Shape { /** * Tests if the specified coordinates are inside the boundary of the - * Shape. + * Shape, as described by the + * + * definition of insideness. * @param x the specified X coordinate to be tested * @param y the specified Y coordinate to be tested * @return true if the specified coordinates are inside @@ -128,7 +182,9 @@ public interface Shape { /** * Tests if a specified {@link Point2D} is inside the boundary - * of the Shape. + * of the Shape, as described by the + * + * definition of insideness. * @param p the specified Point2D to be tested * @return true if the specified Point2D is * inside the boundary of the Shape; From 493fdf3e2429ae3147cdc08ab680bb4a5ce972cc Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Tue, 29 Mar 2011 10:39:00 -0400 Subject: [PATCH 074/168] 7019937: Translatability bug - Remove Unused String - String ID , read end of file 7019938: Translatability bug - Remove Unused String - String ID can not specify Principal with a 7019940: Translatability bug - Remove unused string - String ID: provided null name 7019942: Translatability bug - String ID: trustedCertEntry, 7019945: Translatability bug - Translatability issue - String ID: * has NOT been verified! In order to veri 7019947: Translatability bug - Translatability issue - String ID: * The integrity of the information stored i 7019949: Translatability bug - Translatability issue - String ID: * you must provide your keystore password Reviewed-by: weijun, wetmore --- .../com/sun/security/auth/PolicyParser.java | 16 ++++++++------- .../classes/sun/security/tools/JarSigner.java | 2 -- .../security/tools/JarSignerResources.java | 8 +++----- .../classes/sun/security/tools/KeyTool.java | 17 ++++++---------- .../sun/security/util/AuthResources.java | 15 +++++++------- .../classes/sun/security/util/Resources.java | 20 ++++++------------- 6 files changed, 32 insertions(+), 46 deletions(-) diff --git a/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java b/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java index e4168e4072c..aaf061b514f 100644 --- a/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java +++ b/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 @@ -30,13 +30,14 @@ import java.lang.RuntimePermission; import java.net.MalformedURLException; import java.net.SocketPermission; import java.net.URL; +import java.security.GeneralSecurityException; +import java.text.MessageFormat; import java.util.Enumeration; import java.util.Hashtable; import java.util.LinkedList; import java.util.ListIterator; import java.util.Vector; import java.util.StringTokenizer; -import java.security.GeneralSecurityException; import sun.security.util.PropertyExpander; /** @@ -368,8 +369,8 @@ class PolicyParser { "WILDCARD class but no WILDCARD name"); throw new ParsingException (st.lineno(), - rb.getString("can.not.specify.Principal.with.a.") + - rb.getString("wildcard.class.without.a.wildcard.name")); + rb.getString("can.not.specify.Principal.with.a." + + "wildcard.class.without.a.wildcard.name")); } try { @@ -525,9 +526,10 @@ class PolicyParser { rb.getString("number.") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: - throw new ParsingException - (rb.getString("expected.") + expect + - rb.getString(".read.end.of.file")); + MessageFormat form = new MessageFormat( + rb.getString("expected.expect.read.end.of.file.")); + Object[] source = {expect}; + throw new ParsingException(form.format(source)); case StreamTokenizer.TT_WORD: if (expect.equalsIgnoreCase(st.sval)) { lookahead = st.nextToken(); diff --git a/jdk/src/share/classes/sun/security/tools/JarSigner.java b/jdk/src/share/classes/sun/security/tools/JarSigner.java index 2692a515a83..ca1006a840e 100644 --- a/jdk/src/share/classes/sun/security/tools/JarSigner.java +++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java @@ -1238,8 +1238,6 @@ public class JarSigner { // Provide a helpful message when TSA is beyond a firewall error(rb.getString("unable.to.sign.jar.") + rb.getString("no.response.from.the.Timestamping.Authority.") + - rb.getString("When.connecting.from.behind.a.firewall.an.HTTP.or.HTTPS.proxy.may.need.to.be.specified.") + - rb.getString("Supply.the.following.options.to.jarsigner.") + "\n -J-Dhttp.proxyHost=" + "\n -J-Dhttp.proxyPort=\n" + rb.getString("or") + diff --git a/jdk/src/share/classes/sun/security/tools/JarSignerResources.java b/jdk/src/share/classes/sun/security/tools/JarSignerResources.java index cfa83abe6a0..cea8b253927 100644 --- a/jdk/src/share/classes/sun/security/tools/JarSignerResources.java +++ b/jdk/src/share/classes/sun/security/tools/JarSignerResources.java @@ -181,11 +181,9 @@ public class JarSignerResources extends java.util.ListResourceBundle { {"TSA.location.", "TSA location: "}, {"TSA.certificate.", "TSA certificate: "}, {"no.response.from.the.Timestamping.Authority.", - "no response from the Timestamping Authority. "}, - {"When.connecting.from.behind.a.firewall.an.HTTP.or.HTTPS.proxy.may.need.to.be.specified.", - "When connecting from behind a firewall an HTTP or HTTPS proxy may need to be specified. "}, - {"Supply.the.following.options.to.jarsigner.", - "Supply the following options to jarsigner: "}, + "no response from the Timestamping Authority. When connecting" + + " from behind a firewall an HTTP or HTTPS proxy may need to" + + " be specified. Supply the following options to jarsigner:"}, {"or", "or"}, {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the", "Certificate not found for: {0}. {1} must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority."}, diff --git a/jdk/src/share/classes/sun/security/tools/KeyTool.java b/jdk/src/share/classes/sun/security/tools/KeyTool.java index 50349173a41..d2749f5f8b2 100644 --- a/jdk/src/share/classes/sun/security/tools/KeyTool.java +++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java @@ -1740,16 +1740,19 @@ public final class KeyTool { KeyStore.TrustedCertificateEntry.class)) { // We have a trusted certificate entry Certificate cert = keyStore.getCertificate(alias); + Object[] source = {"trustedCertEntry"}; + String mf = new MessageFormat( + rb.getString("Entry.type.type.")).format(source) + "\n"; if (verbose && (cert instanceof X509Certificate)) { - out.println(rb.getString("Entry.type.trustedCertEntry.")); + out.println(mf); printX509Cert((X509Certificate)cert, out); } else if (rfc) { - out.println(rb.getString("Entry.type.trustedCertEntry.")); + out.println(mf); dumpCert(cert, out); } else if (debug) { out.println(cert.toString()); } else { - out.println(rb.getString("trustedCertEntry.")); + out.println("trustedCertEntry, "); out.println(rb.getString("Certificate.fingerprint.SHA1.") + getCertFingerPrint("SHA1", cert)); } @@ -1836,10 +1839,6 @@ public final class KeyTool { (".WARNING.WARNING.WARNING.")); System.err.println(rb.getString (".The.integrity.of.the.information.stored.in.the.srckeystore.")); - System.err.println(rb.getString - (".has.NOT.been.verified.In.order.to.verify.its.integrity.")); - System.err.println(rb.getString - (".you.must.provide.the.srckeystore.password.")); System.err.println(rb.getString (".WARNING.WARNING.WARNING.")); System.err.println(); @@ -3186,10 +3185,6 @@ public final class KeyTool { (".WARNING.WARNING.WARNING.")); System.err.println(rb.getString (".The.integrity.of.the.information.stored.in.your.keystore.")); - System.err.println(rb.getString - (".has.NOT.been.verified.In.order.to.verify.its.integrity.")); - System.err.println(rb.getString - (".you.must.provide.your.keystore.password.")); System.err.println(rb.getString (".WARNING.WARNING.WARNING.")); System.err.println(); diff --git a/jdk/src/share/classes/sun/security/util/AuthResources.java b/jdk/src/share/classes/sun/security/util/AuthResources.java index 68d8d9edbe2..8821b87988a 100644 --- a/jdk/src/share/classes/sun/security/util/AuthResources.java +++ b/jdk/src/share/classes/sun/security/util/AuthResources.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -111,17 +111,15 @@ public class AuthResources extends java.util.ListResourceBundle { // com.sun.security.auth.PolicyParser {"expected.keystore.type", "expected keystore type"}, - {"can.not.specify.Principal.with.a.", - "can not specify Principal with a "}, - {"wildcard.class.without.a.wildcard.name", - "wildcard class without a wildcard name"}, + {"can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name", + "can not specify Principal with a wildcard class without a wildcard name"}, {"expected.codeBase.or.SignedBy", "expected codeBase or SignedBy"}, {"only.Principal.based.grant.entries.permitted", "only Principal-based grant entries permitted"}, {"expected.permission.entry", "expected permission entry"}, {"number.", "number "}, - {"expected.", "expected "}, - {".read.end.of.file", ", read end of file"}, + {"expected.expect.read.end.of.file.", + "expected {0}, read end of file"}, {"expected.read.end.of.file", "expected ';', read end of file"}, {"line.", "line "}, {".expected.", ": expected '"}, @@ -136,6 +134,9 @@ public class AuthResources extends java.util.ListResourceBundle { {"SolarisNumericUserPrincipal.", "SolarisNumericUserPrincipal: "}, {"SolarisPrincipal.", "SolarisPrincipal: "}, + // provided.null.name is the NullPointerException message when a + // developer incorrectly passes a null name to the constructor of + // subclasses of java.security.Principal {"provided.null.name", "provided null name"} }; diff --git a/jdk/src/share/classes/sun/security/util/Resources.java b/jdk/src/share/classes/sun/security/util/Resources.java index 5489c3d9eaa..299facc668a 100644 --- a/jdk/src/share/classes/sun/security/util/Resources.java +++ b/jdk/src/share/classes/sun/security/util/Resources.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -304,8 +304,6 @@ public class Resources extends java.util.ListResourceBundle { {"Certificate.chain.length.", "Certificate chain length: "}, {"Certificate.i.1.", "Certificate[{0,number,integer}]:"}, {"Certificate.fingerprint.SHA1.", "Certificate fingerprint (SHA1): "}, - {"Entry.type.trustedCertEntry.", "Entry type: trustedCertEntry\n"}, - {"trustedCertEntry.", "trustedCertEntry,"}, {"Keystore.type.", "Keystore type: "}, {"Keystore.provider.", "Keystore provider: "}, {"Your.keystore.contains.keyStore.size.entry", @@ -378,21 +376,15 @@ public class Resources extends java.util.ListResourceBundle { {"No.certificate.from.the.SSL.server", "No certificate from the SSL server"}, - // Translators of the following 5 pairs, ATTENTION: - // the next 5 string pairs are meant to be combined into 2 paragraphs, - // 1+3+4 and 2+3+5. make sure your translation also does. {".The.integrity.of.the.information.stored.in.your.keystore.", - "* The integrity of the information stored in your keystore *"}, - {".The.integrity.of.the.information.stored.in.the.srckeystore.", - "* The integrity of the information stored in the srckeystore*"}, - {".has.NOT.been.verified.In.order.to.verify.its.integrity.", - "* has NOT been verified! In order to verify its integrity, *"}, - {".you.must.provide.your.keystore.password.", + "* The integrity of the information stored in your keystore *\n" + + "* has NOT been verified! In order to verify its integrity, *\n" + "* you must provide your keystore password. *"}, - {".you.must.provide.the.srckeystore.password.", + {".The.integrity.of.the.information.stored.in.the.srckeystore.", + "* The integrity of the information stored in the srckeystore*\n" + + "* has NOT been verified! In order to verify its integrity, *\n" + "* you must provide the srckeystore password. *"}, - {"Certificate.reply.does.not.contain.public.key.for.alias.", "Certificate reply does not contain public key for <{0}>"}, {"Incomplete.certificate.chain.in.reply", From 0a0b5a7a8a42dd74202079dada900787991f66f9 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 29 Mar 2011 16:40:07 +0100 Subject: [PATCH 075/168] 7030687: Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class Diamond accepts non-parameterized member inner classes with parameterized outer because of a bad check Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Check.java | 2 +- .../sun/tools/javac/parser/JavacParser.java | 91 +++++---- .../generics/diamond/7030687/ParserTest.java | 175 ++++++++++++++++++ .../generics/diamond/7030687/T7030687.java | 19 ++ .../generics/diamond/7030687/T7030687.out | 4 + 5 files changed, 249 insertions(+), 42 deletions(-) create mode 100644 langtools/test/tools/javac/generics/diamond/7030687/ParserTest.java create mode 100644 langtools/test/tools/javac/generics/diamond/7030687/T7030687.java create mode 100644 langtools/test/tools/javac/generics/diamond/7030687/T7030687.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java index 6b67a3ff4e9..c54d6862812 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -676,7 +676,7 @@ public class Check { "cant.apply.diamond.1", t, diags.fragment("diamond.and.anon.class", t)); return types.createErrorType(t); - } else if (!t.tsym.type.isParameterized()) { + } else if (t.tsym.type.getTypeArguments().isEmpty()) { log.error(tree.clazz.pos(), "cant.apply.diamond.1", t, diags.fragment("diamond.non.generic", t)); diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java index 7f9997d8fd3..22da1a85094 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -971,7 +971,7 @@ public class JavacParser implements Parser { if ((mode & EXPR) != 0) { mode = EXPR; S.nextToken(); - if (S.token() == LT) typeArgs = typeArguments(); + if (S.token() == LT) typeArgs = typeArguments(false); t = creator(pos, typeArgs); typeArgs = null; } else return illegal(); @@ -1036,7 +1036,7 @@ public class JavacParser implements Parser { mode = EXPR; int pos1 = S.pos(); S.nextToken(); - if (S.token() == LT) typeArgs = typeArguments(); + if (S.token() == LT) typeArgs = typeArguments(false); t = innerCreator(pos1, typeArgs, t); typeArgs = null; break loop; @@ -1116,7 +1116,7 @@ public class JavacParser implements Parser { mode = EXPR; int pos2 = S.pos(); S.nextToken(); - if (S.token() == LT) typeArgs = typeArguments(); + if (S.token() == LT) typeArgs = typeArguments(false); t = innerCreator(pos2, typeArgs, t); typeArgs = null; } else { @@ -1146,7 +1146,7 @@ public class JavacParser implements Parser { } else { int pos = S.pos(); accept(DOT); - typeArgs = (S.token() == LT) ? typeArguments() : null; + typeArgs = (S.token() == LT) ? typeArguments(false) : null; t = toP(F.at(pos).Select(t, ident())); t = argumentsOpt(typeArgs, t); } @@ -1206,7 +1206,7 @@ public class JavacParser implements Parser { (mode & NOPARAMS) == 0) { mode = TYPE; checkGenerics(); - return typeArguments(t); + return typeArguments(t, false); } else { return t; } @@ -1223,51 +1223,54 @@ public class JavacParser implements Parser { illegal(); } mode = useMode; - return typeArguments(); + return typeArguments(false); } return null; } /** TypeArguments = "<" TypeArgument {"," TypeArgument} ">" */ - List typeArguments() { - ListBuffer args = lb(); + List typeArguments(boolean diamondAllowed) { if (S.token() == LT) { S.nextToken(); - if (S.token() == GT && (mode & DIAMOND) != 0) { + if (S.token() == GT && diamondAllowed) { checkDiamond(); + mode |= DIAMOND; S.nextToken(); return List.nil(); - } - args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); - while (S.token() == COMMA) { - S.nextToken(); + } else { + ListBuffer args = ListBuffer.lb(); args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); - } - switch (S.token()) { - case GTGTGTEQ: - S.token(GTGTEQ); - break; - case GTGTEQ: - S.token(GTEQ); - break; - case GTEQ: - S.token(EQ); - break; - case GTGTGT: - S.token(GTGT); - break; - case GTGT: - S.token(GT); - break; - default: - accept(GT); - break; + while (S.token() == COMMA) { + S.nextToken(); + args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); + } + switch (S.token()) { + case GTGTGTEQ: + S.token(GTGTEQ); + break; + case GTGTEQ: + S.token(GTEQ); + break; + case GTEQ: + S.token(EQ); + break; + case GTGTGT: + S.token(GTGT); + break; + case GTGT: + S.token(GT); + break; + default: + accept(GT); + break; + } + return args.toList(); } } else { syntaxError(S.pos(), "expected", LT); + return List.nil(); } - return args.toList(); } /** TypeArgument = Type @@ -1303,9 +1306,9 @@ public class JavacParser implements Parser { } } - JCTypeApply typeArguments(JCExpression t) { + JCTypeApply typeArguments(JCExpression t, boolean diamondAllowed) { int pos = S.pos(); - List args = typeArguments(); + List args = typeArguments(diamondAllowed); return toP(F.at(pos).TypeApply(t, args)); } @@ -1370,18 +1373,25 @@ public class JavacParser implements Parser { } JCExpression t = qualident(); int oldmode = mode; - mode = TYPE | DIAMOND; + mode = TYPE; + boolean diamondFound = false; if (S.token() == LT) { checkGenerics(); - t = typeArguments(t); + t = typeArguments(t, true); + diamondFound = (mode & DIAMOND) != 0; } while (S.token() == DOT) { + if (diamondFound) { + //cannot select after a diamond + illegal(S.pos()); + } int pos = S.pos(); S.nextToken(); t = toP(F.at(pos).Select(t, ident())); if (S.token() == LT) { checkGenerics(); - t = typeArguments(t); + t = typeArguments(t, true); + diamondFound = (mode & DIAMOND) != 0; } } mode = oldmode; @@ -1416,9 +1426,8 @@ public class JavacParser implements Parser { JCExpression t = toP(F.at(S.pos()).Ident(ident())); if (S.token() == LT) { int oldmode = mode; - mode |= DIAMOND; checkGenerics(); - t = typeArguments(t); + t = typeArguments(t, true); mode = oldmode; } return classCreatorRest(newpos, encl, typeArgs, t); diff --git a/langtools/test/tools/javac/generics/diamond/7030687/ParserTest.java b/langtools/test/tools/javac/generics/diamond/7030687/ParserTest.java new file mode 100644 index 00000000000..cc7dddf0495 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030687/ParserTest.java @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7030687 + * @summary Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class + */ + +import com.sun.source.util.JavacTask; +import java.net.URI; +import java.util.Arrays; +import javax.tools.Diagnostic; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +public class ParserTest { + + enum TypeArgumentKind { + NONE(""), + EXPLICIT(""), + DIAMOND("<>"); + + String typeargStr; + + private TypeArgumentKind(String typeargStr) { + this.typeargStr = typeargStr; + } + } + + enum TypeQualifierArity { + ONE(1, "A1#TA1"), + TWO(2, "A1#TA1.A2#TA2"), + THREE(3, "A1#TA1.A2#TA2.A3#TA3"), + FOUR(4, "A1#TA1.A2#TA2.A3#TA3.A4#TA4"); + + int n; + String qualifierStr; + + private TypeQualifierArity(int n, String qualifierStr) { + this.n = n; + this.qualifierStr = qualifierStr; + } + + String getType(TypeArgumentKind... typeArgumentKinds) { + String res = qualifierStr; + for (int i = 1 ; i <= typeArgumentKinds.length ; i++) { + res = res.replace("#TA" + i, typeArgumentKinds[i-1].typeargStr); + } + return res; + } + } + + public static void main(String... args) throws Exception { + + //create default shared JavaCompiler - reused across multiple compilations + JavaCompiler comp = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null); + + for (TypeQualifierArity arity : TypeQualifierArity.values()) { + for (TypeArgumentKind tak1 : TypeArgumentKind.values()) { + if (arity == TypeQualifierArity.ONE) { + new ParserTest(arity, tak1).run(comp, fm); + continue; + } + for (TypeArgumentKind tak2 : TypeArgumentKind.values()) { + if (arity == TypeQualifierArity.TWO) { + new ParserTest(arity, tak1, tak2).run(comp, fm); + continue; + } + for (TypeArgumentKind tak3 : TypeArgumentKind.values()) { + if (arity == TypeQualifierArity.THREE) { + new ParserTest(arity, tak1, tak2, tak3).run(comp, fm); + continue; + } + for (TypeArgumentKind tak4 : TypeArgumentKind.values()) { + new ParserTest(arity, tak1, tak2, tak3, tak4).run(comp, fm); + } + } + } + } + } + } + + TypeQualifierArity qualifierArity; + TypeArgumentKind[] typeArgumentKinds; + JavaSource source; + DiagnosticChecker diagChecker; + + ParserTest(TypeQualifierArity qualifierArity, TypeArgumentKind... typeArgumentKinds) { + this.qualifierArity = qualifierArity; + this.typeArgumentKinds = typeArgumentKinds; + this.source = new JavaSource(); + this.diagChecker = new DiagnosticChecker(); + } + + class JavaSource extends SimpleJavaFileObject { + + String template = "class Test {\n" + + "R res = new #T();\n" + + "}\n"; + + String source; + + public JavaSource() { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + source = template.replace("#T", qualifierArity.getType(typeArgumentKinds)); + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + } + + void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception { + JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker, + null, null, Arrays.asList(source)); + ct.parse(); + check(); + } + + void check() { + + boolean errorExpected = false; + + for (int i = 0 ; i < qualifierArity.n - 1 ; i++) { + if (typeArgumentKinds[i] == TypeArgumentKind.DIAMOND) { + errorExpected = true; + break; + } + } + + if (errorExpected != diagChecker.errorFound) { + throw new Error("invalid diagnostics for source:\n" + + source.getCharContent(true) + + "\nFound error: " + diagChecker.errorFound + + "\nExpected error: " + errorExpected); + } + } + + static class DiagnosticChecker implements javax.tools.DiagnosticListener { + + boolean errorFound; + + public void report(Diagnostic diagnostic) { + if (diagnostic.getKind() == Diagnostic.Kind.ERROR) { + errorFound = true; + } + } + } +} diff --git a/langtools/test/tools/javac/generics/diamond/7030687/T7030687.java b/langtools/test/tools/javac/generics/diamond/7030687/T7030687.java new file mode 100644 index 00000000000..4618c315581 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030687/T7030687.java @@ -0,0 +1,19 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7030687 + * @summary Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class + * @compile/fail/ref=T7030687.out -XDrawDiagnostics T7030687.java + */ + +class T7030687 { + class Member { } + static class Nested {} + + void test() { + class Local {} + + Member m = new Member<>(); + Nested n = new Nested<>(); + Local l = new Local<>(); + } +} diff --git a/langtools/test/tools/javac/generics/diamond/7030687/T7030687.out b/langtools/test/tools/javac/generics/diamond/7030687/T7030687.out new file mode 100644 index 00000000000..35d8ed2a7d8 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030687/T7030687.out @@ -0,0 +1,4 @@ +T7030687.java:15:30: compiler.err.cant.apply.diamond.1: T7030687.Member, (compiler.misc.diamond.non.generic: T7030687.Member) +T7030687.java:16:30: compiler.err.cant.apply.diamond.1: T7030687.Nested, (compiler.misc.diamond.non.generic: T7030687.Nested) +T7030687.java:17:28: compiler.err.cant.apply.diamond.1: Local, (compiler.misc.diamond.non.generic: Local) +3 errors From bc3a1c60efa0352d8c59522383d50510b5b6d13e Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 29 Mar 2011 16:40:31 +0100 Subject: [PATCH 076/168] 7030606: Project-coin: multi-catch types should be pairwise disjoint Bring javac in sync with latest Project Coin EDR Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Attr.java | 18 +- .../tools/javac/resources/compiler.properties | 5 + .../MulticatchTypesMustBeDisjoint.java | 39 ++++ .../DisjunctiveTypeWellFormednessTest.java | 205 ++++++++++++++++++ .../javac/multicatch/7030606/T7030606.java | 57 +++++ .../javac/multicatch/7030606/T7030606.out | 13 ++ 6 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/diags/examples/MulticatchTypesMustBeDisjoint.java create mode 100644 langtools/test/tools/javac/multicatch/7030606/DisjunctiveTypeWellFormednessTest.java create mode 100644 langtools/test/tools/javac/multicatch/7030606/T7030606.java create mode 100644 langtools/test/tools/javac/multicatch/7030606/T7030606.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 2f224ebd27b..6856bd94341 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2901,7 +2901,23 @@ public class Attr extends JCTree.Visitor { ctype = chk.checkType(typeTree.pos(), chk.checkClassType(typeTree.pos(), ctype), syms.throwableType); - multicatchTypes.append(ctype); + if (!ctype.isErroneous()) { + //check that alternatives of a disjunctive type are pairwise + //unrelated w.r.t. subtyping + if (chk.intersects(ctype, multicatchTypes.toList())) { + for (Type t : multicatchTypes) { + boolean sub = types.isSubtype(ctype, t); + boolean sup = types.isSubtype(t, ctype); + if (sub || sup) { + //assume 'a' <: 'b' + Type a = sub ? ctype : t; + Type b = sub ? t : ctype; + log.error(typeTree.pos(), "multicatch.types.must.be.disjoint", a, b); + } + } + } + multicatchTypes.append(ctype); + } } tree.type = result = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties index 889e2293bf3..675625e8c35 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -302,6 +302,11 @@ compiler.err.try.resource.may.not.be.assigned=\ compiler.err.multicatch.parameter.may.not.be.assigned=\ multi-catch parameter {0} may not be assigned +# 0: type, 1: type +compiler.err.multicatch.types.must.be.disjoint=\ + Alternatives in a multi-catch statement cannot be related by subclassing\n\ + Alternative {0} is a subclass of alternative {1} + compiler.err.finally.without.try=\ ''finally'' without ''try'' diff --git a/langtools/test/tools/javac/diags/examples/MulticatchTypesMustBeDisjoint.java b/langtools/test/tools/javac/diags/examples/MulticatchTypesMustBeDisjoint.java new file mode 100644 index 00000000000..389ff94af32 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/MulticatchTypesMustBeDisjoint.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.multicatch.types.must.be.disjoint + +class MulticatchTypesMustBeDisjoint { + class E1 extends Exception { } + class E2 extends E1 { } + + void e1() throws E1 { } + void e2() throws E2 { } + + void m() { + try { + e1(); + e2(); + } catch (E1 | E2 e) { } + } +} diff --git a/langtools/test/tools/javac/multicatch/7030606/DisjunctiveTypeWellFormednessTest.java b/langtools/test/tools/javac/multicatch/7030606/DisjunctiveTypeWellFormednessTest.java new file mode 100644 index 00000000000..38fcdcce064 --- /dev/null +++ b/langtools/test/tools/javac/multicatch/7030606/DisjunctiveTypeWellFormednessTest.java @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7030606 + * @summary Project-coin: multi-catch types should be pairwise disjoint + */ + +import com.sun.source.util.JavacTask; +import java.net.URI; +import java.util.Arrays; +import javax.tools.Diagnostic; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +public class DisjunctiveTypeWellFormednessTest { + + enum Alternative { + EXCEPTION("Exception"), + RUNTIME_EXCEPTION("RuntimeException"), + IO_EXCEPTION("java.io.IOException"), + FILE_NOT_FOUND_EXCEPTION("java.io.FileNotFoundException"), + ILLEGAL_ARGUMENT_EXCEPTION("IllegalArgumentException"); + + String exceptionStr; + + private Alternative(String exceptionStr) { + this.exceptionStr = exceptionStr; + } + + static String makeDisjunctiveType(Alternative... alternatives) { + StringBuilder buf = new StringBuilder(); + String sep = ""; + for (Alternative alternative : alternatives) { + buf.append(sep); + buf.append(alternative.exceptionStr); + sep = "|"; + } + return buf.toString(); + } + + boolean disjoint(Alternative that) { + return disjoint[this.ordinal()][that.ordinal()]; + } + + static boolean[][] disjoint = { + // Exception RuntimeException IOException FileNotFoundException IllegalArgumentException + /*Exception*/ { false, false, false, false, false }, + /*RuntimeException*/ { false, false, true, true, false }, + /*IOException*/ { false, true, false, false, true }, + /*FileNotFoundException*/ { false, true, false, false, true }, + /*IllegalArgumentException*/ { false, false, true, true, false } + }; + } + + enum Arity { + ONE(1), + TWO(2), + THREE(3), + FOUR(4), + FIVE(5); + + int n; + + private Arity(int n) { + this.n = n; + } + } + + public static void main(String... args) throws Exception { + + //create default shared JavaCompiler - reused across multiple compilations + JavaCompiler comp = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null); + + for (Arity arity : Arity.values()) { + for (Alternative a1 : Alternative.values()) { + if (arity == Arity.ONE) { + new DisjunctiveTypeWellFormednessTest(a1).run(comp, fm); + continue; + } + for (Alternative a2 : Alternative.values()) { + if (arity == Arity.TWO) { + new DisjunctiveTypeWellFormednessTest(a1, a2).run(comp, fm); + continue; + } + for (Alternative a3 : Alternative.values()) { + if (arity == Arity.THREE) { + new DisjunctiveTypeWellFormednessTest(a1, a2, a3).run(comp, fm); + continue; + } + for (Alternative a4 : Alternative.values()) { + if (arity == Arity.FOUR) { + new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4).run(comp, fm); + continue; + } + for (Alternative a5 : Alternative.values()) { + new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4, a5).run(comp, fm); + } + } + } + } + } + } + } + + Alternative[] alternatives; + JavaSource source; + DiagnosticChecker diagChecker; + + DisjunctiveTypeWellFormednessTest(Alternative... alternatives) { + this.alternatives = alternatives; + this.source = new JavaSource(); + this.diagChecker = new DiagnosticChecker(); + } + + class JavaSource extends SimpleJavaFileObject { + + String template = "class Test {\n" + + "void test() {\n" + + "try {} catch (#T e) {}\n" + + "}\n" + + "}\n"; + + String source; + + public JavaSource() { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + source = template.replace("#T", Alternative.makeDisjunctiveType(alternatives)); + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + } + + void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception { + JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker, + null, null, Arrays.asList(source)); + ct.analyze(); + check(); + } + + void check() { + + int non_disjoint = 0; + int i = 0; + for (Alternative a1 : alternatives) { + int j = 0; + for (Alternative a2 : alternatives) { + if (i == j) continue; + if (!a1.disjoint(a2)) { + non_disjoint++; + break; + } + j++; + } + i++; + } + + if (non_disjoint != diagChecker.errorsFound) { + throw new Error("invalid diagnostics for source:\n" + + source.getCharContent(true) + + "\nFound errors: " + diagChecker.errorsFound + + "\nExpected errors: " + non_disjoint); + } + } + + static class DiagnosticChecker implements javax.tools.DiagnosticListener { + + int errorsFound; + + public void report(Diagnostic diagnostic) { + if (diagnostic.getKind() == Diagnostic.Kind.ERROR && + diagnostic.getCode().startsWith("compiler.err.multicatch.types.must.be.disjoint")) { + errorsFound++; + } + } + } +} diff --git a/langtools/test/tools/javac/multicatch/7030606/T7030606.java b/langtools/test/tools/javac/multicatch/7030606/T7030606.java new file mode 100644 index 00000000000..7548f07bb32 --- /dev/null +++ b/langtools/test/tools/javac/multicatch/7030606/T7030606.java @@ -0,0 +1,57 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7030606 + * + * @summary Project-coin: multi-catch types should be pairwise disjoint + * @compile/fail/ref=T7030606.out -XDrawDiagnostics T7030606.java + */ + +class T7030606 { + class E1 extends Exception { } + class E2 extends E1 { } + + void e1() throws E1 { } + void e2() throws E2 { } + + void m1() { + try { + e1(); + e2(); + } catch (NonExistentType | E2 | E1 e) { } + } + + void m2() { + try { + e1(); + e2(); + } catch (NonExistentType | E1 | E2 e) { } + } + + void m3() { + try { + e1(); + e2(); + } catch (E2 | NonExistentType | E1 e) { } + } + + void m4() { + try { + e1(); + e2(); + } catch (E1 | NonExistentType | E2 e) { } + } + + void m5() { + try { + e1(); + e2(); + } catch (E2 | E1 | NonExistentType e) { } + } + + void m6() { + try { + e1(); + e2(); + } catch (E1 | E2 | NonExistentType e) { } + } +} diff --git a/langtools/test/tools/javac/multicatch/7030606/T7030606.out b/langtools/test/tools/javac/multicatch/7030606/T7030606.out new file mode 100644 index 00000000000..1abe6b89a52 --- /dev/null +++ b/langtools/test/tools/javac/multicatch/7030606/T7030606.out @@ -0,0 +1,13 @@ +T7030606.java:20:18: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null) +T7030606.java:20:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1 +T7030606.java:27:18: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null) +T7030606.java:27:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1 +T7030606.java:34:23: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null) +T7030606.java:34:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1 +T7030606.java:41:23: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null) +T7030606.java:41:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1 +T7030606.java:48:23: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1 +T7030606.java:48:28: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null) +T7030606.java:55:23: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1 +T7030606.java:55:28: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null) +12 errors From bd9526ecbe5a536e4121cece963e468113284189 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 29 Mar 2011 16:40:51 +0100 Subject: [PATCH 077/168] 7030150: Type inference for generic instance creation failed for formal type parameter Problem when explicit generic constructor type-arguments are used in conjunction with diamond Reviewed-by: jjg --- .../com/sun/tools/javac/code/Types.java | 16 ++ .../com/sun/tools/javac/comp/Attr.java | 126 ++++----- .../com/sun/tools/javac/comp/Resolve.java | 6 +- .../GenericConstructorAndDiamondTest.java | 252 ++++++++++++++++++ .../javac/generics/diamond/7030150/Neg01.java | 17 ++ .../javac/generics/diamond/7030150/Neg01.out | 3 + .../javac/generics/diamond/7030150/Neg02.java | 17 ++ .../javac/generics/diamond/7030150/Neg02.out | 3 + .../javac/generics/diamond/7030150/Neg03.java | 17 ++ .../javac/generics/diamond/7030150/Neg03.out | 3 + .../javac/generics/diamond/7030150/Pos01.java | 44 +++ .../javac/generics/diamond/7030150/Pos02.java | 40 +++ 12 files changed, 470 insertions(+), 74 deletions(-) create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Neg01.java create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Neg01.out create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Neg02.java create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Neg02.out create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Neg03.java create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Neg03.out create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Pos01.java create mode 100644 langtools/test/tools/javac/generics/diamond/7030150/Pos02.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index a49077a6821..8de4750d4ac 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -2461,6 +2461,22 @@ public class Types { } }; + public Type createMethodTypeWithReturn(Type original, Type newReturn) { + return original.accept(methodWithReturn, newReturn); + } + // where + private final MapVisitor methodWithReturn = new MapVisitor() { + public Type visitType(Type t, Type newReturn) { + throw new IllegalArgumentException("Not a method type: " + t); + } + public Type visitMethodType(MethodType t, Type newReturn) { + return new MethodType(t.argtypes, newReturn, t.thrown, t.tsym); + } + public Type visitForAll(ForAll t, Type newReturn) { + return new ForAll(t.tvars, t.qtype.accept(this, newReturn)); + } + }; + // public Type createErrorType(Type originalType) { return new ErrorType(originalType, syms.errSymbol); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 6856bd94341..057b8529e79 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1580,7 +1580,7 @@ public class Attr extends JCTree.Visitor { // Attribute clazz expression and store // symbol + type back into the attributed tree. Type clazztype = attribType(clazz, env); - Pair mapping = getSyntheticScopeMapping(clazztype, cdef != null); + Pair mapping = getSyntheticScopeMapping(clazztype); clazztype = chk.checkDiamond(tree, clazztype); chk.validate(clazz, localEnv); if (tree.encl != null) { @@ -1778,62 +1778,48 @@ public class Attr extends JCTree.Visitor { Pair mapping, List argtypes, List typeargtypes) { - if (clazztype.isErroneous() || mapping == erroneousMapping) { + if (clazztype.isErroneous() || + clazztype.isInterface() || + mapping == erroneousMapping) { //if the type of the instance creation expression is erroneous, - //or something prevented us to form a valid mapping, return the - //(possibly erroneous) type unchanged + //or if it's an interface, or if something prevented us to form a valid + //mapping, return the (possibly erroneous) type unchanged return clazztype; } - else if (clazztype.isInterface()) { - //if the type of the instance creation expression is an interface - //skip the method resolution step (JLS 15.12.2.7). The type to be - //inferred is of the kind C - clazztype = new ForAll(clazztype.tsym.type.allparams(), clazztype.tsym.type) { - @Override - public List getConstraints(TypeVar tv, ConstraintKind ck) { - switch (ck) { - case EXTENDS: return types.getBounds(tv); - default: return List.nil(); - } - } - @Override - public Type inst(List inferred, Types types) throws Infer.NoInstanceException { - // check that inferred bounds conform to their bounds - infer.checkWithinBounds(tvars, - types.subst(tvars, tvars, inferred), Warner.noWarnings); - return super.inst(inferred, types); - } - }; - } else { - //if the type of the instance creation expression is a class type - //apply method resolution inference (JLS 15.12.2.7). The return type - //of the resolved constructor will be a partially instantiated type - ((ClassSymbol) clazztype.tsym).members_field = mapping.snd; - Symbol constructor; - try { - constructor = rs.resolveDiamond(tree.pos(), - env, - clazztype.tsym.type, - argtypes, - typeargtypes); - } finally { - ((ClassSymbol) clazztype.tsym).members_field = mapping.fst; - } - if (constructor.kind == MTH) { - ClassType ct = new ClassType(clazztype.getEnclosingType(), - clazztype.tsym.type.getTypeArguments(), - clazztype.tsym); - clazztype = checkMethod(ct, - constructor, - env, - tree.args, - argtypes, - typeargtypes, - env.info.varArgs).getReturnType(); - } else { - clazztype = syms.errType; - } + + //dup attribution environment and augment the set of inference variables + Env localEnv = env.dup(tree); + localEnv.info.tvars = clazztype.tsym.type.getTypeArguments(); + + //if the type of the instance creation expression is a class type + //apply method resolution inference (JLS 15.12.2.7). The return type + //of the resolved constructor will be a partially instantiated type + ((ClassSymbol) clazztype.tsym).members_field = mapping.snd; + Symbol constructor; + try { + constructor = rs.resolveDiamond(tree.pos(), + localEnv, + clazztype.tsym.type, + argtypes, + typeargtypes); + } finally { + ((ClassSymbol) clazztype.tsym).members_field = mapping.fst; } + if (constructor.kind == MTH) { + ClassType ct = new ClassType(clazztype.getEnclosingType(), + clazztype.tsym.type.getTypeArguments(), + clazztype.tsym); + clazztype = checkMethod(ct, + constructor, + localEnv, + tree.args, + argtypes, + typeargtypes, + localEnv.info.varArgs).getReturnType(); + } else { + clazztype = syms.errType; + } + if (clazztype.tag == FORALL && !pt.isErroneous()) { //if the resolved constructor's return type has some uninferred //type-variables, infer them using the expected type and declared @@ -1863,34 +1849,28 @@ public class Attr extends JCTree.Visitor { * inference. The inferred return type of the synthetic constructor IS * the inferred type for the diamond operator. */ - private Pair getSyntheticScopeMapping(Type ctype, boolean overrideProtectedAccess) { + private Pair getSyntheticScopeMapping(Type ctype) { if (ctype.tag != CLASS) { return erroneousMapping; } + Pair mapping = new Pair(ctype.tsym.members(), new Scope(ctype.tsym)); - List typevars = ctype.tsym.type.getTypeArguments(); + + //for each constructor in the original scope, create a synthetic constructor + //whose return type is the type of the class in which the constructor is + //declared, and insert it into the new scope. for (Scope.Entry e = mapping.fst.lookup(names.init); e.scope != null; e = e.next()) { - MethodSymbol newConstr = (MethodSymbol) e.sym.clone(ctype.tsym); - if (overrideProtectedAccess && (newConstr.flags() & PROTECTED) != 0) { - //make protected constructor public (this is required for - //anonymous inner class creation expressions using diamond) - newConstr.flags_field |= PUBLIC; - newConstr.flags_field &= ~PROTECTED; - } - newConstr.name = names.init; - List oldTypeargs = List.nil(); - if (newConstr.type.tag == FORALL) { - oldTypeargs = ((ForAll) newConstr.type).tvars; - } - newConstr.type = new MethodType(newConstr.type.getParameterTypes(), - new ClassType(ctype.getEnclosingType(), ctype.tsym.type.getTypeArguments(), ctype.tsym), - newConstr.type.getThrownTypes(), - syms.methodClass); - newConstr.type = new ForAll(typevars.prependList(oldTypeargs), newConstr.type); - mapping.snd.enter(newConstr); + Type synthRestype = new ClassType(ctype.getEnclosingType(), + ctype.tsym.type.getTypeArguments(), + ctype.tsym); + MethodSymbol synhConstr = new MethodSymbol(e.sym.flags(), + names.init, + types.createMethodTypeWithReturn(e.sym.type, synthRestype), + e.sym.owner); + mapping.snd.enter(synhConstr); } return mapping; } diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index 895112e15ef..301a3aeb44d 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -338,7 +338,11 @@ public class Resolve { // tvars is the list of formal type variables for which type arguments // need to inferred. - List tvars = env.info.tvars; + List tvars = null; + if (env.info.tvars != null) { + tvars = types.newInstances(env.info.tvars); + mt = types.subst(mt, env.info.tvars, tvars); + } if (typeargtypes == null) typeargtypes = List.nil(); if (mt.tag != FORALL && typeargtypes.nonEmpty()) { // This is not a polymorphic method, but typeargs are supplied diff --git a/langtools/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java b/langtools/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java new file mode 100644 index 00000000000..b458c26342f --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7030150 + * @summary Type inference for generic instance creation failed for formal type parameter + */ + +import com.sun.source.util.JavacTask; +import java.net.URI; +import java.util.Arrays; +import javax.tools.Diagnostic; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +public class GenericConstructorAndDiamondTest { + + enum BoundKind { + NO_BOUND(""), + STRING_BOUND("extends String"), + INTEGER_BOUND("extends Integer"); + + String boundStr; + + private BoundKind(String boundStr) { + this.boundStr = boundStr; + } + + boolean matches(TypeArgumentKind tak) { + switch (tak) { + case NONE: return true; + case STRING: return this != INTEGER_BOUND; + case INTEGER: return this != STRING_BOUND; + default: return false; + } + } + } + + enum ConstructorKind { + NON_GENERIC("Foo(Object o) {}"), + GENERIC_NO_BOUND(" Foo(T t) {}"), + GENERIC_STRING_BOUND(" Foo(T t) {}"), + GENERIC_INTEGER_BOUND(" Foo(T t) {}"); + + String constrStr; + + private ConstructorKind(String constrStr) { + this.constrStr = constrStr; + } + + boolean matches(ArgumentKind ak) { + switch (ak) { + case STRING: return this != GENERIC_INTEGER_BOUND; + case INTEGER: return this != GENERIC_STRING_BOUND; + default: return false; + } + } + } + + enum TypeArgArity { + ONE(1), + TWO(2), + THREE(3); + + int n; + + private TypeArgArity(int n) { + this.n = n; + } + } + + enum TypeArgumentKind { + NONE(""), + STRING("String"), + INTEGER("Integer"); + + String typeargStr; + + private TypeArgumentKind(String typeargStr) { + this.typeargStr = typeargStr; + } + + String getArgs(TypeArgArity arity) { + if (this == NONE) return ""; + else { + StringBuilder buf = new StringBuilder(); + String sep = ""; + for (int i = 0 ; i < arity.n ; i++) { + buf.append(sep); + buf.append(typeargStr); + sep = ","; + } + return "<" + buf.toString() + ">"; + } + } + + boolean matches(ArgumentKind ak) { + switch (ak) { + case STRING: return this != INTEGER; + case INTEGER: return this != STRING; + default: return false; + } + } + } + + enum ArgumentKind { + STRING("\"\""), + INTEGER("1"); + + String argStr; + + private ArgumentKind(String argStr) { + this.argStr = argStr; + } + } + + public static void main(String... args) throws Exception { + + //create default shared JavaCompiler - reused across multiple compilations + JavaCompiler comp = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null); + + for (BoundKind boundKind : BoundKind.values()) { + for (ConstructorKind constructorKind : ConstructorKind.values()) { + for (TypeArgumentKind declArgKind : TypeArgumentKind.values()) { + for (TypeArgArity arity : TypeArgArity.values()) { + for (TypeArgumentKind useArgKind : TypeArgumentKind.values()) { + for (ArgumentKind argKind : ArgumentKind.values()) { + new GenericConstructorAndDiamondTest(boundKind, constructorKind, + declArgKind, arity, useArgKind, argKind).run(comp, fm); + } + } + } + } + } + } + } + + BoundKind boundKind; + ConstructorKind constructorKind; + TypeArgumentKind declTypeArgumentKind; + TypeArgArity useTypeArgArity; + TypeArgumentKind useTypeArgumentKind; + ArgumentKind argumentKind; + JavaSource source; + DiagnosticChecker diagChecker; + + GenericConstructorAndDiamondTest(BoundKind boundKind, ConstructorKind constructorKind, + TypeArgumentKind declTypeArgumentKind, TypeArgArity useTypeArgArity, + TypeArgumentKind useTypeArgumentKind, ArgumentKind argumentKind) { + this.boundKind = boundKind; + this.constructorKind = constructorKind; + this.declTypeArgumentKind = declTypeArgumentKind; + this.useTypeArgArity = useTypeArgArity; + this.useTypeArgumentKind = useTypeArgumentKind; + this.argumentKind = argumentKind; + this.source = new JavaSource(); + this.diagChecker = new DiagnosticChecker(); + } + + class JavaSource extends SimpleJavaFileObject { + + String template = "class Foo {\n" + + "#CK\n" + + "}\n" + + "class Test {\n" + + "void test() {\n" + + "Foo#TA1 f = new #TA2 Foo<>(#A);\n" + + "}\n" + + "}\n"; + + String source; + + public JavaSource() { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + source = template.replace("#BK", boundKind.boundStr). + replace("#CK", constructorKind.constrStr) + .replace("#TA1", declTypeArgumentKind.getArgs(TypeArgArity.ONE)) + .replace("#TA2", useTypeArgumentKind.getArgs(useTypeArgArity)) + .replace("#A", argumentKind.argStr); + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + } + + void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception { + JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker, + null, null, Arrays.asList(source)); + ct.analyze(); + check(); + } + + void check() { + boolean badActual = !constructorKind.matches(argumentKind); + + boolean badArity = constructorKind != ConstructorKind.NON_GENERIC && + useTypeArgumentKind != TypeArgumentKind.NONE && + useTypeArgArity != TypeArgArity.ONE; + + boolean badMethodTypeArg = constructorKind != ConstructorKind.NON_GENERIC && + !useTypeArgumentKind.matches(argumentKind); + + boolean badGenericType = !boundKind.matches(declTypeArgumentKind); + + boolean shouldFail = badActual || badArity || badMethodTypeArg || badGenericType; + + if (shouldFail != diagChecker.errorFound) { + throw new Error("invalid diagnostics for source:\n" + + source.getCharContent(true) + + "\nFound error: " + diagChecker.errorFound + + "\nExpected error: " + shouldFail); + } + } + + static class DiagnosticChecker implements javax.tools.DiagnosticListener { + + boolean errorFound; + + public void report(Diagnostic diagnostic) { + if (diagnostic.getKind() == Diagnostic.Kind.ERROR) { + errorFound = true; + } + } + } +} diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Neg01.java b/langtools/test/tools/javac/generics/diamond/7030150/Neg01.java new file mode 100644 index 00000000000..732a4af4c60 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Neg01.java @@ -0,0 +1,17 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7030150 + * @summary Type inference for generic instance creation failed for formal type parameter + * check that explicit type-argument that causes resolution failure is rejected + * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java + */ + +class Neg01 { + + static class Foo { + Foo(T t) {} + } + + Foo fi1 = new Foo<>(1); + Foo fi2 = new Foo(1); +} diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Neg01.out b/langtools/test/tools/javac/generics/diamond/7030150/Neg01.out new file mode 100644 index 00000000000..dec4f5e7125 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Neg01.out @@ -0,0 +1,3 @@ +Neg01.java:15:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg01.Foo), (compiler.misc.infer.no.conforming.assignment.exists: X, int, java.lang.String) +Neg01.java:16:24: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, T, int, kindname.class, Neg01.Foo, (compiler.misc.no.conforming.assignment.exists: int, java.lang.String) +2 errors diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Neg02.java b/langtools/test/tools/javac/generics/diamond/7030150/Neg02.java new file mode 100644 index 00000000000..96bbed3483f --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Neg02.java @@ -0,0 +1,17 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7030150 + * @summary Type inference for generic instance creation failed for formal type parameter + * check that compiler rejects bad number of explicit type-arguments + * @compile/fail/ref=Neg02.out -XDrawDiagnostics Neg02.java + */ + +class Neg02 { + + static class Foo { + Foo(T t) {} + } + + Foo fi1 = new Foo<>(""); + Foo fi2 = new Foo(""); +} diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Neg02.out b/langtools/test/tools/javac/generics/diamond/7030150/Neg02.out new file mode 100644 index 00000000000..fdec30372a1 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Neg02.out @@ -0,0 +1,3 @@ +Neg02.java:15:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg02.Foo), (compiler.misc.arg.length.mismatch) +Neg02.java:16:24: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, T, java.lang.String, kindname.class, Neg02.Foo, (compiler.misc.arg.length.mismatch) +2 errors diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Neg03.java b/langtools/test/tools/javac/generics/diamond/7030150/Neg03.java new file mode 100644 index 00000000000..75258925c13 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Neg03.java @@ -0,0 +1,17 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7030150 + * @summary Type inference for generic instance creation failed for formal type parameter + * check that explicit type-argument that does not conform to bound is rejected + * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java + */ + +class Neg03 { + + static class Foo { + Foo(T t) {} + } + + Foo fi1 = new Foo<>(1); + Foo fi2 = new Foo(1); +} diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Neg03.out b/langtools/test/tools/javac/generics/diamond/7030150/Neg03.out new file mode 100644 index 00000000000..05624f949b8 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Neg03.out @@ -0,0 +1,3 @@ +Neg03.java:15:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg03.Foo), (compiler.misc.explicit.param.do.not.conform.to.bounds: java.lang.String, java.lang.Integer) +Neg03.java:16:24: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, T, int, kindname.class, Neg03.Foo, (compiler.misc.explicit.param.do.not.conform.to.bounds: java.lang.String, java.lang.Integer) +2 errors diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Pos01.java b/langtools/test/tools/javac/generics/diamond/7030150/Pos01.java new file mode 100644 index 00000000000..e5203072ee8 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Pos01.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7030150 + * @summary Type inference for generic instance creation failed for formal type parameter + * check that redundant type-arguments on non-generic constructor are accepted + * @compile Pos01.java + */ + +class Pos01 { + + static class Foo { + Foo(X t) {} + } + + Foo fi1 = new Foo<>(1); + Foo fi2 = new Foo(1); + Foo fi3 = new Foo<>(1); + Foo fi4 = new Foo(1); + Foo fi5 = new Foo<>(1); + Foo fi6 = new Foo(1); +} diff --git a/langtools/test/tools/javac/generics/diamond/7030150/Pos02.java b/langtools/test/tools/javac/generics/diamond/7030150/Pos02.java new file mode 100644 index 00000000000..868a51fd03f --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/7030150/Pos02.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7030150 + * @summary Type inference for generic instance creation failed for formal type parameter + * check that diamond in return context works w/o problems + * @compile Pos02.java + */ + +class Pos02 { + + Pos02(X x) {} + + + Pos02 test(X x) { + return new Pos02<>(x); + } +} From acf788aa1f5ca83b248eb460473b44d8d5a5f140 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 29 Mar 2011 16:41:18 +0100 Subject: [PATCH 078/168] 7027157: Project Coin: javac warnings for AutoCloseable.close throwing InterruptedException Javac should warn about use/declaration of AutoCloseable subclasses that can throw InterruptedException Reviewed-by: jjg --- .../com/sun/tools/javac/code/Symtab.java | 3 + .../com/sun/tools/javac/comp/Attr.java | 36 +++ .../tools/javac/resources/compiler.properties | 4 + .../InterruptedExceptionTest.java | 234 ++++++++++++++++++ .../TryResourceThrowsInterruptedExc.java | 29 +++ 5 files changed, 306 insertions(+) create mode 100644 langtools/test/tools/javac/TryWithResources/InterruptedExceptionTest.java create mode 100644 langtools/test/tools/javac/diags/examples/TryResourceThrowsInterruptedExc.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java index 1a8f77a9143..547d01ef729 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java @@ -131,6 +131,7 @@ public class Symtab { public final Type polymorphicSignatureType; public final Type throwableType; public final Type errorType; + public final Type interruptedExceptionType; public final Type illegalArgumentExceptionType; public final Type exceptionType; public final Type runtimeExceptionType; @@ -441,6 +442,7 @@ public class Symtab { polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature"); errorType = enterClass("java.lang.Error"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); + interruptedExceptionType = enterClass("java.lang.InterruptedException"); exceptionType = enterClass("java.lang.Exception"); runtimeExceptionType = enterClass("java.lang.RuntimeException"); classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException"); @@ -480,6 +482,7 @@ public class Symtab { autoCloseableType.tsym); trustMeType = enterClass("java.lang.SafeVarargs"); + synthesizeEmptyInterfaceIfMissing(autoCloseableType); synthesizeEmptyInterfaceIfMissing(cloneableType); synthesizeEmptyInterfaceIfMissing(serializableType); synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292 diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 057b8529e79..b4fc90f3d9b 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1089,6 +1089,10 @@ public class Attr extends JCTree.Visitor { if (resource.getTag() == JCTree.VARDEF) { attribStat(resource, tryEnv); chk.checkType(resource, resource.type, syms.autoCloseableType, "try.not.applicable.to.type"); + + //check that resource type cannot throw InterruptedException + checkAutoCloseable(resource.pos(), localEnv, resource.type); + VarSymbol var = (VarSymbol)TreeInfo.symbolFor(resource); var.setData(ElementKind.RESOURCE_VARIABLE); } else { @@ -1127,6 +1131,35 @@ public class Attr extends JCTree.Visitor { result = null; } + void checkAutoCloseable(DiagnosticPosition pos, Env env, Type resource) { + if (!resource.isErroneous() && + types.asSuper(resource, syms.autoCloseableType.tsym) != null) { + Symbol close = syms.noSymbol; + boolean prevDeferDiags = log.deferDiagnostics; + Queue prevDeferredDiags = log.deferredDiagnostics; + try { + log.deferDiagnostics = true; + log.deferredDiagnostics = ListBuffer.lb(); + close = rs.resolveQualifiedMethod(pos, + env, + resource, + names.close, + List.nil(), + List.nil()); + } + finally { + log.deferDiagnostics = prevDeferDiags; + log.deferredDiagnostics = prevDeferredDiags; + } + if (close.kind == MTH && + close.overrides(syms.autoCloseableClose, resource.tsym, types, true) && + chk.isHandled(syms.interruptedExceptionType, types.memberType(resource, close).getThrownTypes()) && + env.info.lint.isEnabled(LintCategory.TRY)) { + log.warning(LintCategory.TRY, pos, "try.resource.throws.interrupted.exc", resource); + } + } + } + public void visitConditional(JCConditional tree) { attribExpr(tree.cond, env, syms.booleanType); attribExpr(tree.truepart, env); @@ -3169,6 +3202,9 @@ public class Attr extends JCTree.Visitor { // method conform to the method they implement. chk.checkImplementations(tree); + //check that a resource implementing AutoCloseable cannot throw InterruptedException + checkAutoCloseable(tree.pos(), env, c.type); + for (List l = tree.defs; l.nonEmpty(); l = l.tail) { // Attribute declaration attribStat(l.head, env); diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties index 675625e8c35..62a493320f6 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -1244,6 +1244,10 @@ compiler.warn.try.explicit.close.call=\ compiler.warn.try.resource.not.referenced=\ auto-closeable resource {0} is never referenced in body of corresponding try statement +# 0: type +compiler.warn.try.resource.throws.interrupted.exc=\ + auto-closeable resource {0} has a member method close() that could throw InterruptedException + compiler.warn.unchecked.assign=\ unchecked assignment: {0} to {1} diff --git a/langtools/test/tools/javac/TryWithResources/InterruptedExceptionTest.java b/langtools/test/tools/javac/TryWithResources/InterruptedExceptionTest.java new file mode 100644 index 00000000000..761a62972cf --- /dev/null +++ b/langtools/test/tools/javac/TryWithResources/InterruptedExceptionTest.java @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7027157 + * @summary Project Coin: javac warnings for AutoCloseable.close throwing InterruptedException + */ + +import com.sun.source.util.JavacTask; +import java.net.URI; +import java.util.Arrays; +import javax.tools.Diagnostic; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +public class InterruptedExceptionTest { + + enum XlintOption { + NONE("none"), + TRY("try"); + + String opt; + + XlintOption(String opt) { + this.opt = opt; + } + + String getXlintOption() { + return "-Xlint:" + opt; + } + } + + enum SuppressLevel { + NONE, + SUPPRESS; + + String getSuppressAnno() { + return this == SUPPRESS ? + "@SuppressWarnings(\"try\")" : + ""; + } + } + + enum ClassKind { + ABSTRACT_CLASS("abstract class", "implements", false), + CLASS("class", "implements", true), + INTERFACE("interface", "extends", false); + + String kindName; + String extendsClause; + boolean hasBody; + + private ClassKind(String kindName, String extendsClause, boolean hasBody) { + this.kindName = kindName; + this.extendsClause = extendsClause; + this.hasBody = hasBody; + } + + String getBody() { + return hasBody ? "{}" : ";"; + } + } + + enum ExceptionKind { + NONE("", false), + EXCEPTION("Exception", true), + INTERRUPTED_EXCEPTION("InterruptedException", true), + ILLEGAL_ARGUMENT_EXCEPTION("IllegalArgumentException", false), + X("X", false); + + String exName; + boolean shouldWarn; + + private ExceptionKind(String exName, boolean shouldWarn) { + this.exName = exName; + this.shouldWarn = shouldWarn; + } + + String getThrowsClause() { + return this == NONE ? "" : "throws " + exName; + } + + String getTypeArguments(ExceptionKind decl) { + return (decl != X || this == NONE) ? "" : "<" + exName + ">"; + } + + String getTypeParameter() { + return this == X ? "" : ""; + } + } + + public static void main(String... args) throws Exception { + + //create default shared JavaCompiler - reused across multiple compilations + JavaCompiler comp = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null); + + for (XlintOption xlint : XlintOption.values()) { + for (SuppressLevel suppress_decl : SuppressLevel.values()) { + for (SuppressLevel suppress_use : SuppressLevel.values()) { + for (ClassKind ck : ClassKind.values()) { + for (ExceptionKind ek_decl : ExceptionKind.values()) { + for (ExceptionKind ek_use : ExceptionKind.values()) { + new InterruptedExceptionTest(xlint, suppress_decl, + suppress_use, ck, ek_decl, ek_use).run(comp, fm); + } + } + } + } + } + } + } + + XlintOption xlint; + SuppressLevel suppress_decl; + SuppressLevel suppress_use; + ClassKind ck; + ExceptionKind ek_decl; + ExceptionKind ek_use; + JavaSource source; + DiagnosticChecker diagChecker; + + InterruptedExceptionTest(XlintOption xlint, SuppressLevel suppress_decl, SuppressLevel suppress_use, + ClassKind ck, ExceptionKind ek_decl, ExceptionKind ek_use) { + this.xlint = xlint; + this.suppress_decl = suppress_decl; + this.suppress_use = suppress_use; + this.ck = ck; + this.ek_decl = ek_decl; + this.ek_use = ek_use; + this.source = new JavaSource(); + this.diagChecker = new DiagnosticChecker(); + } + + class JavaSource extends SimpleJavaFileObject { + + String template = "#S1 #CK Resource#G #EC AutoCloseable {\n" + + "public void close() #TK #BK\n" + + "}\n" + + "class Test {\n" + + "#S2 void test() {\n" + + "try (Resource#PK r = null) { }\n" + + "}\n" + + "}\n"; + + String source; + + public JavaSource() { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + source = template.replace("#S1", suppress_decl.getSuppressAnno()) + .replace("#S2", suppress_use.getSuppressAnno()) + .replace("#CK", ck.kindName) + .replace("#EC", ck.extendsClause) + .replace("#G", ek_decl.getTypeParameter()) + .replace("#TK", ek_decl.getThrowsClause()) + .replace("#BK", ck.getBody()) + .replace("#PK", ek_use.getTypeArguments(ek_decl)); + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + } + + void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception { + JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker, + Arrays.asList(xlint.getXlintOption()), null, Arrays.asList(source)); + ct.analyze(); + check(); + } + + void check() { + + boolean shouldWarnDecl = ek_decl.shouldWarn && + xlint == XlintOption.TRY && + suppress_decl != SuppressLevel.SUPPRESS; + + boolean shouldWarnUse = (ek_decl.shouldWarn || + ((ek_use.shouldWarn || ek_use == ExceptionKind.NONE) && ek_decl == ExceptionKind.X)) && + xlint == XlintOption.TRY && + suppress_use != SuppressLevel.SUPPRESS; + + int foundWarnings = 0; + + if (shouldWarnDecl) foundWarnings++; + if (shouldWarnUse) foundWarnings++; + + if (foundWarnings != diagChecker.tryWarnFound) { + throw new Error("invalid diagnostics for source:\n" + + source.getCharContent(true) + + "\nOptions: " + xlint.getXlintOption() + + "\nFound warnings: " + diagChecker.tryWarnFound + + "\nExpected decl warning: " + shouldWarnDecl + + "\nExpected use warning: " + shouldWarnUse); + } + } + + static class DiagnosticChecker implements javax.tools.DiagnosticListener { + + int tryWarnFound; + + public void report(Diagnostic diagnostic) { + if (diagnostic.getKind() == Diagnostic.Kind.WARNING && + diagnostic.getCode().contains("try.resource.throws.interrupted.exc")) { + tryWarnFound++; + } + } + } +} diff --git a/langtools/test/tools/javac/diags/examples/TryResourceThrowsInterruptedExc.java b/langtools/test/tools/javac/diags/examples/TryResourceThrowsInterruptedExc.java new file mode 100644 index 00000000000..c22992c991e --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/TryResourceThrowsInterruptedExc.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.warn.try.resource.throws.interrupted.exc +// options: -Xlint:try + +class TryResourceThrowsInterruptedException implements AutoCloseable { + public void close() throws InterruptedException {} +} From 1c5ff7f80a9a9ca9937b556f3227439855c031e9 Mon Sep 17 00:00:00 2001 From: Eric Caspole Date: Tue, 29 Mar 2011 09:11:51 -0700 Subject: [PATCH 079/168] 7032133: Enable sse4.2 for new AMD processors New AMD processors support sse4.2. Enable corresponding instructions in Hotspot. Reviewed-by: kvn --- hotspot/src/cpu/x86/vm/vm_version_x86.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp index 3321d54860c..9f352e3e9af 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp @@ -429,6 +429,11 @@ void VM_Version::get_processor_features() { UseXmmI2D = false; } } + if( FLAG_IS_DEFAULT(UseSSE42Intrinsics) ) { + if( supports_sse4_2() && UseSSE >= 4 ) { + UseSSE42Intrinsics = true; + } + } // Use count leading zeros count instruction if available. if (supports_lzcnt()) { From 6fec1477a3cf268efd7bae5b12bd958240413ea8 Mon Sep 17 00:00:00 2001 From: Alexander Potochkin Date: Tue, 29 Mar 2011 21:02:53 +0400 Subject: [PATCH 080/168] 7027486: JPopupMenu doesn't take window shape into account Reviewed-by: rupashka --- jdk/src/share/classes/javax/swing/PopupFactory.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jdk/src/share/classes/javax/swing/PopupFactory.java b/jdk/src/share/classes/javax/swing/PopupFactory.java index 13a1f9d1a68..713ada71558 100644 --- a/jdk/src/share/classes/javax/swing/PopupFactory.java +++ b/jdk/src/share/classes/javax/swing/PopupFactory.java @@ -203,6 +203,12 @@ public class PopupFactory { popupType = HEAVY_WEIGHT_POPUP; break; } + } else if (c instanceof Window) { + Window w = (Window) c; + if (!w.isOpaque() || w.getOpacity() < 1 || w.getShape() != null) { + popupType = HEAVY_WEIGHT_POPUP; + break; + } } c = c.getParent(); } From 793f1078b661b6af7943619996e099b5b587bbb1 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 29 Mar 2011 15:50:55 -0700 Subject: [PATCH 081/168] 7024172: Move BufferPoolMXBean and PlatformLoggingMXBean java.lang.management Reviewed-by: alanb --- .../management}/BufferPoolMXBean.java | 19 +- .../lang/management/ManagementFactory.java | 423 +++++++++--------- .../lang/management/PlatformComponent.java | 106 ++++- .../management/PlatformLoggingMXBean.java | 138 ++++++ .../management/PlatformManagedObject.java | 2 +- .../classes/java/lang/management/package.html | 300 +++++-------- .../classes/java/util/logging/LogManager.java | 21 +- .../java/util/logging/LoggingMXBean.java | 43 +- .../util/logging/PlatformLoggingMXBean.java | 60 --- .../management/ManagementFactoryHelper.java | 121 ++--- jdk/test/Makefile | 4 +- .../management}/BufferPoolMXBean/Basic.java | 40 +- .../ManagementFactory/GetPlatformMXBeans.java | 108 ++++- .../LoggingMXBeanTest.java | 229 ++++++++++ .../PlatformLoggingMXBeanTest.java | 19 +- .../AsynchronousSocketChannel/Leaky.java | 2 +- 16 files changed, 1033 insertions(+), 602 deletions(-) rename jdk/src/share/classes/java/{nio => lang/management}/BufferPoolMXBean.java (90%) create mode 100644 jdk/src/share/classes/java/lang/management/PlatformLoggingMXBean.java delete mode 100644 jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java rename jdk/test/java/{nio => lang/management}/BufferPoolMXBean/Basic.java (78%) create mode 100644 jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java rename jdk/test/java/{util/logging => lang/management}/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java (95%) diff --git a/jdk/src/share/classes/java/nio/BufferPoolMXBean.java b/jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java similarity index 90% rename from jdk/src/share/classes/java/nio/BufferPoolMXBean.java rename to jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java index d2f2586fbe1..f8fb4bd42f3 100644 --- a/jdk/src/share/classes/java/nio/BufferPoolMXBean.java +++ b/jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java @@ -23,15 +23,15 @@ * questions. */ -package java.nio; - -import java.lang.management.PlatformManagedObject; +package java.lang.management; /** - * The management interface for a buffer pool. + * The management interface for a buffer pool, for example a pool of + * {@link java.nio.ByteBuffer#allocateDirect direct} or {@link + * java.nio.MappedByteBuffer mapped} buffers. * - *

    A class implementing this interface is an MXBean. A Java + *

    A class implementing this interface is an + * {@link javax.management.MXBean}. A Java * virtual machine has one or more implementations of this interface. The {@link * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans} * method can be used to obtain the list of {@code BufferPoolMXBean} objects @@ -44,14 +44,13 @@ import java.lang.management.PlatformManagedObject; * javax.management.MBeanServer MBeanServer}. The {@link * javax.management.ObjectName ObjectName} that uniquely identifies the * management interface within the {@code MBeanServer} takes the form: - *

    - * java.nio:type=BufferPool,name=pool name - *
    + *
    + *     java.nio:type=BufferPool,name=pool name
    + * 
    * where pool name is the {@link #getName name} of the buffer pool. * * @since 1.7 */ - public interface BufferPoolMXBean extends PlatformManagedObject { /** diff --git a/jdk/src/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/share/classes/java/lang/management/ManagementFactory.java index bfe9d23f959..2dd64d19a84 100644 --- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java +++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java @@ -40,8 +40,9 @@ import javax.management.NotCompliantMBeanException; import javax.management.StandardEmitterMBean; import javax.management.StandardMBean; import java.util.Collections; -import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.TreeSet; import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedAction; @@ -51,37 +52,63 @@ import javax.management.JMX; import sun.management.ManagementFactoryHelper; /** - * The ManagementFactory class is a factory class for getting + * The {@code ManagementFactory} class is a factory class for getting * managed beans for the Java platform. * This class consists of static methods each of which returns - * one or more platform MXBean(s) representing + * one or more platform MXBeans representing * the management interface of a component of the Java virtual * machine. + *

    + *

    Platform MXBeans

    + *

    + * A platform MXBean is a managed bean that + * conforms to the JMX + * Instrumentation Specification and only uses a set of basic data types. + * A JMX management application and the {@linkplain + * #getPlatformMBeanServer platform MBeanServer} + * can interoperate without requiring classes for MXBean specific + * data types. + * The data types being transmitted between the JMX connector + * server and the connector client are + * {@linkplain javax.management.openmbean.OpenType open types} + * and this allows interoperation across versions. + * See + * the specification of MXBeans for details. + * + * + *

    Each platform MXBean is a {@link PlatformManagedObject} + * and it has a unique + * {@link javax.management.ObjectName ObjectName} for + * registration in the platform {@code MBeanServer} as returned by + * by the {@link PlatformManagedObject#getObjectName getObjectName} + * method. * *

    * An application can access a platform MXBean in the following ways: + *

    1. Direct access to an MXBean interface
    + *
    *
      - *
    • Direct access to an MXBean interface - *
        - *
      1. Get the MXBean instance through the static factory method, - * or the {@link #getPlatformMXBeans(Class)} method - * and access the MXBean locally of the running + *
      2. Get an MXBean instance by calling the + * {@link #getPlatformMXBean(Class) getPlatformMXBean} or + * {@link #getPlatformMXBeans(Class) getPlatformMXBeans} method + * and access the MXBean locally in the running * virtual machine. *
      3. *
      4. Construct an MXBean proxy instance that forwards the * method calls to a given {@link MBeanServer MBeanServer} by calling - * the {@link #newPlatformMXBeanProxy newPlatformMXBeanProxy} method - * or the {@link #getPlatformMXBeans(MBeanServerConnection, Class)} - * method. + * the {@link #getPlatformMXBean(MBeanServerConnection, Class)} or + * {@link #getPlatformMXBeans(MBeanServerConnection, Class)} method. + * The {@link #newPlatformMXBeanProxy newPlatformMXBeanProxy} method + * can also be used to construct an MXBean proxy instance of + * a given {@code ObjectName}. * A proxy is typically constructed to remotely access * an MXBean of another running virtual machine. *
      5. - *
    • - *
    • Indirect access to an MXBean interface via MBeanServer - *
        - *
      1. Go through the {@link #getPlatformMBeanServer - * platform MBeanServer} to access MXBeans locally or - * a specific MBeanServerConnection to access + *
    + *
    2. Indirect access to an MXBean interface via MBeanServer
    + *
      + *
    • Go through the platform {@code MBeanServer} to access MXBeans + * locally or a specific MBeanServerConnection to access * MXBeans remotely. * The attributes and operations of an MXBean use only * JMX open types which include basic data types, @@ -89,133 +116,19 @@ import sun.management.ManagementFactoryHelper; * and {@link javax.management.openmbean.TabularData TabularData} * defined in * {@link javax.management.openmbean.OpenType OpenType}. - * The mapping is specified below. + * The mapping is specified in + * the {@linkplain javax.management.MXBean MXBean} specification + * for details. *
    • - * *
    - * - *

    Platform MXBeans

    - * A platform MXBean is a managed bean that conforms to - * the JMX Instrumentation Specification and only uses - * a set of basic data types described below. - * See - * the specification of MXBeans for details. - * All platform MXBean interfaces extend {@link PlatformManagedObject}s - * and new methods may be added in these interfaces - * in future Java SE releases. - *

    - * A JMX management application and the platform MBeanServer - * can interoperate without requiring classes for MXBean specific - * data types. - * The data types being transmitted between the JMX connector - * server and the connector client are - * {@linkplain javax.management.openmbean.OpenType open types} - * and this allows interoperation across versions. - *

    - * The platform MXBean interfaces use only the following data types: - *

      - *
    • Primitive types such as int, long, - * boolean, etc
    • - *
    • Wrapper classes for primitive types such as - * {@link java.lang.Integer Integer}, {@link java.lang.Long Long}, - * {@link java.lang.Boolean Boolean}, etc and - * {@link java.lang.String String}
    • - *
    • {@link java.lang.Enum Enum} classes
    • - *
    • Classes that define only getter methods and define a static - * from method with a - * {@link javax.management.openmbean.CompositeData CompositeData} - * argument to convert from an input CompositeData to - * an instance of that class - *
    • - *
    • {@link java.util.List List<E>} - * where E is a primitive type, a wrapper class, - * an enum class, or a class supporting conversion from a - * CompositeData to its class - *
    • - *
    • {@link java.util.Map Map<K,V>} - * where K and V are - * a primitive type, a wrapper class, - * an enum class, or a class supporting conversion from a - * CompositeData to its class - *
    • - *
    - * - *

    - * When an attribute or operation of a platform MXBean - * is accessed via an MBeanServer, the data types are mapped - * as follows: - *

      - *
    • A primitive type or a wrapper class is mapped - * to the same type. - *
    • - *
    • An {@link Enum} is mapped to - * String whose value is the name of the enum constant. - *
    • A class that defines only getter methods and a static - * from method with a - * {@link javax.management.openmbean.CompositeData CompositeData} - * argument is mapped to - * {@link javax.management.openmbean.CompositeData CompositeData}. - *
    • - *
    • Map<K,V> is mapped to - * {@link javax.management.openmbean.TabularData TabularData} - * whose row type is a - * {@link javax.management.openmbean.CompositeType CompositeType} with - * two items whose names are "key" and "value" - * and the item types are - * the corresponding mapped type of K and V - * respectively and the "key" is the index. - *
    • - *
    • List<E> is mapped to an array with the mapped - * type of E as the element type. - *
    • - *
    • An array of element type E is mapped to - * an array of the same dimenions with the mapped type of E - * as the element type.
    • - *
    - * - * The {@link javax.management.MBeanInfo MBeanInfo} - * for a platform MXBean - * describes the data types of the attributes and operations - * as primitive or open types mapped as specified above. - * - *

    - * For example, the {@link MemoryMXBean} - * interface has the following getter and setter methods: - * - *

    - * public MemoryUsage getHeapMemoryUsage();
    - * public boolean isVerbose();
    - * public void setVerbose(boolean value);
    - * 
    - * - * These attributes in the MBeanInfo - * of the MemoryMXBean have the following names and types: - * - *
    - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Attribute NameType
    HeapMemoryUsage{@link MemoryUsage#from - * CompositeData representing MemoryUsage}
    Verboseboolean
    *
    * - *

    MXBean Names

    - * Each platform MXBean for a Java virtual machine has a unique - * {@link javax.management.ObjectName ObjectName} for - * registration in the platform MBeanServer that can - * be obtained by calling the {@link PlatformManagedObject#getObjectName} - * method. - * + *

    + * The {@link #getPlatformManagementInterfaces getPlatformManagementInterfaces} + * method returns all management interfaces supported in the Java virtual machine + * including the standard management interfaces listed in the tables + * below as well as the management interfaces extended by the JDK implementation. + *

    * A Java virtual machine has a single instance of the following management * interfaces: * @@ -228,27 +141,32 @@ import sun.management.ManagementFactoryHelper; * * {@link ClassLoadingMXBean} * {@link #CLASS_LOADING_MXBEAN_NAME - * java.lang:type=ClassLoading} + * java.lang:type=ClassLoading} * * * {@link MemoryMXBean} * {@link #MEMORY_MXBEAN_NAME - * java.lang:type=Memory} + * java.lang:type=Memory} * * * {@link ThreadMXBean} * {@link #THREAD_MXBEAN_NAME - * java.lang:type=Threading} + * java.lang:type=Threading} * * * {@link RuntimeMXBean} * {@link #RUNTIME_MXBEAN_NAME - * java.lang:type=Runtime} + * java.lang:type=Runtime} * * * {@link OperatingSystemMXBean} * {@link #OPERATING_SYSTEM_MXBEAN_NAME - * java.lang:type=OperatingSystem} + * java.lang:type=OperatingSystem} + * + * + * {@link PlatformLoggingMXBean} + * {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME + * java.util.logging:type=Logging} * * *

    @@ -266,7 +184,7 @@ import sun.management.ManagementFactoryHelper; * * {@link CompilationMXBean} * {@link #COMPILATION_MXBEAN_NAME - * java.lang:type=Compilation} + * java.lang:type=Compilation} * * * @@ -283,17 +201,21 @@ import sun.management.ManagementFactoryHelper; * * {@link GarbageCollectorMXBean} * {@link #GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE - * java.lang:type=GarbageCollector},name=collector's name + * java.lang:type=GarbageCollector},name=collector's name * * * {@link MemoryManagerMXBean} * {@link #MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE - * java.lang:type=MemoryManager},name=manager's name + * java.lang:type=MemoryManager},name=manager's name * * * {@link MemoryPoolMXBean} * {@link #MEMORY_POOL_MXBEAN_DOMAIN_TYPE - * java.lang:type=MemoryPool},name=pool's name + * java.lang:type=MemoryPool},name=pool's name + * + * + * {@link BufferPoolMXBean} + * {@code java.nio:type=BufferPool,name=}pool name * * * @@ -302,7 +224,6 @@ import sun.management.ManagementFactoryHelper; * JMX Specification * @see * Ways to Access Management Metrics - * @see java.util.logging.LoggingMXBean * @see javax.management.MXBean * * @author Mandy Chung @@ -496,35 +417,35 @@ public class ManagementFactory { /** * Returns the platform {@link javax.management.MBeanServer MBeanServer}. * On the first call to this method, it first creates the platform - * MBeanServer by calling the + * {@code MBeanServer} by calling the * {@link javax.management.MBeanServerFactory#createMBeanServer * MBeanServerFactory.createMBeanServer} - * method and registers the platform MXBeans in this platform - * MBeanServer using the MXBean names - * defined in the class description. + * method and registers each platform MXBean in this platform + * {@code MBeanServer} with its + * {@link PlatformManagedObject#getObjectName ObjectName}. * This method, in subsequent calls, will simply return the - * initially created platform MBeanServer. + * initially created platform {@code MBeanServer}. *

    * MXBeans that get created and destroyed dynamically, for example, * memory {@link MemoryPoolMXBean pools} and * {@link MemoryManagerMXBean managers}, * will automatically be registered and deregistered into the platform - * MBeanServer. + * {@code MBeanServer}. *

    - * If the system property javax.management.builder.initial - * is set, the platform MBeanServer creation will be done + * If the system property {@code javax.management.builder.initial} + * is set, the platform {@code MBeanServer} creation will be done * by the specified {@link javax.management.MBeanServerBuilder}. *

    * It is recommended that this platform MBeanServer also be used * to register other application managed beans * besides the platform MXBeans. * This will allow all MBeans to be published through the same - * MBeanServer and hence allow for easier network publishing + * {@code MBeanServer} and hence allow for easier network publishing * and discovery. * Name conflicts with the platform MXBeans should be avoided. * - * @return the platform MBeanServer; the platform - * MXBeans are registered into the platform MBeanServer + * @return the platform {@code MBeanServer}; the platform + * MXBeans are registered into the platform {@code MBeanServer} * at the first time this method is called. * * @exception SecurityException if there is a security manager @@ -671,7 +592,9 @@ public class ManagementFactory { try { final ObjectName objName = new ObjectName(mxbeanName); - if (!connection.isInstanceOf(objName, interfaceClass.getName())) { + // skip the isInstanceOf check for LoggingMXBean + String intfName = interfaceClass.getName(); + if (!connection.isInstanceOf(objName, intfName)) { throw new IllegalArgumentException(mxbeanName + " is not an instance of " + interfaceClass); } @@ -683,55 +606,128 @@ public class ManagementFactory { // create an MXBean proxy return JMX.newMXBeanProxy(connection, objName, mxbeanInterface, emitter); - } catch (InstanceNotFoundException e) { - final IllegalArgumentException iae = - new IllegalArgumentException(mxbeanName + - " not found in the connection."); - iae.initCause(e); - throw iae; - } catch (MalformedObjectNameException e) { - final IllegalArgumentException iae = - new IllegalArgumentException(mxbeanName + - " is not a valid ObjectName format."); - iae.initCause(e); - throw iae; + } catch (InstanceNotFoundException|MalformedObjectNameException e) { + throw new IllegalArgumentException(e); } } /** - * Returns the list of platform MXBeans that implement - * the given {@code mxbeanInterface} in the running Java + * Returns the platform MXBean implementing + * the given {@code mxbeanInterface} which is specified + * to have one single instance in the Java virtual machine. + * This method may return {@code null} if the management interface + * is not implemented in the Java virtual machine (for example, + * a Java virtual machine with no compilation system does not + * implement {@link CompilationMXBean}); + * otherwise, this method is equivalent to calling: + *

    +     *    {@link #getPlatformMXBeans(Class)
    +     *      getPlatformMXBeans(mxbeanInterface)}.get(0);
    +     * 
    + * + * @param mxbeanInterface a management interface for a platform + * MXBean with one single instance in the Java virtual machine + * if implemented. + * + * @return the platform MXBean that implements + * {@code mxbeanInterface}, or {@code null} if not exist. + * + * @throws IllegalArgumentException if {@code mxbeanInterface} + * is not a platform management interface or + * not a singleton platform MXBean. + * + * @since 1.7 + */ + public static + T getPlatformMXBean(Class mxbeanInterface) { + PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface); + if (pc == null) + throw new IllegalArgumentException(mxbeanInterface.getName() + + " is not a platform management interface"); + if (!pc.isSingleton()) + throw new IllegalArgumentException(mxbeanInterface.getName() + + " can have zero or more than one instances"); + + return pc.getSingletonMXBean(mxbeanInterface); + } + + /** + * Returns the list of platform MXBeans implementing + * the given {@code mxbeanInterface} in the Java * virtual machine. * The returned list may contain zero, one, or more instances. * The number of instances in the returned list is defined * in the specification of the given management interface. + * The order is undefined and there is no guarantee that + * the list returned is in the same order as previous invocations. * * @param mxbeanInterface a management interface for a platform * MXBean * - * @return the list of platform MXBeans that implements + * @return the list of platform MXBeans that implement * {@code mxbeanInterface}. * * @throws IllegalArgumentException if {@code mxbeanInterface} - * is not a management interface for the platform. + * is not a platform management interface. * * @since 1.7 */ public static List getPlatformMXBeans(Class mxbeanInterface) { - String className = mxbeanInterface.getName(); - for (PlatformComponent component: PlatformComponent.values()) { - // comparing the class name first instead of the Class instance - // to avoid causing unnecessary class loading of - // the other MXBean interfaces - if (className.equals(component.getMXBeanInterfaceName())) { - if (component.getMXBeanInterface() == mxbeanInterface) { - return component.getMXBeans(mxbeanInterface); - } - } - } - throw new IllegalArgumentException(mxbeanInterface.getName() + - " is not implemented by any of the platform MXBeans."); + PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface); + if (pc == null) + throw new IllegalArgumentException(mxbeanInterface.getName() + + " is not a platform management interface"); + return Collections.unmodifiableList(pc.getMXBeans(mxbeanInterface)); + } + + /** + * Returns the platform MXBean proxy for + * {@code mxbeanInterface} which is specified to have one single + * instance in a Java virtual machine and the proxy will + * forward the method calls through the given {@code MBeanServerConnection}. + * This method may return {@code null} if the management interface + * is not implemented in the Java virtual machine being monitored + * (for example, a Java virtual machine with no compilation system + * does not implement {@link CompilationMXBean}); + * otherwise, this method is equivalent to calling: + *
    +     *     {@link #getPlatformMXBeans(MBeanServerConnection, Class)
    +     *        getPlatformMXBeans(connection, mxbeanInterface)}.get(0);
    +     * 
    + * + * @param connection the {@code MBeanServerConnection} to forward to. + * @param mxbeanInterface a management interface for a platform + * MXBean with one single instance in the Java virtual machine + * being monitored, if implemented. + * + * @return the platform MXBean proxy for + * forwarding the method calls of the {@code mxbeanInterface} + * through the given {@code MBeanServerConnection}, + * or {@code null} if not exist. + * + * @throws IllegalArgumentException if {@code mxbeanInterface} + * is not a platform management interface or + * not a singleton platform MXBean. + * @throws java.io.IOException if a communication problem + * occurred when accessing the {@code MBeanServerConnection}. + * + * @see #newPlatformMXBeanProxy + * @since 1.7 + */ + public static + T getPlatformMXBean(MBeanServerConnection connection, + Class mxbeanInterface) + throws java.io.IOException + { + PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface); + if (pc == null) + throw new IllegalArgumentException(mxbeanInterface.getName() + + " is not a platform management interface"); + if (!pc.isSingleton()) + throw new IllegalArgumentException(mxbeanInterface.getName() + + " can have zero or more than one instances"); + return pc.getSingletonMXBean(connection, mxbeanInterface); } /** @@ -741,6 +737,8 @@ public class ManagementFactory { * The returned list may contain zero, one, or more instances. * The number of instances in the returned list is defined * in the specification of the given management interface. + * The order is undefined and there is no guarantee that + * the list returned is in the same order as previous invocations. * * @param connection the {@code MBeanServerConnection} to forward to. * @param mxbeanInterface a management interface for a platform @@ -751,54 +749,49 @@ public class ManagementFactory { * through the given {@code MBeanServerConnection}. * * @throws IllegalArgumentException if {@code mxbeanInterface} - * is not a management interface for the platform. + * is not a platform management interface. * * @throws java.io.IOException if a communication problem * occurred when accessing the {@code MBeanServerConnection}. * + * @see #newPlatformMXBeanProxy * @since 1.7 */ public static - List getPlatformMXBeans(MBeanServerConnection connection, - Class mxbeanInterface) + List getPlatformMXBeans(MBeanServerConnection connection, + Class mxbeanInterface) throws java.io.IOException { - String className = mxbeanInterface.getName(); - for (PlatformComponent component: PlatformComponent.values()) { - // comparing the class name first instead of the Class instance - // to avoid causing unnecessary class loading of - // the other MXBean interfaces - if (className.equals(component.getMXBeanInterfaceName())) { - if (component.getMXBeanInterface() == mxbeanInterface) { - return component.getMXBeans(connection, - mxbeanInterface); - } - } + PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface); + if (pc == null) { + throw new IllegalArgumentException(mxbeanInterface.getName() + + " is not a platform management interface"); } - throw new IllegalArgumentException(mxbeanInterface.getName() + - " is not implemented by any of the platform MXBeans."); + return Collections.unmodifiableList(pc.getMXBeans(connection, mxbeanInterface)); } /** - * Returns a list of {@code Class} objects, subinterface of + * Returns the set of {@code Class} objects, subinterface of * {@link PlatformManagedObject}, representing * all management interfaces for * monitoring and managing the Java platform. * - * @return a list of {@code Class} objects, subinterface of + * @return the set of {@code Class} objects, subinterface of * {@link PlatformManagedObject} representing * the management interfaces for * monitoring and managing the Java platform. * * @since 1.7 */ - public static List> getAllPlatformMXBeanInterfaces() { - List> result = - new ArrayList<>(); + public static Set> + getPlatformManagementInterfaces() + { + Set> result = + new TreeSet<>(); for (PlatformComponent component: PlatformComponent.values()) { result.add(component.getMXBeanInterface()); } - return result; + return Collections.unmodifiableSet(result); } private static final String NOTIF_EMITTER = @@ -810,7 +803,9 @@ public class ManagementFactory { private static void addMXBean(final MBeanServer mbs, final PlatformManagedObject pmo) { // Make DynamicMBean out of MXBean by wrapping it with a StandardMBean final DynamicMBean dmbean; - if (pmo instanceof NotificationEmitter) { + if (pmo instanceof DynamicMBean) { + dmbean = DynamicMBean.class.cast(pmo); + } else if (pmo instanceof NotificationEmitter) { dmbean = new StandardEmitterMBean(pmo, null, true, (NotificationEmitter) pmo); } else { dmbean = new StandardMBean(pmo, null, true); diff --git a/jdk/src/share/classes/java/lang/management/PlatformComponent.java b/jdk/src/share/classes/java/lang/management/PlatformComponent.java index 4b8056e70bf..94ba4388236 100644 --- a/jdk/src/share/classes/java/lang/management/PlatformComponent.java +++ b/jdk/src/share/classes/java/lang/management/PlatformComponent.java @@ -29,9 +29,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.HashSet; +import java.util.HashMap; +import java.util.Map; import java.util.Set; -import java.util.logging.PlatformLoggingMXBean; -import java.nio.BufferPoolMXBean; import javax.management.MBeanServerConnection; import javax.management.ObjectName; @@ -66,6 +66,7 @@ enum PlatformComponent { CLASS_LOADING( "java.lang.management.ClassLoadingMXBean", "java.lang", "ClassLoading", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return Collections.singletonList(ManagementFactoryHelper.getClassLoadingMXBean()); @@ -78,6 +79,7 @@ enum PlatformComponent { COMPILATION( "java.lang.management.CompilationMXBean", "java.lang", "Compilation", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { CompilationMXBean m = ManagementFactoryHelper.getCompilationMXBean(); @@ -95,6 +97,7 @@ enum PlatformComponent { MEMORY( "java.lang.management.MemoryMXBean", "java.lang", "Memory", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return Collections.singletonList(ManagementFactoryHelper.getMemoryMXBean()); @@ -107,6 +110,7 @@ enum PlatformComponent { GARBAGE_COLLECTOR( "java.lang.management.GarbageCollectorMXBean", "java.lang", "GarbageCollector", keyProperties("name"), + false, // zero or more instances new MXBeanFetcher() { public List getMXBeans() { return ManagementFactoryHelper. @@ -120,6 +124,7 @@ enum PlatformComponent { MEMORY_MANAGER( "java.lang.management.MemoryManagerMXBean", "java.lang", "MemoryManager", keyProperties("name"), + false, // zero or more instances new MXBeanFetcher() { public List getMXBeans() { return ManagementFactoryHelper.getMemoryManagerMXBeans(); @@ -133,6 +138,7 @@ enum PlatformComponent { MEMORY_POOL( "java.lang.management.MemoryPoolMXBean", "java.lang", "MemoryPool", keyProperties("name"), + false, // zero or more instances new MXBeanFetcher() { public List getMXBeans() { return ManagementFactoryHelper.getMemoryPoolMXBeans(); @@ -145,6 +151,7 @@ enum PlatformComponent { OPERATING_SYSTEM( "java.lang.management.OperatingSystemMXBean", "java.lang", "OperatingSystem", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return Collections.singletonList(ManagementFactoryHelper.getOperatingSystemMXBean()); @@ -157,6 +164,7 @@ enum PlatformComponent { RUNTIME( "java.lang.management.RuntimeMXBean", "java.lang", "Runtime", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return Collections.singletonList(ManagementFactoryHelper.getRuntimeMXBean()); @@ -169,6 +177,7 @@ enum PlatformComponent { THREADING( "java.lang.management.ThreadMXBean", "java.lang", "Threading", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return Collections.singletonList(ManagementFactoryHelper.getThreadMXBean()); @@ -180,11 +189,17 @@ enum PlatformComponent { * Logging facility. */ LOGGING( - "java.util.logging.PlatformLoggingMXBean", + "java.lang.management.PlatformLoggingMXBean", "java.util.logging", "Logging", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { - return ManagementFactoryHelper.getLoggingMXBean(); + PlatformLoggingMXBean m = ManagementFactoryHelper.getPlatformLoggingMXBean(); + if (m == null) { + return Collections.emptyList(); + } else { + return Collections.singletonList(m); + } } }), @@ -192,8 +207,9 @@ enum PlatformComponent { * Buffer pools. */ BUFFER_POOL( - "java.nio.BufferPoolMXBean", + "java.lang.management.BufferPoolMXBean", "java.nio", "BufferPool", keyProperties("name"), + false, // zero or more instances new MXBeanFetcher() { public List getMXBeans() { return ManagementFactoryHelper.getBufferPoolMXBeans(); @@ -209,6 +225,7 @@ enum PlatformComponent { SUN_GARBAGE_COLLECTOR( "com.sun.management.GarbageCollectorMXBean", "java.lang", "GarbageCollector", keyProperties("name"), + false, // zero or more instances new MXBeanFetcher() { public List getMXBeans() { return getGcMXBeanList(com.sun.management.GarbageCollectorMXBean.class); @@ -222,6 +239,7 @@ enum PlatformComponent { SUN_OPERATING_SYSTEM( "com.sun.management.OperatingSystemMXBean", "java.lang", "OperatingSystem", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return getOSMXBeanList(com.sun.management.OperatingSystemMXBean.class); @@ -234,6 +252,7 @@ enum PlatformComponent { SUN_UNIX_OPERATING_SYSTEM( "com.sun.management.UnixOperatingSystemMXBean", "java.lang", "OperatingSystem", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return getOSMXBeanList(com.sun.management.UnixOperatingSystemMXBean.class); @@ -246,6 +265,7 @@ enum PlatformComponent { HOTSPOT_DIAGNOSTIC( "com.sun.management.HotSpotDiagnosticMXBean", "com.sun.management", "HotSpotDiagnostic", defaultKeyProperties(), + true, // singleton new MXBeanFetcher() { public List getMXBeans() { return Collections.singletonList(ManagementFactoryHelper.getDiagnosticMXBean()); @@ -296,27 +316,19 @@ enum PlatformComponent { private final Set keyProperties; private final MXBeanFetcher fetcher; private final PlatformComponent[] subComponents; + private final boolean singleton; private PlatformComponent(String intfName, String domain, String type, Set keyProperties, - MXBeanFetcher fetcher) { - this.mxbeanInterfaceName = intfName; - this.domain = domain; - this.type = type; - this.keyProperties = keyProperties; - this.fetcher = fetcher; - this.subComponents = new PlatformComponent[0]; - } - private PlatformComponent(String intfName, - String domain, String type, - Set keyProperties, + boolean singleton, MXBeanFetcher fetcher, PlatformComponent... subComponents) { this.mxbeanInterfaceName = intfName; this.domain = domain; this.type = type; this.keyProperties = keyProperties; + this.singleton = singleton; this.fetcher = fetcher; this.subComponents = subComponents; } @@ -338,6 +350,10 @@ enum PlatformComponent { return set; } + boolean isSingleton() { + return singleton; + } + String getMXBeanInterfaceName() { return mxbeanInterfaceName; } @@ -360,8 +376,35 @@ enum PlatformComponent { return fetcher.getMXBeans(); } + T getSingletonMXBean(Class mxbeanInterface) + { + if (!singleton) + throw new IllegalArgumentException(mxbeanInterfaceName + + " can have zero or more than one instances"); + + List list = fetcher.getMXBeans(); + assert list.size() == 1; + return list.isEmpty() ? null : list.get(0); + } + - List getMXBeans(MBeanServerConnection mbs, Class mxbeanInterface) + T getSingletonMXBean(MBeanServerConnection mbs, Class mxbeanInterface) + throws java.io.IOException + { + if (!singleton) + throw new IllegalArgumentException(mxbeanInterfaceName + + " can have zero or more than one instances"); + + // ObjectName of a singleton MXBean contains only domain and type + assert keyProperties.size() == 1; + String on = domain + ":type=" + type; + return ManagementFactory.newPlatformMXBeanProxy(mbs, + on, + mxbeanInterface); + } + + + List getMXBeans(MBeanServerConnection mbs, Class mxbeanInterface) throws java.io.IOException { List result = new ArrayList<>(); @@ -391,5 +434,34 @@ enum PlatformComponent { return set; } + // a map from MXBean interface name to PlatformComponent + private static Map enumMap; + private static synchronized void ensureInitialized() { + if (enumMap == null) { + enumMap = new HashMap<>(); + for (PlatformComponent pc: PlatformComponent.values()) { + // Use String as the key rather than Class to avoid + // causing unnecessary class loading of management interface + enumMap.put(pc.getMXBeanInterfaceName(), pc); + } + } + } + + static boolean isPlatformMXBean(String cn) { + ensureInitialized(); + return enumMap.containsKey(cn); + } + + static + PlatformComponent getPlatformComponent(Class mxbeanInterface) + { + ensureInitialized(); + String cn = mxbeanInterface.getName(); + PlatformComponent pc = enumMap.get(cn); + if (pc != null && pc.getMXBeanInterface() == mxbeanInterface) + return pc; + return null; + } + private static final long serialVersionUID = 6992337162326171013L; } diff --git a/jdk/src/share/classes/java/lang/management/PlatformLoggingMXBean.java b/jdk/src/share/classes/java/lang/management/PlatformLoggingMXBean.java new file mode 100644 index 00000000000..dfb9f869303 --- /dev/null +++ b/jdk/src/share/classes/java/lang/management/PlatformLoggingMXBean.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2009, Oracle and/or its affiliates. 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.management; + +/** + * The management interface for the {@linkplain java.util.logging logging} facility. + * + *

    There is a single global instance of the PlatformLoggingMXBean. + * The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class) + * ManagementFactory.getPlatformMXBean} method can be used to obtain + * the {@code PlatformLoggingMXBean} object as follows: + *

    + *     PlatformLoggingMXBean logging = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
    + * 
    + * The {@code PlatformLoggingMXBean} object is also registered with the + * platform {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer + * MBeanServer}. + * The {@link javax.management.ObjectName ObjectName} for uniquely + * identifying the {@code PlatformLoggingMXBean} within an MBeanServer is: + *
    + *      {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
    + * 
    + * + *

    The instance registered in the platform MBeanServer with + * this {@code ObjectName} implements all attributes defined by + * {@link java.util.logging.LoggingMXBean}. + * + * @since 1.7 + */ +public interface PlatformLoggingMXBean extends PlatformManagedObject { + + /** + * Returns the list of the currently registered + * {@linkplain java.util.logging.Logger logger} names. This method + * calls {@link java.util.logging.LogManager#getLoggerNames} and + * returns a list of the logger names. + * + * @return A list of {@code String} each of which is a + * currently registered {@code Logger} name. + */ + java.util.List getLoggerNames(); + + /** + * Gets the name of the log {@linkplain java.util.logging.Logger#getLevel + * level} associated with the specified logger. + * If the specified logger does not exist, {@code null} + * is returned. + * This method first finds the logger of the given name and + * then returns the name of the log level by calling: + *

    + * {@link java.util.logging.Logger#getLevel + * Logger.getLevel()}.{@link java.util.logging.Level#getName getName()}; + *
    + * + *

    + * If the {@code Level} of the specified logger is {@code null}, + * which means that this logger's effective level is inherited + * from its parent, an empty string will be returned. + * + * @param loggerName The name of the {@code Logger} to be retrieved. + * + * @return The name of the log level of the specified logger; or + * an empty string if the log level of the specified logger + * is {@code null}. If the specified logger does not + * exist, {@code null} is returned. + * + * @see java.util.logging.Logger#getLevel + */ + String getLoggerLevel(String loggerName); + + /** + * Sets the specified logger to the specified new + * {@linkplain java.util.logging.Logger#setLevel level}. + * If the {@code levelName} is not {@code null}, the level + * of the specified logger is set to the parsed + * {@link java.util.logging.Level Level} + * matching the {@code levelName}. + * If the {@code levelName} is {@code null}, the level + * of the specified logger is set to {@code null} and + * the effective level of the logger is inherited from + * its nearest ancestor with a specific (non-null) level value. + * + * @param loggerName The name of the {@code Logger} to be set. + * Must be non-null. + * @param levelName The name of the level to set on the specified logger, + * or {@code null} if setting the level to inherit + * from its nearest ancestor. + * + * @throws IllegalArgumentException if the specified logger + * does not exist, or {@code levelName} is not a valid level name. + * + * @throws SecurityException if a security manager exists and if + * the caller does not have LoggingPermission("control"). + * + * @see java.util.logging.Logger#setLevel + */ + void setLoggerLevel(String loggerName, String levelName); + + /** + * Returns the name of the + * {@linkplain java.util.logging.Logger#getParent parent} + * for the specified logger. + * If the specified logger does not exist, {@code null} is returned. + * If the specified logger is the root {@code Logger} in the namespace, + * the result will be an empty string. + * + * @param loggerName The name of a {@code Logger}. + * + * @return the name of the nearest existing parent logger; + * an empty string if the specified logger is the root logger. + * If the specified logger does not exist, {@code null} + * is returned. + */ + String getParentLoggerName(String loggerName); +} diff --git a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java index b12dc268347..b8782573263 100644 --- a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java +++ b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java @@ -46,7 +46,7 @@ import javax.management.ObjectName; * intended for the management interfaces for the platform to extend but * not for applications. * - * @see Platform MXBeans + * @see ManagementFactory * @since 1.7 */ public interface PlatformManagedObject { diff --git a/jdk/src/share/classes/java/lang/management/package.html b/jdk/src/share/classes/java/lang/management/package.html index 7ae6fbefc1e..eb01e37a2d8 100644 --- a/jdk/src/share/classes/java/lang/management/package.html +++ b/jdk/src/share/classes/java/lang/management/package.html @@ -27,160 +27,124 @@ -Provides the management interface for monitoring and management of the -Java virtual machine as well as the operating system on which the -Java virtual machine is running. It allows both local and remote -monitoring and management of the running Java virtual machine. - -

    Platform MXBeans

    - -This package defines the management interface of the following -components: - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Management Interface

    Description

    {@link java.lang.management.ClassLoadingMXBean} Class loading system of the Java virtual machine.
    {@link java.lang.management.CompilationMXBean} Compilation system of the Java virtual machine.
    {@link java.lang.management.MemoryMXBean} Memory system of the Java virtual machine.
    {@link java.lang.management.ThreadMXBean} Threads system of the Java virtual machine.
    {@link java.lang.management.RuntimeMXBean} Runtime system of the Java virtual machine.
    {@link java.lang.management.OperatingSystemMXBean} Operating system on which the Java virtual machine is running.
    {@link java.lang.management.GarbageCollectorMXBean} Garbage collector in the Java virtual machine.
    {@link java.lang.management.MemoryManagerMXBean} Memory manager in the Java virtual machine.
    {@link java.lang.management.MemoryPoolMXBean} Memory pool in the Java virtual machine.
    -
    - +Provides the management interfaces for monitoring and management of the +Java virtual machine and other components in the Java runtime. +It allows both local and remote +monitoring and management of the running Java virtual machine.

    -A platform MXBean is a managed bean that defines the management -interface for one component for the platform and is specified in the - -ManagementFactory class. - -

    An application can monitor the instrumentation of the -Java virtual machine and manage certain characteristics in -the following ways: -

      -
    • Direct access to an MXBean interface -
        -
      1. Get the MXBean instance through the static factory method - and access the MXBean interface locally of the running - virtual machine.
      2. -
      3. Construct an MXBean proxy instance that - forwards the method calls to a given - {@link javax.management.MBeanServer MBeanServer} - by calling - {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy - ManagementFactory.newPlatformMXBeanProxy}. - A proxy is typically constructed to remotely access - an MXBean of another running virtual machine.
      4. -
    • -
    • Indirect access via {@link javax.management.MBeanServer MBeanServer} - interface -
        -
      1. Go through the - {@link java.lang.management.ManagementFactory#getPlatformMBeanServer - platform MBeanServer} to access MXBeans locally or - a specific MBeanServerConnection to access - MXBeans remotely. - The attributes and operations of an MXBean use only - JMX open types which include basic data types, - {@link javax.management.openmbean.CompositeData CompositeData}, - and {@link javax.management.openmbean.TabularData TabularData} - defined in {@link javax.management.openmbean.OpenType OpenType}. -
      2. -
    • -
    - -Below shows a few examples of different -ways to access MXBeans. +

    Platform MXBean

    +

    +A platform MXBean is a managed bean that +conforms to the JMX +Instrumentation Specification and only uses a set of basic data types. +Each platform MXBean is a {@link java.lang.management.PlatformManagedObject} +with a unique +{@linkplain java.lang.management.PlatformManagedObject#getObjectName name}. +

    ManagementFactory

    -The {@link java.lang.management.ManagementFactory} class is the management -factory class for the Java platform. This class provides a set of +

    The {@link java.lang.management.ManagementFactory} class is the management +factory class for the Java platform. This class provides a set of static factory methods to obtain the MXBeans for the Java platform to allow an application to access the MXBeans directly.

    A platform MBeanServer can be accessed with the {@link java.lang.management.ManagementFactory#getPlatformMBeanServer getPlatformMBeanServer} method. On the first call to this method, -it creates the platform MBeanServer and registers all platform MXBeans -including platform MXBeans defined in other packages such as -{@link java.util.logging.LoggingMXBean}. -Each platform MXBean is registered with a unique name defined in the -{@link java.lang.management.ManagementFactory ManagementFactory} class -for constructing {@link javax.management.ObjectName ObjectName}. -This is a single MBeanServer that can be shared by different managed +it creates the platform MBeanServer and registers all platform MXBeans +including {@linkplain java.lang.management.PlatformManagedObject +platform MXBeans}. +Each platform MXBean is registered with a unique name defined in +the specification of the management interface. +This is a single MBeanServer that can be shared by different managed components running within the same Java virtual machine. - +

    Interoperability

    -A management application and a platform MBeanServer of a running -virtual machine can interoperate +

    A management application and a platform MBeanServer of a running +virtual machine can interoperate without requiring classes used by the platform MXBean interfaces. The data types being transmitted between the JMX connector server and the connector client are JMX -{@link javax.management.openmbean.OpenType open types} and +{@linkplain javax.management.openmbean.OpenType open types} and this allows interoperation across versions. - -

    A data type used by the MXBean interfaces are mapped to -an open type when being accessed via MBeanServer interface. -The data type mapping is specified in the -{@link java.lang.management.ManagementFactory ManagementFactory} class. +A data type used by the MXBean interfaces are mapped to an +open type when being accessed via MBeanServer interface. +See the +MXBean specification for details.

    Ways to Access MXBeans

    -There are three different ways to access the management interfaces. - +

    An application can monitor the instrumentation of the +Java virtual machine and the runtime in the following ways:

    -

      -
    1. Call the methods in the MXBean directly within the same - Java virtual machine. -
      +1. Direct access to an MXBean interface
      +

      +

        +
      • Get an MXBean instance locally in the running Java virtual machine:

        +

            RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
         
            // Get the standard attribute "VmVendor"
            String vendor = mxbean.getVmVendor();
        -
         
        -
      -
    2. +

      Or by calling the + {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class) + getPlatformMXBean} or + {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class) + getPlatformMXBeans} method: +

      +   RuntimeMXBean mxbean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
       
      -
    3. Go through a MBeanServerConnection connecting - to the platform MBeanServer of a running virtual machine.
    4. -
      +   // Get the standard attribute "VmVendor"
      +   String vendor = mxbean.getVmVendor();
      +
      +

      + +

    5. Construct an MXBean proxy instance that forwards the + method calls to a given MBeanServer:

      +

      +   MBeanServerConnection mbs;
      +
      +   // Connect to a running JVM (or itself) and get MBeanServerConnection
      +   // that has the JVM MBeans registered in it
      +   ...
      +
      +   // Get a MBean proxy for RuntimeMXBean interface
      +   RuntimeMXBean proxy =
      +       {@link java.lang.management.ManagementFactory#getPlatformMXBean(MBeanServerConnection, Class)
      +       ManagementFactory.getPlatformMXBean}(mbs,
      +                                           RuntimeMXBean.class);
      +   // Get standard attribute "VmVendor"
      +   String vendor = proxy.getVmVendor();
      +
      +

      A proxy is typically used to access an MXBean + in a remote Java virtual machine. + An alternative way to create an MXBean proxy is: +

      +   RuntimeMXBean proxy =
      +       {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
      +              ManagementFactory.newPlatformMXBeanProxy}(mbs,
      +                                                ManagementFactory.RUNTIME_MXBEAN_NAME,
      +                                                RuntimeMXBean.class);
      +
      +
    6. +
+

+2. Indirect access to an MXBean interface via MBeanServer

+

    +
  • Go through the + {@link java.lang.management.ManagementFactory#getPlatformMBeanServer + platform MBeanServer} to access MXBeans locally or + a specific {@code MBeanServerConnection} to access + MXBeans remotely. + The attributes and operations of an MXBean use only + JMX open types which include basic data types, + {@link javax.management.openmbean.CompositeData CompositeData}, + and {@link javax.management.openmbean.TabularData TabularData} + defined in {@link javax.management.openmbean.OpenType OpenType}.

    +

        MBeanServerConnection mbs;
     
        // Connect to a running JVM (or itself) and get MBeanServerConnection
    @@ -190,7 +154,7 @@ There are three different ways to access the management interfaces.
        try {
            // Assuming the RuntimeMXBean has been registered in mbs
            ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
    -    
    +
            // Get standard attribute "VmVendor"
            String vendor = (String) mbs.getAttribute(oname, "VmVendor");
        } catch (....) {
    @@ -198,36 +162,19 @@ There are three different ways to access the management interfaces.
            // and MBeanServer.getAttribute method
            ...
        }
    -
    -
    - -
  • Use MXBean proxy.
  • -
    -   MBeanServerConnection mbs;
    -
    -   // Connect to a running JVM (or itself) and get MBeanServerConnection
    -   // that has the JVM MBeans registered in it
    -   ...
    -
    -   // Get a MBean proxy for RuntimeMXBean interface
    -   RuntimeMXBean proxy = 
    -       ManagementFactory.newPlatformMXBeanProxy(mbs,
    -                                                ManagementFactory.RUNTIME_MXBEAN_NAME,
    -                                                RuntimeMXBean.class);
    -   // Get standard attribute "VmVendor" 
    -   String vendor = proxy.getVmVendor();
    -
    - + + +

Platform Extension

-A Java virtual machine implementation may add its platform extension to +

A Java virtual machine implementation may add its platform extension to the management interface by defining platform-dependent interfaces that extend the standard management interfaces to include -platform-specific metrics and management operations. +platform-specific metrics and management operations. The static factory methods in the ManagementFactory class will -return the MBeans with the platform extension. +return the MXBeans with the platform extension.

It is recommended to name the platform-specific attributes with @@ -240,26 +187,30 @@ is happened to be same as some vendor-specific attribute's name, the applications accessing that vendor-specific attribute would have to be modified to cope with versioning and compatibility issues. -

Below is an example showing how to access a platform-specific -attribute from Sun's implementation of the RuntimeMXBean. +

Below is an example showing how to access an attribute +from the platform extension:

-1) Direct access to the Sun-specific MXBean interface -

-   com.sun.management.RuntimeMXBean mxbean = 
-       (com.sun.management.RuntimeMXBean) ManagementFactory.getRuntimeMXBean();
+1) Direct access to the Oracle-specific MXBean interface
+
+
+   List<com.sun.management.GarbageCollectorMXBean> mxbeans =
+       ManagementFactory.getPlatformMXBeans(com.sun.management.GarbageCollectorMXBean.class);
 
-   // Get the standard attribute "VmVendor"
-   String vendor = mxbean.getVmVendor();
-
-   // Get the platform-specific attribute "Bar"
-   BarType bar = mxbean.getBar();
+   for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+       // Get the standard attribute "CollectionCount"
+       String count = mxbean.getCollectionCount();
 
+       // Get the platform-specific attribute "LastGcInfo"
+       GcInfo gcinfo = gc.getLastGcInfo();
+       ...
+   }
 

-2) Access the Sun-specific MXBean interface via MBeanServer +2) Access the Oracle-specific MXBean interface via MBeanServer + through proxy

    MBeanServerConnection mbs;
@@ -268,24 +219,17 @@ attribute from Sun's implementation of the RuntimeMXBean.
    // that has the JVM MXBeans registered in it
    ...
 
-   try {
-       // Assuming the RuntimeMXBean has been registered in mbs
-       ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
-    
-       // Get standard attribute "VmVendor"
-       String vendor = (String) mbs.getAttribute(oname, "VmVendor");
+   List<com.sun.management.GarbageCollectorMXBean> mxbeans =
+       ManagementFactory.getPlatformMXBeans(mbs, com.sun.management.GarbageCollectorMXBean.class);
 
-       // Check if this MXBean contains Sun's extension
-       if (mbs.isInstanceOf(oname, "com.sun.management.RuntimeMXBean")) {
-           // Get platform-specific attribute "Bar"
-           BarType bar = (String) mbs.getAttribute(oname, "Bar");
-       }
-   } catch (....) {
-       // Catch the exceptions thrown by ObjectName constructor
-       // and MBeanServer methods
+   for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+       // Get the standard attribute "CollectionCount"
+       String count = mxbean.getCollectionCount();
+
+       // Get the platform-specific attribute "LastGcInfo"
+       GcInfo gcinfo = gc.getLastGcInfo();
        ...
    }
-
 

Unless otherwise noted, passing a null argument to a constructor diff --git a/jdk/src/share/classes/java/util/logging/LogManager.java b/jdk/src/share/classes/java/util/logging/LogManager.java index fb074721ab5..cf49a0a69b7 100644 --- a/jdk/src/share/classes/java/util/logging/LogManager.java +++ b/jdk/src/share/classes/java/util/logging/LogManager.java @@ -1166,7 +1166,12 @@ public class LogManager { private static LoggingMXBean loggingMXBean = null; /** * String representation of the - * {@link javax.management.ObjectName} for {@link LoggingMXBean}. + * {@link javax.management.ObjectName} for the management interface + * for the logging facility. + * + * @see java.lang.management.PlatformLoggingMXBean + * @see java.util.logging.LoggingMXBean + * * @since 1.5 */ public final static String LOGGING_MXBEAN_NAME @@ -1174,20 +1179,20 @@ public class LogManager { /** * Returns LoggingMXBean for managing loggers. - * An alternative way to manage loggers is using - * the {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class) - * ManagementFactory.getPlatformMXBeans} method as follows: + * An alternative way to manage loggers is through the + * {@link java.lang.management.PlatformLoggingMXBean} interface + * that can be obtained by calling: *

-     *     List<{@link PlatformLoggingMXBean}> result = ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
+     *     PlatformLoggingMXBean logging = {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+     *         ManagementFactory.getPlatformMXBean}(PlatformLoggingMXBean.class);
      * 
* * @return a {@link LoggingMXBean} object. * - * @see PlatformLoggingMXBean - * @see java.lang.management.ManagementFactory + * @see java.lang.management.PlatformLoggingMXBean * @since 1.5 */ - public static synchronized LoggingMXBean getLoggingMXBean() { + public static synchronized LoggingMXBean getLoggingMXBean() { if (loggingMXBean == null) { loggingMXBean = new Logging(); } diff --git a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java index d6700e098bc..2c9bad2feb8 100644 --- a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java +++ b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java @@ -27,36 +27,41 @@ package java.util.logging; /** - * The management interface for the logging facility. + * The management interface for the logging facility. It is recommended + * to use the {@link java.lang.management.PlatformLoggingMXBean} management + * interface that implements all attributes defined in this + * {@code LoggingMXBean}. The + * {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class) + * ManagementFactory.getPlatformMXBean} method can be used to obtain + * the {@code PlatformLoggingMXBean} object representing the management + * interface for logging. * *

There is a single global instance of the LoggingMXBean. - * This instance is an - * MXBean - * can be obtained by calling - * the {@link LogManager#getLoggingMXBean} method or from the + * This instance is an {@link javax.management.MXBean MXBean} that + * can be obtained by calling the {@link LogManager#getLoggingMXBean} + * method or from the * {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer * platform MBeanServer}. - * - * The {@link javax.management.ObjectName ObjectName} for uniquely - * identifying the LoggingMXBean within an MBeanServer is: - *

- * {@link LogManager#LOGGING_MXBEAN_NAME - * java.util.logging:type=Logging} - *
- * - * The instance registered in the platform MBeanServer with - * this {@code ObjectName} is also a {@link PlatformLoggingMXBean}. + *

+ * The {@link javax.management.ObjectName ObjectName} that uniquely identifies + * the management interface for logging within the {@code MBeanServer} is: + *

+ *    {@link LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
+ * 
+ *

+ * The instance registered in the platform {@code MBeanServer} + * is also a {@link java.lang.management.PlatformLoggingMXBean}. * * @author Ron Mann * @author Mandy Chung * @since 1.5 * - * @see PlatformLoggingMXBean + * @see java.lang.management.PlatformLoggingMXBean */ public interface LoggingMXBean { /** - * Returns the list of currently registered loggers. This method + * Returns the list of currently registered logger names. This method * calls {@link LogManager#getLoggerNames} and returns a list * of the logger names. * @@ -89,7 +94,7 @@ public interface LoggingMXBean { * * @see Logger#getLevel */ - public String getLoggerLevel( String loggerName ); + public String getLoggerLevel(String loggerName); /** * Sets the specified logger to the specified new level. @@ -115,7 +120,7 @@ public interface LoggingMXBean { * * @see Logger#setLevel */ - public void setLoggerLevel( String loggerName, String levelName ); + public void setLoggerLevel(String loggerName, String levelName); /** * Returns the name of the parent for the specified logger. diff --git a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java b/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java deleted file mode 100644 index 72297490ee4..00000000000 --- a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.util.logging; - -import java.lang.management.PlatformManagedObject; - -/** - * The {@linkplain PlatformManagedObject platform managed object} for the - * logging facility. This interface simply unifies {@link LoggingMXBean} - * {@link PlatformManagedObject}; - * and it does not specify any new operations. - * - *

The {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class) - * ManagementFactory.getPlatformMXBeans} method can be used to obtain - * the {@code PlatformLoggingMXBean} object as follows: - *

- *     ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
- * 
- * or from the {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer - * platform MBeanServer}. - * - * The {@link javax.management.ObjectName ObjectName} for uniquely - * identifying the LoggingMXBean within an MBeanServer is: - *
- * java.util.logging:type=Logging - *
- * - * The {@link PlatformManagedObject#getObjectName} method - * can be used to obtain its {@code ObjectName}. - * - * @see java.lang.management.PlatformManagedObject - * - * @author Mandy Chung - * @since 1.7 - */ -public interface PlatformLoggingMXBean extends LoggingMXBean, PlatformManagedObject { -} diff --git a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java index 19aa6d71954..64ac47f9c44 100644 --- a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java +++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java @@ -27,20 +27,18 @@ package sun.management; import java.lang.management.*; -import javax.management.MBeanServer; -import javax.management.ObjectName; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; +import javax.management.MBeanServer; import javax.management.MBeanRegistrationException; import javax.management.NotCompliantMBeanException; +import javax.management.ObjectName; import javax.management.RuntimeOperationsException; -import java.nio.BufferPoolMXBean; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import sun.security.action.LoadLibraryAction; -import java.util.logging.PlatformLoggingMXBean; import sun.util.logging.LoggingSupport; import java.util.ArrayList; @@ -139,61 +137,80 @@ public class ManagementFactoryHelper { return result; } - public static List getLoggingMXBean() { + public static PlatformLoggingMXBean getPlatformLoggingMXBean() { if (LoggingSupport.isAvailable()) { - return Collections.singletonList(createPlatformLoggingMXBean()); + return PlatformLoggingImpl.instance; } else { - return Collections.emptyList(); + return null; } } - private final static String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging"; - private static PlatformLoggingMXBean createPlatformLoggingMXBean() { - return new PlatformLoggingMXBean() { - private volatile ObjectName objname; // created lazily - @Override - public ObjectName getObjectName() { - ObjectName result = objname; - if (result == null) { - synchronized (this) { - if (objname == null) { - result = Util.newObjectName(LOGGING_MXBEAN_NAME); - objname = result; - } - } - } - return result; - } - - @Override - public java.util.List getLoggerNames() { - return LoggingSupport.getLoggerNames(); - } - - @Override - public String getLoggerLevel(String loggerName) { - return LoggingSupport.getLoggerLevel(loggerName); - } - - @Override - public void setLoggerLevel(String loggerName, String levelName) { - LoggingSupport.setLoggerLevel(loggerName, levelName); - } - - @Override - public String getParentLoggerName(String loggerName) { - return LoggingSupport.getParentLoggerName(loggerName); - } - }; + // The logging MXBean object is an instance of + // PlatformLoggingMXBean and java.util.logging.LoggingMXBean + // but it can't directly implement two MXBean interfaces + // as a compliant MXBean implements exactly one MXBean interface, + // or if it implements one interface that is a subinterface of + // all the others; otherwise, it is a non-compliant MXBean + // and MBeanServer will throw NotCompliantMBeanException. + // See the Definition of an MXBean section in javax.management.MXBean spec. + // + // To create a compliant logging MXBean, define a LoggingMXBean interface + // that extend PlatformLoggingMXBean and j.u.l.LoggingMXBean + interface LoggingMXBean + extends PlatformLoggingMXBean, java.util.logging.LoggingMXBean { } - public static List getBufferPoolMXBeans() { - List pools = new ArrayList(2); - pools.add(createBufferPoolMXBean(sun.misc.SharedSecrets.getJavaNioAccess() - .getDirectBufferPool())); - pools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl - .getMappedBufferPool())); - return pools; + static class PlatformLoggingImpl implements LoggingMXBean + { + final static PlatformLoggingMXBean instance = new PlatformLoggingImpl(); + final static String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging"; + + private volatile ObjectName objname; // created lazily + @Override + public ObjectName getObjectName() { + ObjectName result = objname; + if (result == null) { + synchronized (this) { + if (objname == null) { + result = Util.newObjectName(LOGGING_MXBEAN_NAME); + objname = result; + } + } + } + return result; + } + + @Override + public java.util.List getLoggerNames() { + return LoggingSupport.getLoggerNames(); + } + + @Override + public String getLoggerLevel(String loggerName) { + return LoggingSupport.getLoggerLevel(loggerName); + } + + @Override + public void setLoggerLevel(String loggerName, String levelName) { + LoggingSupport.setLoggerLevel(loggerName, levelName); + } + + @Override + public String getParentLoggerName(String loggerName) { + return LoggingSupport.getParentLoggerName(loggerName); + } + } + + private static List bufferPools = null; + public static synchronized List getBufferPoolMXBeans() { + if (bufferPools == null) { + bufferPools = new ArrayList<>(2); + bufferPools.add(createBufferPoolMXBean(sun.misc.SharedSecrets.getJavaNioAccess() + .getDirectBufferPool())); + bufferPools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl + .getMappedBufferPool())); + } + return bufferPools; } private final static String BUFFER_POOL_MXBEAN_NAME = "java.nio:type=BufferPool"; diff --git a/jdk/test/Makefile b/jdk/test/Makefile index 0fe74310c52..26bd7e5e2c8 100644 --- a/jdk/test/Makefile +++ b/jdk/test/Makefile @@ -504,7 +504,7 @@ jdk_nio1: $(call TestDirs, java/nio/file) # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_nio2 jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \ - java/nio/channels java/nio/BufferPoolMXBean java/nio/MappedByteBuffer) + java/nio/channels java/nio/MappedByteBuffer) $(call SharedLibraryPermissions,java/nio/channels) $(call RunSamevmBatch) @@ -687,7 +687,7 @@ PHONY_LIST += packtest packtest_stress ################################################################ -# perftest to collect statistics +# perftest to collect statistics # Expect JPRT to set JPRT_PACKTEST_HOME. PERFTEST_HOME = $(TEST_ROOT)/perf diff --git a/jdk/test/java/nio/BufferPoolMXBean/Basic.java b/jdk/test/java/lang/management/BufferPoolMXBean/Basic.java similarity index 78% rename from jdk/test/java/nio/BufferPoolMXBean/Basic.java rename to jdk/test/java/lang/management/BufferPoolMXBean/Basic.java index 255edae0c8b..a55f50ef0ef 100644 --- a/jdk/test/java/nio/BufferPoolMXBean/Basic.java +++ b/jdk/test/java/lang/management/BufferPoolMXBean/Basic.java @@ -22,20 +22,22 @@ */ /* @test - * @bug 6606598 - * @summary Unit test for java.nio.BufferPoolMXBean + * @bug 6606598 7024172 + * @summary Unit test for java.lang.management.BufferPoolMXBean * @run main/othervm Basic */ import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; -import java.nio.BufferPoolMXBean; +import java.nio.file.Path; +import java.nio.file.Files; +import static java.nio.file.StandardOpenOption.*; import java.nio.channels.FileChannel; -import java.io.File; -import java.io.RandomAccessFile; +import java.lang.management.BufferPoolMXBean; import java.lang.management.ManagementFactory; import javax.management.MBeanServer; import javax.management.ObjectName; +import java.lang.ref.WeakReference; import java.util.*; public class Basic { @@ -78,21 +80,21 @@ public class Basic { totalCapacity += cap; } - // map a file - File f = File.createTempFile("blah", null); - f.deleteOnExit(); - RandomAccessFile raf = new RandomAccessFile(f, "rw"); - FileChannel fc = raf.getChannel(); - mbb = fc.map(FileChannel.MapMode.READ_WRITE, 10, 100); - bufferCount++; - totalCapacity += mbb.capacity(); + // create a mapped buffer + Path tmpfile = Files.createTempFile("blah", null); + tmpfile.toFile().deleteOnExit(); + try (FileChannel fc = FileChannel.open(tmpfile, READ, WRITE)) { + mbb = fc.map(FileChannel.MapMode.READ_WRITE, 10, 100); + bufferCount++; + totalCapacity += mbb.capacity(); + } - // direct + // use platform MXBeans directly List pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class); check(pools, bufferCount, totalCapacity); - // using MBeanServer + // use MBeanServer MBeanServer server = ManagementFactory.getPlatformMBeanServer(); Set mbeans = server.queryNames( new ObjectName("java.nio:type=BufferPool,*"), null); @@ -103,5 +105,13 @@ public class Basic { pools.add(pool); } check(pools, bufferCount, totalCapacity); + + // attempt to unmap mapped buffer + WeakReference ref = new WeakReference<>(mbb); + mbb = null; + do { + System.gc(); + Thread.sleep(250); + } while (ref.get() != null); } } diff --git a/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java b/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java index 86acdb95dfd..5e88b469e50 100644 --- a/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java +++ b/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java @@ -23,23 +23,26 @@ /* * @test - * @bug 6610094 - * @summary Basic unit test of ManagementFactory.getPlatformMXBeans() - * and also PlatformManagedObject.getObjectName() + * @bug 6610094 7024172 + * @summary Basic unit test of ManagementFactory.getPlatformMXBean(s) + * methods and PlatformManagedObject.getObjectName() * @author Mandy Chung * * @run main GetPlatformMXBeans */ import java.lang.management.*; -import static java.lang.management.ManagementFactory.*; +import java.io.IOException; import java.util.*; import javax.management.*; +import static java.lang.management.ManagementFactory.*; + public class GetPlatformMXBeans { private static MBeanServer platformMBeanServer = getPlatformMBeanServer(); public static void main(String[] argv) throws Exception { + // singleton platform MXBean checkPlatformMXBean(getClassLoadingMXBean(), ClassLoadingMXBean.class, CLASS_LOADING_MXBEAN_NAME); @@ -58,17 +61,28 @@ public class GetPlatformMXBeans { checkPlatformMXBean(getThreadMXBean(), ThreadMXBean.class, THREAD_MXBEAN_NAME); + + // the following MXBean can have more than one instances checkGarbageCollectorMXBeans(getGarbageCollectorMXBeans()); checkMemoryManagerMXBeans(getMemoryManagerMXBeans()); checkMemoryPoolMXBeans(getMemoryPoolMXBeans()); + + // check invalid platform MXBean + checkInvalidPlatformMXBean(); } private static - void checkPlatformMXBean(T obj, Class mxbeanInterface, - String mxbeanName) throws Exception + void checkPlatformMXBean(T obj, Class mxbeanInterface, + String mxbeanName) + throws Exception { - int numElements = (obj != null ? 1 : 0); - // verify local list of platform MXBeans + // getPlatformMXBean may return null if the mxbean is not implemented + PlatformManagedObject mxbean = getPlatformMXBean(mxbeanInterface); + if (obj != mxbean) { + throw new RuntimeException("Singleton MXBean returned not matched"); + } + + int numElements = obj == null ? 0 : 1; List mxbeans = getPlatformMXBeans(mxbeanInterface); if (mxbeans.size() != numElements) { @@ -77,24 +91,46 @@ public class GetPlatformMXBeans { } if (obj != null) { - PlatformManagedObject pmo = mxbeans.get(0); - if (obj != pmo) { + if (obj != mxbeans.get(0)) { throw new RuntimeException("The list returned by getPlatformMXBeans" + " not matched"); } ObjectName on = new ObjectName(mxbeanName); - if (!on.equals(pmo.getObjectName())) { + if (!on.equals(mxbean.getObjectName())) { throw new RuntimeException("Unmatched ObjectName " + - pmo.getObjectName() + " Expected = " + on); + mxbean.getObjectName() + " Expected = " + on); } + checkRemotePlatformMXBean(obj, platformMBeanServer, + mxbeanInterface, mxbeanName); + } + } + + // verify platform MXBeans in the platform MBeanServer + private static + void checkRemotePlatformMXBean(T obj, + MBeanServerConnection mbs, + Class mxbeanInterface, + String mxbeanName) + throws Exception + { + PlatformManagedObject mxbean = getPlatformMXBean(mbs, mxbeanInterface); + if ((obj == null && mxbean != null) || (obj != null && mxbean == null)) { + throw new RuntimeException("Singleton MXBean returned not matched"); } - // verify platform MXBeans in the platform MBeanServer - mxbeans = getPlatformMXBeans(platformMBeanServer, mxbeanInterface); + int numElements = obj == null ? 0 : 1; + List mxbeans = + getPlatformMXBeans(mbs, mxbeanInterface); if (mxbeans.size() != numElements) { throw new RuntimeException("Unmatched number of platform MXBeans " + mxbeans.size() + ". Expected = " + numElements); } + + ObjectName on = new ObjectName(mxbeanName); + if (!on.equals(mxbean.getObjectName())) { + throw new RuntimeException("Unmatched ObjectName " + + mxbean.getObjectName() + " Expected = " + on); + } } private static void checkMemoryManagerMXBeans(List objs) @@ -148,6 +184,14 @@ public class GetPlatformMXBeans { void checkPlatformMXBeans(List objs, Class mxbeanInterface) throws Exception { + try { + getPlatformMXBean(mxbeanInterface); + // mxbeanInterface is not a singleton + throw new RuntimeException(mxbeanInterface + ": not a singleton MXBean"); + } catch (IllegalArgumentException e) { + // expect IAE + } + // verify local list of platform MXBeans List mxbeans = getPlatformMXBeans(mxbeanInterface); @@ -177,4 +221,40 @@ public class GetPlatformMXBeans { + mxbeans.size() + ". Expected = " + objs.size()); } } + + interface FakeMXBean extends PlatformManagedObject {}; + + private static void checkInvalidPlatformMXBean() throws IOException { + try { + getPlatformMXBean(FakeMXBean.class); + // mxbeanInterface is not a singleton + throw new RuntimeException("Expect IllegalArgumentException but not thrown"); + } catch (IllegalArgumentException e) { + // expect IAE + } + + try { + getPlatformMXBeans(FakeMXBean.class); + // mxbeanInterface is not a singleton + throw new RuntimeException("Expect IllegalArgumentException but not thrown"); + } catch (IllegalArgumentException e) { + // expect IAE + } + + try { + getPlatformMXBean(platformMBeanServer, FakeMXBean.class); + // mxbeanInterface is not a singleton + throw new RuntimeException("Expect IllegalArgumentException but not thrown"); + } catch (IllegalArgumentException e) { + // expect IAE + } + + try { + getPlatformMXBeans(platformMBeanServer, FakeMXBean.class); + // mxbeanInterface is not a singleton + throw new RuntimeException("Expect IllegalArgumentException but not thrown"); + } catch (IllegalArgumentException e) { + // expect IAE + } + } } diff --git a/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java b/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java new file mode 100644 index 00000000000..17569b4cec1 --- /dev/null +++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7024172 + * @summary Test if proxy for PlatformLoggingMXBean is equivalent + * to proxy for LoggingMXBean + * + * @build LoggingMXBeanTest + * @run main LoggingMXBeanTest + */ + +import java.lang.management.*; +import javax.management.MBeanServer; +import java.util.logging.*; +import java.util.ArrayList; +import java.util.List; + +public class LoggingMXBeanTest +{ + static String LOGGER_NAME_1 = "com.sun.management.Logger"; + static String LOGGER_NAME_2 = "com.sun.management.Logger.Logger2"; + static String UNKNOWN_LOGGER_NAME = "com.sun.management.Unknown"; + + public static void main(String[] argv) throws Exception { + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + LoggingMXBean proxy = + ManagementFactory.newPlatformMXBeanProxy(mbs, + LogManager.LOGGING_MXBEAN_NAME, + LoggingMXBean.class); + + // test LoggingMXBean proxy + LoggingMXBeanTest p = new LoggingMXBeanTest(proxy); + + // check if the attributes implemented by PlatformLoggingMXBean + // and LoggingMXBean return the same value + PlatformLoggingMXBean mxbean = + ManagementFactory.getPlatformMXBean(mbs, PlatformLoggingMXBean.class); + + checkAttributes(proxy, mxbean); + } + + // same verification as in java/util/logging/LoggingMXBeanTest2 + public LoggingMXBeanTest(LoggingMXBean mbean) throws Exception { + + Logger logger1 = Logger.getLogger( LOGGER_NAME_1 ); + logger1.setLevel(Level.FINE); + Logger logger2 = Logger.getLogger( LOGGER_NAME_2 ); + logger2.setLevel(null); + + /* + * Check for the existence of our new Loggers + */ + System.out.println("Test Logger Name retrieval (getLoggerNames)"); + boolean log1 = false, log2 = false; + List loggers = mbean.getLoggerNames(); + if (loggers == null || loggers.size() < 2) { + throw new RuntimeException( + "Could not Detect the presense of the new Loggers"); + } + + for (String logger : loggers) { + if (logger.equals(LOGGER_NAME_1)) { + log1 = true; + System.out.println(" : Found new Logger : " + logger); + } + if (logger.equals(LOGGER_NAME_2)) { + log2 = true; + System.out.println(" : Found new Logger : " + logger); + } + } + if ( log1 && log2 ) + System.out.println(" : PASSED." ); + else { + System.out.println(" : FAILED. Could not Detect the new Loggers." ); + throw new RuntimeException( + "Could not Detect the presense of the new Loggers"); + } + + System.out.println("Test getLoggerLevel"); + String l1 = mbean.getLoggerLevel(LOGGER_NAME_1); + System.out.println(" : Level for Logger " + LOGGER_NAME_1 + " : " + l1); + if (!l1.equals(Level.FINE.getName())) { + throw new RuntimeException( + "Expected level for " + LOGGER_NAME_1 + " = " + + Level.FINE.getName() + " but got " + l1); + } + String l2 = mbean.getLoggerLevel(LOGGER_NAME_2); + System.out.println(" : Level for Logger " + LOGGER_NAME_2 + " : " + l2); + if (!l2.equals("")) { + throw new RuntimeException( + "Expected level for " + LOGGER_NAME_2 + " = \"\"" + + " but got " + l2); + } + String l3 = mbean.getLoggerLevel(UNKNOWN_LOGGER_NAME); + System.out.println(" : Level for unknown logger : " + l3); + if (l3 != null) { + throw new RuntimeException( + "Expected level for " + UNKNOWN_LOGGER_NAME + " = null" + + " but got " + l3); + } + + System.out.println("Test setLoggerLevel"); + mbean.setLoggerLevel(LOGGER_NAME_1, "INFO"); + System.out.println(" : Set Level for Logger " + LOGGER_NAME_1 + " to: INFO"); + Level l = logger1.getLevel(); + if (l != Level.INFO) { + throw new RuntimeException( + "Expected level for " + LOGGER_NAME_1 + " = " + + Level.INFO + " but got " + l); + } + + mbean.setLoggerLevel(LOGGER_NAME_2, "SEVERE"); + System.out.println(" : Set Level for Logger " + LOGGER_NAME_2 + " to: SERVER"); + l = logger2.getLevel(); + if (l != Level.SEVERE) { + throw new RuntimeException( + "Expected level for " + LOGGER_NAME_2 + " = " + + Level.SEVERE+ " but got " + l); + } + + mbean.setLoggerLevel(LOGGER_NAME_1, null); + System.out.println(" : Set Level for Logger " + LOGGER_NAME_1 + " to: null"); + l = logger1.getLevel(); + if (l != null) { + throw new RuntimeException( + "Expected level for " + LOGGER_NAME_1 + " = null " + + " but got " + l); + } + + boolean iaeCaught = false; + System.out.println(" : Set Level for unknown Logger to: FINE"); + try { + mbean.setLoggerLevel(UNKNOWN_LOGGER_NAME, "FINE"); + } catch (IllegalArgumentException e) { + // expected + iaeCaught = true; + System.out.println(" : IllegalArgumentException caught as expected"); + } + if (!iaeCaught) { + throw new RuntimeException( + "Expected IllegalArgumentException for setting level for " + + UNKNOWN_LOGGER_NAME + " not thrown"); + } + iaeCaught = false; + System.out.println(" : Set Level for Logger " + LOGGER_NAME_1 + " to: DUMMY"); + try { + mbean.setLoggerLevel(LOGGER_NAME_1, "DUMMY"); + } catch (IllegalArgumentException e) { + // expected + iaeCaught = true; + System.out.println(" : IllegalArgumentException caught as expected"); + } + if (!iaeCaught) { + throw new RuntimeException( + "Expected IllegalArgumentException for invalid level."); + } + + + System.out.println("Test getParentLoggerName"); + String p1 = mbean.getParentLoggerName(LOGGER_NAME_2); + System.out.println(" : Parent Logger for " + LOGGER_NAME_2 + " : " + p1); + if (!p1.equals(LOGGER_NAME_1)) { + throw new RuntimeException( + "Expected parent for " + LOGGER_NAME_2 + " = " + + LOGGER_NAME_1 + " but got " + p1); + } + String p2 = mbean.getParentLoggerName(""); + System.out.println(" : Parent Logger for \"\" : " + p2); + if (!p2.equals("")) { + throw new RuntimeException( + "Expected parent for root logger \"\" = \"\"" + + " but got " + p2); + } + String p3 = mbean.getParentLoggerName(UNKNOWN_LOGGER_NAME); + System.out.println(" : Parent Logger for unknown logger : " + p3); + if (p3 != null) { + throw new RuntimeException( + "Expected level for " + UNKNOWN_LOGGER_NAME + " = null" + + " but got " + p3); + } + } + + private static void checkAttributes(LoggingMXBean mxbean1, + PlatformLoggingMXBean mxbean2) { + // verify logger names + List loggers1 = mxbean1.getLoggerNames(); + List loggers2 = mxbean2.getLoggerNames(); + if (loggers1.size() != loggers2.size()) + throw new RuntimeException("LoggerNames: unmatched number of entries"); + List loggers3 = new ArrayList<>(loggers1); + loggers3.removeAll(loggers2); + if (loggers3.size() != 0) + throw new RuntimeException("LoggerNames: unmatched loggers"); + + // verify logger's level and parent + for (String logger : loggers1) { + if (!mxbean1.getLoggerLevel(logger) + .equals(mxbean2.getLoggerLevel(logger))) + throw new RuntimeException( + "LoggerLevel: unmatched level for " + logger); + if (!mxbean1.getParentLoggerName(logger) + .equals(mxbean2.getParentLoggerName(logger))) + throw new RuntimeException( + "ParentLoggerName: unmatched parent logger's name for " + logger); + } + } +} diff --git a/jdk/test/java/util/logging/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java b/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java similarity index 95% rename from jdk/test/java/util/logging/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java rename to jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java index f76a3d3ff10..3694641351d 100644 --- a/jdk/test/java/util/logging/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java +++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java @@ -23,10 +23,11 @@ /* * @test - * @bug 6876135 + * @bug 6876135 7024172 * * @summary Test PlatformLoggingMXBean - * This test performs similar testing as LoggingMXBeanTest. + * This test performs similar testing as + * java/util/logging/LoggingMXBeanTest. * * @build PlatformLoggingMXBeanTest * @run main PlatformLoggingMXBeanTest @@ -34,6 +35,7 @@ import javax.management.*; import java.lang.management.ManagementFactory; +import java.lang.management.PlatformLoggingMXBean; import java.util.logging.*; import java.util.List; @@ -247,14 +249,8 @@ public class PlatformLoggingMXBeanTest } public static void main(String[] argv) throws Exception { - List result = - ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class); - if (result.size() != 1) { - throw new RuntimeException("Unexpected number of PlatformLoggingMXBean instances: " + - result.size()); - } - - PlatformLoggingMXBean mbean = result.get(0); + PlatformLoggingMXBean mbean = + ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); ObjectName objname = mbean.getObjectName(); if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) { throw new RuntimeException("Invalid ObjectName " + objname); @@ -263,11 +259,12 @@ public class PlatformLoggingMXBeanTest // check if the PlatformLoggingMXBean is registered in the platform MBeanServer MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME); + // We could call mbs.isRegistered(objName) here. // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); - if (!platformMBS.isInstanceOf(objName, "java.util.logging.PlatformLoggingMXBean") || + if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } diff --git a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java index 2606627446d..39b50187242 100644 --- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java +++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java @@ -28,12 +28,12 @@ */ import java.nio.ByteBuffer; -import java.nio.BufferPoolMXBean; import java.nio.channels.*; import java.net.*; import java.util.List; import java.util.concurrent.Future; import java.util.concurrent.ThreadFactory; +import java.lang.management.BufferPoolMXBean; import java.lang.management.ManagementFactory; /** From 47a20b752650a6e6d4d122c2629b39b90b129234 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 29 Mar 2011 15:58:18 -0700 Subject: [PATCH 082/168] 6381464: SimpleFormatter should use one single line format Define a new logging properties to support custom output format Reviewed-by: alanb --- .../java/util/logging/LoggingProxyImpl.java | 5 + .../java/util/logging/SimpleFormatter.java | 157 ++++++++++++----- .../sun/util/logging/LoggingProxy.java | 3 + .../sun/util/logging/LoggingSupport.java | 39 +++++ .../sun/util/logging/PlatformLogger.java | 65 +++---- jdk/src/share/lib/logging.properties | 5 + .../util/logging/SimpleFormatterFormat.java | 159 ++++++++++++++++++ .../sun/util/logging/PlatformLoggerTest.java | 5 +- 8 files changed, 349 insertions(+), 89 deletions(-) create mode 100644 jdk/test/java/util/logging/SimpleFormatterFormat.java diff --git a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java index 61e56db406b..8e027d66a47 100644 --- a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java +++ b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java @@ -99,4 +99,9 @@ class LoggingProxyImpl implements LoggingProxy { public String getLevelName(Object level) { return ((Level) level).getName(); } + + @Override + public String getProperty(String key) { + return LogManager.getLogManager().getProperty(key); + } } diff --git a/jdk/src/share/classes/java/util/logging/SimpleFormatter.java b/jdk/src/share/classes/java/util/logging/SimpleFormatter.java index e318a047f2b..87f2c7eeba6 100644 --- a/jdk/src/share/classes/java/util/logging/SimpleFormatter.java +++ b/jdk/src/share/classes/java/util/logging/SimpleFormatter.java @@ -29,31 +29,108 @@ package java.util.logging; import java.io.*; import java.text.*; import java.util.Date; +import sun.util.logging.LoggingSupport; /** - * Print a brief summary of the LogRecord in a human readable + * Print a brief summary of the {@code LogRecord} in a human readable * format. The summary will typically be 1 or 2 lines. * + *

+ * + * Configuration: + * The {@code SimpleFormatter} is initialized with the + * format string + * specified in the {@code java.util.logging.SimpleFormatter.format} + * property to {@linkplain #format format} the log messages. + * This property can be defined + * in the {@linkplain LogManager#getProperty logging properties} + * configuration file + * or as a system property. If this property is set in both + * the logging properties and system properties, + * the format string specified in the system property will be used. + * If this property is not defined or the given format string + * is {@linkplain java.util.IllegalFormatException illegal}, + * the default format is implementation-specific. + * * @since 1.4 + * @see java.util.Formatter */ public class SimpleFormatter extends Formatter { - Date dat = new Date(); - private final static String format = "{0,date} {0,time}"; - private MessageFormat formatter; - - private Object args[] = new Object[1]; - - // Line separator string. This is the value of the line.separator - // property at the moment that the SimpleFormatter was created. - private String lineSeparator = java.security.AccessController.doPrivileged( - new sun.security.action.GetPropertyAction("line.separator")); + // format string for printing the log record + private static final String format = LoggingSupport.getSimpleFormat(); + private final Date dat = new Date(); /** * Format the given LogRecord. *

- * This method can be overridden in a subclass. + * The formatting can be customized by specifying the + * format string + * in the + * {@code java.util.logging.SimpleFormatter.format} property. + * The given {@code LogRecord} will be formatted as if by calling: + *

+     *    {@link String#format String.format}(format, date, source, logger, level, message, thrown);
+     * 
+ * where the arguments are:
+ *
    + *
  1. {@code format} - the {@link java.util.Formatter + * java.util.Formatter} format string specified in the + * {@code java.util.logging.SimpleFormatter.format} property + * or the default format.
  2. + *
  3. {@code date} - a {@link Date} object representing + * {@linkplain LogRecord#getMillis event time} of the log record.
  4. + *
  5. {@code source} - a string representing the caller, if available; + * otherwise, the logger's name.
  6. + *
  7. {@code logger} - the logger's name.
  8. + *
  9. {@code level} - the {@linkplain Level#getLocalizedName + * log level}.
  10. + *
  11. {@code message} - the formatted log message + * returned from the {@link Formatter#formatMessage(LogRecord)} + * method. It uses {@link java.text.MessageFormat java.text} + * formatting and does not use the {@code java.util.Formatter + * format} argument.
  12. + *
  13. {@code thrown} - a string representing + * the {@linkplain LogRecord#getThrown throwable} + * associated with the log record and its backtrace + * beginning with a newline character, if any; + * otherwise, an empty string.
  14. + *
+ * + *

Some example formats:
+ *

    + *
  • {@code java.util.logging.SimpleFormatter.format="%4$s: %5$s [%1$tc]%n"} + *

    This prints 1 line with the log level ({@code 4$}), + * the log message ({@code 5$}) and the timestamp ({@code 1$}) in + * a square bracket. + *

    +     *     WARNING: warning message [Tue Mar 22 13:11:31 PDT 2011]
    +     *     
  • + *
  • {@code java.util.logging.SimpleFormatter.format="%1$tc %2$s%n%4$s: %5$s%6$s%n"} + *

    This prints 2 lines where the first line includes + * the timestamp ({@code 1$}) and the source ({@code 2$}); + * the second line includes the log level ({@code 4$}) and + * the log message ({@code 5$}) followed with the throwable + * and its backtrace ({@code 6$}), if any: + *

    +     *     Tue Mar 22 13:11:31 PDT 2011 MyClass fatal
    +     *     SEVERE: several message with an exception
    +     *     java.lang.IllegalArgumentException: invalid argument
    +     *             at MyClass.mash(MyClass.java:9)
    +     *             at MyClass.crunch(MyClass.java:6)
    +     *             at MyClass.main(MyClass.java:3)
    +     *     
  • + *
  • {@code java.util.logging.SimpleFormatter.format="%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%n"} + *

    This prints 2 lines similar to the example above + * with a different date/time formatting and does not print + * the throwable and its backtrace: + *

    +     *     Mar 22, 2011 1:11:31 PM MyClass fatal
    +     *     SEVERE: several message with an exception
    +     *     
  • + *
+ *

This method can also be overridden in a subclass. * It is recommended to use the {@link Formatter#formatMessage} * convenience method to localize and format the message field. * @@ -61,42 +138,32 @@ public class SimpleFormatter extends Formatter { * @return a formatted log record */ public synchronized String format(LogRecord record) { - StringBuffer sb = new StringBuffer(); - // Minimize memory allocations here. dat.setTime(record.getMillis()); - args[0] = dat; - StringBuffer text = new StringBuffer(); - if (formatter == null) { - formatter = new MessageFormat(format); - } - formatter.format(args, text, null); - sb.append(text); - sb.append(" "); + String source; if (record.getSourceClassName() != null) { - sb.append(record.getSourceClassName()); - } else { - sb.append(record.getLoggerName()); - } - if (record.getSourceMethodName() != null) { - sb.append(" "); - sb.append(record.getSourceMethodName()); - } - sb.append(lineSeparator); - String message = formatMessage(record); - sb.append(record.getLevel().getLocalizedName()); - sb.append(": "); - sb.append(message); - sb.append(lineSeparator); - if (record.getThrown() != null) { - try { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - record.getThrown().printStackTrace(pw); - pw.close(); - sb.append(sw.toString()); - } catch (Exception ex) { + source = record.getSourceClassName(); + if (record.getSourceMethodName() != null) { + source += " " + record.getSourceMethodName(); } + } else { + source = record.getLoggerName(); } - return sb.toString(); + String message = formatMessage(record); + String throwable = ""; + if (record.getThrown() != null) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + pw.println(); + record.getThrown().printStackTrace(pw); + pw.close(); + throwable = sw.toString(); + } + return String.format(format, + dat, + source, + record.getLoggerName(), + record.getLevel().getLocalizedName(), + message, + throwable); } } diff --git a/jdk/src/share/classes/sun/util/logging/LoggingProxy.java b/jdk/src/share/classes/sun/util/logging/LoggingProxy.java index bb3fc78066e..c3cbfd614fc 100644 --- a/jdk/src/share/classes/sun/util/logging/LoggingProxy.java +++ b/jdk/src/share/classes/sun/util/logging/LoggingProxy.java @@ -60,4 +60,7 @@ public interface LoggingProxy { public Object parseLevel(String levelName); public String getLevelName(Object level); + + // return the logging property + public String getProperty(String key); } diff --git a/jdk/src/share/classes/sun/util/logging/LoggingSupport.java b/jdk/src/share/classes/sun/util/logging/LoggingSupport.java index 1c1b140d50e..c5a2200c5e7 100644 --- a/jdk/src/share/classes/sun/util/logging/LoggingSupport.java +++ b/jdk/src/share/classes/sun/util/logging/LoggingSupport.java @@ -29,6 +29,7 @@ package sun.util.logging; import java.lang.reflect.Field; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.Date; /** * Internal API to support JRE implementation to detect if the java.util.logging @@ -138,4 +139,42 @@ public class LoggingSupport { ensureAvailable(); return proxy.getLevelName(level); } + + private static final String DEFAULT_FORMAT = + "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%6$s%n"; + + private static final String FORMAT_PROP_KEY = "java.util.logging.SimpleFormatter.format"; + public static String getSimpleFormat() { + return getSimpleFormat(true); + } + + // useProxy if true will cause initialization of + // java.util.logging and read its configuration + static String getSimpleFormat(boolean useProxy) { + String format = + AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { + return System.getProperty(FORMAT_PROP_KEY); + } + }); + + if (useProxy && proxy != null && format == null) { + format = proxy.getProperty(FORMAT_PROP_KEY); + } + + if (format != null) { + try { + // validate the user-defined format string + String.format(format, new Date(), "", "", "", "", ""); + } catch (IllegalArgumentException e) { + // illegal syntax; fall back to the default format + format = DEFAULT_FORMAT; + } + } else { + format = DEFAULT_FORMAT; + } + return format; + } + } diff --git a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java index 98fd0196746..c1420c8f278 100644 --- a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java +++ b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java @@ -316,12 +316,6 @@ public class PlatformLogger { */ static class LoggerProxy { private static final PrintStream defaultStream = System.err; - private static final String lineSeparator = AccessController.doPrivileged( - new PrivilegedAction() { - public String run() { - return System.getProperty("line.separator"); - } - }); final String name; volatile int levelValue; @@ -353,14 +347,14 @@ public class PlatformLogger { if (level < levelValue || levelValue == OFF) { return; } - defaultStream.println(format(level, msg, null)); + defaultStream.print(format(level, msg, null)); } void doLog(int level, String msg, Throwable thrown) { if (level < levelValue || levelValue == OFF) { return; } - defaultStream.println(format(level, msg, thrown)); + defaultStream.print(format(level, msg, thrown)); } void doLog(int level, String msg, Object... params) { @@ -368,7 +362,7 @@ public class PlatformLogger { return; } String newMsg = formatMessage(msg, params); - defaultStream.println(format(level, newMsg, null)); + defaultStream.print(format(level, newMsg, null)); } public boolean isLoggable(int level) { @@ -378,12 +372,6 @@ public class PlatformLogger { return true; } - private static final String format = "{0,date} {0,time}"; - - private Object args[] = new Object[1]; - private MessageFormat formatter; - private Date dat; - // Copied from java.util.logging.Formatter.formatMessage private String formatMessage(String format, Object... parameters) { // Do the formatting. @@ -408,37 +396,30 @@ public class PlatformLogger { } } + private static final String formatString = + LoggingSupport.getSimpleFormat(false); // don't check logging.properties + + // minimize memory allocation + private Date date = new Date(); private synchronized String format(int level, String msg, Throwable thrown) { - StringBuffer sb = new StringBuffer(); - // Minimize memory allocations here. - if (dat == null) { - dat = new Date(); - formatter = new MessageFormat(format); - } - dat.setTime(System.currentTimeMillis()); - args[0] = dat; - StringBuffer text = new StringBuffer(); - formatter.format(args, text, null); - sb.append(text); - sb.append(" "); - sb.append(getCallerInfo()); - sb.append(lineSeparator); - sb.append(PlatformLogger.getLevelName(level)); - sb.append(": "); - sb.append(msg); + date.setTime(System.currentTimeMillis()); + String throwable = ""; if (thrown != null) { - try { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - thrown.printStackTrace(pw); - pw.close(); - sb.append(sw.toString()); - } catch (Exception ex) { - throw new AssertionError(ex); - } + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + pw.println(); + thrown.printStackTrace(pw); + pw.close(); + throwable = sw.toString(); } - return sb.toString(); + return String.format(formatString, + date, + getCallerInfo(), + name, + PlatformLogger.getLevelName(level), + msg, + throwable); } // Returns the caller's class and method's name; best effort diff --git a/jdk/src/share/lib/logging.properties b/jdk/src/share/lib/logging.properties index 4f7f6dcfd41..65cf1b1b7dc 100644 --- a/jdk/src/share/lib/logging.properties +++ b/jdk/src/share/lib/logging.properties @@ -43,6 +43,11 @@ java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter java.util.logging.ConsoleHandler.level = INFO java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +# Example to customize the SimpleFormatter output format +# to print one-line log message like this: +# : [] +# +# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n ############################################################ # Facility specific properties. diff --git a/jdk/test/java/util/logging/SimpleFormatterFormat.java b/jdk/test/java/util/logging/SimpleFormatterFormat.java new file mode 100644 index 00000000000..fc786a0f092 --- /dev/null +++ b/jdk/test/java/util/logging/SimpleFormatterFormat.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6381464 + * @summary Test the custom simple formatter output + * + * @run main/othervm SimpleFormatterFormat + */ + +import java.io.*; +import java.util.logging.*; +import java.util.regex.*; + +public class SimpleFormatterFormat { + private static final String key = "java.util.logging.SimpleFormatter.format"; + private static final String origFormat = System.getProperty(key); + private static final PrintStream err = System.err; + public static void main(String[] args) throws Exception { + try { + File dir = new File(System.getProperty("user.dir", ".")); + File log = new File(dir, "simpleformat.txt"); + java.nio.file.Files.deleteIfExists(log.toPath()); + PrintStream logps = new PrintStream(log); + System.setProperty(key, "%3$s:%4$s: %5$s [%1$tc] source: %2$s%6$s%n"); + writeLogRecords(logps); + checkLogRecords(log); + } finally { + if (origFormat == null) { + System.clearProperty(key); + } else { + System.setProperty(key, origFormat); + } + System.setErr(err); + } + } + + private static String[] loggers = new String[] { + "test.foo", + "test.foo", + "test.bar", + "test.bar" + }; + private static String[] messages = new String[] { + "severe hello world", + "warning lost connection", + "info welcome", + "warning exception thrown", + }; + private static void writeLogRecords(PrintStream logps) throws Exception { + try { + System.setErr(logps); + + Logger foo = Logger.getLogger("test.foo"); + foo.log(Level.SEVERE, "{0} {1} {2}", new Object[] {"severe", "hello", "world"}); + foo.warning(messages[1]); + + Logger bar = Logger.getLogger("test.bar"); + bar.finest("Dummy message"); + bar.info(messages[2]); + bar.log(Level.WARNING, messages[3], new IllegalArgumentException()); + + } finally { + logps.flush(); + logps.close(); + System.setErr(err); + } + } + + private static void checkLogRecords(File log) throws Exception { + System.out.println("Checking log records in file: " + log); + Pattern p = Pattern.compile("([\\.a-zA-Z:]+) (.*) \\[.*\\] source: (.*)"); + + try (FileInputStream in = new FileInputStream(log)) { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String line; + int i = 0; + while (i < messages.length && + (line = reader.readLine()) != null) { + String expectedLogger = loggers[i]; + String expectedMsg = messages[i]; + i++; + + line = line.trim(); + System.out.println(line); + + Matcher m = p.matcher(line); + if (!m.matches()) { + throw new RuntimeException("Unexpected output format"); + } + if (m.groupCount() != 3) { + throw new RuntimeException("Unexpected group count = " + + m.groupCount()); + } + // verify logger name and level + String[] ss = m.group(1).split(":"); + int len = ss.length; + if (len != 2) { + throw new RuntimeException("Unexpected logger name and level" + + m.group(1)); + } + + verify(expectedLogger, expectedMsg, ss[0], ss[1], m.group(2), m.group(3)); + } + + // expect IllegalArgumentException following it + line = reader.readLine().trim(); + if (!line.equals("java.lang.IllegalArgumentException")) { + throw new RuntimeException("Invalid line: " + line); + } + } + } + + private static void verify(String expectedLogger, String expectedMsg, + String logger, String level, + String msg, String source) { + if (!logger.equals(expectedLogger)) { + throw new RuntimeException("Unexpected logger: " + logger); + } + if (!msg.equals(expectedMsg)) { + throw new RuntimeException("Unexpected message: " + msg); + } + + String[] ss = expectedMsg.split("\\s+"); + String expectedLevel = ss[0].toUpperCase(); + if (!level.equals(expectedLevel)) { + throw new RuntimeException("Unexpected level: " + level); + } + + ss = source.split("\\s+"); + int len = ss.length; + if (!(len == 2 && + ss[0].equals("SimpleFormatterFormat") && + ss[1].equals("writeLogRecords"))) { + throw new RuntimeException("Unexpected source: " + source); + } + } +} diff --git a/jdk/test/sun/util/logging/PlatformLoggerTest.java b/jdk/test/sun/util/logging/PlatformLoggerTest.java index 35fccfc00e6..9e7435d4045 100644 --- a/jdk/test/sun/util/logging/PlatformLoggerTest.java +++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java @@ -26,10 +26,11 @@ * @bug 6882376 6985460 * @summary Test if java.util.logging.Logger is created before and after * logging is enabled. Also validate some basic PlatformLogger - * operations. + * operations. othervm mode to make sure java.util.logging + * is not initialized. * * @compile -XDignore.symbol.file PlatformLoggerTest.java - * @run main PlatformLoggerTest + * @run main/othervm PlatformLoggerTest */ import java.util.logging.*; From f24980f896be02f81c47a7485cd25769e3d4bab5 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Wed, 30 Mar 2011 00:59:07 +0100 Subject: [PATCH 083/168] 7026507: Bidi initialization fails if AWT not present Reviewed-by: okutsu --- .../share/classes/sun/text/bidi/BidiBase.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/jdk/src/share/classes/sun/text/bidi/BidiBase.java b/jdk/src/share/classes/sun/text/bidi/BidiBase.java index d3457dd5c61..8be648e931c 100644 --- a/jdk/src/share/classes/sun/text/bidi/BidiBase.java +++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java @@ -3457,13 +3457,18 @@ public class BidiBase { */ static final AttributedCharacterIterator.Attribute RUN_DIRECTION = getTextAttribute("RUN_DIRECTION"); - static final Boolean RUN_DIRECTION_LTR = - (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR"); static final AttributedCharacterIterator.Attribute NUMERIC_SHAPING = getTextAttribute("NUMERIC_SHAPING"); static final AttributedCharacterIterator.Attribute BIDI_EMBEDDING = getTextAttribute("BIDI_EMBEDDING"); + /** + * TextAttribute.RUN_DIRECTION_LTR + */ + static final Boolean RUN_DIRECTION_LTR = (clazz == null) ? + Boolean.FALSE : (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR"); + + private static Class getClass(String name) { try { return Class.forName(name, true, null); @@ -3473,25 +3478,23 @@ public class BidiBase { } private static Object getStaticField(Class clazz, String name) { - if (clazz == null) { - // fake attribute - return new AttributedCharacterIterator.Attribute(name) { }; - } else { - try { - Field f = clazz.getField(name); - return f.get(null); - } catch (NoSuchFieldException x) { - throw new AssertionError(x); - } catch (IllegalAccessException x) { - throw new AssertionError(x); - } + try { + Field f = clazz.getField(name); + return f.get(null); + } catch (NoSuchFieldException | IllegalAccessException x) { + throw new AssertionError(x); } } private static AttributedCharacterIterator.Attribute getTextAttribute(String name) { - return (AttributedCharacterIterator.Attribute)getStaticField(clazz, name); + if (clazz == null) { + // fake attribute + return new AttributedCharacterIterator.Attribute(name) { }; + } else { + return (AttributedCharacterIterator.Attribute)getStaticField(clazz, name); + } } } From 546f3df880fc6a88af3b40957e659beb05a9355f Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Tue, 29 Mar 2011 17:35:34 -0700 Subject: [PATCH 084/168] 6741940: Nonvolatile XMM registers not preserved across JNI calls Save xmm6-xmm15 in call stub on win64 Reviewed-by: kvn, never --- hotspot/src/cpu/x86/vm/frame_x86.hpp | 4 +-- .../src/cpu/x86/vm/stubGenerator_x86_64.cpp | 31 ++++++++++++++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/frame_x86.hpp b/hotspot/src/cpu/x86/vm/frame_x86.hpp index d949e250c59..ea92dc518cc 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.hpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -125,7 +125,7 @@ // Entry frames #ifdef AMD64 #ifdef _WIN64 - entry_frame_after_call_words = 8, + entry_frame_after_call_words = 28, entry_frame_call_wrapper_offset = 2, arg_reg_save_area_bytes = 32, // Register argument save area diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 49181238c69..07d87d34142 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -144,8 +144,11 @@ class StubGenerator: public StubCodeGenerator { // [ return_from_Java ] <--- rsp // [ argument word n ] // ... - // -8 [ argument word 1 ] - // -7 [ saved r15 ] <--- rsp_after_call + // -28 [ argument word 1 ] + // -27 [ saved xmm15 ] <--- rsp_after_call + // [ saved xmm7-xmm14 ] + // -9 [ saved xmm6 ] (each xmm register takes 2 slots) + // -7 [ saved r15 ] // -6 [ saved r14 ] // -5 [ saved r13 ] // -4 [ saved r12 ] @@ -169,8 +172,11 @@ class StubGenerator: public StubCodeGenerator { // Call stub stack layout word offsets from rbp enum call_stub_layout { #ifdef _WIN64 - rsp_after_call_off = -7, - r15_off = rsp_after_call_off, + xmm_save_first = 6, // save from xmm6 + xmm_save_last = 15, // to xmm15 + xmm_save_base = -9, + rsp_after_call_off = xmm_save_base - 2 * (xmm_save_last - xmm_save_first), // -27 + r15_off = -7, r14_off = -6, r13_off = -5, r12_off = -4, @@ -208,6 +214,13 @@ class StubGenerator: public StubCodeGenerator { #endif }; +#ifdef _WIN64 + Address xmm_save(int reg) { + assert(reg >= xmm_save_first && reg <= xmm_save_last, "XMM register number out of range"); + return Address(rbp, (xmm_save_base - (reg - xmm_save_first) * 2) * wordSize); + } +#endif + address generate_call_stub(address& return_address) { assert((int)frame::entry_frame_after_call_words == -(int)rsp_after_call_off + 1 && (int)frame::entry_frame_call_wrapper_offset == (int)call_wrapper_off, @@ -256,8 +269,11 @@ class StubGenerator: public StubCodeGenerator { __ movptr(r13_save, r13); __ movptr(r14_save, r14); __ movptr(r15_save, r15); - #ifdef _WIN64 + for (int i = 6; i <= 15; i++) { + __ movdqu(xmm_save(i), as_XMMRegister(i)); + } + const Address rdi_save(rbp, rdi_off * wordSize); const Address rsi_save(rbp, rsi_off * wordSize); @@ -360,6 +376,11 @@ class StubGenerator: public StubCodeGenerator { #endif // restore regs belonging to calling function +#ifdef _WIN64 + for (int i = 15; i >= 6; i--) { + __ movdqu(as_XMMRegister(i), xmm_save(i)); + } +#endif __ movptr(r15, r15_save); __ movptr(r14, r14_save); __ movptr(r13, r13_save); From 2c7249578993f3a359d75727d05a7c12fdd5eb12 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 29 Mar 2011 22:05:21 -0700 Subject: [PATCH 085/168] 7032306: Fastdebug build failure on Solaris with SS11 compilers Reviewed-by: kvn, iveresov --- hotspot/src/share/vm/oops/instanceKlass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 840ae03d09e..a99ecd4114d 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -2337,7 +2337,7 @@ void instanceKlass::oop_print_on(oop obj, outputStream* st) { st->print_cr(BULLET"fake entry for oop_size: %d", java_lang_Class::oop_size(obj)); st->print_cr(BULLET"fake entry for static_oop_field_count: %d", java_lang_Class::static_oop_field_count(obj)); klassOop real_klass = java_lang_Class::as_klassOop(obj); - if (real_klass && real_klass->klass_part()->oop_is_instance()) { + if (real_klass != NULL && real_klass->klass_part()->oop_is_instance()) { instanceKlass::cast(real_klass)->do_local_static_fields(&print_field); } } else if (as_klassOop() == SystemDictionary::MethodType_klass()) { From 431a861d74e81ba9a1358f20c85d43a9f424067f Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Tue, 29 Mar 2011 22:25:17 -0700 Subject: [PATCH 086/168] 7026307: DEBUG MESSAGE: broken null klass on amd64 Correct typo introduces in 7020521 Reviewed-by: never, kvn --- hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 07d87d34142..c16f642631c 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -2449,8 +2449,8 @@ class StubGenerator: public StubCodeGenerator { // address generate_generic_copy(const char *name, address byte_copy_entry, address short_copy_entry, - address int_copy_entry, address long_copy_entry, - address oop_copy_entry, address checkcast_copy_entry) { + address int_copy_entry, address oop_copy_entry, + address long_copy_entry, address checkcast_copy_entry) { Label L_failed, L_failed_0, L_objArray; Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs; From f0b8d4d06831c19dff4d897e61071333cdd750d1 Mon Sep 17 00:00:00 2001 From: Shinya Ogino Date: Tue, 29 Mar 2011 22:59:52 -0700 Subject: [PATCH 087/168] 7032334: Update Font2DTest demo to support Unicode 6 Reviewed-by: naoto --- jdk/src/share/demo/jfc/Font2DTest/README.txt | 2 +- .../share/demo/jfc/Font2DTest/RangeMenu.java | 416 +++--------------- 2 files changed, 64 insertions(+), 354 deletions(-) diff --git a/jdk/src/share/demo/jfc/Font2DTest/README.txt b/jdk/src/share/demo/jfc/Font2DTest/README.txt index dec4895b55e..c5f03af0cb8 100644 --- a/jdk/src/share/demo/jfc/Font2DTest/README.txt +++ b/jdk/src/share/demo/jfc/Font2DTest/README.txt @@ -7,7 +7,7 @@ To run Font2DTest: or % appletviewer Font2DTest.html -These instructions assume that the 1.5 versions of the java +These instructions assume that the 1.7 versions of the java and appletviewer commands are in your path. If they aren't, then you should either specify the complete path to the commands or update your PATH environment variable as described in the diff --git a/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java b/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java index 1f4c582f2df..20a3113df44 100644 --- a/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java +++ b/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,6 +41,9 @@ import java.awt.event.ItemListener; import javax.swing.*; +import java.util.*; +import java.util.regex.*; + /** * RangeMenu.java * @@ -52,358 +55,8 @@ import javax.swing.*; public final class RangeMenu extends JComboBox implements ActionListener { - /// Painfully extracted from java.lang.Character.UnicodeBlock. Arrrgh! - /// Unicode 5.1.0 data. - - private final int[][] UNICODE_RANGES = { - { 0x000000, 0x00007f }, /// BASIC_LATIN - { 0x000080, 0x0000ff }, /// LATIN_1_SUPPLEMENT - { 0x000100, 0x00017f }, /// LATIN_EXTENDED_A - { 0x000180, 0x00024f }, /// LATIN_EXTENDED_B - { 0x000250, 0x0002af }, /// IPA_EXTENSIONS - { 0x0002b0, 0x0002ff }, /// SPACING_MODIFIER_LETTERS - { 0x000300, 0x00036f }, /// COMBINING_DIACRITICAL_MARKS - { 0x000370, 0x0003ff }, /// GREEK_AND_COPTIC - { 0x000400, 0x0004ff }, /// CYRILLIC - { 0x000500, 0x00052f }, /// CYRILLIC_SUPPLEMENTARY - { 0x000530, 0x00058f }, /// ARMENIAN - { 0x000590, 0x0005ff }, /// HEBREW - { 0x000600, 0x0006ff }, /// ARABIC - { 0x000700, 0x00074f }, /// SYRIAC - { 0x000750, 0x00077f }, /// ARABIC_SUPPLEMENT - { 0x000780, 0x0007bf }, /// THAANA - { 0x0007c0, 0x0007ff }, /// NKO - { 0x000900, 0x00097f }, /// DEVANAGARI - { 0x000980, 0x0009ff }, /// BENGALI - { 0x000a00, 0x000a7f }, /// GURMUKHI - { 0x000a80, 0x000aff }, /// GUJARATI - { 0x000b00, 0x000b7f }, /// ORIYA - { 0x000b80, 0x000bff }, /// TAMIL - { 0x000c00, 0x000c7f }, /// TELUGU - { 0x000c80, 0x000cff }, /// KANNADA - { 0x000d00, 0x000d7f }, /// MALAYALAM - { 0x000d80, 0x000dff }, /// SINHALA - { 0x000e00, 0x000e7f }, /// THAI - { 0x000e80, 0x000eff }, /// LAO - { 0x000f00, 0x000fff }, /// TIBETAN - { 0x001000, 0x00109f }, /// MYANMAR - { 0x0010a0, 0x0010ff }, /// GEORGIAN - { 0x001100, 0x0011ff }, /// HANGUL_JAMO - { 0x001200, 0x00137f }, /// ETHIOPIC - { 0x001380, 0x00139f }, /// ETHIOPIC_SUPPLEMENT - { 0x0013a0, 0x0013ff }, /// CHEROKEE - { 0x001400, 0x00167f }, /// UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS - { 0x001680, 0x00169f }, /// OGHAM - { 0x0016a0, 0x0016ff }, /// RUNIC - { 0x001700, 0x00171f }, /// TAGALOG - { 0x001720, 0x00173f }, /// HANUNOO - { 0x001740, 0x00175f }, /// BUHID - { 0x001760, 0x00177f }, /// TAGBANWA - { 0x001780, 0x0017ff }, /// KHMER - { 0x001800, 0x0018af }, /// MONGOLIAN - { 0x001900, 0x00194f }, /// LIMBU - { 0x001950, 0x00197f }, /// TAI_LE - { 0x001980, 0x0019df }, /// NEW_TAI_LE - { 0x0019e0, 0x0019ff }, /// KHMER_SYMBOLS - { 0x001a00, 0x001a1f }, /// BUGINESE - { 0x001b00, 0x001b7f }, /// BALINESE - { 0x001b80, 0x001bbf }, /// SUNDANESE - { 0x001c00, 0x001c4f }, /// LEPCHA - { 0x001c50, 0x001c7f }, /// OL_CHIKI - { 0x001d00, 0x001d7f }, /// PHONETIC_EXTENSIONS - { 0x001d80, 0x001dbf }, /// PHONEITC EXTENSIONS SUPPLEMENT - { 0x001dc0, 0x001dff }, /// COMBINING_DIACRITICAL_MAKRS_SUPPLEMENT - { 0x001e00, 0x001eff }, /// LATIN_EXTENDED_ADDITIONAL - { 0x001f00, 0x001fff }, /// GREEK_EXTENDED - { 0x002000, 0x00206f }, /// GENERAL_PUNCTUATION - { 0x002070, 0x00209f }, /// SUPERSCRIPTS_AND_SUBSCRIPTS - { 0x0020a0, 0x0020cf }, /// CURRENCY_SYMBOLS - { 0x0020d0, 0x0020ff }, /// COMBINING_MARKS_FOR_SYMBOLS - { 0x002100, 0x00214f }, /// LETTERLIKE_SYMBOLS - { 0x002150, 0x00218f }, /// NUMBER_FORMS - { 0x002190, 0x0021ff }, /// ARROWS - { 0x002200, 0x0022ff }, /// MATHEMATICAL_OPERATORS - { 0x002300, 0x0023ff }, /// MISCELLANEOUS_TECHNICAL - { 0x002400, 0x00243f }, /// CONTROL_PICTURES - { 0x002440, 0x00245f }, /// OPTICAL_CHARACTER_RECOGNITION - { 0x002460, 0x0024ff }, /// ENCLOSED_ALPHANUMERICS - { 0x002500, 0x00257f }, /// BOX_DRAWING - { 0x002580, 0x00259f }, /// BLOCK_ELEMENTS - { 0x0025a0, 0x0025ff }, /// GEOMETRIC_SHAPES - { 0x002600, 0x0026ff }, /// MISCELLANEOUS_SYMBOLS - { 0x002700, 0x0027bf }, /// DINGBATS - { 0x0027c0, 0x0027ef }, /// MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A - { 0x0027f0, 0x0027ff }, /// SUPPLEMENTAL_ARROWS_A - { 0x002800, 0x0028ff }, /// BRAILLE_PATTERNS - { 0x002900, 0x00297f }, /// SUPPLEMENTAL_ARROWS_B - { 0x002980, 0x0029ff }, /// MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B - { 0x002a00, 0x002aff }, /// SUPPLEMENTAL_MATHEMATICAL_OPERATORS - { 0x002b00, 0x002bff }, /// MISCELLANEOUS_SYMBOLS_AND_ARROWS - { 0x002c00, 0x002c5f }, /// GLAGOLITIC - { 0x002c60, 0x002c7f }, /// LATIN_EXTENDED-C - { 0x002c80, 0x002cff }, /// COPTIC - { 0x002d00, 0x002d2f }, /// GEORGIAN_SUPPLEMENT - { 0x002d30, 0x002d7f }, /// TIFINAGH - { 0x002d80, 0x002ddf }, /// ETHIOPIC_EXTENDED - { 0x002de0, 0x002dff }, /// CYRILLIC_EXTENDED-A - { 0x002e00, 0x002e7f }, /// SUPPLEMENTAL_PUNCTUATION - { 0x002e80, 0x002eff }, /// CJK_RADICALS_SUPPLEMENT - { 0x002f00, 0x002fdf }, /// KANGXI_RADICALS - { 0x002ff0, 0x002fff }, /// IDEOGRAPHIC_DESCRIPTION_CHARACTERS - { 0x003000, 0x00303f }, /// CJK_SYMBOLS_AND_PUNCTUATION - { 0x003040, 0x00309f }, /// HIRAGANA - { 0x0030a0, 0x0030ff }, /// KATAKANA - { 0x003100, 0x00312f }, /// BOPOMOFO - { 0x003130, 0x00318f }, /// HANGUL_COMPATIBILITY_JAMO - { 0x003190, 0x00319f }, /// KANBUN - { 0x0031a0, 0x0031bf }, /// BOPOMOFO_EXTENDED - { 0x0031c0, 0x0031ef }, /// CJK_STROKES - { 0x0031f0, 0x0031ff }, /// KATAKANA_PHONETIC_EXTENSIONS - { 0x003200, 0x0032ff }, /// ENCLOSED_CJK_LETTERS_AND_MONTHS - { 0x003300, 0x0033ff }, /// CJK_COMPATIBILITY - { 0x003400, 0x004dbf }, /// CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A - { 0x004dc0, 0x004dff }, /// YIJING_HEXAGRAM_SYMBOLS - { 0x004e00, 0x009fff }, /// CJK_UNIFIED_IDEOGRAPHS - { 0x00a000, 0x00a48f }, /// YI_SYLLABLES - { 0x00a490, 0x00a4cf }, /// YI_RADICALS - { 0x00a500, 0x00a63f }, /// YAI - { 0x00a640, 0x00a69f }, /// CYRILLIC_EXTENDED-B - { 0x00a700, 0x00a71f }, /// MODIFIER_TONE_LETTERS - { 0x00a720, 0x00a7ff }, /// LATIN_EXTENDED-D - { 0x00a800, 0x00a82f }, /// SYLOTI_NAGRI - { 0x00a840, 0x00a87f }, /// PHAGS-PA - { 0x00a880, 0x00a8df }, /// SAURASHTRA - { 0x00a900, 0x00a92f }, /// KAYAH_LI - { 0x00a930, 0x00a95f }, /// REJANG - { 0x00aa00, 0x00aa5f }, /// CHAM - { 0x00ac00, 0x00d7af }, /// HANGUL_SYLLABLES - { 0x00d800, 0x00db7f }, /// HIGH_SURROGATES_AREA - { 0x00db80, 0x00dbff }, /// HIGH_PRIVATE_USE_SURROGATES_AREA - { 0x00dc00, 0x00dfff }, /// LOW_SURROGATES_AREA - { 0x00e000, 0x00f8ff }, /// PRIVATE_USE_AREA - { 0x00f900, 0x00faff }, /// CJK_COMPATIBILITY_IDEOGRAPHS - { 0x00fb00, 0x00fb4f }, /// ALPHABETIC_PRESENTATION_FORMS - { 0x00fb50, 0x00fdff }, /// ARABIC_PRESENTATION_FORMS_A - { 0x00fe00, 0x00fe0f }, /// VARIATION_SELECTORS - { 0x00fe10, 0x00fe1f }, /// VERTICAL_FORMS - { 0x00fe20, 0x00fe2f }, /// COMBINING_HALF_MARKS - { 0x00fe30, 0x00fe4f }, /// CJK_COMPATIBILITY_FORMS - { 0x00fe50, 0x00fe6f }, /// SMALL_FORM_VARIANTS - { 0x00fe70, 0x00feff }, /// ARABIC_PRESENTATION_FORMS_B - { 0x00ff00, 0x00ffef }, /// HALFWIDTH_AND_FULLWIDTH_FORMS - { 0x00fff0, 0x00ffff }, /// SPECIALS - { 0x010000, 0x01007f }, /// LINEAR_B_SYLLABARY - { 0x010080, 0x0100ff }, /// LINEAR_B_IDEOGRAMS - { 0x010100, 0x01013f }, /// AEGEAN_NUMBERS - { 0x010140, 0x01018f }, /// ANCIENT_GREEK_NUMBERS - { 0x010190, 0x0101cf }, /// ANCIENT_SYMBOLS - { 0x0101d0, 0x0101ff }, /// PHAISTOS_DISC - { 0x010280, 0x01029f }, /// LYCIAN - { 0x0102a0, 0x0102df }, /// CARIAN - { 0x010300, 0x01032f }, /// OLD_ITALIC - { 0x010330, 0x01034f }, /// GOTHIC - { 0x010380, 0x01039f }, /// UGARITIC - { 0x0103a0, 0x0103df }, /// OLD_PERSIAN - { 0x010400, 0x01044f }, /// DESERET - { 0x010450, 0x01047f }, /// SHAVIAN - { 0x010480, 0x0104af }, /// OSMANYA - { 0x010800, 0x01083f }, /// CYPRIOT_SYLLABARY - { 0x010900, 0x01091f }, /// PHOENICIAN - { 0x010920, 0x01093f }, /// LYDIAN - { 0x010a00, 0x010a5f }, /// KHAROSHTHI - { 0x012000, 0x0123ff }, /// CUNEIFORM - { 0x012400, 0x01247f }, /// CUNEIFORM_NUMBERS_AND_PUNCTUATION - { 0x01d000, 0x01d0ff }, /// BYZANTINE_MUSICAL_SYMBOLS - { 0x01d100, 0x01d1ff }, /// MUSICAL_SYMBOLS - { 0x01d200, 0x01d24f }, /// ANCIENT_GREEK_MUSICAL_NOTATION - { 0x01d300, 0x01d35f }, /// TAI_XUAN_JING_SYMBOLS - { 0x01d360, 0x01d37f }, /// COUNTING_ROD_NUMERALS - { 0x01d400, 0x01d7ff }, /// MATHEMATICAL_ALPHANUMERIC_SYMBOLS - { 0x01f000, 0x01f02f }, /// MAHJONG_TILES - { 0x01f030, 0x01f09f }, /// DOMINO_TILES - { 0x020000, 0x02a6df }, /// CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B - { 0x02f800, 0x02fa1f }, /// CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT - { 0x0e0000, 0x0e007f }, /// TAGS - { 0x0e0100, 0x0e01ef }, /// VARIATION_SELECTORS_SUPPLEMENT - { 0x0f0000, 0x0fffff }, /// SUPPLEMENTARY_PRIVATE_USE_AREA_A - { 0x100000, 0x10ffff }, /// SUPPLEMENTARY_PRIVATE_USE_AREA_B - { 0x000000, 0x00007f }, /// OTHER [USER DEFINED RANGE] - }; - - private final String[] UNICODE_RANGE_NAMES = { - "Basic Latin", - "Latin-1 Supplement", - "Latin Extended-A", - "Latin Extended-B", - "IPA Extensions", - "Spacing Modifier Letters", - "Combining Diacritical Marks", - "Greek and Coptic", - "Cyrillic", - "Cyrillic Supplement", - "Armenian", - "Hebrew", - "Arabic", - "Syriac", - "Arabic Supplement", - "Thaana", - "NKo", - "Devanagari", - "Bengali", - "Gurmukhi", - "Gujarati", - "Oriya", - "Tamil", - "Telugu", - "Kannada", - "Malayalam", - "Sinhala", - "Thai", - "Lao", - "Tibetan", - "Myanmar", - "Georgian", - "Hangul Jamo", - "Ethiopic", - "Ethiopic Supplement", - "Cherokee", - "Unified Canadian Aboriginal Syllabics", - "Ogham", - "Runic", - "Tagalog", - "Hanunoo", - "Buhid", - "Tagbanwa", - "Khmer", - "Mongolian", - "Limbu", - "Tai Le", - "New Tai Lue", - "Khmer Symbols", - "Buginese", - "Balinese", - "Sundanese", - "Lepcha", - "Ol Chiki", - "Phonetic Extensions", - "Phonetic Extensions Supplement", - "Combining Diacritical Marks Supplement", - "Latin Extended Additional", - "Greek Extended", - "General Punctuation", - "Superscripts and Subscripts", - "Currency Symbols", - "Combining Diacritical Marks for Symbols", - "Letterlike Symbols", - "Number Forms", - "Arrows", - "Mathematical Operators", - "Miscellaneous Technical", - "Control Pictures", - "Optical Character Recognition", - "Enclosed Alphanumerics", - "Box Drawing", - "Block Elements", - "Geometric Shapes", - "Miscellaneous Symbols", - "Dingbats", - "Miscellaneous Mathematical Symbols-A", - "Supplemental Arrows-A", - "Braille Patterns", - "Supplemental Arrows-B", - "Miscellaneous Mathematical Symbols-B", - "Supplemental Mathematical Operators", - "Miscellaneous Symbols and Arrows", - "Glagolitic", - "Latin Extended-C", - "Coptic", - "Georgian Supplement", - "Tifinagh", - "Ethiopic Extended", - "Cyrillic Extended-A", - "Supplemental Punctuation", - "CJK Radicals Supplement", - "Kangxi Radicals", - "Ideographic Description Characters", - "CJK Symbols and Punctuation", - "Hiragana", - "Katakana", - "Bopomofo", - "Hangul Compatibility Jamo", - "Kanbun", - "Bopomofo Extended", - "CJK Strokes", - "Katakana Phonetic Extensions", - "Enclosed CJK Letters and Months", - "CJK Compatibility", - "CJK Unified Ideographs Extension A", - "Yijing Hexagram Symbols", - "CJK Unified Ideographs", - "Yi Syllables", - "Yi Radicals", - "Vai", - "Cyrillic Extended-B", - "Modifier Tone Letters", - "Latin Extended-D", - "Syloti Nagri", - "Phags-pa", - "Saurashtra", - "Kayah Li", - "Rejang", - "Cham", - "Hangul Syllables", - "High Surrogates", - "High Private Use Surrogates", - "Low Surrogates", - "Private Use Area", - "CJK Compatibility Ideographs", - "Alphabetic Presentation Forms", - "Arabic Presentation Forms-A", - "Variation Selectors", - "Vertical Forms", - "Combining Half Marks", - "CJK Compatibility Forms", - "Small Form Variants", - "Arabic Presentation Forms-B", - "Halfwidth and Fullwidth Forms", - "Specials", - "Linear B Syllabary", - "Linear B Ideograms", - "Aegean Numbers", - "Ancient Greek Numbers", - "Ancient Symbols", - "Phaistos Disc", - "Lycian", - "Carian", - "Old Italic", - "Gothic", - "Ugaritic", - "Old Persian", - "Deseret", - "Shavian", - "Osmanya", - "Cypriot Syllabary", - "Phoenician", - "Lydian", - "Kharoshthi", - "Cuneiform", - "Cuneiform Numbers and Punctuation", - "Byzantine Musical Symbols", - "Musical Symbols", - "Ancient Greek Musical Notation", - "Tai Xuan Jing Symbols", - "Counting Rod Numerals", - "Mathematical Alphanumeric Symbols", - "Mahjong Tiles", - "Domino Tiles", - "CJK Unified Ideographs Extension B", - "CJK Compatibility Ideographs Supplement", - "Tags", - "Variation Selectors Supplement", - "Supplementary Private Use Area-A", - "Supplementary Private Use Area-B", - "Custom...", - }; + private static final int[][] UNICODE_RANGES = getUnicodeRanges(); + private static final String[] UNICODE_RANGE_NAMES = getUnicodeRangeNames(); private boolean useCustomRange = false; private int[] customRange = { 0x0000, 0x007f }; @@ -536,4 +189,61 @@ public final class RangeMenu extends JComboBox implements ActionListener { customRangeDialog.hide(); } } + + private static int[][] getUnicodeRanges() { + List ranges = new ArrayList<>(); + ranges.add(0); + Character.UnicodeBlock currentBlock = Character.UnicodeBlock.of(0); + for (int cp = 0x000001; cp < 0x110000; cp++ ) { + Character.UnicodeBlock ub = Character.UnicodeBlock.of(cp); + if (currentBlock == null) { + if (ub != null) { + ranges.add(cp); + currentBlock = ub; + } + } else { // being in some unicode range + if (ub == null) { + ranges.add(cp - 1); + currentBlock = null; + } else if (cp == 0x10ffff) { // end of last block + ranges.add(cp); + } else if (! ub.equals(currentBlock)) { + ranges.add(cp - 1); + ranges.add(cp); + currentBlock = ub; + } + } + } + ranges.add(0x00); // for user defined range. + ranges.add(0x7f); // for user defined range. + + int[][] returnval = new int[ranges.size() / 2][2]; + for (int i = 0 ; i < ranges.size() / 2 ; i++ ) { + returnval[i][0] = ranges.get(2*i); + returnval[i][1] = ranges.get(2*i + 1); + } + return returnval; + } + + private static String[] getUnicodeRangeNames() { + String[] names = new String[UNICODE_RANGES.length]; + for (int i = 0 ; i < names.length ; i++ ) { + names[i] = titleCase( + Character.UnicodeBlock.of(UNICODE_RANGES[i][0]).toString()); + } + names[names.length - 1] = "Custom..."; + return names; + } + + private static String titleCase(String str) { + str = str.replaceAll("_", " "); + Pattern p = Pattern.compile("(^|\\W)([a-z])"); + Matcher m = p.matcher(str.toLowerCase(Locale.ROOT)); + StringBuffer sb = new StringBuffer(); + while (m.find()) { + m.appendReplacement(sb, m.group(1) + m.group(2).toUpperCase(Locale.ROOT)); + } + m.appendTail(sb); + return sb.toString().replace("Cjk", "CJK").replace("Nko", "NKo"); + } } From fd8aac2f3c07611b2f5712a1978232d88f02b572 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Wed, 30 Mar 2011 07:47:19 -0700 Subject: [PATCH 088/168] 7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue Reviewed-by: kvn, dcubed --- .../hotspot/jdi/ClassObjectReferenceImpl.java | 6 +- .../sun/jvm/hotspot/oops/Instance.java | 4 +- .../sun/jvm/hotspot/oops/InstanceKlass.java | 23 +++++- .../jvm/hotspot/oops/InstanceMirrorKlass.java | 67 ++++++++++++++++ .../sun/jvm/hotspot/oops/ObjectHeap.java | 13 +++- .../classes/sun/jvm/hotspot/oops/Oop.java | 10 +-- .../sun/jvm/hotspot/oops/OopUtilities.java | 24 ------ .../sun/jvm/hotspot/oops/java_lang_Class.java | 77 +++++++++++++++++++ .../classes/sun/jvm/hotspot/runtime/VM.java | 28 ++++--- .../sun/jvm/hotspot/tools/FinalizerInfo.java | 18 ++--- .../jvm/hotspot/utilities/HeapGXLWriter.java | 4 +- .../hotspot/utilities/HeapHprofBinWriter.java | 2 +- .../utilities/ReversePtrsAnalysis.java | 9 +-- .../utilities/soql/JSJavaFactoryImpl.java | 4 +- .../src/share/vm/oops/instanceMirrorKlass.hpp | 2 + hotspot/src/share/vm/runtime/vmStructs.cpp | 2 + 16 files changed, 219 insertions(+), 74 deletions(-) create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java index 469765d73be..41d926aec77 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -27,7 +27,7 @@ package sun.jvm.hotspot.jdi; import com.sun.jdi.*; import sun.jvm.hotspot.oops.Instance; import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.OopUtilities; +import sun.jvm.hotspot.oops.java_lang_Class; public class ClassObjectReferenceImpl extends ObjectReferenceImpl implements ClassObjectReference { @@ -39,7 +39,7 @@ public class ClassObjectReferenceImpl extends ObjectReferenceImpl public ReferenceType reflectedType() { if (reflectedType == null) { - Klass k = OopUtilities.classOopToKlass(ref()); + Klass k = java_lang_Class.asKlass(ref()); reflectedType = vm.referenceType(k); } return reflectedType; diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java index 3555285fefc..09c27f0fee0 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -64,7 +64,7 @@ public class Instance extends Oop { public void iterateFields(OopVisitor visitor, boolean doVMFields) { super.iterateFields(visitor, doVMFields); - ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor); + ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor, this); } public void printValueOn(PrintStream tty) { diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index c2756bb9e79..b1d6741ce63 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -241,6 +241,10 @@ public class InstanceKlass extends Klass { // Byteside of the header private static long headerSize; + public long getObjectSize(Oop object) { + return getSizeHelper() * VM.getVM().getAddressSize(); + } + public static long getHeaderSize() { return headerSize; } // Accessors for declared fields @@ -459,7 +463,22 @@ public class InstanceKlass extends Klass { visitor.doCInt(vtableLen, true); visitor.doCInt(itableLen, true); } + } + /* + * Visit the static fields of this InstanceKlass with the obj of + * the visitor set to the oop holding the fields, which is + * currently the java mirror. + */ + public void iterateStaticFields(OopVisitor visitor) { + visitor.setObj(getJavaMirror()); + visitor.prologue(); + iterateStaticFieldsInternal(visitor); + visitor.epilogue(); + + } + + void iterateStaticFieldsInternal(OopVisitor visitor) { TypeArray fields = getFields(); int length = (int) fields.getLength(); for (int index = 0; index < length; index += NEXT_OFFSET) { @@ -477,9 +496,9 @@ public class InstanceKlass extends Klass { return getSuper(); } - public void iterateNonStaticFields(OopVisitor visitor) { + public void iterateNonStaticFields(OopVisitor visitor, Oop obj) { if (getSuper() != null) { - ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor); + ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj); } TypeArray fields = getFields(); diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java new file mode 100644 index 00000000000..53191c885f5 --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.memory.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// An InstanceKlass is the VM level representation of a Java class. + +public class InstanceMirrorKlass extends InstanceKlass { + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { + // Just make sure it's there for now + Type type = db.lookupType("instanceMirrorKlass"); + } + + InstanceMirrorKlass(OopHandle handle, ObjectHeap heap) { + super(handle, heap); + } + + public long getObjectSize(Oop o) { + return java_lang_Class.getOopSize(o) * VM.getVM().getAddressSize(); + } + + public void iterateNonStaticFields(OopVisitor visitor, Oop obj) { + super.iterateNonStaticFields(visitor, obj); + // Fetch the real klass from the mirror object + Klass klass = java_lang_Class.asKlass(obj); + if (klass instanceof InstanceKlass) { + ((InstanceKlass)klass).iterateStaticFields(visitor); + } + } +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java index 08aa0143c8e..749c49d1b91 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -362,7 +362,16 @@ public class ObjectHeap { if (klass.equals(compiledICHolderKlassHandle)) return new CompiledICHolder(handle, this); if (klass.equals(methodDataKlassHandle)) return new MethodData(handle, this); } - if (klass.equals(instanceKlassKlassHandle)) return new InstanceKlass(handle, this); + if (klass.equals(instanceKlassKlassHandle)) { + InstanceKlass ik = new InstanceKlass(handle, this); + if (ik.getName().asString().equals("java/lang/Class")) { + // We would normally do this using the vtable style + // lookup but since it's not used for these currently + // it's simpler to just check for the name. + return new InstanceMirrorKlass(handle, this); + } + return ik; + } if (klass.equals(objArrayKlassKlassHandle)) return new ObjArrayKlass(handle, this); if (klass.equals(typeArrayKlassKlassHandle)) return new TypeArrayKlass(handle, this); diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java index 0e7e6fcce01..283e32d6619 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -103,12 +103,8 @@ public class Oop { // Returns the byte size of this object public long getObjectSize() { Klass k = getKlass(); - if (k instanceof InstanceKlass) { - return ((InstanceKlass)k).getSizeHelper() - * VM.getVM().getAddressSize(); - } - // If it is not an instance, this method should be replaced. - return getHeaderSize(); + // All other types should be overriding getObjectSize directly + return ((InstanceKlass)k).getObjectSize(this); } // Type test operations diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java index a51b9e9fc47..e6887b12b1a 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java @@ -74,9 +74,6 @@ public class OopUtilities implements /* imports */ JVMTIThreadState { private static int THREAD_STATUS_TERMINATED; */ - // java.lang.Class fields - private static OopField hcKlassField; - // java.util.concurrent.locks.AbstractOwnableSynchronizer fields private static OopField absOwnSyncOwnerThreadField; @@ -268,27 +265,6 @@ public class OopUtilities implements /* imports */ JVMTIThreadState { return null; } - // initialize fields for java.lang.Class - private static void initClassFields() { - if (hcKlassField == null) { - // hc_klass is a HotSpot magic field and hence we can't - // find it from InstanceKlass for java.lang.Class. - TypeDataBase db = VM.getVM().getTypeDataBase(); - int hcKlassOffset = (int) db.lookupType("java_lang_Class").getCIntegerField("klass_offset").getValue(); - if (VM.getVM().isCompressedOopsEnabled()) { - hcKlassField = new NarrowOopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true); - } else { - hcKlassField = new OopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true); - } - } - } - - /** get klassOop field at offset hc_klass_offset from a java.lang.Class object */ - public static Klass classOopToKlass(Oop aClass) { - initClassFields(); - return (Klass) hcKlassField.getValue(aClass); - } - // initialize fields for j.u.c.l AbstractOwnableSynchornizer class private static void initAbsOwnSyncFields() { if (absOwnSyncOwnerThreadField == null) { diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java new file mode 100644 index 00000000000..b91eab3655a --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package sun.jvm.hotspot.oops; + +import java.util.*; + +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.memory.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.Type; +import sun.jvm.hotspot.types.TypeDataBase; +import sun.jvm.hotspot.utilities.*; +import sun.jvm.hotspot.jdi.JVMTIThreadState; + +/** A utility class encapsulating useful oop operations */ + +// initialize fields for java.lang.Class +public class java_lang_Class { + + // java.lang.Class fields + static OopField klassField; + static IntField oopSizeField; + + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static synchronized void initialize(TypeDataBase db) { + // klass and oop_size are HotSpot magic fields and hence we can't + // find them from InstanceKlass for java.lang.Class. + Type jlc = db.lookupType("java_lang_Class"); + int klassOffset = (int) jlc.getCIntegerField("klass_offset").getValue(); + if (VM.getVM().isCompressedOopsEnabled()) { + klassField = new NarrowOopField(new NamedFieldIdentifier("klass"), klassOffset, true); + } else { + klassField = new OopField(new NamedFieldIdentifier("klass"), klassOffset, true); + } + int oopSizeOffset = (int) jlc.getCIntegerField("oop_size_offset").getValue(); + oopSizeField = new IntField(new NamedFieldIdentifier("oop_size"), oopSizeOffset, true); + } + + /** get klassOop field at offset hc_klass_offset from a java.lang.Class object */ + public static Klass asKlass(Oop aClass) { + return (Klass) java_lang_Class.klassField.getValue(aClass); + } + + /** get oop_size field at offset oop_size_offset from a java.lang.Class object */ + public static long getOopSize(Oop aClass) { + return java_lang_Class.oopSizeField.getValue(aClass); + } +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java index 23b4ab9da5b..4d333baa9a6 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java @@ -839,20 +839,18 @@ public class VM { } private void readSystemProperties() { - final InstanceKlass systemKls = getSystemDictionary().getSystemKlass(); - systemKls.iterate(new DefaultOopVisitor() { - ObjectReader objReader = new ObjectReader(); - public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) { - if (field.getID().getName().equals("props")) { - try { - sysProps = (Properties) objReader.readObject(field.getValue(systemKls.getJavaMirror())); - } catch (Exception e) { - if (Assert.ASSERTS_ENABLED) { - e.printStackTrace(); - } - } - } - } - }, false); + final InstanceKlass systemKls = getSystemDictionary().getSystemKlass(); + systemKls.iterateStaticFields(new DefaultOopVisitor() { + ObjectReader objReader = new ObjectReader(); + public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) { + if (field.getID().getName().equals("props")) { + try { + sysProps = (Properties) objReader.readObject(field.getValue(getObj())); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }); } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java index ab81e8cfc1e..79e6784a63e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 @@ -64,16 +64,16 @@ public class FinalizerInfo extends Tool { */ InstanceKlass ik = SystemDictionaryHelper.findInstanceKlass("java.lang.ref.Finalizer"); - final OopField queueField[] = new OopField[1]; - ik.iterateFields(new DefaultOopVisitor() { + final Oop[] queueref = new Oop[1]; + ik.iterateStaticFields(new DefaultOopVisitor() { public void doOop(OopField field, boolean isVMField) { - String name = field.getID().getName(); - if (name.equals("queue")) { - queueField[0] = field; - } + String name = field.getID().getName(); + if (name.equals("queue")) { + queueref[0] = field.getValue(getObj()); + } } - }, false); - Oop queue = queueField[0].getValue(ik); + }); + Oop queue = queueref[0]; InstanceKlass k = (InstanceKlass) queue.getKlass(); diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java index 982a21192e2..5f5d17d3901 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 @@ -164,7 +164,7 @@ public class HeapGXLWriter extends AbstractHeapGraphWriter { protected void writeClass(Instance instance) throws IOException { writeObjectHeader(instance); - Klass reflectedType = OopUtilities.classOopToKlass(instance); + Klass reflectedType = java_lang_Class.asKlass(instance); boolean isInstanceKlass = (reflectedType instanceof InstanceKlass); // reflectedType is null for primitive types (int.class etc). if (reflectedType != null) { diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java index f1e9c5dd95f..68e5d1ba36f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java @@ -455,7 +455,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter { } protected void writeClass(Instance instance) throws IOException { - Klass reflectedKlass = OopUtilities.classOopToKlass(instance); + Klass reflectedKlass = java_lang_Class.asKlass(instance); // dump instance record only for primitive type Class objects. // all other Class objects are covered by writeClassDumpRecords. if (reflectedKlass == null) { diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java index 3c34eaf3fcd..26eca405dba 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -117,10 +117,10 @@ public class ReversePtrsAnalysis { public boolean doObj(Oop obj) { if (obj instanceof InstanceKlass) { final InstanceKlass ik = (InstanceKlass) obj; - ik.iterateFields( + ik.iterateStaticFields( new DefaultOopVisitor() { public void doOop(OopField field, boolean isVMField) { - Oop next = field.getValue(ik); + Oop next = field.getValue(getObj()); LivenessPathElement lp = new LivenessPathElement(null, new NamedFieldIdentifier("Static field \"" + field.getID().getName() + @@ -142,8 +142,7 @@ public class ReversePtrsAnalysis { System.err.println(); } } - }, - false); + }); } return false; } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java index 80614f09a3f..d91379136bd 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 @@ -158,7 +158,7 @@ public class JSJavaFactoryImpl implements JSJavaFactory { } else if (className.equals(javaLangThread())) { res = new JSJavaThread(instance, this); } else if (className.equals(javaLangClass())) { - Klass reflectedType = OopUtilities.classOopToKlass(instance); + Klass reflectedType = java_lang_Class.asKlass(instance); if (reflectedType != null) { JSJavaKlass jk = newJSJavaKlass(reflectedType); // we don't support mirrors of VM internal Klasses diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp index 0556dc5abd4..2b8b2f460c4 100644 --- a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp @@ -36,6 +36,8 @@ class instanceMirrorKlass: public instanceKlass { + friend class VMStructs; + private: static int _offset_of_static_fields; diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 2d5cd6dcf66..9f577dd9bbe 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -70,6 +70,7 @@ #include "oops/cpCacheKlass.hpp" #include "oops/cpCacheOop.hpp" #include "oops/instanceKlass.hpp" +#include "oops/instanceMirrorKlass.hpp" #include "oops/instanceKlassKlass.hpp" #include "oops/instanceOop.hpp" #include "oops/klass.hpp" @@ -1101,6 +1102,7 @@ static inline uint64_t cast_uint64_t(size_t x) declare_type(instanceKlass, Klass) \ declare_type(instanceKlassKlass, klassKlass) \ declare_type(instanceOopDesc, oopDesc) \ + declare_type(instanceMirrorKlass, instanceKlass) \ declare_type(instanceRefKlass, instanceKlass) \ declare_type(klassKlass, Klass) \ declare_type(klassOopDesc, oopDesc) \ From ea2862f2869763d6b107ab6771be41b22ada940a Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Wed, 30 Mar 2011 08:52:37 -0700 Subject: [PATCH 089/168] 7027687: /applets/NervousText demo needs to be improved Reviewed-by: alexp --- .../demo/applets/NervousText/NervousText.java | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/jdk/src/share/demo/applets/NervousText/NervousText.java b/jdk/src/share/demo/applets/NervousText/NervousText.java index e36b61ddb85..c3d8d0889e0 100644 --- a/jdk/src/share/demo/applets/NervousText/NervousText.java +++ b/jdk/src/share/demo/applets/NervousText/NervousText.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,37 +29,37 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ -import java.awt.event.*; import java.awt.Graphics; import java.awt.Font; import java.applet.Applet; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + /** * An applet that displays jittering text on the screen. * * @author Daniel Wyszynski 04/12/95 - * @modified 05/09/95 kwalrath Changed string; added thread suspension - * @modified 02/06/98 madbot removed use of suspend and resume and cleaned up + * @author 05/09/95 kwalrath Changed string; added thread suspension + * @author 02/06/98 madbot removed use of suspend and resume and cleaned up */ - +@SuppressWarnings("serial") public class NervousText extends Applet implements Runnable, MouseListener { + String banner; // The text to be displayed char bannerChars[]; // The same text as an array of characters char attributes[]; // Character attributes ('^' for superscript) Thread runner = null; // The thread that is displaying the text boolean threadSuspended; // True when thread suspended (via mouse click) - static final int REGULAR_WD = 15; static final int REGULAR_HT = 36; static final int SMALL_WD = 12; static final int SMALL_HT = 24; - Font regularFont = new Font("Serif", Font.BOLD, REGULAR_HT); Font smallFont = new Font("Serif", Font.BOLD, SMALL_HT); + @Override public void init() { banner = getParameter("text"); if (banner == null) { @@ -67,8 +67,8 @@ public class NervousText extends Applet implements Runnable, MouseListener { } int bannerLength = banner.length(); - StringBuffer bc = new StringBuffer(bannerLength); - StringBuffer attrs = new StringBuffer(bannerLength); + StringBuilder bc = new StringBuilder(bannerLength); + StringBuilder attrs = new StringBuilder(bannerLength); int wd = 0; for (int i = 0; i < bannerLength; i++) { char c = banner.charAt(i); @@ -89,7 +89,7 @@ public class NervousText extends Applet implements Runnable, MouseListener { } bannerLength = bc.length(); - bannerChars = new char[bannerLength]; + bannerChars = new char[bannerLength]; attributes = new char[bannerLength]; bc.getChars(0, bannerLength, bannerChars, 0); attrs.getChars(0, bannerLength, attributes, 0); @@ -99,15 +99,18 @@ public class NervousText extends Applet implements Runnable, MouseListener { addMouseListener(this); } + @Override public void destroy() { removeMouseListener(this); } + @Override public void start() { runner = new Thread(this); runner.start(); } + @Override public synchronized void stop() { runner = null; if (threadSuspended) { @@ -116,22 +119,24 @@ public class NervousText extends Applet implements Runnable, MouseListener { } } + @Override public void run() { Thread me = Thread.currentThread(); while (runner == me) { try { Thread.sleep(100); - synchronized(this) { + synchronized (this) { while (threadSuspended) { wait(); } } - } catch (InterruptedException e){ + } catch (InterruptedException e) { } repaint(); } } + @Override public void paint(Graphics g) { int length = bannerChars.length; for (int i = 0, x = 0; i < length; i++) { @@ -152,33 +157,41 @@ public class NervousText extends Applet implements Runnable, MouseListener { } } + @Override public synchronized void mousePressed(MouseEvent e) { e.consume(); threadSuspended = !threadSuspended; - if (!threadSuspended) + if (!threadSuspended) { notify(); + } } + @Override public void mouseReleased(MouseEvent e) { } + @Override public void mouseEntered(MouseEvent e) { } + @Override public void mouseExited(MouseEvent e) { } + @Override public void mouseClicked(MouseEvent e) { } + @Override public String getAppletInfo() { - return "Title: NervousText\nAuthor: Daniel Wyszynski\nDisplays a text banner that jitters."; + return "Title: NervousText\nAuthor: Daniel Wyszynski\n" + + "Displays a text banner that jitters."; } + @Override public String[][] getParameterInfo() { String pinfo[][] = { - {"text", "string", "Text to display"}, - }; + { "text", "string", "Text to display" }, }; return pinfo; } } From 5064de7c28828d7fc7538eef8e9bfa7526de9885 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Wed, 30 Mar 2011 08:54:08 -0700 Subject: [PATCH 090/168] 7027690: /applets/SpreadSheet demo needs to be improved Reviewed-by: alexp --- .../demo/applets/SpreadSheet/SpreadSheet.java | 751 +++++++++--------- 1 file changed, 388 insertions(+), 363 deletions(-) diff --git a/jdk/src/share/demo/applets/SpreadSheet/SpreadSheet.java b/jdk/src/share/demo/applets/SpreadSheet/SpreadSheet.java index 6f0c664465b..d221e342def 100644 --- a/jdk/src/share/demo/applets/SpreadSheet/SpreadSheet.java +++ b/jdk/src/share/demo/applets/SpreadSheet/SpreadSheet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,39 +29,38 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.io.*; -import java.lang.*; import java.net.*; -public class SpreadSheet - extends Applet - implements MouseListener, KeyListener { - String title; - Font titleFont; - Color cellColor; - Color inputColor; - int cellWidth = 100; - int cellHeight = 15; - int titleHeight = 15; - int rowLabelWidth = 15; - Font inputFont; - boolean isStopped = false; - boolean fullUpdate = true; - int rows; - int columns; - int currentKey = -1; - int selectedRow = -1; - int selectedColumn = -1; - SpreadSheetInput inputArea; - Cell cells[][]; - Cell current = null; +@SuppressWarnings("serial") +public class SpreadSheet extends Applet implements MouseListener, KeyListener { + + String title; + Font titleFont; + Color cellColor; + Color inputColor; + int cellWidth = 100; + int cellHeight = 15; + int titleHeight = 15; + int rowLabelWidth = 15; + Font inputFont; + boolean isStopped = false; + boolean fullUpdate = true; + int rows; + int columns; + int currentKey = -1; + int selectedRow = -1; + int selectedColumn = -1; + SpreadSheetInput inputArea; + Cell cells[][]; + Cell current = null; + + @Override public synchronized void init() { String rs; @@ -87,17 +86,17 @@ public class SpreadSheet } cells = new Cell[rows][columns]; char l[] = new char[1]; - for (int i=0; i < rows; i++) { - for (int j=0; j < columns; j++) { + for (int i = 0; i < rows; i++) { + for (int j = 0; j < columns; j++) { cells[i][j] = new Cell(this, - Color.lightGray, - Color.black, - cellColor, - cellWidth - 2, - cellHeight - 2); - l[0] = (char)((int)'a' + j); - rs = getParameter("" + new String(l) + (i+1)); + Color.lightGray, + Color.black, + cellColor, + cellWidth - 2, + cellHeight - 2); + l[0] = (char) ((int) 'a' + j); + rs = getParameter("" + new String(l) + (i + 1)); if (rs != null) { cells[i][j].setUnparsedValue(rs); } @@ -106,9 +105,9 @@ public class SpreadSheet Dimension d = getSize(); inputArea = new SpreadSheetInput(null, this, d.width - 2, cellHeight - 1, - inputColor, Color.white); + inputColor, Color.white); resize(columns * cellWidth + rowLabelWidth, - (rows + 3) * cellHeight + titleHeight); + (rows + 3) * cellHeight + titleHeight); addMouseListener(this); addKeyListener(this); } @@ -121,19 +120,22 @@ public class SpreadSheet repaint(); } + @Override public void stop() { isStopped = true; } + @Override public void start() { isStopped = false; } + @Override public void destroy() { - for (int i=0; i < rows; i++) { - for (int j=0; j < columns; j++) { + for (int i = 0; i < rows; i++) { + for (int j = 0; j < columns; j++) { if (cells[i][j].type == Cell.URL) { - cells[i][j].updaterThread.stop(); + cells[i][j].updaterThread.run = false; } } } @@ -147,16 +149,17 @@ public class SpreadSheet repaint(); } + @Override public void update(Graphics g) { - if (! fullUpdate) { + if (!fullUpdate) { int cx, cy; g.setFont(titleFont); - for (int i=0; i < rows; i++) { - for (int j=0; j < columns; j++) { + for (int i = 0; i < rows; i++) { + for (int j = 0; j < columns; j++) { if (cells[i][j].needRedisplay) { cx = (j * cellWidth) + 2 + rowLabelWidth; - cy = ((i+1) * cellHeight) + 2 + titleHeight; + cy = ((i + 1) * cellHeight) + 2 + titleHeight; cells[i][j].paint(g, cx, cy); } } @@ -168,13 +171,14 @@ public class SpreadSheet } public void recalculate() { - int i,j; + int i, j; //System.out.println("SpreadSheet.recalculate"); - for (i=0; i < rows; i++) { - for (j=0; j < columns; j++) { + for (i = 0; i < rows; i++) { + for (j = 0; j < columns; j++) { if (cells[i][j] != null && cells[i][j].type == Cell.FORMULA) { - cells[i][j].setRawValue(evaluateFormula(cells[i][j].parseRoot)); + cells[i][j].setRawValue(evaluateFormula( + cells[i][j].parseRoot)); cells[i][j].needRedisplay = true; } } @@ -182,8 +186,8 @@ public class SpreadSheet repaint(); } - public float evaluateFormula(Node n) { - float val = 0.0f; + float evaluateFormula(Node n) { + float val = 0.0f; //System.out.println("evaluateFormula:"); //n.print(3); @@ -192,43 +196,40 @@ public class SpreadSheet return val; } switch (n.type) { - case Node.OP: - val = evaluateFormula(n.left); - switch (n.op) { - case '+': - val += evaluateFormula(n.right); + case Node.OP: + val = evaluateFormula(n.left); + switch (n.op) { + case '+': + val += evaluateFormula(n.right); + break; + case '*': + val *= evaluateFormula(n.right); + break; + case '-': + val -= evaluateFormula(n.right); + break; + case '/': + val /= evaluateFormula(n.right); + break; + } break; - case '*': - val *= evaluateFormula(n.right); - break; - case '-': - val -= evaluateFormula(n.right); - break; - case '/': - val /= evaluateFormula(n.right); - break; - } - break; - case Node.VALUE: - //System.out.println("=>" + n.value); - return n.value; - case Node.CELL: - if (n == null) { - //System.out.println("NULL at 192"); - } else { + case Node.VALUE: + //System.out.println("=>" + n.value); + return n.value; + case Node.CELL: if (cells[n.row][n.column] == null) { //System.out.println("NULL at 193"); } else { //System.out.println("=>" + cells[n.row][n.column].value); return cells[n.row][n.column].value; } - } } //System.out.println("=>" + val); return val; } + @Override public synchronized void paint(Graphics g) { int i, j; int cx, cy; @@ -240,40 +241,40 @@ public class SpreadSheet g.setFont(titleFont); i = g.getFontMetrics().stringWidth(title); g.drawString((title == null) ? "Spreadsheet" : title, - (d.width - i) / 2, 12); + (d.width - i) / 2, 12); g.setColor(inputColor); g.fillRect(0, cellHeight, d.width, cellHeight); g.setFont(titleFont); - for (i=0; i < rows+1; i++) { - cy = (i+2) * cellHeight; + for (i = 0; i < rows + 1; i++) { + cy = (i + 2) * cellHeight; g.setColor(getBackground()); g.draw3DRect(0, cy, d.width, 2, true); if (i < rows) { g.setColor(Color.red); - g.drawString("" + (i+1), 2, cy + 12); + g.drawString("" + (i + 1), 2, cy + 12); } } g.setColor(Color.red); - cy = (rows+3) * cellHeight + (cellHeight / 2); - for (i=0; i < columns; i++) { + cy = (rows + 3) * cellHeight + (cellHeight / 2); + for (i = 0; i < columns; i++) { cx = i * cellWidth; g.setColor(getBackground()); g.draw3DRect(cx + rowLabelWidth, - 2 * cellHeight, 1, d.height, true); + 2 * cellHeight, 1, d.height, true); if (i < columns) { g.setColor(Color.red); - l[0] = (char)((int)'A' + i); + l[0] = (char) ((int) 'A' + i); g.drawString(new String(l), - cx + rowLabelWidth + (cellWidth / 2), - cy); + cx + rowLabelWidth + (cellWidth / 2), + cy); } } - for (i=0; i < rows; i++) { - for (j=0; j < columns; j++) { + for (i = 0; i < rows; i++) { + for (j = 0; j < columns; j++) { cx = (j * cellWidth) + 2 + rowLabelWidth; - cy = ((i+1) * cellHeight) + 2 + titleHeight; + cy = ((i + 1) * cellHeight) + 2 + titleHeight; if (cells[i][j] != null) { cells[i][j].paint(g, cx, cy); } @@ -282,141 +283,152 @@ public class SpreadSheet g.setColor(getBackground()); g.draw3DRect(0, titleHeight, - d.width, - d.height - titleHeight, - false); + d.width, + d.height - titleHeight, + false); inputArea.paint(g, 1, titleHeight + 1); } - //1.1 event handling - - public void mouseClicked(MouseEvent e) - {} - - public void mousePressed(MouseEvent e) - { - int x = e.getX(); - int y = e.getY(); - Cell cell; - if (y < (titleHeight + cellHeight)) { - selectedRow = -1; - if (y <= titleHeight && current != null) { - current.deselect(); - current = null; - } - e.consume(); + //1.1 event handling + @Override + public void mouseClicked(MouseEvent e) { } - if (x < rowLabelWidth) { - selectedRow = -1; - if (current != null) { - current.deselect(); + + @Override + public void mousePressed(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + Cell cell; + if (y < (titleHeight + cellHeight)) { + selectedRow = -1; + if (y <= titleHeight && current != null) { + current.deselect(); current = null; - } - e.consume(); + } + e.consume(); + } + if (x < rowLabelWidth) { + selectedRow = -1; + if (current != null) { + current.deselect(); + current = null; + } + e.consume(); + } + selectedRow = ((y - cellHeight - titleHeight) / cellHeight); + selectedColumn = (x - rowLabelWidth) / cellWidth; + if (selectedRow > rows + || selectedColumn >= columns) { + selectedRow = -1; + if (current != null) { + current.deselect(); + current = null; + } + } else { + if (selectedRow >= rows) { + selectedRow = -1; + if (current != null) { + current.deselect(); + current = null; + } + e.consume(); + } + if (selectedRow != -1) { + cell = cells[selectedRow][selectedColumn]; + inputArea.setText(cell.getPrintString()); + if (current != null) { + current.deselect(); + } + current = cell; + current.select(); + requestFocus(); + fullUpdate = true; + repaint(); + } + e.consume(); + } } - selectedRow = ((y - cellHeight - titleHeight) / cellHeight); - selectedColumn = (x - rowLabelWidth) / cellWidth; - if (selectedRow > rows || - selectedColumn >= columns) { - selectedRow = -1; - if (current != null) { - current.deselect(); - current = null; - } - } else { - if (selectedRow >= rows) { - selectedRow = -1; - if (current != null) { - current.deselect(); - current = null; - } - e.consume(); - } - if (selectedRow != -1) { - cell = cells[selectedRow][selectedColumn]; - inputArea.setText(new String(cell.getPrintString())); - if (current != null) { - current.deselect(); - } - current = cell; - current.select(); - requestFocus(); + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyPressed(KeyEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { fullUpdate = true; - repaint(); - } - e.consume(); + inputArea.processKey(e); + e.consume(); } - } - public void mouseReleased(MouseEvent e) - {} - - public void mouseEntered(MouseEvent e) - {} - - public void mouseExited(MouseEvent e) - {} - - public void keyPressed(KeyEvent e) - { - } - - public void keyTyped(KeyEvent e) { - fullUpdate=true; - inputArea.processKey(e); - e.consume(); - } - - public void keyReleased(KeyEvent e) - {} - - public String getAppletInfo() { - return "Title: SpreadSheet \nAuthor: Sami Shaio \nA simple spread sheet."; - } - - public String[][] getParameterInfo() { - String[][] info = { - {"title", "string", "The title of the spread sheet. Default is 'Spreadsheet'"}, - {"rows", "int", "The number of rows. Default is 9."}, - {"columns", "int", "The number of columns. Default is 5."} - }; - return info; - } + @Override + public void keyReleased(KeyEvent e) { + } + @Override + public String getAppletInfo() { + return "Title: SpreadSheet \nAuthor: Sami Shaio \nA simple spread sheet."; + } + @Override + public String[][] getParameterInfo() { + String[][] info = { + { "title", "string", + "The title of the spread sheet. Default is 'Spreadsheet'" }, + { "rows", "int", "The number of rows. Default is 9." }, + { "columns", "int", "The number of columns. Default is 5." } + }; + return info; + } } + class CellUpdater extends Thread { - Cell target; + + Cell target; InputStream dataStream = null; StreamTokenizer tokenStream; + public volatile boolean run = true; public CellUpdater(Cell c) { super("cell updater"); target = c; } + @Override public void run() { try { dataStream = new URL(target.app.getDocumentBase(), - target.getValueString()).openStream(); - tokenStream = new StreamTokenizer(new BufferedReader(new InputStreamReader(dataStream))); + target.getValueString()).openStream(); + tokenStream = new StreamTokenizer(new BufferedReader( + new InputStreamReader(dataStream))); tokenStream.eolIsSignificant(false); - while (true) { + while (run) { switch (tokenStream.nextToken()) { - case StreamTokenizer.TT_EOF: - dataStream.close(); - return; - default: - break; - case StreamTokenizer.TT_NUMBER: - target.setTransientValue((float)tokenStream.nval); - if (! target.app.isStopped && ! target.paused) { - target.app.repaint(); - } - break; + case StreamTokenizer.TT_EOF: + dataStream.close(); + return; + default: + break; + case StreamTokenizer.TT_NUMBER: + target.setTransientValue((float) tokenStream.nval); + if (!target.app.isStopped && !target.paused) { + target.app.repaint(); + } + break; } try { Thread.sleep(2000); @@ -430,35 +442,36 @@ class CellUpdater extends Thread { } } + class Cell { + public static final int VALUE = 0; public static final int LABEL = 1; - public static final int URL = 2; + public static final int URL = 2; public static final int FORMULA = 3; - - Node parseRoot; - boolean needRedisplay; + Node parseRoot; + boolean needRedisplay; boolean selected = false; boolean transientValue = false; - public int type = Cell.VALUE; - String valueString = ""; - String printString = "v"; - float value; - Color bgColor; - Color fgColor; - Color highlightColor; - int width; - int height; + public int type = Cell.VALUE; + String valueString = ""; + String printString = "v"; + float value; + Color bgColor; + Color fgColor; + Color highlightColor; + int width; + int height; SpreadSheet app; CellUpdater updaterThread; - boolean paused = false; + boolean paused = false; public Cell(SpreadSheet app, - Color bgColor, - Color fgColor, - Color highlightColor, - int width, - int height) { + Color bgColor, + Color fgColor, + Color highlightColor, + int width, + int height) { this.app = app; this.bgColor = bgColor; this.fgColor = fgColor; @@ -472,6 +485,7 @@ class Cell { valueString = Float.toString(f); value = f; } + public void setValue(float f) { setRawValue(f); printString = "v" + valueString; @@ -490,18 +504,18 @@ class Cell { public void setUnparsedValue(String s) { switch (s.charAt(0)) { - case 'v': - setValue(Cell.VALUE, s.substring(1)); - break; - case 'f': - setValue(Cell.FORMULA, s.substring(1)); - break; - case 'l': - setValue(Cell.LABEL, s.substring(1)); - break; - case 'u': - setValue(Cell.URL, s.substring(1)); - break; + case 'v': + setValue(Cell.VALUE, s.substring(1)); + break; + case 'f': + setValue(Cell.FORMULA, s.substring(1)); + break; + case 'l': + setValue(Cell.LABEL, s.substring(1)); + break; + case 'u': + setValue(Cell.URL, s.substring(1)); + break; } } @@ -519,8 +533,6 @@ class Cell { public String parseFormula(String formula, Node node) { String subformula; String restFormula; - float value; - int length = formula.length(); Node left; Node right; char op; @@ -534,52 +546,53 @@ class Cell { //System.out.println("Parse succeeded"); return null; } - if (subformula == formula) { + if (subformula.equals(formula)) { //System.out.println("Parse failed"); return formula; } // parse an operator and then another value switch (op = subformula.charAt(0)) { - case 0: - //System.out.println("Parse succeeded"); - return null; - case ')': - //System.out.println("Returning subformula=" + subformula); - return subformula; - case '+': - case '*': - case '-': - case '/': - restFormula = subformula.substring(1); - subformula = parseValue(restFormula, right=new Node()); - //System.out.println("subformula(2) = " + subformula); - if (subformula != restFormula) { + case 0: //System.out.println("Parse succeeded"); - left = new Node(node); - node.left = left; - node.right = right; - node.op = op; - node.type = Node.OP; - //node.print(3); + return null; + case ')': + //System.out.println("Returning subformula=" + subformula); return subformula; - } else { - //System.out.println("Parse failed"); + case '+': + case '*': + case '-': + case '/': + restFormula = subformula.substring(1); + subformula = parseValue(restFormula, right = new Node()); + //System.out.println("subformula(2) = " + subformula); + if (subformula == null ? restFormula != null : !subformula. + equals(restFormula)) { + //System.out.println("Parse succeeded"); + left = new Node(node); + node.left = left; + node.right = right; + node.op = op; + node.type = Node.OP; + //node.print(3); + return subformula; + } else { + //System.out.println("Parse failed"); + return formula; + } + default: + //System.out.println("Parse failed (bad operator): " + subformula); return formula; - } - default: - //System.out.println("Parse failed (bad operator): " + subformula); - return formula; } } public String parseValue(String formula, Node node) { - char c = formula.charAt(0); - String subformula; - String restFormula; - float value; - int row; - int column; + char c = formula.charAt(0); + String subformula; + String restFormula; + float _value; + int row; + int column; //System.out.println("parseValue: " + formula); restFormula = formula; @@ -588,11 +601,11 @@ class Cell { restFormula = formula.substring(1); subformula = parseFormula(restFormula, node); //System.out.println("rest=(" + subformula + ")"); - if (subformula == null || - subformula.length() == restFormula.length()) { + if (subformula == null + || subformula.length() == restFormula.length()) { //System.out.println("Failed"); return formula; - } else if (! (subformula.charAt(0) == ')')) { + } else if (!(subformula.charAt(0) == ')')) { //System.out.println("Failed (missing parentheses)"); return formula; } @@ -601,31 +614,31 @@ class Cell { int i; //System.out.println("formula=" + formula); - for (i=0; i < formula.length(); i++) { + for (i = 0; i < formula.length(); i++) { c = formula.charAt(i); if ((c < '0' || c > '9') && c != '.') { break; } } try { - value = Float.valueOf(formula.substring(0, i)).floatValue(); + _value = Float.valueOf(formula.substring(0, i)).floatValue(); } catch (NumberFormatException e) { //System.out.println("Failed (number format error)"); return formula; } node.type = Node.VALUE; - node.value = value; + node.value = _value; //node.print(3); restFormula = formula.substring(i); //System.out.println("value= " + value + " i=" + i + - // " rest = " + restFormula); + // " rest = " + restFormula); return restFormula; } else if (c >= 'A' && c <= 'Z') { int i; column = c - 'A'; restFormula = formula.substring(1); - for (i=0; i < restFormula.length(); i++) { + for (i = 0; i < restFormula.length(); i++) { c = restFormula.charAt(i); if (c < '0' || c > '9') { break; @@ -650,33 +663,32 @@ class Cell { return restFormula; } - public void setValue(int type, String s) { paused = false; if (this.type == Cell.URL) { - updaterThread.stop(); + updaterThread.run = false; updaterThread = null; } - valueString = new String(s); + valueString = s; this.type = type; needRedisplay = true; switch (type) { - case Cell.VALUE: - setValue(Float.valueOf(s).floatValue()); - break; - case Cell.LABEL: - printString = "l" + valueString; - break; - case Cell.URL: - printString = "u" + valueString; - updaterThread = new CellUpdater(this); - updaterThread.start(); - break; - case Cell.FORMULA: - parseFormula(valueString, parseRoot = new Node()); - printString = "f" + valueString; - break; + case Cell.VALUE: + setValue(Float.valueOf(s).floatValue()); + break; + case Cell.LABEL: + printString = "l" + valueString; + break; + case Cell.URL: + printString = "u" + valueString; + updaterThread = new CellUpdater(this); + updaterThread.start(); + break; + case Cell.FORMULA: + parseFormula(valueString, parseRoot = new Node()); + printString = "f" + valueString; + break; } app.recalculate(); } @@ -693,12 +705,14 @@ class Cell { selected = true; paused = true; } + public void deselect() { selected = false; paused = false; needRedisplay = true; app.repaint(); } + public void paint(Graphics g, int x, int y) { if (selected) { g.setColor(highlightColor); @@ -708,23 +722,23 @@ class Cell { g.fillRect(x, y, width - 1, height); if (valueString != null) { switch (type) { - case Cell.VALUE: - case Cell.LABEL: - g.setColor(fgColor); - break; - case Cell.FORMULA: - g.setColor(Color.red); - break; - case Cell.URL: - g.setColor(Color.blue); - break; + case Cell.VALUE: + case Cell.LABEL: + g.setColor(fgColor); + break; + case Cell.FORMULA: + g.setColor(Color.red); + break; + case Cell.URL: + g.setColor(Color.blue); + break; } - if (transientValue){ + if (transientValue) { g.drawString("" + value, x, y + (height / 2) + 5); } else { if (valueString.length() > 14) { g.drawString(valueString.substring(0, 14), - x, y + (height / 2) + 5); + x, y + (height / 2) + 5); } else { g.drawString(valueString, x, y + (height / 2) + 5); } @@ -734,18 +748,19 @@ class Cell { } } + class Node { + public static final int OP = 0; public static final int VALUE = 1; public static final int CELL = 2; - - int type; - Node left; - Node right; - int row; - int column; - float value; - char op; + int type; + Node left; + Node right; + int row; + int column; + float value; + char op; public Node() { left = null; @@ -756,6 +771,7 @@ class Node { op = 0; type = Node.VALUE; } + public Node(Node n) { left = n.left; right = n.right; @@ -765,47 +781,51 @@ class Node { op = n.op; type = n.type; } + public void indent(int ind) { for (int i = 0; i < ind; i++) { System.out.print(" "); } } + public void print(int indentLevel) { char l[] = new char[1]; indent(indentLevel); System.out.println("NODE type=" + type); indent(indentLevel); switch (type) { - case Node.VALUE: - System.out.println(" value=" + value); - break; - case Node.CELL: - l[0] = (char)((int)'A' + column); - System.out.println(" cell=" + new String(l) + (row+1)); - break; - case Node.OP: - System.out.println(" op=" + op); - left.print(indentLevel + 3); - right.print(indentLevel + 3); - break; + case Node.VALUE: + System.out.println(" value=" + value); + break; + case Node.CELL: + l[0] = (char) ((int) 'A' + column); + System.out.println(" cell=" + new String(l) + (row + 1)); + break; + case Node.OP: + System.out.println(" op=" + op); + left.print(indentLevel + 3); + right.print(indentLevel + 3); + break; } } } + class InputField { - int maxchars = 50; - int cursorPos = 0; - Applet app; - String sval; - char buffer[]; - int nChars; - int width; - int height; - Color bgColor; - Color fgColor; + + int maxchars = 50; + int cursorPos = 0; + Applet app; + String sval; + char buffer[]; + int nChars; + int width; + int height; + Color bgColor; + Color fgColor; public InputField(String initValue, Applet app, int width, int height, - Color bgColor, Color fgColor) { + Color bgColor, Color fgColor) { this.width = width; this.height = height; this.bgColor = bgColor; @@ -823,7 +843,7 @@ class InputField { public void setText(String val) { int i; - for (i=0; i < maxchars; i++) { + for (i = 0; i < maxchars; i++) { buffer[i] = 0; } if (val == null) { @@ -876,47 +896,52 @@ class InputField { } } + class SpreadSheetInput - extends InputField { + extends InputField { - public SpreadSheetInput(String initValue, - SpreadSheet app, - int width, - int height, - Color bgColor, - Color fgColor) { - super(initValue, app, width, height, bgColor, fgColor); - } + public SpreadSheetInput(String initValue, + SpreadSheet app, + int width, + int height, + Color bgColor, + Color fgColor) { + super(initValue, app, width, height, bgColor, fgColor); + } + @Override public void selected() { float f; - sval = ("".equals(sval)) ? "v":sval; + sval = ("".equals(sval)) ? "v" : sval; switch (sval.charAt(0)) { - case 'v': - String s= sval.substring(1); - try { - int i; - for (i = 0; i < s.length(); i++) { - char c = s.charAt(i); - if (c < '0' || c > '9') - break; + case 'v': + String s = sval.substring(1); + try { + int i; + for (i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c < '0' || c > '9') { + break; + } + } + s = s.substring(0, i); + f = Float.valueOf(s).floatValue(); + ((SpreadSheet) app).setCurrentValue(f); + } catch (NumberFormatException e) { + System.out.println("Not a float: '" + s + "'"); } - s = s.substring(0, i); - f = Float.valueOf(s).floatValue(); - ((SpreadSheet)app).setCurrentValue(f); - } catch (NumberFormatException e) { - System.out.println("Not a float: '" + s + "'"); - } - break; - case 'l': - ((SpreadSheet)app).setCurrentValue(Cell.LABEL, sval.substring(1)); - break; - case 'u': - ((SpreadSheet)app).setCurrentValue(Cell.URL, sval.substring(1)); - break; - case 'f': - ((SpreadSheet)app).setCurrentValue(Cell.FORMULA, sval.substring(1)); - break; + break; + case 'l': + ((SpreadSheet) app).setCurrentValue(Cell.LABEL, + sval.substring(1)); + break; + case 'u': + ((SpreadSheet) app).setCurrentValue(Cell.URL, sval.substring(1)); + break; + case 'f': + ((SpreadSheet) app).setCurrentValue(Cell.FORMULA, + sval.substring(1)); + break; } } } From ab41c31673e582b2e98610595fadd67fafa3ee35 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Wed, 30 Mar 2011 08:58:02 -0700 Subject: [PATCH 091/168] 7027701: /jfc/TableExample demo needs to be improved Reviewed-by: alexp --- .../demo/jfc/TableExample/JDBCAdapter.java | 178 ++++++------ .../demo/jfc/TableExample/OldJTable.java | 53 ++-- .../demo/jfc/TableExample/TableExample.java | 186 +++++++----- .../demo/jfc/TableExample/TableExample2.java | 51 +++- .../demo/jfc/TableExample/TableExample3.java | 135 ++++++--- .../demo/jfc/TableExample/TableExample4.java | 152 ++++++---- .../share/demo/jfc/TableExample/TableMap.java | 25 +- .../demo/jfc/TableExample/TableSorter.java | 264 ++++++++---------- 8 files changed, 597 insertions(+), 447 deletions(-) diff --git a/jdk/src/share/demo/jfc/TableExample/JDBCAdapter.java b/jdk/src/share/demo/jfc/TableExample/JDBCAdapter.java index 9093e7cb59d..4dbfe420115 100644 --- a/jdk/src/share/demo/jfc/TableExample/JDBCAdapter.java +++ b/jdk/src/share/demo/jfc/TableExample/JDBCAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,46 +29,50 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; +import javax.swing.table.AbstractTableModel; + /** * An adaptor, transforming the JDBC interface to the TableModel interface. * * @author Philip Milne */ - -import java.util.Vector; -import java.sql.*; -import javax.swing.table.AbstractTableModel; -import javax.swing.event.TableModelEvent; - +@SuppressWarnings("serial") public class JDBCAdapter extends AbstractTableModel { - Connection connection; - Statement statement; - ResultSet resultSet; - String[] columnNames = {}; - Vector rows = new Vector(); - ResultSetMetaData metaData; + + Connection connection; + Statement statement; + ResultSet resultSet; + String[] columnNames = {}; + List> rows = new ArrayList>(); + ResultSetMetaData metaData; public JDBCAdapter(String url, String driverName, - String user, String passwd) { + String user, String passwd) { try { Class.forName(driverName); System.out.println("Opening db connection"); connection = DriverManager.getConnection(url, user, passwd); statement = connection.createStatement(); - } - catch (ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { System.err.println("Cannot find the database driver classes."); System.err.println(ex); - } - catch (SQLException ex) { + } catch (SQLException ex) { System.err.println("Cannot connect to this database."); System.err.println(ex); } - } + } public void executeQuery(String query) { if (connection == null || statement == null) { @@ -79,27 +83,28 @@ public class JDBCAdapter extends AbstractTableModel { resultSet = statement.executeQuery(query); metaData = resultSet.getMetaData(); - int numberOfColumns = metaData.getColumnCount(); + int numberOfColumns = metaData.getColumnCount(); columnNames = new String[numberOfColumns]; // Get the column names and cache them. // Then we can close the connection. - for(int column = 0; column < numberOfColumns; column++) { - columnNames[column] = metaData.getColumnLabel(column+1); + for (int column = 0; column < numberOfColumns; column++) { + columnNames[column] = metaData.getColumnLabel(column + 1); } // Get all rows. - rows = new Vector(); + rows = new ArrayList>(); while (resultSet.next()) { - Vector newRow = new Vector(); + List newRow = new ArrayList(); for (int i = 1; i <= getColumnCount(); i++) { - newRow.addElement(resultSet.getObject(i)); + newRow.add(resultSet.getObject(i)); } - rows.addElement(newRow); + rows.add(newRow); } // close(); Need to copy the metaData, bug in jdbc:odbc driver. - fireTableChanged(null); // Tell the listeners a new table has arrived. - } - catch (SQLException ex) { + + // Tell the listeners a new table has arrived. + fireTableChanged(null); + } catch (SQLException ex) { System.err.println(ex); } } @@ -111,6 +116,7 @@ public class JDBCAdapter extends AbstractTableModel { connection.close(); } + @Override protected void finalize() throws Throwable { close(); super.finalize(); @@ -121,9 +127,8 @@ public class JDBCAdapter extends AbstractTableModel { // Implementation of the TableModel Interface // ////////////////////////////////////////////////////////////////////////// - // MetaData - + @Override public String getColumnName(int column) { if (columnNames[column] != null) { return columnNames[column]; @@ -132,49 +137,49 @@ public class JDBCAdapter extends AbstractTableModel { } } - public Class getColumnClass(int column) { + @Override + public Class getColumnClass(int column) { int type; try { - type = metaData.getColumnType(column+1); - } - catch (SQLException e) { + type = metaData.getColumnType(column + 1); + } catch (SQLException e) { return super.getColumnClass(column); } - switch(type) { - case Types.CHAR: - case Types.VARCHAR: - case Types.LONGVARCHAR: - return String.class; + switch (type) { + case Types.CHAR: + case Types.VARCHAR: + case Types.LONGVARCHAR: + return String.class; - case Types.BIT: - return Boolean.class; + case Types.BIT: + return Boolean.class; - case Types.TINYINT: - case Types.SMALLINT: - case Types.INTEGER: - return Integer.class; + case Types.TINYINT: + case Types.SMALLINT: + case Types.INTEGER: + return Integer.class; - case Types.BIGINT: - return Long.class; + case Types.BIGINT: + return Long.class; - case Types.FLOAT: - case Types.DOUBLE: - return Double.class; + case Types.FLOAT: + case Types.DOUBLE: + return Double.class; - case Types.DATE: - return java.sql.Date.class; + case Types.DATE: + return java.sql.Date.class; - default: - return Object.class; + default: + return Object.class; } } + @Override public boolean isCellEditable(int row, int column) { try { - return metaData.isWritable(column+1); - } - catch (SQLException e) { + return metaData.isWritable(column + 1); + } catch (SQLException e) { return false; } } @@ -184,14 +189,13 @@ public class JDBCAdapter extends AbstractTableModel { } // Data methods - public int getRowCount() { return rows.size(); } public Object getValueAt(int aRow, int aColumn) { - Vector row = (Vector)rows.elementAt(aRow); - return row.elementAt(aColumn); + List row = rows.get(aRow); + return row.get(aColumn); } public String dbRepresentation(int column, Object value) { @@ -202,43 +206,42 @@ public class JDBCAdapter extends AbstractTableModel { } try { - type = metaData.getColumnType(column+1); - } - catch (SQLException e) { + type = metaData.getColumnType(column + 1); + } catch (SQLException e) { return value.toString(); } - switch(type) { - case Types.INTEGER: - case Types.DOUBLE: - case Types.FLOAT: - return value.toString(); - case Types.BIT: - return ((Boolean)value).booleanValue() ? "1" : "0"; - case Types.DATE: - return value.toString(); // This will need some conversion. - default: - return "\""+value.toString()+"\""; + switch (type) { + case Types.INTEGER: + case Types.DOUBLE: + case Types.FLOAT: + return value.toString(); + case Types.BIT: + return ((Boolean) value).booleanValue() ? "1" : "0"; + case Types.DATE: + return value.toString(); // This will need some conversion. + default: + return "\"" + value.toString() + "\""; } } + @Override public void setValueAt(Object value, int row, int column) { try { - String tableName = metaData.getTableName(column+1); + String tableName = metaData.getTableName(column + 1); // Some of the drivers seem buggy, tableName should not be null. if (tableName == null) { System.out.println("Table name returned null."); } String columnName = getColumnName(column); String query = - "update "+tableName+ - " set "+columnName+" = "+dbRepresentation(column, value)+ - " where "; + "update " + tableName + " set " + columnName + " = " + + dbRepresentation(column, value) + " where "; // We don't have a model of the schema so we don't know the // primary keys or which columns to lock on. To demonstrate // that editing is possible, we'll just lock on everything. - for(int col = 0; col dataRow = rows.get(row); + dataRow.set(column, value); } } diff --git a/jdk/src/share/demo/jfc/TableExample/OldJTable.java b/jdk/src/share/demo/jfc/TableExample/OldJTable.java index 2ee6267eac5..28a3f212816 100644 --- a/jdk/src/share/demo/jfc/TableExample/OldJTable.java +++ b/jdk/src/share/demo/jfc/TableExample/OldJTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,28 +29,26 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ -import java.lang.Thread; -import java.util.*; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.plaf.*; -import javax.swing.table.*; +import java.util.EventObject; +import java.util.List; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; /** * The OldJTable is an unsupported class containing some methods that were * deleted from the JTable between releases 0.6 and 0.7 */ +@SuppressWarnings("serial") public class OldJTable extends JTable { /* - * A new convenience method returning the index of the column in the co-ordinate - * space of the view. + * A new convenience method returning the index of the column in the + * co-ordinate space of the view. */ public int getColumnIndex(Object identifier) { return getColumnModel().getColumnIndex(identifier); @@ -65,7 +63,7 @@ public class OldJTable extends JTable return addColumn(columnIdentifier, width, null, null, null); } - public TableColumn addColumn(Object columnIdentifier, Vector columnData) { + public TableColumn addColumn(Object columnIdentifier, List columnData) { return addColumn(columnIdentifier, -1, null, null, columnData); } @@ -79,16 +77,17 @@ public class OldJTable extends JTable public TableColumn addColumn(Object columnIdentifier, int width, TableCellRenderer renderer, - TableCellEditor editor, Vector columnData) { + TableCellEditor editor, List columnData) { checkDefaultTableModel(); // Set up the model side first DefaultTableModel m = (DefaultTableModel)getModel(); - m.addColumn(columnIdentifier, columnData); + m.addColumn(columnIdentifier, columnData.toArray()); // The column will have been added to the end, so the index of the // column in the model is the last element. - TableColumn newColumn = new TableColumn(m.getColumnCount()-1, width, renderer, editor); + TableColumn newColumn = new TableColumn( + m.getColumnCount()-1, width, renderer, editor); super.addColumn(newColumn); return newColumn; } @@ -104,9 +103,9 @@ public class OldJTable extends JTable ((DefaultTableModel)getModel()).addRow(rowData); } - public void addRow(Vector rowData) { + public void addRow(List rowData) { checkDefaultTableModel(); - ((DefaultTableModel)getModel()).addRow(rowData); + ((DefaultTableModel)getModel()).addRow(rowData.toArray()); } public void removeRow(int rowIndex) { @@ -124,9 +123,9 @@ public class OldJTable extends JTable ((DefaultTableModel)getModel()).insertRow(rowIndex, rowData); } - public void insertRow(int rowIndex, Vector rowData) { + public void insertRow(int rowIndex, List rowData) { checkDefaultTableModel(); - ((DefaultTableModel)getModel()).insertRow(rowIndex, rowData); + ((DefaultTableModel)getModel()).insertRow(rowIndex, rowData.toArray()); } public void setNumRows(int newSize) { @@ -134,9 +133,10 @@ public class OldJTable extends JTable ((DefaultTableModel)getModel()).setNumRows(newSize); } - public void setDataVector(Vector newData, Vector columnIds) { + public void setDataVector(Object[][] newData, List columnIds) { checkDefaultTableModel(); - ((DefaultTableModel)getModel()).setDataVector(newData, columnIds); + ((DefaultTableModel)getModel()).setDataVector( + newData, columnIds.toArray()); } public void setDataVector(Object[][] newData, Object[] columnIds) { @@ -154,11 +154,11 @@ public class OldJTable extends JTable // public Object getValueAt(Object columnIdentifier, int rowIndex) { - return super.getValueAt(rowIndex, getColumnIndex(columnIdentifier)); + return super.getValueAt(rowIndex, getColumnIndex(columnIdentifier)); } public boolean isCellEditable(Object columnIdentifier, int rowIndex) { - return super.isCellEditable(rowIndex, getColumnIndex(columnIdentifier)); + return super.isCellEditable(rowIndex, getColumnIndex(columnIdentifier)); } public void setValueAt(Object aValue, Object columnIdentifier, int rowIndex) { @@ -217,7 +217,8 @@ public class OldJTable extends JTable public TableColumn addColumn(int modelColumn, int width, TableCellRenderer renderer, TableCellEditor editor) { - TableColumn newColumn = new TableColumn(modelColumn, width, renderer, editor); + TableColumn newColumn = new TableColumn( + modelColumn, width, renderer, editor); addColumn(newColumn); return newColumn; } diff --git a/jdk/src/share/demo/jfc/TableExample/TableExample.java b/jdk/src/share/demo/jfc/TableExample/TableExample.java index b0ac36dac04..03d798f3f12 100644 --- a/jdk/src/share/demo/jfc/TableExample/TableExample.java +++ b/jdk/src/share/demo/jfc/TableExample/TableExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ /** * A a UI around the JDBCAdaptor, allowing database data to be interactively @@ -41,41 +39,56 @@ * * @author Philip Milne */ +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.LayoutManager; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.border.BevelBorder; -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.table.*; -import javax.swing.event.*; -import javax.swing.border.*; -public class TableExample implements LayoutManager { +public final class TableExample implements LayoutManager { + static String[] ConnectOptionNames = { "Connect" }; - static String ConnectTitle = "Connection Information"; - - Dimension origin = new Dimension(0, 0); - - JButton fetchButton; - JButton showConnectionInfoButton; - - JPanel connectionPanel; - JFrame frame; // The query/results window. - - JLabel userNameLabel; - JTextField userNameField; - JLabel passwordLabel; - JTextField passwordField; + static String ConnectTitle = "Connection Information"; + Dimension origin = new Dimension(0, 0); + JButton fetchButton; + JButton showConnectionInfoButton; + JPanel connectionPanel; + JFrame frame; // The query/results window. + JLabel userNameLabel; + JTextField userNameField; + JLabel passwordLabel; + JTextField passwordField; // JLabel queryLabel; - JTextArea queryTextArea; - JComponent queryAggregate; - JLabel serverLabel; - JTextField serverField; - JLabel driverLabel; - JTextField driverField; - - JPanel mainPanel; - + JTextArea queryTextArea; + JComponent queryAggregate; + JLabel serverLabel; + JTextField serverField; + JLabel driverLabel; + JTextField driverField; + JPanel mainPanel; TableSorter sorter; JDBCAdapter dataBase; JScrollPane tableAggregate; @@ -85,14 +98,15 @@ public class TableExample implements LayoutManager { * If the user clicks on the 'Connect' button the connection is reset. */ void activateConnectionDialog() { - if(JOptionPane.showOptionDialog(tableAggregate, connectionPanel, ConnectTitle, - JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, - null, ConnectOptionNames, ConnectOptionNames[0]) == 0) { + if (JOptionPane.showOptionDialog(tableAggregate, connectionPanel, + ConnectTitle, + JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, + null, ConnectOptionNames, ConnectOptionNames[0]) == 0) { connect(); frame.setVisible(true); - } - else if(!frame.isVisible()) + } else if (!frame.isVisible()) { System.exit(0); + } } /** @@ -102,21 +116,21 @@ public class TableExample implements LayoutManager { public void createConnectionDialog() { // Create the labels and text fields. userNameLabel = new JLabel("User name: ", JLabel.RIGHT); - userNameField = new JTextField("guest"); + userNameField = new JTextField("app"); passwordLabel = new JLabel("Password: ", JLabel.RIGHT); - passwordField = new JTextField("trustworthy"); + passwordField = new JTextField("app"); serverLabel = new JLabel("Database URL: ", JLabel.RIGHT); - serverField = new JTextField("jdbc:sybase://dbtest:1455/pubs2"); + serverField = new JTextField("jdbc:derby://localhost:1527/sample"); driverLabel = new JLabel("Driver: ", JLabel.RIGHT); - driverField = new JTextField("connect.sybase.SybaseDriver"); + driverField = new JTextField("org.apache.derby.jdbc.ClientDriver"); connectionPanel = new JPanel(false); connectionPanel.setLayout(new BoxLayout(connectionPanel, - BoxLayout.X_AXIS)); + BoxLayout.X_AXIS)); JPanel namePanel = new JPanel(false); namePanel.setLayout(new GridLayout(0, 1)); @@ -145,22 +159,22 @@ public class TableExample implements LayoutManager { // Create the buttons. showConnectionInfoButton = new JButton("Configuration"); showConnectionInfoButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - activateConnectionDialog(); - } + + public void actionPerformed(ActionEvent e) { + activateConnectionDialog(); } - ); + }); fetchButton = new JButton("Fetch"); fetchButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - fetch(); - } + + public void actionPerformed(ActionEvent e) { + fetch(); } - ); + }); // Create the query text area and label. - queryTextArea = new JTextArea("SELECT * FROM titles", 25, 25); + queryTextArea = new JTextArea("SELECT * FROM APP.CUSTOMER", 25, 25); queryAggregate = new JScrollPane(queryTextArea); queryAggregate.setBorder(new BevelBorder(BevelBorder.LOWERED)); @@ -178,7 +192,12 @@ public class TableExample implements LayoutManager { // Create a Frame and put the main panel in it. frame = new JFrame("TableExample"); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) {System.exit(0);}}); + + @Override + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); frame.setBackground(Color.lightGray); frame.getContentPane().add(mainPanel); frame.pack(); @@ -189,13 +208,13 @@ public class TableExample implements LayoutManager { } public void connect() { - dataBase = new JDBCAdapter( - serverField.getText(), - driverField.getText(), - userNameField.getText(), - passwordField.getText()); - sorter.setModel(dataBase); - } + dataBase = new JDBCAdapter( + serverField.getText(), + driverField.getText(), + userNameField.getText(), + passwordField.getText()); + sorter.setModel(dataBase); + } public void fetch() { dataBase.executeQuery(queryTextArea.getText()); @@ -221,25 +240,48 @@ public class TableExample implements LayoutManager { } public static void main(String s[]) { + // Trying to set Nimbus look and feel + try { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception ex) { + Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE, + "Failed to apply Nimbus look and feel", ex); + } + new TableExample(); } - public Dimension preferredLayoutSize(Container c){return origin;} - public Dimension minimumLayoutSize(Container c){return origin;} - public void addLayoutComponent(String s, Component c) {} - public void removeLayoutComponent(Component c) {} + public Dimension preferredLayoutSize(Container c) { + return origin; + } + + public Dimension minimumLayoutSize(Container c) { + return origin; + } + + public void addLayoutComponent(String s, Component c) { + } + + public void removeLayoutComponent(Component c) { + } + public void layoutContainer(Container c) { Rectangle b = c.getBounds(); int topHeight = 90; int inset = 4; - showConnectionInfoButton.setBounds(b.width-2*inset-120, inset, 120, 25); - fetchButton.setBounds(b.width-2*inset-120, 60, 120, 25); + showConnectionInfoButton.setBounds(b.width - 2 * inset - 120, inset, 120, + 25); + fetchButton.setBounds(b.width - 2 * inset - 120, 60, 120, 25); // queryLabel.setBounds(10, 10, 100, 25); - queryAggregate.setBounds(inset, inset, b.width-2*inset - 150, 80); + queryAggregate.setBounds(inset, inset, b.width - 2 * inset - 150, 80); tableAggregate.setBounds(new Rectangle(inset, - inset + topHeight, - b.width-2*inset, - b.height-2*inset - topHeight)); + inset + topHeight, + b.width - 2 * inset, + b.height - 2 * inset - topHeight)); } - } diff --git a/jdk/src/share/demo/jfc/TableExample/TableExample2.java b/jdk/src/share/demo/jfc/TableExample/TableExample2.java index 145e7104640..9423f17556e 100644 --- a/jdk/src/share/demo/jfc/TableExample/TableExample2.java +++ b/jdk/src/share/demo/jfc/TableExample/TableExample2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,28 +29,36 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ + +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.Dimension; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; + /** * A minimal example, using the JTable to view data from a database. * * @author Philip Milne */ - -import javax.swing.*; - -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.Dimension; - public class TableExample2 { public TableExample2(String URL, String driver, String user, - String passwd, String query) { + String passwd, String query) { JFrame frame = new JFrame("Table"); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) {System.exit(0);}}); + + @Override + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); JDBCAdapter dt = new JDBCAdapter(URL, driver, user, passwd); dt.executeQuery(query); @@ -68,9 +76,26 @@ public class TableExample2 { public static void main(String[] args) { if (args.length != 5) { System.err.println("Needs database parameters eg. ..."); - System.err.println("java TableExample2 \"jdbc:sybase://dbtest:1455/pubs2\" \"connect.sybase.SybaseDriver\" guest trustworthy \"select * from titles\""); + System.err.println( + "java TableExample2 \"jdbc:derby://localhost:1527/sample\" " + + "org.apache.derby.jdbc.ClientDriver app app " + + "\"select * from app.customer\""); return; } + + // Trying to set Nimbus look and feel + try { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception ex) { + Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE, + "Failed to apply Nimbus look and feel", ex); + } + new TableExample2(args[0], args[1], args[2], args[3], args[4]); } } diff --git a/jdk/src/share/demo/jfc/TableExample/TableExample3.java b/jdk/src/share/demo/jfc/TableExample/TableExample3.java index b04b40aa6a5..51646395b0e 100644 --- a/jdk/src/share/demo/jfc/TableExample/TableExample3.java +++ b/jdk/src/share/demo/jfc/TableExample/TableExample3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ + +import javax.swing.*; +import javax.swing.table.*; + +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.Dimension; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.UIManager.LookAndFeelInfo; + /** * An example showing the JTable with a dataModel that is not derived @@ -39,70 +48,92 @@ * * @author Philip Milne */ - -import javax.swing.*; -import javax.swing.table.*; - -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.Dimension; - public class TableExample3 { public TableExample3() { JFrame frame = new JFrame("Table"); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) {System.exit(0);}}); + + @Override + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); // Take the dummy data from SwingSet. - final String[] names = {"First Name", "Last Name", "Favorite Color", - "Favorite Number", "Vegetarian"}; + final String[] names = { "First Name", "Last Name", "Favorite Color", + "Favorite Number", "Vegetarian" }; final Object[][] data = { - {"Mark", "Andrews", "Red", new Integer(2), Boolean.TRUE}, - {"Tom", "Ball", "Blue", new Integer(99), Boolean.FALSE}, - {"Alan", "Chung", "Green", new Integer(838), Boolean.FALSE}, - {"Jeff", "Dinkins", "Turquois", new Integer(8), Boolean.TRUE}, - {"Amy", "Fowler", "Yellow", new Integer(3), Boolean.FALSE}, - {"Brian", "Gerhold", "Green", new Integer(0), Boolean.FALSE}, - {"James", "Gosling", "Pink", new Integer(21), Boolean.FALSE}, - {"David", "Karlton", "Red", new Integer(1), Boolean.FALSE}, - {"Dave", "Kloba", "Yellow", new Integer(14), Boolean.FALSE}, - {"Peter", "Korn", "Purple", new Integer(12), Boolean.FALSE}, - {"Phil", "Milne", "Purple", new Integer(3), Boolean.FALSE}, - {"Dave", "Moore", "Green", new Integer(88), Boolean.FALSE}, - {"Hans", "Muller", "Maroon", new Integer(5), Boolean.FALSE}, - {"Rick", "Levenson", "Blue", new Integer(2), Boolean.FALSE}, - {"Tim", "Prinzing", "Blue", new Integer(22), Boolean.FALSE}, - {"Chester", "Rose", "Black", new Integer(0), Boolean.FALSE}, - {"Ray", "Ryan", "Gray", new Integer(77), Boolean.FALSE}, - {"Georges", "Saab", "Red", new Integer(4), Boolean.FALSE}, - {"Willie", "Walker", "Phthalo Blue", new Integer(4), Boolean.FALSE}, - {"Kathy", "Walrath", "Blue", new Integer(8), Boolean.FALSE}, - {"Arnaud", "Weber", "Green", new Integer(44), Boolean.FALSE} + { "Mark", "Andrews", "Red", new Integer(2), Boolean.TRUE }, + { "Tom", "Ball", "Blue", new Integer(99), Boolean.FALSE }, + { "Alan", "Chung", "Green", new Integer(838), Boolean.FALSE }, + { "Jeff", "Dinkins", "Turquois", new Integer(8), Boolean.TRUE }, + { "Amy", "Fowler", "Yellow", new Integer(3), Boolean.FALSE }, + { "Brian", "Gerhold", "Green", new Integer(0), Boolean.FALSE }, + { "James", "Gosling", "Pink", new Integer(21), Boolean.FALSE }, + { "David", "Karlton", "Red", new Integer(1), Boolean.FALSE }, + { "Dave", "Kloba", "Yellow", new Integer(14), Boolean.FALSE }, + { "Peter", "Korn", "Purple", new Integer(12), Boolean.FALSE }, + { "Phil", "Milne", "Purple", new Integer(3), Boolean.FALSE }, + { "Dave", "Moore", "Green", new Integer(88), Boolean.FALSE }, + { "Hans", "Muller", "Maroon", new Integer(5), Boolean.FALSE }, + { "Rick", "Levenson", "Blue", new Integer(2), Boolean.FALSE }, + { "Tim", "Prinzing", "Blue", new Integer(22), Boolean.FALSE }, + { "Chester", "Rose", "Black", new Integer(0), Boolean.FALSE }, + { "Ray", "Ryan", "Gray", new Integer(77), Boolean.FALSE }, + { "Georges", "Saab", "Red", new Integer(4), Boolean.FALSE }, + { "Willie", "Walker", "Phthalo Blue", new Integer(4), Boolean.FALSE }, + { "Kathy", "Walrath", "Blue", new Integer(8), Boolean.FALSE }, + { "Arnaud", "Weber", "Green", new Integer(44), Boolean.FALSE } }; // Create a model of the data. + @SuppressWarnings("serial") TableModel dataModel = new AbstractTableModel() { // These methods always need to be implemented. - public int getColumnCount() { return names.length; } - public int getRowCount() { return data.length;} - public Object getValueAt(int row, int col) {return data[row][col];} + + public int getColumnCount() { + return names.length; + } + + public int getRowCount() { + return data.length; + } + + public Object getValueAt(int row, int col) { + return data[row][col]; + } // The default implementations of these methods in // AbstractTableModel would work, but we can refine them. - public String getColumnName(int column) {return names[column];} - public Class getColumnClass(int col) {return getValueAt(0,col).getClass();} - public boolean isCellEditable(int row, int col) {return (col==4);} + @Override + public String getColumnName(int column) { + return names[column]; + } + + @Override + public Class getColumnClass(int col) { + return getValueAt(0, col).getClass(); + } + + @Override + public boolean isCellEditable(int row, int col) { + return (col == 4); + } + + @Override public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; } - }; + }; - // Instead of making the table display the data as it would normally with: + // Instead of making the table display the data as it would normally + // with: // JTable tableView = new JTable(dataModel); - // Add a sorter, by using the following three lines instead of the one above. - TableSorter sorter = new TableSorter(dataModel); - JTable tableView = new JTable(sorter); + // Add a sorter, by using the following three lines instead of the one + // above. + TableSorter sorter = new TableSorter(dataModel); + JTable tableView = new JTable(sorter); sorter.addMouseListenerToHeaderInTable(tableView); JScrollPane scrollpane = new JScrollPane(tableView); @@ -114,6 +145,18 @@ public class TableExample3 { } public static void main(String[] args) { + // Trying to set Nimbus look and feel + try { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception ex) { + Logger.getLogger(TableExample3.class.getName()).log(Level.SEVERE, + "Failed to apply Nimbus look and feel", ex); + } new TableExample3(); } } diff --git a/jdk/src/share/demo/jfc/TableExample/TableExample4.java b/jdk/src/share/demo/jfc/TableExample/TableExample4.java index 621d905256a..e75e2db3838 100644 --- a/jdk/src/share/demo/jfc/TableExample/TableExample4.java +++ b/jdk/src/share/demo/jfc/TableExample/TableExample4.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ + +import javax.swing.*; +import javax.swing.table.*; +import javax.swing.border.*; +import java.awt.Dimension; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.Color; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.UIManager.LookAndFeelInfo; + /** * Another JTable example, showing how column attributes can be refined @@ -40,72 +50,91 @@ * * @author Philip Milne */ - -import javax.swing.*; -import javax.swing.table.*; -import javax.swing.border.*; - -import java.awt.Dimension; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.Color; - public class TableExample4 { public TableExample4() { JFrame frame = new JFrame("Table"); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) {System.exit(0);}}); + + @Override + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); // Take the dummy data from SwingSet. - final String[] names = {"First Name", "Last Name", "Favorite Color", - "Favorite Number", "Vegetarian"}; + final String[] names = { "First Name", "Last Name", "Favorite Color", + "Favorite Number", "Vegetarian" }; final Object[][] data = { - {"Mark", "Andrews", "Red", new Integer(2), Boolean.TRUE}, - {"Tom", "Ball", "Blue", new Integer(99), Boolean.FALSE}, - {"Alan", "Chung", "Green", new Integer(838), Boolean.FALSE}, - {"Jeff", "Dinkins", "Turquois", new Integer(8), Boolean.TRUE}, - {"Amy", "Fowler", "Yellow", new Integer(3), Boolean.FALSE}, - {"Brian", "Gerhold", "Green", new Integer(0), Boolean.FALSE}, - {"James", "Gosling", "Pink", new Integer(21), Boolean.FALSE}, - {"David", "Karlton", "Red", new Integer(1), Boolean.FALSE}, - {"Dave", "Kloba", "Yellow", new Integer(14), Boolean.FALSE}, - {"Peter", "Korn", "Purple", new Integer(12), Boolean.FALSE}, - {"Phil", "Milne", "Purple", new Integer(3), Boolean.FALSE}, - {"Dave", "Moore", "Green", new Integer(88), Boolean.FALSE}, - {"Hans", "Muller", "Maroon", new Integer(5), Boolean.FALSE}, - {"Rick", "Levenson", "Blue", new Integer(2), Boolean.FALSE}, - {"Tim", "Prinzing", "Blue", new Integer(22), Boolean.FALSE}, - {"Chester", "Rose", "Black", new Integer(0), Boolean.FALSE}, - {"Ray", "Ryan", "Gray", new Integer(77), Boolean.FALSE}, - {"Georges", "Saab", "Red", new Integer(4), Boolean.FALSE}, - {"Willie", "Walker", "Phthalo Blue", new Integer(4), Boolean.FALSE}, - {"Kathy", "Walrath", "Blue", new Integer(8), Boolean.FALSE}, - {"Arnaud", "Weber", "Green", new Integer(44), Boolean.FALSE} + { "Mark", "Andrews", "Red", new Integer(2), Boolean.TRUE }, + { "Tom", "Ball", "Blue", new Integer(99), Boolean.FALSE }, + { "Alan", "Chung", "Green", new Integer(838), Boolean.FALSE }, + { "Jeff", "Dinkins", "Turquois", new Integer(8), Boolean.TRUE }, + { "Amy", "Fowler", "Yellow", new Integer(3), Boolean.FALSE }, + { "Brian", "Gerhold", "Green", new Integer(0), Boolean.FALSE }, + { "James", "Gosling", "Pink", new Integer(21), Boolean.FALSE }, + { "David", "Karlton", "Red", new Integer(1), Boolean.FALSE }, + { "Dave", "Kloba", "Yellow", new Integer(14), Boolean.FALSE }, + { "Peter", "Korn", "Purple", new Integer(12), Boolean.FALSE }, + { "Phil", "Milne", "Purple", new Integer(3), Boolean.FALSE }, + { "Dave", "Moore", "Green", new Integer(88), Boolean.FALSE }, + { "Hans", "Muller", "Maroon", new Integer(5), Boolean.FALSE }, + { "Rick", "Levenson", "Blue", new Integer(2), Boolean.FALSE }, + { "Tim", "Prinzing", "Blue", new Integer(22), Boolean.FALSE }, + { "Chester", "Rose", "Black", new Integer(0), Boolean.FALSE }, + { "Ray", "Ryan", "Gray", new Integer(77), Boolean.FALSE }, + { "Georges", "Saab", "Red", new Integer(4), Boolean.FALSE }, + { "Willie", "Walker", "Phthalo Blue", new Integer(4), Boolean.FALSE }, + { "Kathy", "Walrath", "Blue", new Integer(8), Boolean.FALSE }, + { "Arnaud", "Weber", "Green", new Integer(44), Boolean.FALSE } }; // Create a model of the data. + @SuppressWarnings("serial") TableModel dataModel = new AbstractTableModel() { // These methods always need to be implemented. - public int getColumnCount() { return names.length; } - public int getRowCount() { return data.length;} - public Object getValueAt(int row, int col) {return data[row][col];} + + public int getColumnCount() { + return names.length; + } + + public int getRowCount() { + return data.length; + } + + public Object getValueAt(int row, int col) { + return data[row][col]; + } // The default implementations of these methods in // AbstractTableModel would work, but we can refine them. - public String getColumnName(int column) {return names[column];} - public Class getColumnClass(int c) {return getValueAt(0, c).getClass();} - public boolean isCellEditable(int row, int col) {return true;} + @Override + public String getColumnName(int column) { + return names[column]; + } + + @Override + public Class getColumnClass(int c) { + return getValueAt(0, c).getClass(); + } + + @Override + public boolean isCellEditable(int row, int col) { + return true; + } + + @Override public void setValueAt(Object aValue, int row, int column) { System.out.println("Setting value to: " + aValue); data[row][column] = aValue; } - }; + }; // Create the table JTable tableView = new JTable(dataModel); - // Turn off auto-resizing so that we can set column sizes programmatically. - // In this mode, all columns will get their preferred widths, as set blow. + // Turn off auto-resizing so that we can set column sizes + // programmatically. In this mode, all columns will get their preferred + // widths, as set blow. tableView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // Create a combo box to show that you can use one in a table. @@ -123,15 +152,18 @@ public class TableExample4 { colorColumn.setCellEditor(new DefaultCellEditor(comboBox)); // Set a pink background and tooltip for the Color column renderer. - DefaultTableCellRenderer colorColumnRenderer = new DefaultTableCellRenderer(); + DefaultTableCellRenderer colorColumnRenderer = + new DefaultTableCellRenderer(); colorColumnRenderer.setBackground(Color.pink); colorColumnRenderer.setToolTipText("Click for combo box"); colorColumn.setCellRenderer(colorColumnRenderer); // Set a tooltip for the header of the colors column. TableCellRenderer headerRenderer = colorColumn.getHeaderRenderer(); - if (headerRenderer instanceof DefaultTableCellRenderer) - ((DefaultTableCellRenderer)headerRenderer).setToolTipText("Hi Mom!"); + if (headerRenderer instanceof DefaultTableCellRenderer) { + ((DefaultTableCellRenderer) headerRenderer).setToolTipText( + "Hi Mom!"); + } // Set the width of the "Vegetarian" column. TableColumn vegetarianColumn = tableView.getColumn("Vegetarian"); @@ -139,9 +171,14 @@ public class TableExample4 { // Show the values in the "Favorite Number" column in different colors. TableColumn numbersColumn = tableView.getColumn("Favorite Number"); - DefaultTableCellRenderer numberColumnRenderer = new DefaultTableCellRenderer() { + @SuppressWarnings("serial") + DefaultTableCellRenderer numberColumnRenderer + = new DefaultTableCellRenderer() { + + @Override public void setValue(Object value) { - int cellValue = (value instanceof Number) ? ((Number)value).intValue() : 0; + int cellValue = (value instanceof Number) ? ((Number) value). + intValue() : 0; setForeground((cellValue > 30) ? Color.black : Color.red); setText((value == null) ? "" : value.toString()); } @@ -160,6 +197,19 @@ public class TableExample4 { } public static void main(String[] args) { + // Trying to set Nimbus look and feel + try { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (Exception ex) { + Logger.getLogger(TableExample4.class.getName()).log(Level.SEVERE, + "Failed to apply Nimbus look and feel", ex); + } + new TableExample4(); } } diff --git a/jdk/src/share/demo/jfc/TableExample/TableMap.java b/jdk/src/share/demo/jfc/TableExample/TableMap.java index a6c61df7137..2511397fec1 100644 --- a/jdk/src/share/demo/jfc/TableExample/TableMap.java +++ b/jdk/src/share/demo/jfc/TableExample/TableMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ /** * In a chain of data manipulators some behaviour is common. TableMap @@ -41,32 +39,34 @@ * a TableMap which has not been subclassed into a chain of table filters * should have no effect. * - * @author Philip Milne */ - + * @author Philip Milne + */ import javax.swing.table.*; import javax.swing.event.TableModelListener; import javax.swing.event.TableModelEvent; -public class TableMap extends AbstractTableModel implements TableModelListener -{ + +@SuppressWarnings("serial") +public class TableMap extends AbstractTableModel implements TableModelListener { + protected TableModel model; - public TableModel getModel() { + public TableModel getModel() { return model; } - public void setModel(TableModel model) { + public void setModel(TableModel model) { this.model = model; model.addTableModelListener(this); } // By default, Implement TableModel by forwarding all messages // to the model. - public Object getValueAt(int aRow, int aColumn) { return model.getValueAt(aRow, aColumn); } + @Override public void setValueAt(Object aValue, int aRow, int aColumn) { model.setValueAt(aValue, aRow, aColumn); } @@ -79,16 +79,19 @@ public class TableMap extends AbstractTableModel implements TableModelListener return (model == null) ? 0 : model.getColumnCount(); } + @Override public String getColumnName(int aColumn) { return model.getColumnName(aColumn); } + @Override public Class getColumnClass(int aColumn) { return model.getColumnClass(aColumn); } + @Override public boolean isCellEditable(int row, int column) { - return model.isCellEditable(row, column); + return model.isCellEditable(row, column); } // // Implementation of the TableModelListener interface, diff --git a/jdk/src/share/demo/jfc/TableExample/TableSorter.java b/jdk/src/share/demo/jfc/TableExample/TableSorter.java index 8f8b0625dce..625b6f26005 100644 --- a/jdk/src/share/demo/jfc/TableExample/TableSorter.java +++ b/jdk/src/share/demo/jfc/TableExample/TableSorter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +29,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ + +import javax.swing.table.TableModel; +import javax.swing.event.TableModelEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.InputEvent; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.swing.JTable; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumnModel; + /** * A sorter for TableModels. The sorter has a model (conforming to TableModel) @@ -48,46 +59,29 @@ * * @author Philip Milne */ +@SuppressWarnings("serial") +public final class TableSorter extends TableMap { -import java.util.*; - -import javax.swing.table.TableModel; -import javax.swing.event.TableModelEvent; - -// Imports for picking up mouse events from the JTable. - -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.InputEvent; -import javax.swing.JTable; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; - -public class TableSorter extends TableMap -{ - int indexes[]; - Vector sortingColumns = new Vector(); - boolean ascending = true; + int indexes[]; + List sortingColumns = new ArrayList(); + boolean ascending = true; int compares; - public TableSorter() - { + public TableSorter() { indexes = new int[0]; // For consistency. } - public TableSorter(TableModel model) - { + public TableSorter(TableModel model) { setModel(model); } + @Override public void setModel(TableModel model) { super.setModel(model); reallocateIndexes(); } - public int compareRowsByColumn(int row1, int row2, int column) - { + public int compareRowsByColumn(int row1, int row2, int column) { Class type = model.getColumnClass(column); TableModel data = model; @@ -99,104 +93,100 @@ public class TableSorter extends TableMap // If both values are null return 0 if (o1 == null && o2 == null) { return 0; - } - else if (o1 == null) { // Define null less than everything. + } else if (o1 == null) { // Define null less than everything. return -1; - } - else if (o2 == null) { + } else if (o2 == null) { return 1; } -/* We copy all returned values from the getValue call in case -an optimised model is reusing one object to return many values. -The Number subclasses in the JDK are immutable and so will not be used in -this way but other subclasses of Number might want to do this to save -space and avoid unnecessary heap allocation. -*/ - if (type.getSuperclass() == java.lang.Number.class) - { - Number n1 = (Number)data.getValueAt(row1, column); - double d1 = n1.doubleValue(); - Number n2 = (Number)data.getValueAt(row2, column); - double d2 = n2.doubleValue(); + /* We copy all returned values from the getValue call in case + an optimised model is reusing one object to return many values. + The Number subclasses in the JDK are immutable and so will not be used + in this way but other subclasses of Number might want to do this to save + space and avoid unnecessary heap allocation. + */ + if (type.getSuperclass() == java.lang.Number.class) { + Number n1 = (Number) data.getValueAt(row1, column); + double d1 = n1.doubleValue(); + Number n2 = (Number) data.getValueAt(row2, column); + double d2 = n2.doubleValue(); - if (d1 < d2) - return -1; - else if (d1 > d2) - return 1; - else - return 0; + if (d1 < d2) { + return -1; + } else if (d1 > d2) { + return 1; + } else { + return 0; } - else if (type == java.util.Date.class) - { - Date d1 = (Date)data.getValueAt(row1, column); - long n1 = d1.getTime(); - Date d2 = (Date)data.getValueAt(row2, column); - long n2 = d2.getTime(); + } else if (type == java.util.Date.class) { + Date d1 = (Date) data.getValueAt(row1, column); + long n1 = d1.getTime(); + Date d2 = (Date) data.getValueAt(row2, column); + long n2 = d2.getTime(); - if (n1 < n2) - return -1; - else if (n1 > n2) - return 1; - else return 0; + if (n1 < n2) { + return -1; + } else if (n1 > n2) { + return 1; + } else { + return 0; } - else if (type == String.class) - { - String s1 = (String)data.getValueAt(row1, column); - String s2 = (String)data.getValueAt(row2, column); - int result = s1.compareTo(s2); + } else if (type == String.class) { + String s1 = (String) data.getValueAt(row1, column); + String s2 = (String) data.getValueAt(row2, column); + int result = s1.compareTo(s2); - if (result < 0) - return -1; - else if (result > 0) - return 1; - else return 0; + if (result < 0) { + return -1; + } else if (result > 0) { + return 1; + } else { + return 0; } - else if (type == Boolean.class) - { - Boolean bool1 = (Boolean)data.getValueAt(row1, column); - boolean b1 = bool1.booleanValue(); - Boolean bool2 = (Boolean)data.getValueAt(row2, column); - boolean b2 = bool2.booleanValue(); + } else if (type == Boolean.class) { + Boolean bool1 = (Boolean) data.getValueAt(row1, column); + boolean b1 = bool1.booleanValue(); + Boolean bool2 = (Boolean) data.getValueAt(row2, column); + boolean b2 = bool2.booleanValue(); - if (b1 == b2) - return 0; - else if (b1) // Define false < true - return 1; - else - return -1; - } - else + if (b1 == b2) { + return 0; + } else if (b1) // Define false < true { - Object v1 = data.getValueAt(row1, column); - String s1 = v1.toString(); - Object v2 = data.getValueAt(row2, column); - String s2 = v2.toString(); - int result = s1.compareTo(s2); - - if (result < 0) - return -1; - else if (result > 0) - return 1; - else return 0; + return 1; + } else { + return -1; } + } else { + Object v1 = data.getValueAt(row1, column); + String s1 = v1.toString(); + Object v2 = data.getValueAt(row2, column); + String s2 = v2.toString(); + int result = s1.compareTo(s2); + + if (result < 0) { + return -1; + } else if (result > 0) { + return 1; + } else { + return 0; + } + } } - public int compare(int row1, int row2) - { + public int compare(int row1, int row2) { compares++; - for(int level = 0; level < sortingColumns.size(); level++) - { - Integer column = (Integer)sortingColumns.elementAt(level); - int result = compareRowsByColumn(row1, row2, column.intValue()); - if (result != 0) - return ascending ? result : -result; + for (int level = 0; level < sortingColumns.size(); level++) { + Integer column = sortingColumns.get(level); + int result = compareRowsByColumn(row1, row2, column.intValue()); + if (result != 0) { + return ascending ? result : -result; } + } return 0; } - public void reallocateIndexes() - { + public void reallocateIndexes() { int rowCount = model.getRowCount(); // Set up a new array of indexes with the right number of elements @@ -204,39 +194,38 @@ space and avoid unnecessary heap allocation. indexes = new int[rowCount]; // Initialise with the identity mapping. - for(int row = 0; row < rowCount; row++) + for (int row = 0; row < rowCount; row++) { indexes[row] = row; + } } - public void tableChanged(TableModelEvent e) - { + @Override + public void tableChanged(TableModelEvent e) { System.out.println("Sorter: tableChanged"); reallocateIndexes(); super.tableChanged(e); } - public void checkModel() - { + public void checkModel() { if (indexes.length != model.getRowCount()) { System.err.println("Sorter not informed of a change in model."); } } - public void sort(Object sender) - { + public void sort(Object sender) { checkModel(); compares = 0; // n2sort(); // qsort(0, indexes.length-1); - shuttlesort((int[])indexes.clone(), indexes, 0, indexes.length); - System.out.println("Compares: "+compares); + shuttlesort(indexes.clone(), indexes, 0, indexes.length); + System.out.println("Compares: " + compares); } public void n2sort() { - for(int i = 0; i < getRowCount(); i++) { - for(int j = i+1; j < getRowCount(); j++) { + for (int i = 0; i < getRowCount(); i++) { + for (int j = i + 1; j < getRowCount(); j++) { if (compare(indexes[i], indexes[j]) == -1) { swap(i, j); } @@ -255,7 +244,7 @@ space and avoid unnecessary heap allocation. if (high - low < 2) { return; } - int middle = (low + high)/2; + int middle = (low + high) / 2; shuttlesort(to, from, low, middle); shuttlesort(to, from, middle, high); @@ -277,20 +266,17 @@ space and avoid unnecessary heap allocation. find out how the performance drops to Nlog(N) as the initial order diminishes - it may drop very quickly. */ - if (high - low >= 4 && compare(from[middle-1], from[middle]) <= 0) { - for (int i = low; i < high; i++) { - to[i] = from[i]; - } + if (high - low >= 4 && compare(from[middle - 1], from[middle]) <= 0) { + System.arraycopy(from, low, to, low, high - low); return; } // A normal merge. - for(int i = low; i < high; i++) { + for (int i = low; i < high; i++) { if (q >= high || (p < middle && compare(from[p], from[q]) <= 0)) { to[i] = from[p++]; - } - else { + } else { to[i] = from[q++]; } } @@ -304,15 +290,14 @@ space and avoid unnecessary heap allocation. // The mapping only affects the contents of the data rows. // Pass all requests to these rows through the mapping array: "indexes". - - public Object getValueAt(int aRow, int aColumn) - { + @Override + public Object getValueAt(int aRow, int aColumn) { checkModel(); return model.getValueAt(indexes[aRow], aColumn); } - public void setValueAt(Object aValue, int aRow, int aColumn) - { + @Override + public void setValueAt(Object aValue, int aRow, int aColumn) { checkModel(); model.setValueAt(aValue, indexes[aRow], aColumn); } @@ -323,8 +308,8 @@ space and avoid unnecessary heap allocation. public void sortByColumn(int column, boolean ascending) { this.ascending = ascending; - sortingColumns.removeAllElements(); - sortingColumns.addElement(new Integer(column)); + sortingColumns.clear(); + sortingColumns.add(column); sort(this); super.tableChanged(new TableModelEvent(this)); } @@ -337,22 +322,21 @@ space and avoid unnecessary heap allocation. final JTable tableView = table; tableView.setColumnSelectionAllowed(false); MouseAdapter listMouseListener = new MouseAdapter() { + + @Override public void mouseClicked(MouseEvent e) { TableColumnModel columnModel = tableView.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = tableView.convertColumnIndexToModel(viewColumn); - if(e.getClickCount() == 1 && column != -1) { + if (e.getClickCount() == 1 && column != -1) { System.out.println("Sorting ..."); - int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK; + int shiftPressed = e.getModifiers() & InputEvent.SHIFT_MASK; boolean ascending = (shiftPressed == 0); sorter.sortByColumn(column, ascending); } - } - }; + } + }; JTableHeader th = tableView.getTableHeader(); th.addMouseListener(listMouseListener); } - - - } From 97d01f5e6f11300c997dc2bdd9f3a2d793c56d81 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Wed, 30 Mar 2011 08:58:54 -0700 Subject: [PATCH 092/168] 7027682: /applets/Fractal demo needs to be improved Reviewed-by: alexp --- .../demo/applets/Fractal/CLSFractal.java | 218 +++++++++++------- .../share/demo/applets/Fractal/example1.html | 2 +- 2 files changed, 137 insertions(+), 83 deletions(-) diff --git a/jdk/src/share/demo/applets/Fractal/CLSFractal.java b/jdk/src/share/demo/applets/Fractal/CLSFractal.java index 089c6f77896..be391e6176f 100644 --- a/jdk/src/share/demo/applets/Fractal/CLSFractal.java +++ b/jdk/src/share/demo/applets/Fractal/CLSFractal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,13 +29,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ import java.awt.Graphics; import java.util.Stack; -import java.util.Vector; import java.awt.event.*; +import java.util.ArrayList; +import java.util.List; + /** * A (not-yet) Context sensitive L-System Fractal applet class. @@ -50,9 +50,11 @@ import java.awt.event.*; * * @author Jim Graham */ +@SuppressWarnings("serial") public class CLSFractal - extends java.applet.Applet - implements Runnable, MouseListener { + extends java.applet.Applet + implements Runnable, MouseListener { + Thread kicker; ContextLSystem cls; int fractLevel = 1; @@ -67,31 +69,48 @@ public class CLSFractal int border; boolean normalizescaling; + @Override public void init() { String s; cls = new ContextLSystem(this); s = getParameter("level"); - if (s != null) fractLevel = Integer.parseInt(s); + if (s != null) { + fractLevel = Integer.parseInt(s); + } s = getParameter("incremental"); - if (s != null) incrementalUpdates = s.equalsIgnoreCase("true"); + if (s != null) { + incrementalUpdates = s.equalsIgnoreCase("true"); + } s = getParameter("delay"); - if (s != null) repaintDelay = Integer.parseInt(s); + if (s != null) { + repaintDelay = Integer.parseInt(s); + } s = getParameter("startAngle"); - if (s != null) startAngle = Float.valueOf(s).floatValue(); + if (s != null) { + startAngle = Float.valueOf(s).floatValue(); + } s = getParameter("rotAngle"); - if (s != null) rotAngle = Float.valueOf(s).floatValue(); + if (s != null) { + rotAngle = Float.valueOf(s).floatValue(); + } rotAngle = rotAngle / 360 * 2 * 3.14159265358f; s = getParameter("border"); - if (s != null) border = Integer.parseInt(s); + if (s != null) { + border = Integer.parseInt(s); + } s = getParameter("normalizescale"); - if (s != null) normalizescaling = s.equalsIgnoreCase("true"); + if (s != null) { + normalizescaling = s.equalsIgnoreCase("true"); + } addMouseListener(this); } + @Override public void destroy() { removeMouseListener(this); } + @Override public void run() { Thread me = Thread.currentThread(); boolean needsRepaint = false; @@ -99,7 +118,10 @@ public class CLSFractal cls.generate(); if (kicker == me && incrementalUpdates) { repaint(); - try {Thread.sleep(repaintDelay);} catch (InterruptedException e){} + try { + Thread.sleep(repaintDelay); + } catch (InterruptedException ignored) { + } } else { needsRepaint = true; } @@ -112,22 +134,27 @@ public class CLSFractal } } + @Override public void start() { kicker = new Thread(this); kicker.start(); } + @Override public void stop() { kicker = null; } - /*1.1 event handling */ + /*1.1 event handling */ + @Override public void mouseClicked(MouseEvent e) { } + @Override public void mousePressed(MouseEvent e) { } + @Override public void mouseReleased(MouseEvent e) { cls = new ContextLSystem(this); savedPath = null; @@ -135,14 +162,16 @@ public class CLSFractal e.consume(); } + @Override public void mouseEntered(MouseEvent e) { } + @Override public void mouseExited(MouseEvent e) { } - String savedPath; + @Override public void paint(Graphics g) { String fractalPath = cls.getPath(); if (fractalPath == null) { @@ -155,13 +184,14 @@ public class CLSFractal } for (int i = 0; i < border; i++) { - g.draw3DRect(i, i, getSize().width - i * 2, getSize().height - i * 2,false); + g.draw3DRect(i, i, getSize().width - i * 2, getSize().height - i * 2, + false); } render(g, fractalPath); } void render(Graphics g, String path) { - Stack turtleStack = new Stack(); + Stack turtleStack = new Stack(); CLSTurtle turtle; if (g == null) { @@ -172,11 +202,13 @@ public class CLSFractal turtle = new CLSTurtle(startAngle, 0, 0, 0, 0, 1, 1); } else { float frwidth = Xmax - Xmin; - if (frwidth == 0) + if (frwidth == 0) { frwidth = 1; + } float frheight = Ymax - Ymin; - if (frheight == 0) + if (frheight == 0) { frheight = 1; + } float xscale = (getSize().width - border * 2 - 1) / frwidth; float yscale = (getSize().height - border * 2 - 1) / frheight; int xoff = border; @@ -184,84 +216,102 @@ public class CLSFractal if (normalizescaling) { if (xscale < yscale) { yoff += ((getSize().height - border * 2) - - ((Ymax - Ymin) * xscale)) / 2; + - ((Ymax - Ymin) * xscale)) / 2; yscale = xscale; } else if (yscale < xscale) { xoff += ((getSize().width - border * 2) - - ((Xmax - Xmin) * yscale)) / 2; + - ((Xmax - Xmin) * yscale)) / 2; xscale = yscale; } } turtle = new CLSTurtle(startAngle, 0 - Xmin, 0 - Ymin, - xoff, yoff, xscale, yscale); + xoff, yoff, xscale, yscale); } for (int pos = 0; pos < path.length(); pos++) { switch (path.charAt(pos)) { - case '+': - turtle.rotate(rotAngle); - break; - case '-': - turtle.rotate(-rotAngle); - break; - case '[': - turtleStack.push(turtle); - turtle = new CLSTurtle(turtle); - break; - case ']': - turtle = (CLSTurtle) turtleStack.pop(); - break; - case 'f': - turtle.jump(); - break; - case 'F': - if (g == null) { - includePt(turtle.X, turtle.Y); + case '+': + turtle.rotate(rotAngle); + break; + case '-': + turtle.rotate(-rotAngle); + break; + case '[': + turtleStack.push(turtle); + turtle = new CLSTurtle(turtle); + break; + case ']': + turtle = turtleStack.pop(); + break; + case 'f': turtle.jump(); - includePt(turtle.X, turtle.Y); - } else { - turtle.draw(g); - } - break; - default: - break; + break; + case 'F': + if (g == null) { + includePt(turtle.X, turtle.Y); + turtle.jump(); + includePt(turtle.X, turtle.Y); + } else { + turtle.draw(g); + } + break; + default: + break; } } } void includePt(float x, float y) { - if (x < Xmin) + if (x < Xmin) { Xmin = x; - if (x > Xmax) + } + if (x > Xmax) { Xmax = x; - if (y < Ymin) + } + if (y < Ymin) { Ymin = y; - if (y > Ymax) + } + if (y > Ymax) { Ymax = y; + } } - public String getAppletInfo() { - return "Title: CLSFractal 1.1f, 27 Mar 1995 \nAuthor: Jim Graham \nA (not yet) Context Sensitive L-System production rule. \nThis class encapsulates a production rule for a Context Sensitive\n L-System \n(pred, succ, lContext, rContext). The matches() method, however, does not \n(yet) verify the lContext and rContext parts of the rule."; - } + @Override + public String getAppletInfo() { + return "Title: CLSFractal 1.1f, 27 Mar 1995 \nAuthor: Jim Graham \nA " + + "(not yet) Context Sensitive L-System production rule. \n" + + "This class encapsulates a production rule for a Context " + + "Sensitive\n L-System \n(pred, succ, lContext, rContext)." + + " The matches() method, however, does not \n(yet) verify " + + "the lContext and rContext parts of the rule."; + } - public String[][] getParameterInfo() { - String[][] info = { - {"level", "int", "Maximum number of recursions. Default is 1."}, - {"incremental","boolean","Whether or not to repaint between recursions. Default is true."}, - {"delay","integer","Sets delay between repaints. Default is 50."}, - {"startAngle","float","Sets the starting angle. Default is 0."}, - {"rotAngle","float","Sets the rotation angle. Default is 45."}, - {"border","integer","Width of border. Default is 2."}, - {"normalizeScale","boolean","Whether or not to normalize the scaling. Default is true."}, - {"pred","String","Initializes the rules for Context Sensitive L-Systems."}, - {"succ","String","Initializes the rules for Context Sensitive L-Systems."}, - {"lContext","String","Initializes the rules for Context Sensitive L-Systems."}, - {"rContext","String","Initializes the rules for Context Sensitive L-Systems."} - }; - return info; - } + @Override + public String[][] getParameterInfo() { + String[][] info = { + { "level", "int", "Maximum number of recursions. Default is 1." }, + { "incremental", "boolean", "Whether or not to repaint between " + + "recursions. Default is true." }, + { "delay", "integer", "Sets delay between repaints. Default is 50." }, + { "startAngle", "float", "Sets the starting angle. Default is 0." }, + { "rotAngle", "float", "Sets the rotation angle. Default is 45." }, + { "border", "integer", "Width of border. Default is 2." }, + { "normalizeScale", "boolean", "Whether or not to normalize " + + "the scaling. Default is true." }, + { "pred", "String", + "Initializes the rules for Context Sensitive L-Systems." }, + { "succ", "String", + "Initializes the rules for Context Sensitive L-Systems." }, + { "lContext", "String", + "Initializes the rules for Context Sensitive L-Systems." }, + { "rContext", "String", + "Initializes the rules for Context Sensitive L-Systems." } + }; + return info; + } } + /** * A Logo turtle class designed to support Context sensitive L-Systems. * @@ -271,6 +321,7 @@ public class CLSFractal * @author Jim Graham */ class CLSTurtle { + float angle; float X; float Y; @@ -280,7 +331,7 @@ class CLSTurtle { int yoff; public CLSTurtle(float ang, float x, float y, - int xorg, int yorg, float sx, float sy) { + int xorg, int yorg, float sx, float sy) { angle = ang; scaleX = sx; scaleY = sy; @@ -313,12 +364,13 @@ class CLSTurtle { float x = X + (float) Math.cos(angle) * scaleX; float y = Y + (float) Math.sin(angle) * scaleY; g.drawLine((int) X + xoff, (int) Y + yoff, - (int) x + xoff, (int) y + yoff); + (int) x + xoff, (int) y + yoff); X = x; Y = y; } } + /** * A (non-)Context sensitive L-System class. * @@ -330,22 +382,23 @@ class CLSTurtle { * @author Jim Graham */ class ContextLSystem { + String axiom; - Vector rules = new Vector(); + List rules = new ArrayList(); int level; public ContextLSystem(java.applet.Applet app) { axiom = app.getParameter("axiom"); int num = 1; while (true) { - String pred = app.getParameter("pred"+num); - String succ = app.getParameter("succ"+num); + String pred = app.getParameter("pred" + num); + String succ = app.getParameter("succ" + num); if (pred == null || succ == null) { break; } - rules.addElement(new CLSRule(pred, succ, - app.getParameter("lContext"+num), - app.getParameter("rContext"+num))); + rules.add(new CLSRule(pred, succ, + app.getParameter("lContext" + num), + app.getParameter("rContext" + num))); num++; } currentPath = new StringBuffer(axiom); @@ -355,7 +408,6 @@ class ContextLSystem { public int getLevel() { return level; } - StringBuffer currentPath; public synchronized String getPath() { @@ -385,7 +437,7 @@ class ContextLSystem { public CLSRule findRule(int pos) { for (int i = 0; i < rules.size(); i++) { - CLSRule rule = (CLSRule) rules.elementAt(i); + CLSRule rule = rules.get(i); if (rule.matches(currentPath, pos)) { return rule; } @@ -394,6 +446,7 @@ class ContextLSystem { } } + /** * A Context sensitive L-System production rule. * @@ -405,6 +458,7 @@ class ContextLSystem { * @author Jim Graham */ class CLSRule { + String pred; String succ; String lContext; diff --git a/jdk/src/share/demo/applets/Fractal/example1.html b/jdk/src/share/demo/applets/Fractal/example1.html index ac6aab9ad64..12d49e03217 100644 --- a/jdk/src/share/demo/applets/Fractal/example1.html +++ b/jdk/src/share/demo/applets/Fractal/example1.html @@ -5,7 +5,7 @@

Fractals 1.1


- + From 3ecb9f51dfc9fdd06499f59452c3b093c316bec9 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Wed, 30 Mar 2011 12:08:49 -0700 Subject: [PATCH 093/168] 7029152: Ideal nodes for String intrinsics miss memory edge optimization In Ideal() method of String intrinsics nodes look for TypeAryPtr::CHARS memory slice if memory is MergeMem. Do not unroll a loop with String intrinsics code. Reviewed-by: never --- hotspot/src/share/vm/opto/loopTransform.cpp | 79 ++++++++++++++------- hotspot/src/share/vm/opto/memnode.cpp | 54 ++++---------- hotspot/src/share/vm/opto/memnode.hpp | 72 ++++++++++--------- hotspot/test/compiler/7029152/Test.java | 49 +++++++++++++ 4 files changed, 151 insertions(+), 103 deletions(-) create mode 100644 hotspot/test/compiler/7029152/Test.java diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index ce4a028058a..e386dcd59d8 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -396,16 +396,16 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) { // Return exact loop trip count, or 0 if not maximally unrolling bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const { CountedLoopNode *cl = _head->as_CountedLoop(); - assert( cl->is_normal_loop(), "" ); + assert(cl->is_normal_loop(), ""); Node *init_n = cl->init_trip(); Node *limit_n = cl->limit(); // Non-constant bounds - if( init_n == NULL || !init_n->is_Con() || + if (init_n == NULL || !init_n->is_Con() || limit_n == NULL || !limit_n->is_Con() || // protect against stride not being a constant - !cl->stride_is_con() ) { + !cl->stride_is_con()) { return false; } int init = init_n->get_int(); @@ -428,7 +428,25 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const { uint unroll_limit = (uint)LoopUnrollLimit * 4; assert( (intx)unroll_limit == LoopUnrollLimit * 4, "LoopUnrollLimit must fit in 32bits"); cl->set_trip_count(trip_count); - if( trip_count <= unroll_limit && body_size <= unroll_limit ) { + if (trip_count > unroll_limit || body_size > unroll_limit) { + return false; + } + + // Do not unroll a loop with String intrinsics code. + // String intrinsics are large and have loops. + for (uint k = 0; k < _body.size(); k++) { + Node* n = _body.at(k); + switch (n->Opcode()) { + case Op_StrComp: + case Op_StrEquals: + case Op_StrIndexOf: + case Op_AryEq: { + return false; + } + } // switch + } + + if (body_size <= unroll_limit) { uint new_body_size = body_size * trip_count; if (new_body_size <= unroll_limit && body_size == new_body_size / trip_count && @@ -448,13 +466,13 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const { bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { CountedLoopNode *cl = _head->as_CountedLoop(); - assert( cl->is_normal_loop() || cl->is_main_loop(), "" ); + assert(cl->is_normal_loop() || cl->is_main_loop(), ""); // protect against stride not being a constant - if( !cl->stride_is_con() ) return false; + if (!cl->stride_is_con()) return false; // protect against over-unrolling - if( cl->trip_count() <= 1 ) return false; + if (cl->trip_count() <= 1) return false; int future_unroll_ct = cl->unrolled_count() * 2; @@ -485,21 +503,21 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { // Non-constant bounds. // Protect against over-unrolling when init or/and limit are not constant // (so that trip_count's init value is maxint) but iv range is known. - if( init_n == NULL || !init_n->is_Con() || - limit_n == NULL || !limit_n->is_Con() ) { + if (init_n == NULL || !init_n->is_Con() || + limit_n == NULL || !limit_n->is_Con()) { Node* phi = cl->phi(); - if( phi != NULL ) { + if (phi != NULL) { assert(phi->is_Phi() && phi->in(0) == _head, "Counted loop should have iv phi."); const TypeInt* iv_type = phase->_igvn.type(phi)->is_int(); int next_stride = cl->stride_con() * 2; // stride after this unroll - if( next_stride > 0 ) { - if( iv_type->_lo + next_stride <= iv_type->_lo || // overflow - iv_type->_lo + next_stride > iv_type->_hi ) { + if (next_stride > 0) { + if (iv_type->_lo + next_stride <= iv_type->_lo || // overflow + iv_type->_lo + next_stride > iv_type->_hi) { return false; // over-unrolling } - } else if( next_stride < 0 ) { - if( iv_type->_hi + next_stride >= iv_type->_hi || // overflow - iv_type->_hi + next_stride < iv_type->_lo ) { + } else if (next_stride < 0) { + if (iv_type->_hi + next_stride >= iv_type->_hi || // overflow + iv_type->_hi + next_stride < iv_type->_lo) { return false; // over-unrolling } } @@ -511,24 +529,33 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { // Key test to unroll CaffeineMark's Logic test int xors_in_loop = 0; // Also count ModL, DivL and MulL which expand mightly - for( uint k = 0; k < _body.size(); k++ ) { - switch( _body.at(k)->Opcode() ) { - case Op_XorI: xors_in_loop++; break; // CaffeineMark's Logic test - case Op_ModL: body_size += 30; break; - case Op_DivL: body_size += 30; break; - case Op_MulL: body_size += 10; break; - } + for (uint k = 0; k < _body.size(); k++) { + Node* n = _body.at(k); + switch (n->Opcode()) { + case Op_XorI: xors_in_loop++; break; // CaffeineMark's Logic test + case Op_ModL: body_size += 30; break; + case Op_DivL: body_size += 30; break; + case Op_MulL: body_size += 10; break; + case Op_StrComp: + case Op_StrEquals: + case Op_StrIndexOf: + case Op_AryEq: { + // Do not unroll a loop with String intrinsics code. + // String intrinsics are large and have loops. + return false; + } + } // switch } // Check for being too big - if( body_size > (uint)LoopUnrollLimit ) { - if( xors_in_loop >= 4 && body_size < (uint)LoopUnrollLimit*4) return true; + if (body_size > (uint)LoopUnrollLimit) { + if (xors_in_loop >= 4 && body_size < (uint)LoopUnrollLimit*4) return true; // Normal case: loop too big return false; } // Check for stride being a small enough constant - if( abs(cl->stride_con()) > (1<<3) ) return false; + if (abs(cl->stride_con()) > (1<<3)) return false; // Unroll once! (Each trip will soon do double iterations) return true; diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index b9ff98ff76d..4c6878d3f6d 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -2617,54 +2617,24 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, } //============================================================================= -// Do we match on this edge? No memory edges -uint StrCompNode::match_edge(uint idx) const { - return idx == 2 || idx == 3; // StrComp (Binary str1 cnt1) (Binary str2 cnt2) +// Do not match memory edge. +uint StrIntrinsicNode::match_edge(uint idx) const { + return idx == 2 || idx == 3; } //------------------------------Ideal------------------------------------------ // Return a node which is more "ideal" than the current node. Strip out // control copies -Node *StrCompNode::Ideal(PhaseGVN *phase, bool can_reshape){ - return remove_dead_region(phase, can_reshape) ? this : NULL; -} +Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) { + if (remove_dead_region(phase, can_reshape)) return this; -//============================================================================= -// Do we match on this edge? No memory edges -uint StrEqualsNode::match_edge(uint idx) const { - return idx == 2 || idx == 3; // StrEquals (Binary str1 str2) cnt -} - -//------------------------------Ideal------------------------------------------ -// Return a node which is more "ideal" than the current node. Strip out -// control copies -Node *StrEqualsNode::Ideal(PhaseGVN *phase, bool can_reshape){ - return remove_dead_region(phase, can_reshape) ? this : NULL; -} - -//============================================================================= -// Do we match on this edge? No memory edges -uint StrIndexOfNode::match_edge(uint idx) const { - return idx == 2 || idx == 3; // StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2) -} - -//------------------------------Ideal------------------------------------------ -// Return a node which is more "ideal" than the current node. Strip out -// control copies -Node *StrIndexOfNode::Ideal(PhaseGVN *phase, bool can_reshape){ - return remove_dead_region(phase, can_reshape) ? this : NULL; -} - -//============================================================================= -// Do we match on this edge? No memory edges -uint AryEqNode::match_edge(uint idx) const { - return idx == 2 || idx == 3; // StrEquals ary1 ary2 -} -//------------------------------Ideal------------------------------------------ -// Return a node which is more "ideal" than the current node. Strip out -// control copies -Node *AryEqNode::Ideal(PhaseGVN *phase, bool can_reshape){ - return remove_dead_region(phase, can_reshape) ? this : NULL; + Node* mem = phase->transform(in(MemNode::Memory)); + // If transformed to a MergeMem, get the desired slice + uint alias_idx = phase->C->get_alias_index(adr_type()); + mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem; + if (mem != in(MemNode::Memory)) + set_req(MemNode::Memory, mem); + return NULL; } //============================================================================= diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp index dec1b0ab1fb..0c072fc211a 100644 --- a/hotspot/src/share/vm/opto/memnode.hpp +++ b/hotspot/src/share/vm/opto/memnode.hpp @@ -776,67 +776,69 @@ public: static bool step_through(Node** np, uint instance_id, PhaseTransform* phase); }; -//------------------------------StrComp------------------------------------- -class StrCompNode: public Node { +//------------------------------StrIntrinsic------------------------------- +// Base class for Ideal nodes used in String instrinsic code. +class StrIntrinsicNode: public Node { public: - StrCompNode(Node* control, Node* char_array_mem, - Node* s1, Node* c1, - Node* s2, Node* c2): Node(control, char_array_mem, - s1, c1, - s2, c2) {}; - virtual int Opcode() const; + StrIntrinsicNode(Node* control, Node* char_array_mem, + Node* s1, Node* c1, Node* s2, Node* c2): + Node(control, char_array_mem, s1, c1, s2, c2) { + } + + StrIntrinsicNode(Node* control, Node* char_array_mem, + Node* s1, Node* s2, Node* c): + Node(control, char_array_mem, s1, s2, c) { + } + + StrIntrinsicNode(Node* control, Node* char_array_mem, + Node* s1, Node* s2): + Node(control, char_array_mem, s1, s2) { + } + virtual bool depends_only_on_test() const { return false; } - virtual const Type* bottom_type() const { return TypeInt::INT; } virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; } virtual uint match_edge(uint idx) const; virtual uint ideal_reg() const { return Op_RegI; } virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); }; +//------------------------------StrComp------------------------------------- +class StrCompNode: public StrIntrinsicNode { +public: + StrCompNode(Node* control, Node* char_array_mem, + Node* s1, Node* c1, Node* s2, Node* c2): + StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {}; + virtual int Opcode() const; + virtual const Type* bottom_type() const { return TypeInt::INT; } +}; + //------------------------------StrEquals------------------------------------- -class StrEqualsNode: public Node { +class StrEqualsNode: public StrIntrinsicNode { public: StrEqualsNode(Node* control, Node* char_array_mem, - Node* s1, Node* s2, Node* c): Node(control, char_array_mem, - s1, s2, c) {}; + Node* s1, Node* s2, Node* c): + StrIntrinsicNode(control, char_array_mem, s1, s2, c) {}; virtual int Opcode() const; - virtual bool depends_only_on_test() const { return false; } virtual const Type* bottom_type() const { return TypeInt::BOOL; } - virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; } - virtual uint match_edge(uint idx) const; - virtual uint ideal_reg() const { return Op_RegI; } - virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); }; //------------------------------StrIndexOf------------------------------------- -class StrIndexOfNode: public Node { +class StrIndexOfNode: public StrIntrinsicNode { public: StrIndexOfNode(Node* control, Node* char_array_mem, - Node* s1, Node* c1, - Node* s2, Node* c2): Node(control, char_array_mem, - s1, c1, - s2, c2) {}; + Node* s1, Node* c1, Node* s2, Node* c2): + StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {}; virtual int Opcode() const; - virtual bool depends_only_on_test() const { return false; } virtual const Type* bottom_type() const { return TypeInt::INT; } - virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; } - virtual uint match_edge(uint idx) const; - virtual uint ideal_reg() const { return Op_RegI; } - virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); }; //------------------------------AryEq--------------------------------------- -class AryEqNode: public Node { +class AryEqNode: public StrIntrinsicNode { public: - AryEqNode(Node* control, Node* char_array_mem, - Node* s1, Node* s2): Node(control, char_array_mem, s1, s2) {}; + AryEqNode(Node* control, Node* char_array_mem, Node* s1, Node* s2): + StrIntrinsicNode(control, char_array_mem, s1, s2) {}; virtual int Opcode() const; - virtual bool depends_only_on_test() const { return false; } virtual const Type* bottom_type() const { return TypeInt::BOOL; } - virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; } - virtual uint match_edge(uint idx) const; - virtual uint ideal_reg() const { return Op_RegI; } - virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); }; //------------------------------MemBar----------------------------------------- diff --git a/hotspot/test/compiler/7029152/Test.java b/hotspot/test/compiler/7029152/Test.java new file mode 100644 index 00000000000..edc7fd9432b --- /dev/null +++ b/hotspot/test/compiler/7029152/Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7029152 + * @summary Ideal nodes for String intrinsics miss memory edge optimization + * + * @run main/othervm -Xbatch Test + */ + +public class Test { + + static final String str = "11111xx11111xx1x"; + static int idx = 0; + + static int IndexOfTest(String str) { + return str.indexOf("11111xx1x"); + } + + public static void main(String args[]) { + final int ITERS=2000000; + + for (int i=0; iinvocation_count(); reset_counter_for_invocation_event(m); const char* comment = "count"; @@ -413,8 +411,6 @@ void SimpleCompPolicy::method_invocation_event( methodHandle m, TRAPS) { } void SimpleCompPolicy::method_back_branch_event(methodHandle m, int bci, TRAPS) { - assert(UseCompiler || CompileTheWorld, "UseCompiler should be set by now."); - int hot_count = m->backedge_count(); const char* comment = "backedge_count"; @@ -432,8 +428,6 @@ const char* StackWalkCompPolicy::_msg = NULL; // Consider m for compilation void StackWalkCompPolicy::method_invocation_event(methodHandle m, TRAPS) { - assert(UseCompiler || CompileTheWorld, "UseCompiler should be set by now."); - int hot_count = m->invocation_count(); reset_counter_for_invocation_event(m); const char* comment = "count"; @@ -473,8 +467,6 @@ void StackWalkCompPolicy::method_invocation_event(methodHandle m, TRAPS) { } void StackWalkCompPolicy::method_back_branch_event(methodHandle m, int bci, TRAPS) { - assert(UseCompiler || CompileTheWorld, "UseCompiler should be set by now."); - int hot_count = m->backedge_count(); const char* comment = "backedge_count"; From 7fbd44488376d697a361aa56630304ff030f8557 Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Wed, 30 Mar 2011 15:52:32 -0700 Subject: [PATCH 095/168] 7027693: /jfc/CodePointIM demo needs to be improved Reviewed-by: alexp --- .../demo/jfc/CodePointIM/CodePointIM.java | 14 +-- .../jfc/CodePointIM/CodePointInputMethod.java | 107 ++++++++---------- .../CodePointInputMethodDescriptor.java | 14 +-- 3 files changed, 63 insertions(+), 72 deletions(-) diff --git a/jdk/src/share/demo/jfc/CodePointIM/CodePointIM.java b/jdk/src/share/demo/jfc/CodePointIM/CodePointIM.java index 61542daefcc..6d02ecdc9f2 100644 --- a/jdk/src/share/demo/jfc/CodePointIM/CodePointIM.java +++ b/jdk/src/share/demo/jfc/CodePointIM/CodePointIM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,12 +29,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ + import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; + public class CodePointIM { // Actually, the main method is not required for InputMethod. @@ -42,11 +42,11 @@ public class CodePointIM { // not correct and encourage their reading README.txt. public static void main(String[] args) { try { - ResourceBundle resource = ResourceBundle.getBundle("resources.codepoint", - Locale.getDefault()); + ResourceBundle resource = ResourceBundle.getBundle( + "resources.codepoint", + Locale.getDefault()); System.err.println(resource.getString("warning")); - } - catch (MissingResourceException e) { + } catch (MissingResourceException e) { System.err.println(e.toString()); } diff --git a/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethod.java b/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethod.java index ff7a5769de7..67ff106c682 100644 --- a/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethod.java +++ b/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,13 +28,8 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -/* - */ - package com.sun.inputmethods.internal.codepointim; -import java.text.AttributedCharacterIterator; -import java.util.Map; + import java.awt.AWTEvent; import java.awt.Toolkit; @@ -50,6 +45,7 @@ import java.io.IOException; import java.text.AttributedString; import java.util.Locale; + /** * The Code Point Input Method is a simple input method that allows Unicode * characters to be entered using their code point or code unit values. See the @@ -59,18 +55,16 @@ import java.util.Locale; */ public class CodePointInputMethod implements InputMethod { - private static final int UNSET = 0; - private static final int ESCAPE = 1; // \u0000 - \uFFFF - private static final int SPECIAL_ESCAPE = 2; // \U000000 - \U10FFFF - private static final int SURROGATE_PAIR = 3; // \uD800\uDC00 - \uDBFF\uDFFF - + private static final int UNSET = 0; + private static final int ESCAPE = 1; // \u0000 - \uFFFF + private static final int SPECIAL_ESCAPE = 2; // \U000000 - \U10FFFF + private static final int SURROGATE_PAIR = 3; // \uD800\uDC00 - \uDBFF\uDFFF private InputMethodContext context; private Locale locale; private StringBuffer buffer; private int insertionPoint; private int format = UNSET; - public CodePointInputMethod() throws IOException { } @@ -90,7 +84,7 @@ public class CodePointInputMethod implements InputMethod { if (eventID == KeyEvent.KEY_PRESSED) { // If we are not in composition mode, pass through - if (notInCompositionMode) { + if (notInCompositionMode) { return; } @@ -106,7 +100,7 @@ public class CodePointInputMethod implements InputMethod { char c = e.getKeyChar(); // If we are not in composition mode, wait a back slash - if (notInCompositionMode) { + if (notInCompositionMode) { // If the type character is not a back slash, pass through if (c != '\\') { return; @@ -115,30 +109,30 @@ public class CodePointInputMethod implements InputMethod { startComposition(); // Enter to composition mode } else { switch (c) { - case ' ': // Exit from composition mode - finishComposition(); - break; - case '\u007f': // Delete - deleteCharacter(); - break; - case '\b': // BackSpace - deletePreviousCharacter(); - break; - case '\u001b': // Escape - cancelComposition(); - break; - case '\n': // Return - case '\t': // Tab - sendCommittedText(); - break; - default: - composeUnicodeEscape(c); - break; + case ' ': // Exit from composition mode + finishComposition(); + break; + case '\u007f': // Delete + deleteCharacter(); + break; + case '\b': // BackSpace + deletePreviousCharacter(); + break; + case '\u001b': // Escape + cancelComposition(); + break; + case '\n': // Return + case '\t': // Tab + sendCommittedText(); + break; + default: + composeUnicodeEscape(c); + break; } } } else { // KeyEvent.KEY_RELEASED // If we are not in composition mode, pass through - if (notInCompositionMode) { + if (notInCompositionMode) { return; } } @@ -148,7 +142,7 @@ public class CodePointInputMethod implements InputMethod { private void composeUnicodeEscape(char c) { switch (buffer.length()) { - case 1: // \\ + case 1: // \\ waitEscapeCharacter(c); break; case 2: // \\u or \\U @@ -221,7 +215,7 @@ public class CodePointInputMethod implements InputMethod { private void waitDigit2(char c) { if (Character.digit(c, 16) != -1) { buffer.insert(insertionPoint++, c); - char codePoint = (char)getCodePoint(buffer, 2, 5); + char codePoint = (char) getCodePoint(buffer, 2, 5); if (Character.isHighSurrogate(codePoint)) { format = SURROGATE_PAIR; buffer.append("\\u"); @@ -261,11 +255,11 @@ public class CodePointInputMethod implements InputMethod { private void sendComposedText() { AttributedString as = new AttributedString(buffer.toString()); as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT, - InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT); + InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT); context.dispatchInputMethodEvent( - InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, - as.getIterator(), 0, - TextHitInfo.leading(insertionPoint), null); + InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, + as.getIterator(), 0, + TextHitInfo.leading(insertionPoint), null); } /** @@ -274,9 +268,9 @@ public class CodePointInputMethod implements InputMethod { private void sendCommittedText() { AttributedString as = new AttributedString(buffer.toString()); context.dispatchInputMethodEvent( - InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, - as.getIterator(), buffer.length(), - TextHitInfo.leading(insertionPoint), null); + InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, + as.getIterator(), buffer.length(), + TextHitInfo.leading(insertionPoint), null); buffer.setLength(0); insertionPoint = 0; @@ -298,9 +292,9 @@ public class CodePointInputMethod implements InputMethod { } context.dispatchInputMethodEvent( - InputMethodEvent.CARET_POSITION_CHANGED, - null, 0, - TextHitInfo.leading(insertionPoint), null); + InputMethodEvent.CARET_POSITION_CHANGED, + null, 0, + TextHitInfo.leading(insertionPoint), null); } /** @@ -314,9 +308,9 @@ public class CodePointInputMethod implements InputMethod { } context.dispatchInputMethodEvent( - InputMethodEvent.CARET_POSITION_CHANGED, - null, 0, - TextHitInfo.leading(insertionPoint), null); + InputMethodEvent.CARET_POSITION_CHANGED, + null, 0, + TextHitInfo.leading(insertionPoint), null); } /** @@ -383,7 +377,7 @@ public class CodePointInputMethod implements InputMethod { private void finishComposition() { int len = buffer.length(); if (len == 6 && format != SPECIAL_ESCAPE) { - char codePoint = (char)getCodePoint(buffer, 2, 5); + char codePoint = (char) getCodePoint(buffer, 2, 5); if (Character.isValidCodePoint(codePoint) && codePoint != 0xFFFF) { buffer.setLength(0); buffer.append(codePoint); @@ -400,11 +394,11 @@ public class CodePointInputMethod implements InputMethod { } } else if (len == 12 && format == SURROGATE_PAIR) { char[] codePoint = { - (char)getCodePoint(buffer, 2, 5), - (char)getCodePoint(buffer, 8, 11) + (char) getCodePoint(buffer, 2, 5), + (char) getCodePoint(buffer, 8, 11) }; - if (Character.isHighSurrogate(codePoint[0]) && - Character.isLowSurrogate(codePoint[1])) { + if (Character.isHighSurrogate(codePoint[0]) && Character. + isLowSurrogate(codePoint[1])) { buffer.setLength(0); buffer.append(codePoint); sendCommittedText(); @@ -418,7 +412,7 @@ public class CodePointInputMethod implements InputMethod { private int getCodePoint(StringBuffer sb, int from, int to) { int value = 0; for (int i = from; i <= to; i++) { - value = (value<<4) + Character.digit(sb.charAt(i), 16); + value = (value << 4) + Character.digit(sb.charAt(i), 16); } return value; } @@ -427,7 +421,6 @@ public class CodePointInputMethod implements InputMethod { Toolkit.getDefaultToolkit().beep(); } - public void activate() { if (buffer == null) { buffer = new StringBuffer(12); diff --git a/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethodDescriptor.java b/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethodDescriptor.java index 812e51eff00..1ee62162b18 100644 --- a/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethodDescriptor.java +++ b/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethodDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,17 +28,15 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -/* - */ - package com.sun.inputmethods.internal.codepointim; + import java.awt.Image; import java.awt.im.spi.InputMethodDescriptor; import java.awt.im.spi.InputMethod; import java.util.Locale; + /** * The CodePointInputMethod is a simple input method that allows Unicode * characters to be entered via their hexadecimal code point values. @@ -68,12 +66,12 @@ public class CodePointInputMethodDescriptor implements InputMethodDescriptor { */ public Locale[] getAvailableLocales() { Locale[] locales = { - new Locale("","",""), - }; + new Locale("", "", ""), }; return locales; } - public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) { + public synchronized String getInputMethodDisplayName(Locale inputLocale, + Locale displayLanguage) { return "CodePoint Input Method"; } From ce0e6ca247ae874f98253197bc2f593ccec0ee76 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 30 Mar 2011 18:18:11 -0700 Subject: [PATCH 096/168] 7031108: NPE in javac.jvm.ClassReader.findMethod in PackageElement.enclosedElements from AP in incr build Reviewed-by: darcy, mcimadamore --- .../com/sun/tools/javac/jvm/ClassReader.java | 3 + .../JavacProcessingEnvironment.java | 4 + .../tools/javac/resources/compiler.properties | 13 +- .../tools/javac/classreader/T7031108.java | 149 ++++++++++++++++++ .../tools/javac/diags/examples.not-yet.txt | 2 + 5 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/classreader/T7031108.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java index e4d3de8e6c9..3fbdc2eb77d 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -1162,6 +1162,9 @@ public class ClassReader implements Completer { ClassSymbol c = readClassSymbol(nextChar()); NameAndType nt = (NameAndType)readPool(nextChar()); + if (c.members_field == null) + throw badClassFile("bad.enclosing.class", self, c); + MethodSymbol m = findMethod(nt, c.members_field, self.flags()); if (nt != null && m == null) throw badClassFile("bad.enclosing.method", self); diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index bf70ee2f64d..00ad62362e7 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -58,6 +58,7 @@ import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.file.FSInfo; import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.jvm.*; +import com.sun.tools.javac.jvm.ClassReader.BadClassFile; import com.sun.tools.javac.main.JavaCompiler; import com.sun.tools.javac.main.JavaCompiler.CompileState; import com.sun.tools.javac.model.JavacElements; @@ -790,6 +791,9 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea RoundEnvironment renv) { try { return proc.process(tes, renv); + } catch (BadClassFile ex) { + log.error("proc.cant.access.1", ex.sym, ex.getDetailValue()); + return false; } catch (CompletionFailure ex) { StringWriter out = new StringWriter(); ex.printStackTrace(new PrintWriter(out)); diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties index 62a493320f6..3aa5a4331cb 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -611,12 +611,18 @@ compiler.err.warnings.and.werror=\ # Errors related to annotation processing +# 0: symbol, 1: string, 2: stack-trace compiler.err.proc.cant.access=\ cannot access {0}\n\ {1}\n\ Consult the following stack trace for details.\n\ {2} +# 0: symbol, 1: string +compiler.err.proc.cant.access.1=\ + cannot access {0}\n\ + {1} + # 0: string compiler.err.proc.cant.find.class=\ Could not find class file for ''{0}''. @@ -1424,8 +1430,13 @@ compiler.misc.bad.source.file.header=\ compiler.misc.bad.class.signature=\ bad class signature: {0} +#0: symbol, 1: symbol +compiler.misc.bad.enclosing.class=\ + bad enclosing class for {0}: {1} + +# 0: symbol compiler.misc.bad.enclosing.method=\ - bad enclosing method attribute: {0} + bad enclosing method attribute for class {0} compiler.misc.bad.runtime.invisible.param.annotations=\ bad RuntimeInvisibleParameterAnnotations attribute: {0} diff --git a/langtools/test/tools/javac/classreader/T7031108.java b/langtools/test/tools/javac/classreader/T7031108.java new file mode 100644 index 00000000000..51a58ffe61c --- /dev/null +++ b/langtools/test/tools/javac/classreader/T7031108.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7031108 + * @summary NPE in javac.jvm.ClassReader.findMethod in PackageElement.enclosedElements from AP in incr build + * @library ../lib + * @build JavacTestingAbstractProcessor T7031108 + * @run main T7031108 + */ + +import java.io.*; +import java.net.*; +import java.util.*; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import javax.tools.*; +import javax.tools.JavaCompiler.CompilationTask; + +public class T7031108 extends JavacTestingAbstractProcessor { + public static void main(String... args) throws Exception { + new T7031108().run(); + } + + /* Class containing a local class definition; + * compiled class file will have an EnclosedMethod attribute. + */ + static final JavaSource pC = + new JavaSource("p/C.java", + "package p;\n" + + "class C {\n" + + " void m() {\n" + + " new Runnable() {\n" + + " public void run() {\n" + + " new Runnable() {\n" + + " public void run() { }\n" + + " };\n" + + " }\n" + + " };\n" + + " }\n" + + "}"); + + /* Dummy source file to compile while running anno processor. */ + static final JavaSource dummy = + new JavaSource("Dummy.java", + "class Dummy { }"); + + void run() throws Exception { + JavaCompiler comp = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null); + + // step 1: compile test classes + File cwd = new File("."); + fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(cwd)); + compile(comp, fm, null, null, pC); + + // step 2: verify functioning of processor + fm.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, + fm.getLocation(StandardLocation.CLASS_PATH)); + fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(cwd)); + compile(comp, fm, null, getClass().getName(), dummy); + + File pC_class = new File(new File("p"), "C.class"); + pC_class.delete(); + + DiagnosticCollector dc = new DiagnosticCollector(); + compile(comp, fm, dc, getClass().getName(), dummy); + List> diags =dc.getDiagnostics(); + + System.err.println(diags); + switch (diags.size()) { + case 0: + throw new Exception("no diagnostics received"); + case 1: + String code = diags.get(0).getCode(); + String expect = "compiler.err.proc.cant.access.1"; + if (!expect.equals(code)) + throw new Exception("unexpected diag code: " + code + + ", expected: " + expect); + break; + default: + throw new Exception("unexpected diags received"); + } + } + + void compile(JavaCompiler comp, JavaFileManager fm, + DiagnosticListener dl, + String processor, JavaFileObject... files) throws Exception { + System.err.println("compile processor:" + processor + ", files:" + Arrays.asList(files)); + List opts = new ArrayList(); + if (processor != null) { + // opts.add("-verbose"); + opts.addAll(Arrays.asList("-processor", processor)); + } + CompilationTask task = comp.getTask(null, fm, dl, opts, null, Arrays.asList(files)); + boolean ok = task.call(); + if (dl == null && !ok) + throw new Exception("compilation failed"); + } + + static class JavaSource extends SimpleJavaFileObject { + JavaSource(String name, String text) { + super(URI.create("js://" + name), JavaFileObject.Kind.SOURCE); + this.text = text; + } + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return text; + } + final String text; + } + + // annotation processor method + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + PackageElement p = elements.getPackageElement("p"); + List elems = p.getEnclosedElements(); + System.err.println("contents of package p: " + elems); + if (elems.size() != 1 || !elems.get(0).getSimpleName().contentEquals("C")) { + messager.printMessage(Diagnostic.Kind.ERROR, "unexpected package contents"); + } + } + return true; + } +} + diff --git a/langtools/test/tools/javac/diags/examples.not-yet.txt b/langtools/test/tools/javac/diags/examples.not-yet.txt index 4604743bdd2..0395228f32c 100644 --- a/langtools/test/tools/javac/diags/examples.not-yet.txt +++ b/langtools/test/tools/javac/diags/examples.not-yet.txt @@ -27,6 +27,7 @@ compiler.err.not.annotation.type # cannot occur given pre compiler.err.prob.found.req.1 # Check: DEAD, in unused method compiler.err.proc.bad.config.file # JavacProcessingEnvironment compiler.err.proc.cant.access # completion failure +compiler.err.proc.cant.access.1 # completion failure, no stack trace compiler.err.proc.cant.create.loader # security exception from service loader compiler.err.proc.no.service # JavacProcessingEnvironment: no service loader available compiler.err.proc.processor.bad.option.name # cannot happen? masked by javac.err.invalid.A.key @@ -49,6 +50,7 @@ compiler.misc.bad.class.file.header # bad class file compiler.misc.bad.class.signature # bad class file compiler.misc.bad.const.pool.tag # bad class file compiler.misc.bad.const.pool.tag.at # bad class file +compiler.misc.bad.enclosing.class # bad class file compiler.misc.bad.enclosing.method # bad class file compiler.misc.bad.runtime.invisible.param.annotations # bad class file compiler.misc.bad.signature # bad class file From cd57e9960f0047147cc61c5e8ceaf2f27bb64026 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 30 Mar 2011 18:32:16 -0700 Subject: [PATCH 097/168] 7031005: javap prints "extends java.lang.Object" Reviewed-by: mcimadamore --- .../classes/com/sun/tools/classfile/Type.java | 14 +- .../com/sun/tools/javap/ClassWriter.java | 144 +++++++++++++- .../test/tools/javap/6937244/T6937244A.java | 6 +- langtools/test/tools/javap/T4880663.java | 6 +- langtools/test/tools/javap/T4880672.java | 6 +- .../test/tools/javap/TestSuperclass.java | 178 ++++++++++++++++++ 6 files changed, 336 insertions(+), 18 deletions(-) create mode 100644 langtools/test/tools/javap/TestSuperclass.java diff --git a/langtools/src/share/classes/com/sun/tools/classfile/Type.java b/langtools/src/share/classes/com/sun/tools/classfile/Type.java index ded095b7e61..b0f23625706 100644 --- a/langtools/src/share/classes/com/sun/tools/classfile/Type.java +++ b/langtools/src/share/classes/com/sun/tools/classfile/Type.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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 @@ -41,6 +41,11 @@ import java.util.Set; */ public abstract class Type { protected Type() { } + + public boolean isObject() { + return false; + } + public abstract R accept(Visitor visitor, D data); protected static void append(StringBuilder sb, String prefix, List types, String suffix) { @@ -262,6 +267,13 @@ public abstract class Type { return sb.toString(); } + @Override + public boolean isObject() { + return (outerType == null) + && name.equals("java/lang/Object") + && (typeArgs == null || typeArgs.isEmpty()); + } + public final ClassType outerType; public final String name; public final List typeArgs; diff --git a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java index 1d92e711b06..331a7b9e955 100644 --- a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java +++ b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -48,6 +48,13 @@ import com.sun.tools.classfile.Signature; import com.sun.tools.classfile.Signature_attribute; import com.sun.tools.classfile.SourceFile_attribute; import com.sun.tools.classfile.Type; +import com.sun.tools.classfile.Type.ArrayType; +import com.sun.tools.classfile.Type.ClassSigType; +import com.sun.tools.classfile.Type.ClassType; +import com.sun.tools.classfile.Type.MethodType; +import com.sun.tools.classfile.Type.SimpleType; +import com.sun.tools.classfile.Type.TypeParamType; +import com.sun.tools.classfile.Type.WildcardType; import static com.sun.tools.classfile.AccessFlags.*; @@ -166,8 +173,10 @@ public class ClassWriter extends BasicWriter { // use info from class file header if (classFile.isClass() && classFile.super_class != 0 ) { String sn = getJavaSuperclassName(cf); - print(" extends "); - print(sn); + if (!sn.equals("java.lang.Object")) { + print(" extends "); + print(sn); + } } for (int i = 0; i < classFile.interfaces.length; i++) { print(i == 0 ? (classFile.isClass() ? " implements " : " extends ") : ","); @@ -176,13 +185,14 @@ public class ClassWriter extends BasicWriter { } else { try { Type t = sigAttr.getParsedSignature().getType(constant_pool); + JavaTypePrinter p = new JavaTypePrinter(classFile.isInterface()); // The signature parser cannot disambiguate between a // FieldType and a ClassSignatureType that only contains a superclass type. - if (t instanceof Type.ClassSigType) - print(getJavaName(t.toString())); - else { + if (t instanceof Type.ClassSigType) { + print(p.print(t)); + } else if (options.verbose || !t.isObject()) { print(" extends "); - print(getJavaName(t.toString())); + print(p.print(t)); } } catch (ConstantPoolException e) { print(report(e)); @@ -210,6 +220,124 @@ public class ClassWriter extends BasicWriter { indent(-1); println("}"); } + // where + class JavaTypePrinter implements Type.Visitor { + boolean isInterface; + + JavaTypePrinter(boolean isInterface) { + this.isInterface = isInterface; + } + + String print(Type t) { + return t.accept(this, new StringBuilder()).toString(); + } + + public StringBuilder visitSimpleType(SimpleType type, StringBuilder sb) { + sb.append(getJavaName(type.name)); + return sb; + } + + public StringBuilder visitArrayType(ArrayType type, StringBuilder sb) { + append(sb, type.elemType); + sb.append("[]"); + return sb; + } + + public StringBuilder visitMethodType(MethodType type, StringBuilder sb) { + appendIfNotEmpty(sb, "<", type.typeParamTypes, "> "); + append(sb, type.returnType); + append(sb, " (", type.paramTypes, ")"); + appendIfNotEmpty(sb, " throws ", type.throwsTypes, ""); + return sb; + } + + public StringBuilder visitClassSigType(ClassSigType type, StringBuilder sb) { + appendIfNotEmpty(sb, "<", type.typeParamTypes, ">"); + if (isInterface) { + appendIfNotEmpty(sb, " extends ", type.superinterfaceTypes, ""); + } else { + if (type.superclassType != null + && (options.verbose || !type.superclassType.isObject())) { + sb.append(" extends "); + append(sb, type.superclassType); + } + appendIfNotEmpty(sb, " implements ", type.superinterfaceTypes, ""); + } + return sb; + } + + public StringBuilder visitClassType(ClassType type, StringBuilder sb) { + if (type.outerType != null) { + append(sb, type.outerType); + sb.append("."); + } + sb.append(getJavaName(type.name)); + appendIfNotEmpty(sb, "<", type.typeArgs, ">"); + return sb; + } + + public StringBuilder visitTypeParamType(TypeParamType type, StringBuilder sb) { + sb.append(type.name); + String sep = " extends "; + if (type.classBound != null + && (options.verbose || !type.classBound.isObject())) { + sb.append(sep); + append(sb, type.classBound); + sep = " & "; + } + if (type.interfaceBounds != null) { + for (Type bound: type.interfaceBounds) { + sb.append(sep); + append(sb, bound); + sep = " & "; + } + } + return sb; + } + + public StringBuilder visitWildcardType(WildcardType type, StringBuilder sb) { + switch (type.kind) { + case UNBOUNDED: + sb.append("?"); + break; + case EXTENDS: + sb.append("? extends "); + append(sb, type.boundType); + break; + case SUPER: + sb.append("? super "); + append(sb, type.boundType); + break; + default: + throw new AssertionError(); + } + return sb; + } + + private void append(StringBuilder sb, Type t) { + t.accept(this, sb); + } + + private void append(StringBuilder sb, String prefix, List list, String suffix) { + sb.append(prefix); + String sep = ""; + for (Type t: list) { + sb.append(sep); + append(sb, t); + sep = ", "; + } + sb.append(suffix); + } + + private void appendIfNotEmpty(StringBuilder sb, String prefix, List list, String suffix) { + if (!isEmpty(list)) + append(sb, prefix, list, suffix); + } + + private boolean isEmpty(List list) { + return (list == null || list.isEmpty()); + } + } protected void writeFields() { for (Field f: classFile.fields) { @@ -298,7 +426,7 @@ public class ClassWriter extends BasicWriter { try { methodType = (Type.MethodType) methodSig.getType(constant_pool); methodExceptions = methodType.throwsTypes; - if (methodExceptions != null && methodExceptions.size() == 0) + if (methodExceptions != null && methodExceptions.isEmpty()) methodExceptions = null; } catch (ConstantPoolException e) { // report error? diff --git a/langtools/test/tools/javap/6937244/T6937244A.java b/langtools/test/tools/javap/6937244/T6937244A.java index 3d02a0e85b4..f7d73fe17dd 100644 --- a/langtools/test/tools/javap/6937244/T6937244A.java +++ b/langtools/test/tools/javap/6937244/T6937244A.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -49,8 +49,8 @@ public class T6937244A { int count = 0; for (String line: out.split("[\r\n]+")) { - if (line.contains("extends")) { - verify(line, "extends java.lang.Object implements java.util.List"); + if (line.contains("implements")) { + verify(line, "implements java.util.List"); count++; } diff --git a/langtools/test/tools/javap/T4880663.java b/langtools/test/tools/javap/T4880663.java index 96bcccac13c..6cadf6aeb0c 100644 --- a/langtools/test/tools/javap/T4880663.java +++ b/langtools/test/tools/javap/T4880663.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4880663 6715757 + * @bug 4880663 6715757 7031005 * @summary javap could output whitespace between class name and opening brace * javap prints "extends java.lang.Object" */ @@ -39,7 +39,7 @@ public class T4880663 { public void run() throws IOException { File javaFile = writeTestFile(); File classFile = compileTestFile(javaFile); - verify(classFile, "class Test extends java.lang.Object {"); + verify(classFile, "class Test {"); if (errors > 0) throw new Error(errors + " found."); diff --git a/langtools/test/tools/javap/T4880672.java b/langtools/test/tools/javap/T4880672.java index a8f31cb094b..70a3ac64b2b 100644 --- a/langtools/test/tools/javap/T4880672.java +++ b/langtools/test/tools/javap/T4880672.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 @@ -24,7 +24,7 @@ /* * @test - * @bug 4880672 + * @bug 4880672 7031005 * @summary javap does not output inner interfaces of an interface */ @@ -39,7 +39,7 @@ public class T4880672 void run() { verify("java.util.Map", "public interface java.util.Map$Entry"); - verify("T4880672", "class T4880672$A$B extends java.lang.Object"); + verify("T4880672", "class T4880672$A$B"); verify("C", ""); // must not give error if no InnerClasses attribute if (errors > 0) throw new Error(errors + " found."); diff --git a/langtools/test/tools/javap/TestSuperclass.java b/langtools/test/tools/javap/TestSuperclass.java new file mode 100644 index 00000000000..07d3c05ab7c --- /dev/null +++ b/langtools/test/tools/javap/TestSuperclass.java @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7031005 + * @summary javap prints "extends java.lang.Object" + */ + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.URI; +import java.util.Arrays; +import javax.tools.JavaCompiler; +import javax.tools.JavaCompiler.CompilationTask; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.StandardLocation; +import javax.tools.ToolProvider; + +public class TestSuperclass { + enum ClassKind { + CLASS("class"), + INTERFACE("interface"); + ClassKind(String keyword) { + this.keyword = keyword; + } + final String keyword; + } + + enum GenericKind { + NO(""), + YES(""); + GenericKind(String typarams) { + this.typarams = typarams; + } + final String typarams; + } + + enum SuperKind { + NONE(null), + SUPER("Super"); + SuperKind(String name) { + this.name = name; + } + String extend() { + return (name == null) ? "" : "extends " + name; + } + String decl(ClassKind ck) { + return (name == null) ? "" : ck.keyword + " " + name + " { }"; + } + final String name; + } + + public static void main(String... args) throws Exception { + JavaCompiler comp = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null); + int errors = 0; + + for (ClassKind ck: ClassKind.values()) { + for (GenericKind gk: GenericKind.values()) { + for (SuperKind sk: SuperKind.values()) { + errors += new TestSuperclass(ck, gk, sk).run(comp, fm); + } + } + } + + if (errors > 0) + throw new Exception(errors + " errors found"); + } + + final ClassKind ck; + final GenericKind gk; + final SuperKind sk; + + TestSuperclass(ClassKind ck, GenericKind gk, SuperKind sk) { + this.ck = ck; + this.gk = gk; + this.sk = sk; + } + + int run(JavaCompiler comp, StandardJavaFileManager fm) throws IOException { + System.err.println("test: ck:" + ck + " gk:" + gk + " sk:" + sk); + File testDir = new File(ck + "-" + gk + "-" + sk); + testDir.mkdirs(); + fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(testDir)); + + JavaSource js = new JavaSource(); + System.err.println(js.getCharContent(false)); + CompilationTask t = comp.getTask(null, fm, null, null, null, Arrays.asList(js)); + if (!t.call()) + throw new Error("compilation failed"); + + File testClass = new File(testDir, "Test.class"); + String out = javap(testClass); + + // Extract class sig from first line of Java source + String expect = js.source.replaceAll("(?s)^(.* Test[^{]+?) *\\{.*", "$1"); + + // Extract class sig from line from javap output + String found = out.replaceAll("(?s).*\n(.* Test[^{]+?) *\\{.*", "$1"); + + checkEqual("class signature", expect, found); + + return errors; + } + + String javap(File file) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + String[] args = { file.getPath() }; + int rc = com.sun.tools.javap.Main.run(args, pw); + pw.close(); + String out = sw.toString(); + if (!out.isEmpty()) + System.err.println(out); + if (rc != 0) + throw new Error("javap failed: rc=" + rc); + return out; + } + + void checkEqual(String label, String expect, String found) { + if (!expect.equals(found)) + error("Unexpected " + label + " found: '" + found + "', expected: '" + expect + "'"); + } + + void error(String msg) { + System.err.println("Error: " + msg); + errors++; + } + + int errors; + + class JavaSource extends SimpleJavaFileObject { + static final String template = + "#CK Test#GK #EK { }\n" + + "#SK\n"; + final String source; + + public JavaSource() { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + source = template + .replace("#CK", ck.keyword) + .replace("#GK", gk.typarams) + .replace("#EK", sk.extend()) + .replace("#SK", sk.decl(ck)); + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + } + +} From b396e66f2bad611e0590c5903bba7833f965c7c0 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 30 Mar 2011 22:20:40 -0400 Subject: [PATCH 098/168] 7032364: Add jvm.cfg file for ARM and PPC architectures Reviewed-by: darcy, bdelsart, alanb, mduigou --- jdk/src/solaris/bin/arm/jvm.cfg | 38 +++++++++++++++++++++++++++++++++ jdk/src/solaris/bin/ppc/jvm.cfg | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 jdk/src/solaris/bin/arm/jvm.cfg create mode 100644 jdk/src/solaris/bin/ppc/jvm.cfg diff --git a/jdk/src/solaris/bin/arm/jvm.cfg b/jdk/src/solaris/bin/arm/jvm.cfg new file mode 100644 index 00000000000..0262ebda2e3 --- /dev/null +++ b/jdk/src/solaris/bin/arm/jvm.cfg @@ -0,0 +1,38 @@ +# Copyright (c) 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# List of JVMs that can be used as an option to java, javac, etc. +# Order is important -- first in this list is the default JVM. +# NOTE that this both this file and its format are UNSUPPORTED and +# WILL GO AWAY in a future release. +# +# You may also select a JVM in an arbitrary location with the +# "-XXaltjvm=" option, but that too is unsupported +# and may not be available in a future release. +# +-client KNOWN +-server KNOWN +-hotspot ERROR +-classic WARN +-native ERROR +-green ERROR diff --git a/jdk/src/solaris/bin/ppc/jvm.cfg b/jdk/src/solaris/bin/ppc/jvm.cfg new file mode 100644 index 00000000000..0262ebda2e3 --- /dev/null +++ b/jdk/src/solaris/bin/ppc/jvm.cfg @@ -0,0 +1,38 @@ +# Copyright (c) 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# List of JVMs that can be used as an option to java, javac, etc. +# Order is important -- first in this list is the default JVM. +# NOTE that this both this file and its format are UNSUPPORTED and +# WILL GO AWAY in a future release. +# +# You may also select a JVM in an arbitrary location with the +# "-XXaltjvm=" option, but that too is unsupported +# and may not be available in a future release. +# +-client KNOWN +-server KNOWN +-hotspot ERROR +-classic WARN +-native ERROR +-green ERROR From 9b466ebe8970362d483e0ee3b835234b1bd1ae0f Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Wed, 30 Mar 2011 21:10:02 -0700 Subject: [PATCH 099/168] 7030400: 3/4 PrivateTransportTest.sh needs adjustment to work with 7003964 Fix typo in GetModuleHandle() function lookup. Reviewed-by: dholmes, alanb, acorn, zgu --- jdk/test/com/sun/jdi/PrivateTransportTest.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/jdk/test/com/sun/jdi/PrivateTransportTest.sh b/jdk/test/com/sun/jdi/PrivateTransportTest.sh index 75e666fdb5e..89a306c9ee9 100644 --- a/jdk/test/com/sun/jdi/PrivateTransportTest.sh +++ b/jdk/test/com/sun/jdi/PrivateTransportTest.sh @@ -1,7 +1,7 @@ #!/bin/ksh -p # -# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 @@ -99,6 +99,8 @@ fi libdir=${TESTCLASSES} +is_windows=false +is_cygwin=false case `uname -s` in SunOS) libarch=`uname -p` @@ -126,10 +128,13 @@ case `uname -s` in libloc=`dirname ${xx}` ;; Windows*) + is_windows=true libloc=${jreloc}/bin sep=';' ;; CYGWIN*) + is_windows=true + is_cygwin=true libloc=${jreloc}/bin sep=':' @@ -176,7 +181,18 @@ fi # CP="-classpath \"${TESTCLASSES}\"" # -DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${private_transport},server=y,suspend=n" +if [ "$is_windows" = "true" ]; then + if [ "$is_cygwin" = "true" ]; then + win_fullpath=`cygpath -m "$fullpath" \ + | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'` + else + win_fullpath=`echo "$fullpath" \ + | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'` + fi + DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${win_fullpath},server=y,suspend=n" +else + DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${private_transport},server=y,suspend=n" +fi echo ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS} eval ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS} From d0e5ec7ac977302602be7627d2ea4cf0786bfef4 Mon Sep 17 00:00:00 2001 From: Yong Jeffrey Huang Date: Wed, 30 Mar 2011 22:46:41 -0700 Subject: [PATCH 100/168] 7025837: fix plural currency display names in sr_Latn_(BA|ME|RS).properties Reviewed-by: naoto --- .../util/resources/CurrencyNames.properties | 250 ++++++++++-------- .../resources/CurrencyNames_pt.properties | 81 ++++-- .../CurrencyNames_sr_Latn_BA.properties | 4 +- .../CurrencyNames_sr_Latn_ME.properties | 2 +- .../CurrencyNames_sr_Latn_RS.properties | 2 +- .../resources/CurrencyNames_sr_RS.properties | 81 ++++-- jdk/test/sun/text/resources/LocaleData | 90 +++++++ .../sun/text/resources/LocaleDataTest.java | 2 +- 8 files changed, 336 insertions(+), 176 deletions(-) diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties index e3eea6e1fa6..6fac2dd43aa 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties @@ -1,45 +1,68 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# ADP=ADP AED=AED AFA=AFA @@ -254,52 +277,52 @@ ZWD=ZWD ZWN=ZWN adp=Andorran Peseta aed=United Arab Emirates Dirham -afa=Afghani (1927-2002) -afn=Afghani +afa=Afghan Afghani (1927-2002) +afn=Afghan Afghani all=Albanian Lek amd=Armenian Dram -ang=Netherlands Antillan Guilder +ang=Netherlands Antillean Guilder aoa=Angolan Kwanza ars=Argentine Peso ats=Austrian Schilling aud=Australian Dollar -awg=Aruban Guilder -azm=Azerbaijanian Manat (1993-2006) -azn=Azerbaijanian Manat +awg=Aruban Florin +azm=Azerbaijani Manat (1993-2006) +azn=Azerbaijani Manat bam=Bosnia-Herzegovina Convertible Mark -bbd=Barbados Dollar -bdt=Bangladesh Taka +bbd=Barbadian Dollar +bdt=Bangladeshi Taka bef=Belgian Franc bgl=Bulgarian Hard Lev -bgn=Bulgarian New Lev +bgn=Bulgarian Lev bhd=Bahraini Dinar -bif=Burundi Franc +bif=Burundian Franc bmd=Bermudan Dollar bnd=Brunei Dollar -bob=Boliviano +bob=Bolivian Boliviano bov=Bolivian Mvdol brl=Brazilian Real bsd=Bahamian Dollar -btn=Bhutan Ngultrum +btn=Bhutanese Ngultrum bwp=Botswanan Pula -byb=Belarussian New Ruble (1994-1999) -byr=Belarussian Ruble +byb=Belarusian New Ruble (1994-1999) +byr=Belarusian Ruble bzd=Belize Dollar cad=Canadian Dollar -cdf=Congolese Franc Congolais +cdf=Congolese Franc chf=Swiss Franc -clf=Chilean Unidades de Fomento +clf=Chilean Unit of Account (UF) clp=Chilean Peso -cny=Chinese Yuan Renminbi +cny=Chinese Yuan cop=Colombian Peso -crc=Costa Rican Colon -csd=Serbian Dinar +crc=Costa Rican Col\u00f3n +csd=Serbian Dinar (2002-2006) cup=Cuban Peso -cve=Cape Verde Escudo -cyp=Cyprus Pound +cve=Cape Verdean Escudo +cyp=Cypriot Pound czk=Czech Republic Koruna -dem=Deutsche Mark -djf=Djibouti Franc +dem=German Mark +djf=Djiboutian Franc dkk=Danish Krone dop=Dominican Peso dzd=Algerian Dinar @@ -310,22 +333,22 @@ esp=Spanish Peseta etb=Ethiopian Birr eur=Euro fim=Finnish Markka -fjd=Fiji Dollar +fjd=Fijian Dollar fkp=Falkland Islands Pound frf=French Franc gbp=British Pound Sterling gel=Georgian Lari -ghc=Ghana Cedi -ghs=Ghana Cedi +ghc=Ghanaian Cedi (1979-2007) +ghs=Ghanaian Cedi gip=Gibraltar Pound -gmd=Gambia Dalasi -gnf=Guinea Franc +gmd=Gambian Dalasi +gnf=Guinean Franc grd=Greek Drachma -gtq=Guatemala Quetzal +gtq=Guatemalan Quetzal gwp=Guinea-Bissau Peso -gyd=Guyana Dollar +gyd=Guyanaese Dollar hkd=Hong Kong Dollar -hnl=Hoduras Lempira +hnl=Honduran Lempira hrk=Croatian Kuna htg=Haitian Gourde huf=Hungarian Forint @@ -335,110 +358,111 @@ ils=Israeli New Sheqel inr=Indian Rupee iqd=Iraqi Dinar irr=Iranian Rial -isk=Icelandic Krona +isk=Icelandic Kr\u00f3na itl=Italian Lira jmd=Jamaican Dollar jod=Jordanian Dinar jpy=Japanese Yen kes=Kenyan Shilling -kgs=Kyrgystan Som +kgs=Kyrgystani Som khr=Cambodian Riel -kmf=Comoro Franc +kmf=Comorian Franc kpw=North Korean Won krw=South Korean Won kwd=Kuwaiti Dinar kyd=Cayman Islands Dollar -kzt=Kazakhstan Tenge +kzt=Kazakhstani Tenge lak=Laotian Kip lbp=Lebanese Pound -lkr=Sri Lanka Rupee +lkr=Sri Lankan Rupee lrd=Liberian Dollar lsl=Lesotho Loti -ltl=Lithuanian Lita -luf=Luxembourg Franc +ltl=Lithuanian Litas +luf=Luxembourgian Franc lvl=Latvian Lats lyd=Libyan Dinar mad=Moroccan Dirham mdl=Moldovan Leu -mga=Madagascar Ariary -mgf=Madagascar Franc +mga=Malagasy Ariary +mgf=Malagasy Franc mkd=Macedonian Denar -mmk=Myanmar Kyat +mmk=Myanma Kyat mnt=Mongolian Tugrik -mop=Macao Pataca -mro=Mauritania Ouguiya +mop=Macanese Pataca +mro=Mauritanian Ouguiya mtl=Maltese Lira -mur=Mauritius Rupee -mvr=Maldive Islands Rufiyaa -mwk=Malawi Kwacha +mur=Mauritian Rupee +mvr=Maldivian Rufiyaa +mwk=Malawian Kwacha mxn=Mexican Peso -mxv=Mexican Unidad de Inversion (UDI) +mxv=Mexican Investment Unit myr=Malaysian Ringgit -mzm=Old Mozambique Metical -mzn=Mozambique Metical -nad=Namibia Dollar +mzm=Mozambican Metical (1980-2006) +mzn=Mozambican Metical +nad=Namibian Dollar ngn=Nigerian Naira -nio=Nicaraguan Cordoba Oro -nlg=Netherlands Guilder +nio=Nicaraguan C\u00f3rdoba +nlg=Dutch Guilder nok=Norwegian Krone npr=Nepalese Rupee nzd=New Zealand Dollar -omr=Oman Rial +omr=Omani Rial pab=Panamanian Balboa -pen=Peruvian Sol Nuevo -pgk=Papua New Guinea Kina +pen=Peruvian Nuevo Sol +pgk=Papua New Guinean Kina php=Philippine Peso -pkr=Pakistan Rupee +pkr=Pakistani Rupee pln=Polish Zloty pte=Portuguese Escudo -pyg=Paraguay Guarani +pyg=Paraguayan Guarani qar=Qatari Rial -rol=Old Romanian Leu +rol=Romanian Leu (1952-2006) ron=Romanian Leu +rsd=Serbian Dinar rub=Russian Ruble rur=Russian Ruble (1991-1998) rwf=Rwandan Franc sar=Saudi Riyal sbd=Solomon Islands Dollar -scr=Seychelles Rupee -sdd=Sudanese Dinar +scr=Seychellois Rupee +sdd=Sudanese Dinar (1992-2007) sdg=Sudanese Pound sek=Swedish Krona sgd=Singapore Dollar shp=Saint Helena Pound -sit=Slovenia Tolar +sit=Slovenian Tolar skk=Slovak Koruna -sll=Sierra Leone Leone +sll=Sierra Leonean Leone sos=Somali Shilling -srd=Surinam Dollar -srg=Suriname Guilder -std=Sao Tome and Principe Dobra -svc=El Salvador Colon +srd=Surinamese Dollar +srg=Surinamese Guilder +std=S\u00e3o Tom\u00e9 and Pr\u00edncipe Dobra +svc=Salvadoran Col\u00f3n syp=Syrian Pound -szl=Swaziland Lilangeni +szl=Swazi Lilangeni thb=Thai Baht -tjs=Tajikistan Somoni -tmm=Turkmenistan Manat +tjs=Tajikistani Somoni +tmm=Turkmenistani Manat (1993-2009) tnd=Tunisian Dinar -top=Tonga Pa\u02bbanga -tpe=Timor Escudo -trl=Turkish Lira -try=New Turkish Lira +top=Tongan Pa\u02bbanga +tpe=Timorese Escudo +trl=Turkish Lira (1922-2005) +try=Turkish Lira ttd=Trinidad and Tobago Dollar -twd=Taiwan New Dollar +twd=New Taiwan Dollar tzs=Tanzanian Shilling uah=Ukrainian Hryvnia ugx=Ugandan Shilling usd=US Dollar usn=US Dollar (Next day) uss=US Dollar (Same day) -uyu=Uruguay Peso Uruguayo -uzs=Uzbekistan Sum -veb=Venezuelan Bolivar -vef=Venezuelan Bolivar Fuerte +uyu=Uruguayan Peso +uzs=Uzbekistan Som +veb=Venezuelan Bol\u00edvar (1871-2008) +vef=Venezuelan Bol\u00edvar vnd=Vietnamese Dong vuv=Vanuatu Vatu -wst=Western Samoa Tala +wst=Samoan Tala xaf=CFA Franc BEAC xag=Silver xau=Gold @@ -455,9 +479,9 @@ xpd=Palladium xpf=CFP Franc xpt=Platinum xts=Testing Currency Code -xxx=No Currency +xxx=Unknown Currency yer=Yemeni Rial -yum=Yugoslavian Noviy Dinar +yum=Yugoslavian New Dinar (1994-2002) zar=South African Rand zmk=Zambian Kwacha -zwd=Zimbabwe Dollar +zwd=Zimbabwean Dollar (1980-2008) diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_pt.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_pt.properties index 5adb677a5dd..d033ea7e676 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_pt.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_pt.properties @@ -1,5 +1,26 @@ # # Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # @@ -8,38 +29,40 @@ # Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# adp=Peseta de Andorra aed=Dir\u00e9m dos Emirados \u00c1rabes Unidos afa=Afegane (1927-2002) diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_BA.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_BA.properties index a5f63a940da..7dc0375ecbf 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_BA.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_BA.properties @@ -64,6 +64,6 @@ # Generated automatically from the Common Locale Data Repository. DO NOT EDIT! # BAM=KM -bam=bosansko-hercegova\u010dkih konvertibilnih maraka +bam=Bosansko-Hercegova\u010dka konvertibilna marka EUR=\u20ac -eur=evra +eur=Evro diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_ME.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_ME.properties index 2746103ca98..0983b6a2ecc 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_ME.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_ME.properties @@ -64,4 +64,4 @@ # Generated automatically from the Common Locale Data Repository. DO NOT EDIT! # EUR=\u20ac -eur=evra +eur=Evro diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_RS.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_RS.properties index 34992f0e310..3a299f40642 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_RS.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_Latn_RS.properties @@ -64,4 +64,4 @@ # Generated automatically from the Common Locale Data Repository. DO NOT EDIT! # RSD=din. -rsd=srpski dinari +rsd=Srpski dinar diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_RS.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_RS.properties index b6153c86f64..83555220774 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_RS.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sr_RS.properties @@ -1,5 +1,26 @@ # # Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # @@ -8,36 +29,38 @@ # Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# RSD=\u0434\u0438\u043d. diff --git a/jdk/test/sun/text/resources/LocaleData b/jdk/test/sun/text/resources/LocaleData index 36f17917d12..0f538113beb 100644 --- a/jdk/test/sun/text/resources/LocaleData +++ b/jdk/test/sun/text/resources/LocaleData @@ -6356,3 +6356,93 @@ CurrencyNames/pt/zwd=D\u00f3lar do Zimb\u00e1bue # bug 7020960 CurrencyNames/sr_RS/RSD=\u0434\u0438\u043d. + +# bug 7025837 +CurrencyNames/sr-Latn-BA/bam=Bosansko-Hercegova\u010dka konvertibilna marka +CurrencyNames/sr-Latn-BA/eur=Evro +CurrencyNames/sr-Latn-ME/eur=Evro +CurrencyNames/sr-Latn-RS/rsd=Srpski dinar + +CurrencyNames//afa=Afghan Afghani (1927-2002) +CurrencyNames//afn=Afghan Afghani +CurrencyNames//ang=Netherlands Antillean Guilder +CurrencyNames//awg=Aruban Florin +CurrencyNames//azm=Azerbaijani Manat (1993-2006) +CurrencyNames//azn=Azerbaijani Manat +CurrencyNames//bbd=Barbadian Dollar +CurrencyNames//bdt=Bangladeshi Taka +CurrencyNames//bgn=Bulgarian Lev +CurrencyNames//bif=Burundian Franc +CurrencyNames//bob=Bolivian Boliviano +CurrencyNames//btn=Bhutanese Ngultrum +CurrencyNames//byb=Belarusian New Ruble (1994-1999) +CurrencyNames//byr=Belarusian Ruble +CurrencyNames//cdf=Congolese Franc +CurrencyNames//clf=Chilean Unit of Account (UF) +CurrencyNames//cny=Chinese Yuan +CurrencyNames//crc=Costa Rican Col\u00f3n +CurrencyNames//csd=Serbian Dinar (2002-2006) +CurrencyNames//cve=Cape Verdean Escudo +CurrencyNames//cyp=Cypriot Pound +CurrencyNames//dem=German Mark +CurrencyNames//djf=Djiboutian Franc +CurrencyNames//fjd=Fijian Dollar +CurrencyNames//ghc=Ghanaian Cedi (1979-2007) +CurrencyNames//ghs=Ghanaian Cedi +CurrencyNames//gmd=Gambian Dalasi +CurrencyNames//gnf=Guinean Franc +CurrencyNames//gtq=Guatemalan Quetzal +CurrencyNames//gyd=Guyanaese Dollar +CurrencyNames//hnl=Honduran Lempira +CurrencyNames//isk=Icelandic Kr\u00f3na +CurrencyNames//kgs=Kyrgystani Som +CurrencyNames//kmf=Comorian Franc +CurrencyNames//kzt=Kazakhstani Tenge +CurrencyNames//lkr=Sri Lankan Rupee +CurrencyNames//ltl=Lithuanian Litas +CurrencyNames//luf=Luxembourgian Franc +CurrencyNames//mga=Malagasy Ariary +CurrencyNames//mgf=Malagasy Franc +CurrencyNames//mmk=Myanma Kyat +CurrencyNames//mop=Macanese Pataca +CurrencyNames//mro=Mauritanian Ouguiya +CurrencyNames//mur=Mauritian Rupee +CurrencyNames//mvr=Maldivian Rufiyaa +CurrencyNames//mwk=Malawian Kwacha +CurrencyNames//mxv=Mexican Investment Unit +CurrencyNames//mzm=Mozambican Metical (1980-2006) +CurrencyNames//mzn=Mozambican Metical +CurrencyNames//nad=Namibian Dollar +CurrencyNames//nio=Nicaraguan C\u00f3rdoba +CurrencyNames//nlg=Dutch Guilder +CurrencyNames//omr=Omani Rial +CurrencyNames//pen=Peruvian Nuevo Sol +CurrencyNames//pgk=Papua New Guinean Kina +CurrencyNames//pkr=Pakistani Rupee +CurrencyNames//pyg=Paraguayan Guarani +CurrencyNames//rol=Romanian Leu (1952-2006) +CurrencyNames//rsd=Serbian Dinar +CurrencyNames//scr=Seychellois Rupee +CurrencyNames//sdd=Sudanese Dinar (1992-2007) +CurrencyNames//sit=Slovenian Tolar +CurrencyNames//sll=Sierra Leonean Leone +CurrencyNames//srd=Surinamese Dollar +CurrencyNames//srg=Surinamese Guilder +CurrencyNames//std=S\u00e3o Tom\u00e9 and Pr\u00edncipe Dobra +CurrencyNames//svc=Salvadoran Col\u00f3n +CurrencyNames//szl=Swazi Lilangeni +CurrencyNames//tjs=Tajikistani Somoni +CurrencyNames//tmm=Turkmenistani Manat (1993-2009) +CurrencyNames//top=Tongan Pa\u02bbanga +CurrencyNames//tpe=Timorese Escudo +CurrencyNames//trl=Turkish Lira (1922-2005) +CurrencyNames//try=Turkish Lira +CurrencyNames//twd=New Taiwan Dollar +CurrencyNames//uyu=Uruguayan Peso +CurrencyNames//uzs=Uzbekistan Som +CurrencyNames//veb=Venezuelan Bol\u00edvar (1871-2008) +CurrencyNames//vef=Venezuelan Bol\u00edvar +CurrencyNames//wst=Samoan Tala +CurrencyNames//xxx=Unknown Currency +CurrencyNames//yum=Yugoslavian New Dinar (1994-2002) +CurrencyNames//zwd=Zimbabwean Dollar (1980-2008) diff --git a/jdk/test/sun/text/resources/LocaleDataTest.java b/jdk/test/sun/text/resources/LocaleDataTest.java index 5cf693cc1aa..311b08a9125 100644 --- a/jdk/test/sun/text/resources/LocaleDataTest.java +++ b/jdk/test/sun/text/resources/LocaleDataTest.java @@ -33,7 +33,7 @@ * 6379214 6485516 6486607 4225362 4494727 6533691 6531591 6531593 6570259 * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611 * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787 - * 6919624 6998391 7019267 7020960 + * 6919624 6998391 7019267 7020960 7025837 * @summary Verify locale data * */ From 79c814c61642fcfc81b462df5cfa478d46428b97 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Thu, 31 Mar 2011 00:27:08 -0700 Subject: [PATCH 101/168] 7032388: guarantee(VM_Version::supports_cmov()) failed: illegal instruction on i586 after 6919934 6919934 added some unguarded cmov instructions which hit a guarantee on older hardware. Reviewed-by: never, iveresov, kvn, phh --- hotspot/src/cpu/x86/vm/assembler_x86.cpp | 31 ++++++++++++----- hotspot/src/cpu/x86/vm/assembler_x86.hpp | 9 +++-- .../src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 26 +++++---------- hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp | 1 + .../src/cpu/x86/vm/templateTable_x86_32.cpp | 33 +++++-------------- 5 files changed, 47 insertions(+), 53 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index 884dcc26985..0e96e8d427a 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -7769,6 +7769,28 @@ void MacroAssembler::xorps(XMMRegister dst, AddressLiteral src) { } } +void MacroAssembler::cmov32(Condition cc, Register dst, Address src) { + if (VM_Version::supports_cmov()) { + cmovl(cc, dst, src); + } else { + Label L; + jccb(negate_condition(cc), L); + movl(dst, src); + bind(L); + } +} + +void MacroAssembler::cmov32(Condition cc, Register dst, Register src) { + if (VM_Version::supports_cmov()) { + cmovl(cc, dst, src); + } else { + Label L; + jccb(negate_condition(cc), L); + movl(dst, src); + bind(L); + } +} + void MacroAssembler::verify_oop(Register reg, const char* s) { if (!VerifyOops) return; @@ -9019,14 +9041,7 @@ void MacroAssembler::string_compare(Register str1, Register str2, movl(result, cnt1); subl(cnt1, cnt2); push(cnt1); - if (VM_Version::supports_cmov()) { - cmovl(Assembler::lessEqual, cnt2, result); - } else { - Label GT_LABEL; - jccb(Assembler::greater, GT_LABEL); - movl(cnt2, result); - bind(GT_LABEL); - } + cmov32(Assembler::lessEqual, cnt2, result); // Is the minimum length zero? testl(cnt2, cnt2); diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index 6a69a260822..6ef01cbb409 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -2244,10 +2244,13 @@ public: // Data - void cmov(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); } + void cmov32( Condition cc, Register dst, Address src); + void cmov32( Condition cc, Register dst, Register src); - void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); } - void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); } + void cmov( Condition cc, Register dst, Register src) { cmovptr(cc, dst, src); } + + void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); } + void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); } void movoop(Register dst, jobject obj); void movoop(Address dst, jobject obj); diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index 7ac7255c126..7ee3391263b 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "asm/assembler.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" @@ -569,24 +570,13 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst, __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); // compute minimum length (in rax) and difference of lengths (on top of stack) - if (VM_Version::supports_cmov()) { - __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); - __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); - __ mov (rcx, rbx); - __ subptr (rbx, rax); // subtract lengths - __ push (rbx); // result - __ cmov (Assembler::lessEqual, rax, rcx); - } else { - Label L; - __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); - __ movl (rcx, Address(rax, java_lang_String::count_offset_in_bytes())); - __ mov (rax, rbx); - __ subptr (rbx, rcx); - __ push (rbx); - __ jcc (Assembler::lessEqual, L); - __ mov (rax, rcx); - __ bind (L); - } + __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); + __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); + __ mov (rcx, rbx); + __ subptr(rbx, rax); // subtract lengths + __ push (rbx); // result + __ cmov (Assembler::lessEqual, rax, rcx); + // is minimum length 0? Label noLoop, haveResult; __ testptr (rax, rax); diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp index 241e0899342..055bb93c4cd 100644 --- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "asm/assembler.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index 73ed5182d8e..a9fef5db256 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "asm/assembler.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "interpreter/templateTable.hpp" @@ -1939,18 +1940,10 @@ void TemplateTable::fast_binaryswitch() { __ movl(temp, Address(array, h, Address::times_8, 0*wordSize)); __ bswapl(temp); __ cmpl(key, temp); - if (VM_Version::supports_cmov()) { - __ cmovl(Assembler::less , j, h); // j = h if (key < array[h].fast_match()) - __ cmovl(Assembler::greaterEqual, i, h); // i = h if (key >= array[h].fast_match()) - } else { - Label set_i, end_of_if; - __ jccb(Assembler::greaterEqual, set_i); // { - __ mov(j, h); // j = h; - __ jmp(end_of_if); // } - __ bind(set_i); // else { - __ mov(i, h); // i = h; - __ bind(end_of_if); // } - } + // j = h if (key < array[h].fast_match()) + __ cmov32(Assembler::less , j, h); + // i = h if (key >= array[h].fast_match()) + __ cmov32(Assembler::greaterEqual, i, h); // while (i+1 < j) __ bind(entry); __ leal(h, Address(i, 1)); // i+1 @@ -3478,22 +3471,14 @@ void TemplateTable::monitorenter() { // find a free slot in the monitor block (result in rdx) { Label entry, loop, exit; - __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry - __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block + __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry + + __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block __ jmpb(entry); __ bind(loop); __ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used - -// TODO - need new func here - kbt - if (VM_Version::supports_cmov()) { - __ cmov(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx - } else { - Label L; - __ jccb(Assembler::notEqual, L); - __ mov(rdx, rcx); // if not used then remember entry in rdx - __ bind(L); - } + __ cmovptr(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx __ cmpptr(rax, Address(rcx, BasicObjectLock::obj_offset_in_bytes())); // check if current entry is for same object __ jccb(Assembler::equal, exit); // if same object then stop searching __ addptr(rcx, entry_size); // otherwise advance to next entry From c9e2dcda4b68b8fdc64e0674d2ead0b84de797ec Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Thu, 31 Mar 2011 02:31:57 -0700 Subject: [PATCH 102/168] 6817525: turn on method handle functionality by default for JSR 292 After appropriate testing, we need to turn on EnableMethodHandles and EnableInvokeDynamic by default. Reviewed-by: never, kvn, jrose, phh --- .../src/cpu/sparc/vm/cppInterpreter_sparc.cpp | 4 +-- .../src/cpu/sparc/vm/interp_masm_sparc.cpp | 4 +-- .../src/cpu/sparc/vm/interpreter_sparc.cpp | 2 +- .../src/cpu/sparc/vm/templateTable_sparc.cpp | 4 +-- hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp | 4 +-- hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp | 4 +-- hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp | 2 +- hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp | 2 +- .../cpu/x86/vm/templateInterpreter_x86_32.cpp | 2 +- .../cpu/x86/vm/templateInterpreter_x86_64.cpp | 2 +- .../src/cpu/x86/vm/templateTable_x86_32.cpp | 4 +-- .../src/cpu/x86/vm/templateTable_x86_64.cpp | 4 +-- .../share/vm/classfile/classFileParser.cpp | 22 ++++++------- .../share/vm/classfile/classFileParser.hpp | 6 ++-- .../src/share/vm/classfile/javaClasses.cpp | 14 ++++---- .../share/vm/classfile/systemDictionary.cpp | 32 +++++++------------ .../share/vm/classfile/systemDictionary.hpp | 2 +- .../src/share/vm/interpreter/linkResolver.cpp | 4 +-- .../src/share/vm/oops/constantPoolKlass.cpp | 2 +- hotspot/src/share/vm/oops/constantPoolOop.hpp | 6 ++-- hotspot/src/share/vm/oops/instanceKlass.hpp | 2 +- hotspot/src/share/vm/oops/klass.cpp | 2 +- hotspot/src/share/vm/oops/methodOop.hpp | 2 +- hotspot/src/share/vm/prims/methodHandles.cpp | 16 +++------- hotspot/src/share/vm/prims/unsafe.cpp | 2 +- hotspot/src/share/vm/runtime/arguments.cpp | 27 ++++++++++------ hotspot/src/share/vm/runtime/globals.hpp | 11 ++++--- .../src/share/vm/runtime/sharedRuntime.cpp | 2 +- hotspot/src/share/vm/runtime/thread.cpp | 2 +- 29 files changed, 90 insertions(+), 102 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp index 1b25b2af831..479a99152cc 100644 --- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp @@ -1188,8 +1188,8 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register __ st_ptr(O2, XXX_STATE(_stack)); // PREPUSH __ lduh(max_stack, O3); // Full size expression stack - guarantee(!EnableMethodHandles, "no support yet for java.lang.invoke.MethodHandle"); //6815692 - //6815692//if (EnableMethodHandles) + guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692 + //6815692//if (EnableInvokeDynamic) //6815692// __ inc(O3, methodOopDesc::extra_stack_entries()); __ sll(O3, LogBytesPerWord, O3); __ sub(O2, O3, O3); diff --git a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp index c6b33222a6c..58c4c9451df 100644 --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp @@ -743,12 +743,12 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register cache, Register if (index_size == sizeof(u2)) { get_2_byte_integer_at_bcp(bcp_offset, cache, tmp, Unsigned); } else if (index_size == sizeof(u4)) { - assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic"); + assert(EnableInvokeDynamic, "giant index used only for JSR 292"); get_4_byte_integer_at_bcp(bcp_offset, cache, tmp); assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line"); xor3(tmp, -1, tmp); // convert to plain index } else if (index_size == sizeof(u1)) { - assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles"); + assert(EnableInvokeDynamic, "tiny index used only for JSR 292"); ldub(Lbcp, bcp_offset, tmp); } else { ShouldNotReachHere(); diff --git a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp index 06375d0b0ad..0c84df6afe9 100644 --- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp @@ -262,7 +262,7 @@ address InterpreterGenerator::generate_abstract_entry(void) { // Method handle invoker // Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...) address InterpreterGenerator::generate_method_handle_entry(void) { - if (!EnableMethodHandles) { + if (!EnableInvokeDynamic) { return generate_abstract_entry(); } diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index e590cb8235d..9f4bcc6b4d6 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -334,8 +334,8 @@ void TemplateTable::ldc(bool wide) { void TemplateTable::fast_aldc(bool wide) { transition(vtos, atos); - if (!EnableMethodHandles) { - // We should not encounter this bytecode if !EnableMethodHandles. + if (!EnableInvokeDynamic) { + // We should not encounter this bytecode if !EnableInvokeDynamic. // The verifier will stop it. However, if we get past the verifier, // this will stop the thread in a reasonable way, without crashing the JVM. __ call_VM(noreg, CAST_FROM_FN_PTR(address, diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp index 33daeac2441..e0d5cf03ca5 100644 --- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp @@ -215,7 +215,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register reg, int bcp_off if (index_size == sizeof(u2)) { load_unsigned_short(reg, Address(rsi, bcp_offset)); } else if (index_size == sizeof(u4)) { - assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic"); + assert(EnableInvokeDynamic, "giant index used only for JSR 292"); movl(reg, Address(rsi, bcp_offset)); // Check if the secondary index definition is still ~x, otherwise // we have to change the following assembler code to calculate the @@ -223,7 +223,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register reg, int bcp_off assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line"); notl(reg); // convert to plain index } else if (index_size == sizeof(u1)) { - assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles"); + assert(EnableInvokeDynamic, "tiny index used only for JSR 292"); load_unsigned_byte(reg, Address(rsi, bcp_offset)); } else { ShouldNotReachHere(); diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp index 3c235ce2190..428281d00f7 100644 --- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp @@ -213,7 +213,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, if (index_size == sizeof(u2)) { load_unsigned_short(index, Address(r13, bcp_offset)); } else if (index_size == sizeof(u4)) { - assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic"); + assert(EnableInvokeDynamic, "giant index used only for JSR 292"); movl(index, Address(r13, bcp_offset)); // Check if the secondary index definition is still ~x, otherwise // we have to change the following assembler code to calculate the @@ -221,7 +221,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line"); notl(index); // convert to plain index } else if (index_size == sizeof(u1)) { - assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles"); + assert(EnableInvokeDynamic, "tiny index used only for JSR 292"); load_unsigned_byte(index, Address(r13, bcp_offset)); } else { ShouldNotReachHere(); diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp index 6261c81cd64..cb2345a4183 100644 --- a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp @@ -233,7 +233,7 @@ address InterpreterGenerator::generate_abstract_entry(void) { // Method handle invoker // Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...) address InterpreterGenerator::generate_method_handle_entry(void) { - if (!EnableMethodHandles) { + if (!EnableInvokeDynamic) { return generate_abstract_entry(); } diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp index 8d46c93490c..3dbea5754dc 100644 --- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp @@ -320,7 +320,7 @@ address InterpreterGenerator::generate_abstract_entry(void) { // Method handle invoker // Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...) address InterpreterGenerator::generate_method_handle_entry(void) { - if (!EnableMethodHandles) { + if (!EnableInvokeDynamic) { return generate_abstract_entry(); } diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp index c3f20290e2b..ecfe26e0031 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp @@ -1527,7 +1527,7 @@ int AbstractInterpreter::layout_activation(methodOop method, if (interpreter_frame != NULL) { #ifdef ASSERT - if (!EnableMethodHandles) + if (!EnableInvokeDynamic) // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences? // Probably, since deoptimization doesn't work yet. assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable"); diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp index 69ea49e8a88..6051aecb666 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp @@ -1541,7 +1541,7 @@ int AbstractInterpreter::layout_activation(methodOop method, tempcount* Interpreter::stackElementWords + popframe_extra_args; if (interpreter_frame != NULL) { #ifdef ASSERT - if (!EnableMethodHandles) + if (!EnableInvokeDynamic) // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences? // Probably, since deoptimization doesn't work yet. assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable"); diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index a9fef5db256..b152f698cfd 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -392,8 +392,8 @@ void TemplateTable::ldc(bool wide) { void TemplateTable::fast_aldc(bool wide) { transition(vtos, atos); - if (!EnableMethodHandles) { - // We should not encounter this bytecode if !EnableMethodHandles. + if (!EnableInvokeDynamic) { + // We should not encounter this bytecode if !EnableInvokeDynamic. // The verifier will stop it. However, if we get past the verifier, // this will stop the thread in a reasonable way, without crashing the JVM. __ call_VM(noreg, CAST_FROM_FN_PTR(address, diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index 2638cbc7d4c..64385a7d54c 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -405,8 +405,8 @@ void TemplateTable::ldc(bool wide) { void TemplateTable::fast_aldc(bool wide) { transition(vtos, atos); - if (!EnableMethodHandles) { - // We should not encounter this bytecode if !EnableMethodHandles. + if (!EnableInvokeDynamic) { + // We should not encounter this bytecode if !EnableInvokeDynamic. // The verifier will stop it. However, if we get past the verifier, // this will stop the thread in a reasonable way, without crashing the JVM. __ call_VM(noreg, CAST_FROM_FN_PTR(address, diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 8056159b51a..3f71a2b432c 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -152,7 +152,7 @@ void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int len "Class file version does not support constant tag %u in class file %s", tag, CHECK); } - if (!EnableMethodHandles) { + if (!EnableInvokeDynamic) { classfile_parse_error( "This JVM does not support constant tag %u in class file %s", tag, CHECK); @@ -260,7 +260,7 @@ void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int len verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK); } - if (AnonymousClasses && has_cp_patch_at(index)) { + if (EnableInvokeDynamic && has_cp_patch_at(index)) { Handle patch = clear_cp_patch_at(index); guarantee_property(java_lang_String::is_instance(patch()), "Illegal utf8 patch at %d in class file %s", @@ -443,7 +443,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { int ref_index = cp->method_handle_index_at(index); check_property( valid_cp_range(ref_index, length) && - EnableMethodHandles, + EnableInvokeDynamic, "Invalid constant pool index %u in class file %s", ref_index, CHECK_(nullHandle)); constantTag tag = cp->tag_at(ref_index); @@ -487,7 +487,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { check_property( valid_cp_range(ref_index, length) && cp->tag_at(ref_index).is_utf8() && - EnableMethodHandles, + EnableInvokeDynamic, "Invalid constant pool index %u in class file %s", ref_index, CHECK_(nullHandle)); } @@ -522,7 +522,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { if (_cp_patches != NULL) { // need to treat this_class specially... - assert(AnonymousClasses, ""); + assert(EnableInvokeDynamic, ""); int this_class_index; { cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len @@ -677,7 +677,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) { - assert(AnonymousClasses, ""); + assert(EnableInvokeDynamic, ""); BasicType patch_type = T_VOID; switch (cp->tag_at(index).value()) { @@ -2103,7 +2103,7 @@ methodHandle ClassFileParser::parse_method(constantPoolHandle cp, bool is_interf _has_vanilla_constructor = true; } - if (EnableMethodHandles && (m->is_method_handle_invoke() || + if (EnableInvokeDynamic && (m->is_method_handle_invoke() || m->is_method_handle_adapter())) { THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(), "Method handle invokers must be defined internally to the VM", nullHandle); @@ -2771,7 +2771,7 @@ void ClassFileParser::java_lang_invoke_MethodHandle_fix_pre(constantPoolHandle c // This is not particularly nice, but since there is no way to express // a native wordSize field in Java, we must do it at this level. - if (!EnableMethodHandles) return; + if (!EnableInvokeDynamic) return; int word_sig_index = 0; const int cp_size = cp->length(); @@ -3191,15 +3191,15 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, next_nonstatic_field_offset = first_nonstatic_field_offset; // adjust the vmentry field declaration in java.lang.invoke.MethodHandle - if (EnableMethodHandles && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) { + if (EnableInvokeDynamic && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) { java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle)); } if (AllowTransitionalJSR292 && - EnableMethodHandles && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) { + EnableInvokeDynamic && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) { java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle)); } if (AllowTransitionalJSR292 && - EnableMethodHandles && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) { + EnableInvokeDynamic && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) { // allow vmentry field in MethodHandleImpl also java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle)); } diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp index b48bd99d532..97ae755165f 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.hpp +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp @@ -231,11 +231,11 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS); bool is_anonymous() { - assert(AnonymousClasses || _host_klass.is_null(), ""); + assert(EnableInvokeDynamic || _host_klass.is_null(), ""); return _host_klass.not_null(); } bool has_cp_patch_at(int index) { - assert(AnonymousClasses, ""); + assert(EnableInvokeDynamic, ""); assert(index >= 0, "oob"); return (_cp_patches != NULL && index < _cp_patches->length() @@ -258,7 +258,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { // constant pool construction, but in later versions they can. // %%% Let's phase out the old is_klass_reference. bool is_klass_reference(constantPoolHandle cp, int index) { - return ((LinkWellKnownClasses || AnonymousClasses) + return ((LinkWellKnownClasses || EnableInvokeDynamic) ? cp->tag_at(index).is_klass_or_reference() : cp->tag_at(index).is_klass_reference()); } diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 62f6500a5d4..b1887ae7fda 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -2322,7 +2322,7 @@ int java_lang_invoke_AdapterMethodHandle::_conversion_offset; void java_lang_invoke_MethodHandle::compute_offsets() { klassOop k = SystemDictionary::MethodHandle_klass(); - if (k != NULL && EnableMethodHandles) { + if (k != NULL && EnableInvokeDynamic) { bool allow_super = false; if (AllowTransitionalJSR292) allow_super = true; // temporary, to access java.dyn.MethodHandleImpl compute_offset(_type_offset, k, vmSymbols::type_name(), vmSymbols::java_lang_invoke_MethodType_signature(), allow_super); @@ -2337,7 +2337,7 @@ void java_lang_invoke_MethodHandle::compute_offsets() { void java_lang_invoke_MemberName::compute_offsets() { klassOop k = SystemDictionary::MemberName_klass(); - if (k != NULL && EnableMethodHandles) { + if (k != NULL && EnableInvokeDynamic) { compute_offset(_clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature()); compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); compute_offset(_type_offset, k, vmSymbols::type_name(), vmSymbols::object_signature()); @@ -2349,14 +2349,14 @@ void java_lang_invoke_MemberName::compute_offsets() { void java_lang_invoke_DirectMethodHandle::compute_offsets() { klassOop k = SystemDictionary::DirectMethodHandle_klass(); - if (k != NULL && EnableMethodHandles) { + if (k != NULL && EnableInvokeDynamic) { compute_offset(_vmindex_offset, k, vmSymbols::vmindex_name(), vmSymbols::int_signature(), true); } } void java_lang_invoke_BoundMethodHandle::compute_offsets() { klassOop k = SystemDictionary::BoundMethodHandle_klass(); - if (k != NULL && EnableMethodHandles) { + if (k != NULL && EnableInvokeDynamic) { compute_offset(_vmargslot_offset, k, vmSymbols::vmargslot_name(), vmSymbols::int_signature(), true); compute_offset(_argument_offset, k, vmSymbols::argument_name(), vmSymbols::object_signature(), true); } @@ -2364,7 +2364,7 @@ void java_lang_invoke_BoundMethodHandle::compute_offsets() { void java_lang_invoke_AdapterMethodHandle::compute_offsets() { klassOop k = SystemDictionary::AdapterMethodHandle_klass(); - if (k != NULL && EnableMethodHandles) { + if (k != NULL && EnableInvokeDynamic) { compute_offset(_conversion_offset, k, vmSymbols::conversion_name(), vmSymbols::int_signature(), true); } } @@ -2982,7 +2982,7 @@ void JavaClasses::compute_offsets() { java_lang_Class::compute_offsets(); java_lang_Thread::compute_offsets(); java_lang_ThreadGroup::compute_offsets(); - if (EnableMethodHandles) { + if (EnableInvokeDynamic) { java_lang_invoke_MethodHandle::compute_offsets(); java_lang_invoke_MemberName::compute_offsets(); java_lang_invoke_DirectMethodHandle::compute_offsets(); @@ -2990,8 +2990,6 @@ void JavaClasses::compute_offsets() { java_lang_invoke_AdapterMethodHandle::compute_offsets(); java_lang_invoke_MethodType::compute_offsets(); java_lang_invoke_MethodTypeForm::compute_offsets(); - } - if (EnableInvokeDynamic) { java_lang_invoke_CallSite::compute_offsets(); } java_security_AccessControlContext::compute_offsets(); diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index ac935f90510..9ed92f8354d 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1017,7 +1017,7 @@ klassOop SystemDictionary::parse_stream(Symbol* class_name, } if (host_klass.not_null() && k.not_null()) { - assert(AnonymousClasses, ""); + assert(EnableInvokeDynamic, ""); // If it's anonymous, initialize it now, since nobody else will. k->set_host_klass(host_klass()); @@ -1940,7 +1940,7 @@ bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) { } Symbol* backup_symbol = NULL; // symbol to try if the current symbol fails if (init_opt == SystemDictionary::Pre_JSR292) { - if (!EnableMethodHandles) try_load = false; // do not bother to load such classes + if (!EnableInvokeDynamic) try_load = false; // do not bother to load such classes if (AllowTransitionalJSR292) { backup_symbol = find_backup_class_name(symbol); if (try_load && PreferTransitionalJSR292) { @@ -2038,25 +2038,15 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) { instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL); instanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM); - WKID meth_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass); - WKID meth_group_end = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass); - initialize_wk_klasses_until(meth_group_start, scan, CHECK); - if (EnableMethodHandles) { - initialize_wk_klasses_through(meth_group_end, scan, CHECK); - } - if (_well_known_klasses[meth_group_start] == NULL) { - // Skip the rest of the method handle classes, if MethodHandle is not loaded. - scan = WKID(meth_group_end+1); - } - WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass); - WKID indy_group_end = WK_KLASS_ENUM_NAME(CallSite_klass); - initialize_wk_klasses_until(indy_group_start, scan, CHECK); + // JSR 292 classes + WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass); + WKID jsr292_group_end = WK_KLASS_ENUM_NAME(CallSite_klass); + initialize_wk_klasses_until(jsr292_group_start, scan, CHECK); if (EnableInvokeDynamic) { - initialize_wk_klasses_through(indy_group_end, scan, CHECK); - } - if (_well_known_klasses[indy_group_start] == NULL) { - // Skip the rest of the dynamic typing classes, if Linkage is not loaded. - scan = WKID(indy_group_end+1); + initialize_wk_klasses_through(jsr292_group_end, scan, CHECK); + } else { + // Skip the JSR 292 classes, if not enabled. + scan = WKID(jsr292_group_end + 1); } initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK); @@ -2407,7 +2397,7 @@ methodOop SystemDictionary::find_method_handle_invoke(Symbol* name, Symbol* signature, KlassHandle accessing_klass, TRAPS) { - if (!EnableMethodHandles) return NULL; + if (!EnableInvokeDynamic) return NULL; vmSymbols::SID name_id = vmSymbols::find_sid(name); assert(name_id != vmSymbols::NO_SID, "must be a known name"); unsigned int hash = invoke_method_table()->compute_hash(signature, name_id); diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp index 0719fc33b94..6db5a5048ed 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp @@ -207,7 +207,7 @@ class SystemDictionary : AllStatic { enum InitOption { Pre, // preloaded; error if not present - Pre_JSR292, // preloaded if EnableMethodHandles + Pre_JSR292, // preloaded if EnableInvokeDynamic // Order is significant. Options before this point require resolve_or_fail. // Options after this point will use resolve_or_null instead. diff --git a/hotspot/src/share/vm/interpreter/linkResolver.cpp b/hotspot/src/share/vm/interpreter/linkResolver.cpp index 4ed4ac17f11..746d86fd2bc 100644 --- a/hotspot/src/share/vm/interpreter/linkResolver.cpp +++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp @@ -176,7 +176,7 @@ void LinkResolver::resolve_klass_no_update(KlassHandle& result, constantPoolHand void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) { methodOop result_oop = klass->uncached_lookup_method(name, signature); - if (EnableMethodHandles && result_oop != NULL) { + if (EnableInvokeDynamic && result_oop != NULL) { switch (result_oop->intrinsic_id()) { case vmIntrinsics::_invokeExact: case vmIntrinsics::_invokeGeneric: @@ -214,7 +214,7 @@ void LinkResolver::lookup_implicit_method(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, KlassHandle current_klass, TRAPS) { - if (EnableMethodHandles && + if (EnableInvokeDynamic && klass() == SystemDictionary::MethodHandle_klass() && methodOopDesc::is_method_handle_invoke_name(name)) { if (!THREAD->is_Compiler_thread() && !MethodHandles::enabled()) { diff --git a/hotspot/src/share/vm/oops/constantPoolKlass.cpp b/hotspot/src/share/vm/oops/constantPoolKlass.cpp index 367530717d6..40488301a8a 100644 --- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp +++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp @@ -286,7 +286,7 @@ void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { assert(obj->is_constantPool(), "should be constant pool"); constantPoolOop cp = (constantPoolOop) obj; if (cp->tags() != NULL && - (!JavaObjectsInPerm || (AnonymousClasses && cp->has_pseudo_string()))) { + (!JavaObjectsInPerm || (EnableInvokeDynamic && cp->has_pseudo_string()))) { for (int i = 1; i < cp->length(); ++i) { if (cp->tag_at(i).is_string()) { oop* base = cp->obj_at_addr_raw(i); diff --git a/hotspot/src/share/vm/oops/constantPoolOop.hpp b/hotspot/src/share/vm/oops/constantPoolOop.hpp index fa482a5c4da..d53de40e025 100644 --- a/hotspot/src/share/vm/oops/constantPoolOop.hpp +++ b/hotspot/src/share/vm/oops/constantPoolOop.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -429,7 +429,7 @@ class constantPoolOopDesc : public oopDesc { // A "pseudo-string" is an non-string oop that has found is way into // a String entry. - // Under AnonymousClasses this can happen if the user patches a live + // Under EnableInvokeDynamic this can happen if the user patches a live // object into a CONSTANT_String entry of an anonymous class. // Method oops internally created for method handles may also // use pseudo-strings to link themselves to related metaobjects. @@ -442,7 +442,7 @@ class constantPoolOopDesc : public oopDesc { } void pseudo_string_at_put(int which, oop x) { - assert(AnonymousClasses, ""); + assert(EnableInvokeDynamic, ""); set_pseudo_string(); // mark header assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool"); string_at_put(which, x); // this works just fine diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 07acfc358c0..a1701e43833 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -182,7 +182,7 @@ class instanceKlass: public Klass { // Protection domain. oop _protection_domain; // Host class, which grants its access privileges to this class also. - // This is only non-null for an anonymous class (AnonymousClasses enabled). + // This is only non-null for an anonymous class (JSR 292 enabled). // The host class is either named, or a previously loaded anonymous class. klassOop _host_klass; // Class signers. diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index 294830c17f2..6f6a39a6409 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -500,7 +500,7 @@ const char* Klass::external_name() const { if (oop_is_instance()) { instanceKlass* ik = (instanceKlass*) this; if (ik->is_anonymous()) { - assert(AnonymousClasses, ""); + assert(EnableInvokeDynamic, ""); intptr_t hash = ik->java_mirror()->identity_hash(); char hash_buf[40]; sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash); diff --git a/hotspot/src/share/vm/oops/methodOop.hpp b/hotspot/src/share/vm/oops/methodOop.hpp index bf3f8528e13..bace4defe3c 100644 --- a/hotspot/src/share/vm/oops/methodOop.hpp +++ b/hotspot/src/share/vm/oops/methodOop.hpp @@ -607,7 +607,7 @@ class methodOopDesc : public oopDesc { // method handles want to be able to push a few extra values (e.g., a bound receiver), and // invokedynamic sometimes needs to push a bootstrap method, call site, and arglist, // all without checking for a stack overflow - static int extra_stack_entries() { return (EnableMethodHandles ? (int)MethodHandlePushLimit : 0) + (EnableInvokeDynamic ? 3 : 0); } + static int extra_stack_entries() { return EnableInvokeDynamic ? (int) MethodHandlePushLimit + 3 : 0; } static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize() // RedefineClasses() support: diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index 6da4b969615..2aae1f7f3ec 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -112,7 +112,7 @@ bool MethodHandles::spot_check_entry_names() { // MethodHandles::generate_adapters // void MethodHandles::generate_adapters() { - if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL) return; + if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL) return; assert(_adapter_code == NULL, "generate only once"); @@ -143,7 +143,7 @@ void MethodHandlesAdapterGenerator::generate() { void MethodHandles::set_enabled(bool z) { if (_enabled != z) { - guarantee(z && EnableMethodHandles, "can only enable once, and only if -XX:+EnableMethodHandles"); + guarantee(z && EnableInvokeDynamic, "can only enable once, and only if -XX:+EnableInvokeDynamic"); _enabled = z; } } @@ -2579,7 +2579,6 @@ static JNINativeMethod methods[] = { {CC"getMembers", CC"("CLS""STRG""STRG"I"CLS"I["MEM")I", FN_PTR(MHN_getMembers)} }; -// More entry points specifically for EnableInvokeDynamic. // FIXME: Remove methods2 after AllowTransitionalJSR292 is removed. static JNINativeMethod methods2[] = { {CC"registerBootstrap", CC"("CLS MH")V", FN_PTR(MHN_registerBootstrap)}, @@ -2618,10 +2617,8 @@ static void hack_signatures(JNINativeMethod* methods, jint num_methods, const ch JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) { assert(MethodHandles::spot_check_entry_names(), "entry enum is OK"); - // note: this explicit warning-producing stuff will be replaced by auto-detection of the JSR 292 classes - - if (!EnableMethodHandles) { - warning("JSR 292 method handles are disabled in this JVM. Use -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles to enable."); + if (!EnableInvokeDynamic) { + warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable."); return; // bind nothing } @@ -2702,11 +2699,6 @@ JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) MethodHandles::set_enabled(true); } - if (!EnableInvokeDynamic) { - warning("JSR 292 invokedynamic is disabled in this JVM. Use -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic to enable."); - return; // bind nothing - } - if (AllowTransitionalJSR292) { ThreadToNativeFromVM ttnfv(thread); diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index a4531e948a0..5458bf70e54 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -1560,7 +1560,7 @@ JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls)) } } } - if (AnonymousClasses) { + if (EnableInvokeDynamic) { env->RegisterNatives(unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod)); if (env->ExceptionOccurred()) { if (PrintMiscellaneous && (Verbose || WizardMode)) { diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 6532c305f76..550559e0659 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2974,21 +2974,28 @@ jint Arguments::parse(const JavaVMInitArgs* args) { } #endif // PRODUCT - if (EnableInvokeDynamic && !EnableMethodHandles) { - if (!FLAG_IS_DEFAULT(EnableMethodHandles)) { - warning("forcing EnableMethodHandles true because EnableInvokeDynamic is true"); + // Transitional + if (EnableMethodHandles || AnonymousClasses) { + if (!EnableInvokeDynamic && !FLAG_IS_DEFAULT(EnableInvokeDynamic)) { + warning("EnableMethodHandles and AnonymousClasses are obsolete. Keeping EnableInvokeDynamic disabled."); + } else { + EnableInvokeDynamic = true; } - EnableMethodHandles = true; } - if (EnableMethodHandles && !AnonymousClasses) { - if (!FLAG_IS_DEFAULT(AnonymousClasses)) { - warning("forcing AnonymousClasses true because EnableMethodHandles is true"); + + // JSR 292 is not supported before 1.7 + if (!JDK_Version::is_gte_jdk17x_version()) { + if (EnableInvokeDynamic) { + if (!FLAG_IS_DEFAULT(EnableInvokeDynamic)) { + warning("JSR 292 is not supported before 1.7. Disabling support."); + } + EnableInvokeDynamic = false; } - AnonymousClasses = true; } - if ((EnableMethodHandles || AnonymousClasses) && ScavengeRootsInCode == 0) { + + if (EnableInvokeDynamic && ScavengeRootsInCode == 0) { if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) { - warning("forcing ScavengeRootsInCode non-zero because EnableMethodHandles or AnonymousClasses is true"); + warning("forcing ScavengeRootsInCode non-zero because EnableInvokeDynamic is true"); } ScavengeRootsInCode = 1; } diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 10c687879fe..020a1673ea6 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3693,11 +3693,15 @@ class CommandLineFlags { "Skip assert() and verify() which page-in unwanted shared " \ "objects. ") \ \ + diagnostic(bool, EnableInvokeDynamic, true, \ + "support JSR 292 (method handles, invokedynamic, " \ + "anonymous classes") \ + \ product(bool, AnonymousClasses, false, \ - "support sun.misc.Unsafe.defineAnonymousClass") \ + "support sun.misc.Unsafe.defineAnonymousClass (deprecated)") \ \ experimental(bool, EnableMethodHandles, false, \ - "support method handles (true by default under JSR 292)") \ + "support method handles (deprecated)") \ \ diagnostic(intx, MethodHandlePushLimit, 3, \ "number of additional stack slots a method handle may push") \ @@ -3714,9 +3718,6 @@ class CommandLineFlags { experimental(bool, TrustFinalNonStaticFields, false, \ "trust final non-static declarations for constant folding") \ \ - experimental(bool, EnableInvokeDynamic, false, \ - "recognize the invokedynamic instruction") \ - \ experimental(bool, AllowTransitionalJSR292, true, \ "recognize pre-PFD formats of invokedynamic") \ \ diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index 63d0b7b667d..8e8e2eb812e 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -1682,7 +1682,7 @@ char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread, tty->print_cr("WrongMethodType thread="PTR_FORMAT" req="PTR_FORMAT" act="PTR_FORMAT"", thread, required, actual); } - assert(EnableMethodHandles, ""); + assert(EnableInvokeDynamic, ""); oop singleKlass = wrong_method_type_is_for_single_argument(thread, required); char* message = NULL; if (singleKlass != NULL) { diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 817a80170b4..6cb2deeb428 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -3229,7 +3229,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { warning("java.lang.ArithmeticException has not been initialized"); warning("java.lang.StackOverflowError has not been initialized"); } - } + } // See : bugid 4211085. // Background : the static initializer of java.lang.Compiler tries to read From d695515e875b77d10d1b9f6bfac833fca1de7605 Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Thu, 31 Mar 2011 17:04:31 +0400 Subject: [PATCH 103/168] 7009422: Two dead links in Swing API documentation Reviewed-by: darcy, art --- jdk/src/share/classes/java/awt/Component.java | 2 +- jdk/src/share/classes/java/lang/CharSequence.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index d0eda994f1b..ee01a58d4b5 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -5795,7 +5795,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * InputMethodRequests instance. * If listener l is null, * no exception is thrown and no action is performed. - *

Refer to Refer to AWT Threading Issues for details on AWT's threading model. * * @param l the input method listener diff --git a/jdk/src/share/classes/java/lang/CharSequence.java b/jdk/src/share/classes/java/lang/CharSequence.java index 6d19f5a1830..d9e65a005a1 100644 --- a/jdk/src/share/classes/java/lang/CharSequence.java +++ b/jdk/src/share/classes/java/lang/CharSequence.java @@ -66,7 +66,7 @@ public interface CharSequence { * indexing.

* *

If the char value specified by the index is a - * surrogate, the surrogate + * surrogate, the surrogate * value is returned. * * @param index the index of the char value to be returned From 5faf6281645e3c27ef82fa1aafa1b722edf2155e Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 31 Mar 2011 17:37:11 +0100 Subject: [PATCH 104/168] 7032866: Problem with fix for 7030256 Reviewed-by: alanb --- jdk/src/windows/native/java/net/net_util_md.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/windows/native/java/net/net_util_md.c b/jdk/src/windows/native/java/net/net_util_md.c index 4bb9d26041d..4cf522e786a 100644 --- a/jdk/src/windows/native/java/net/net_util_md.c +++ b/jdk/src/windows/native/java/net/net_util_md.c @@ -230,7 +230,7 @@ NET_GetFileDescriptorID(JNIEnv *env) jint IPv6_supported() { SOCKET s = socket(AF_INET6, SOCK_STREAM, 0) ; - if (s < 0) { + if (s == INVALID_SOCKET) { return JNI_FALSE; } closesocket(s); @@ -775,7 +775,7 @@ jint getDefaultIPv6Interface(JNIEnv *env, struct SOCKADDR_IN6 *target_addr) DWORD b; struct sockaddr_in6 route; SOCKET fd = socket(AF_INET6, SOCK_STREAM, 0); - if (fd < 0) { + if (fd == INVALID_SOCKET) { return 0; } @@ -783,7 +783,7 @@ jint getDefaultIPv6Interface(JNIEnv *env, struct SOCKADDR_IN6 *target_addr) (void *)target_addr, sizeof(struct sockaddr_in6), (void *)&route, sizeof(struct sockaddr_in6), &b, 0, 0); - if (ret < 0) { + if (ret == SOCKET_ERROR) { // error closesocket(fd); return 0; From c19fe5a5d0810e100336e06988146829d1f89fac Mon Sep 17 00:00:00 2001 From: Alexander Kouznetsov Date: Thu, 31 Mar 2011 10:15:08 -0700 Subject: [PATCH 105/168] 7027700: /jfc/SwingApplet demo needs to be improved Reviewed-by: alexp --- .../demo/jfc/SwingApplet/SwingApplet.java | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/jdk/src/share/demo/jfc/SwingApplet/SwingApplet.java b/jdk/src/share/demo/jfc/SwingApplet/SwingApplet.java index bc801a0b368..281ca709849 100644 --- a/jdk/src/share/demo/jfc/SwingApplet/SwingApplet.java +++ b/jdk/src/share/demo/jfc/SwingApplet/SwingApplet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,42 +29,59 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - */ -import java.awt.*; -import java.awt.event.*; -import java.net.*; -import java.applet.*; -import javax.swing.*; +import java.awt.FlowLayout; +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JApplet; +import javax.swing.JButton; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + /** * A very simple applet. */ +@SuppressWarnings("serial") public class SwingApplet extends JApplet { JButton button; - public void init() { - - // Force SwingApplet to come up in the System L&F - String laf = UIManager.getSystemLookAndFeelClassName(); + private void initUI() { + // Trying to set Nimbus look and feel try { - UIManager.setLookAndFeel(laf); - // If you want the Cross Platform L&F instead, comment out the above line and - // uncomment the following: - // UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - } catch (UnsupportedLookAndFeelException exc) { - System.err.println("Warning: UnsupportedLookAndFeel: " + laf); - } catch (Exception exc) { - System.err.println("Error loading " + laf + ": " + exc); + UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); + } catch (Exception ex) { + Logger.getLogger(SwingApplet.class.getName()). + log(Level.SEVERE, "Failed to apply Nimbus look and feel", ex); } - getContentPane().setLayout(new FlowLayout()); button = new JButton("Hello, I'm a Swing Button!"); getContentPane().add(button); + getContentPane().doLayout(); } + @Override + public void init() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + initUI(); + } + }); + } catch (InterruptedException ex) { + Logger.getLogger(SwingApplet.class.getName()). + log(Level.SEVERE, null, ex); + } catch (InvocationTargetException ex) { + Logger.getLogger(SwingApplet.class.getName()). + log(Level.SEVERE, null, ex); + } + } + + @Override public void stop() { if (button != null) { getContentPane().remove(button); From 0493606cdd793eb2ce93f8dd6d79605cbbe8f32c Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 31 Mar 2011 13:22:34 -0700 Subject: [PATCH 106/168] 7032696: Fix for 7029152 broke VM StrIntrinsicNode::Ideal() should not optimize memory during Parse. Reviewed-by: jrose, never --- hotspot/src/share/vm/opto/loopTransform.cpp | 6 ++++++ hotspot/src/share/vm/opto/memnode.cpp | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index e386dcd59d8..4c49ee0e634 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -432,6 +432,12 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const { return false; } + // Currently we don't have policy to optimize one iteration loops. + // Maximally unrolling transformation is used for that: + // it is peeled and the original loop become non reachable (dead). + if (trip_count == 1) + return true; + // Do not unroll a loop with String intrinsics code. // String intrinsics are large and have loops. for (uint k = 0; k < _body.size(); k++) { diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index 4c6878d3f6d..d5d53132a3a 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -2628,12 +2628,16 @@ uint StrIntrinsicNode::match_edge(uint idx) const { Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) { if (remove_dead_region(phase, can_reshape)) return this; - Node* mem = phase->transform(in(MemNode::Memory)); - // If transformed to a MergeMem, get the desired slice - uint alias_idx = phase->C->get_alias_index(adr_type()); - mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem; - if (mem != in(MemNode::Memory)) - set_req(MemNode::Memory, mem); + if (can_reshape) { + Node* mem = phase->transform(in(MemNode::Memory)); + // If transformed to a MergeMem, get the desired slice + uint alias_idx = phase->C->get_alias_index(adr_type()); + mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem; + if (mem != in(MemNode::Memory)) { + set_req(MemNode::Memory, mem); + return this; + } + } return NULL; } From 036560e9991ee634268ab771903c94cf6b11f723 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Thu, 31 Mar 2011 14:00:41 -0700 Subject: [PATCH 107/168] 7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests Reviewed-by: kvn, kamg, jcoomes --- .../src/share/vm/classfile/javaClasses.cpp | 9 +++++ .../src/share/vm/classfile/javaClasses.hpp | 24 ++++++++++++ .../src/share/vm/classfile/symbolTable.cpp | 38 ++----------------- .../src/share/vm/classfile/symbolTable.hpp | 4 +- hotspot/src/share/vm/memory/dump.cpp | 13 +------ 5 files changed, 40 insertions(+), 48 deletions(-) diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index b1887ae7fda..9294a58fbe7 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -301,6 +301,15 @@ jchar* java_lang_String::as_unicode_string(oop java_string, int& length) { return result; } +unsigned int java_lang_String::hash_string(oop java_string) { + typeArrayOop value = java_lang_String::value(java_string); + int offset = java_lang_String::offset(java_string); + int length = java_lang_String::length(java_string); + + if (length == 0) return 0; + return hash_string(value->char_at_addr(offset), length); +} + Symbol* java_lang_String::as_symbol(Handle java_string, TRAPS) { oop obj = java_string(); typeArrayOop value = java_lang_String::value(obj); diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index db4af2e6871..bed2ad46ac2 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -109,6 +109,30 @@ class java_lang_String : AllStatic { static char* as_platform_dependent_str(Handle java_string, TRAPS); static jchar* as_unicode_string(oop java_string, int& length); + // Compute the hash value for a java.lang.String object which would + // contain the characters passed in. This hash value is used for at + // least two purposes. + // + // (a) As the hash value used by the StringTable for bucket selection + // and comparison (stored in the HashtableEntry structures). This + // is used in the String.intern() method. + // + // (b) As the hash value used by the String object itself, in + // String.hashCode(). This value is normally calculate in Java code + // in the String.hashCode method(), but is precomputed for String + // objects in the shared archive file. + // + // For this reason, THIS ALGORITHM MUST MATCH String.hashCode(). + static unsigned int hash_string(jchar* s, int len) { + unsigned int h = 0; + while (len-- > 0) { + h = 31*h + (unsigned int) *s; + s++; + } + return h; + } + static unsigned int hash_string(oop java_string); + static bool equals(oop java_string, jchar* chars, int len); // Conversion between '.' and '/' formats diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index 2ee98db4ef7..e3dd0862910 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -480,33 +480,6 @@ class StableMemoryChecker : public StackObj { // -------------------------------------------------------------------------- - - -// Compute the hash value for a java.lang.String object which would -// contain the characters passed in. This hash value is used for at -// least two purposes. -// -// (a) As the hash value used by the StringTable for bucket selection -// and comparison (stored in the HashtableEntry structures). This -// is used in the String.intern() method. -// -// (b) As the hash value used by the String object itself, in -// String.hashCode(). This value is normally calculate in Java code -// in the String.hashCode method(), but is precomputed for String -// objects in the shared archive file. -// -// For this reason, THIS ALGORITHM MUST MATCH String.hashCode(). - -int StringTable::hash_string(jchar* s, int len) { - unsigned h = 0; - while (len-- > 0) { - h = 31*h + (unsigned) *s; - s++; - } - return h; -} - - StringTable* StringTable::_the_table = NULL; oop StringTable::lookup(int index, jchar* name, @@ -561,7 +534,7 @@ oop StringTable::lookup(Symbol* symbol) { ResourceMark rm; int length; jchar* chars = symbol->as_unicode(length); - unsigned int hashValue = hash_string(chars, length); + unsigned int hashValue = java_lang_String::hash_string(chars, length); int index = the_table()->hash_to_index(hashValue); return the_table()->lookup(index, chars, length, hashValue); } @@ -569,7 +542,7 @@ oop StringTable::lookup(Symbol* symbol) { oop StringTable::intern(Handle string_or_null, jchar* name, int len, TRAPS) { - unsigned int hashValue = hash_string(name, len); + unsigned int hashValue = java_lang_String::hash_string(name, len); int index = the_table()->hash_to_index(hashValue); oop string = the_table()->lookup(index, name, len, hashValue); @@ -663,10 +636,7 @@ void StringTable::verify() { oop s = p->literal(); guarantee(s != NULL, "interned string is NULL"); guarantee(s->is_perm() || !JavaObjectsInPerm, "interned string not in permspace"); - - int length; - jchar* chars = java_lang_String::as_unicode_string(s, length); - unsigned int h = hash_string(chars, length); + unsigned int h = java_lang_String::hash_string(s); guarantee(p->hash() == h, "broken hash in string table entry"); guarantee(the_table()->hash_to_index(h) == i, "wrong index in string table"); diff --git a/hotspot/src/share/vm/classfile/symbolTable.hpp b/hotspot/src/share/vm/classfile/symbolTable.hpp index 13aef77ad7f..ca0b07d7888 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.hpp +++ b/hotspot/src/share/vm/classfile/symbolTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -242,8 +242,6 @@ public: _the_table = new StringTable(t, number_of_entries); } - static int hash_string(jchar* s, int len); - // GC support // Delete pointers to otherwise-unreachable objects. static void unlink(BoolObjectClosure* cl); diff --git a/hotspot/src/share/vm/memory/dump.cpp b/hotspot/src/share/vm/memory/dump.cpp index 3e34118fc91..1c88bb70fd8 100644 --- a/hotspot/src/share/vm/memory/dump.cpp +++ b/hotspot/src/share/vm/memory/dump.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 @@ -80,16 +80,7 @@ public: oop obj = *p; if (obj->klass() == SystemDictionary::String_klass()) { - int hash; - typeArrayOop value = java_lang_String::value(obj); - int length = java_lang_String::length(obj); - if (length == 0) { - hash = 0; - } else { - int offset = java_lang_String::offset(obj); - jchar* s = value->char_at_addr(offset); - hash = StringTable::hash_string(s, length); - } + int hash = java_lang_String::hash_string(obj); obj->int_field_put(hash_offset, hash); } } From b0b08af4d7a0129ed063c3ecee2963d4b2b389a4 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 31 Mar 2011 15:02:57 -0700 Subject: [PATCH 108/168] 7026407: Broken in javax.imageio.metadata.IIOMetadataNode.getTagName() Reviewed-by: jgodinez --- .../share/classes/javax/imageio/metadata/IIOMetadataNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java index 4e3c016874c..9d4145c80da 100644 --- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java +++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java @@ -724,7 +724,7 @@ public class IIOMetadataNode implements Element, NodeList { /** * Equivalent to getNodeName. * - * @return the node name, as a StringString */ public String getTagName() { return nodeName; From f33b8cbb7ab8325a080ce35861bb32e7f0e60476 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 31 Mar 2011 16:54:27 -0700 Subject: [PATCH 109/168] 7032849: 7022998 changes broke hs_err compile task print Initialize the time stamp on ostream used for hs_err dumping. Reviewed-by: never --- hotspot/src/share/vm/utilities/ostream.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp index 02fda35daaf..2bdade8b109 100644 --- a/hotspot/src/share/vm/utilities/ostream.cpp +++ b/hotspot/src/share/vm/utilities/ostream.cpp @@ -810,6 +810,8 @@ staticBufferStream::staticBufferStream(char* buffer, size_t buflen, _buffer = buffer; _buflen = buflen; _outer_stream = outer_stream; + // compile task prints time stamp relative to VM start + _stamp.update_to(1); } void staticBufferStream::write(const char* c, size_t len) { From bddd7f15bd7deb421a99002a176c9d64151ebe24 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 31 Mar 2011 18:13:58 -0700 Subject: [PATCH 110/168] Added tag jdk7-b136 for changeset 9186e0e62eea --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 8b7fabe214d..8d5bee022fb 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -110,3 +110,4 @@ cc58c11af15411042719e9c82707fdbef60a9e0f jdk7-b130 c6f380693342feadccc5fe2c5adf500e861361aa jdk7-b133 ddc2fcb3682ffd27f44354db666128827be7e3c3 jdk7-b134 783bd02b4ab4596059c74b10a1793d7bd2f1c157 jdk7-b135 +2fe76e73adaa5133ac559f0b3c2c0707eca04580 jdk7-b136 From 385806e22ea489e9a410b3f7ae8dabe3b06dde52 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 31 Mar 2011 18:13:59 -0700 Subject: [PATCH 111/168] Added tag jdk7-b136 for changeset 7f7e00766ae7 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index e8459c40d47..b79766ec8ea 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -110,3 +110,4 @@ d7532bcd3742f1576dd07ff9fbb535c9c9a276e9 jdk7-b126 671fe2e623ffefb4b7c312be919fc71eb48c1df1 jdk7-b133 918003855fa0dba5acf4bf1fe36526d2fc4c1ba8 jdk7-b134 e0b72ae5dc5e824b342801c8d1d336a55eb54e2c jdk7-b135 +48ef0c712e7cbf272f47f9224db92a3c6a9e2612 jdk7-b136 From 6c26fd43cdd8e0c6b9839e08ab493ac499203588 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 31 Mar 2011 18:14:04 -0700 Subject: [PATCH 112/168] Added tag jdk7-b136 for changeset 8908d8654a39 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index e5121254096..56937856e86 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -158,3 +158,4 @@ a8d643a4db47c7b58e0bcb49c77b5c3610de86a8 hs21-b03 3c76374706ea8a77e15aec8310e831e5734f8775 hs21-b04 b898f0fc3cedc972d884d31a751afd75969531cf jdk7-b135 b898f0fc3cedc972d884d31a751afd75969531cf hs21-b05 +bd586e392d93b7ed7a1636dcc8da2b6a4203a102 jdk7-b136 From 8dbe27427fc9e36fcb278517e0b32265d9a178ab Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 31 Mar 2011 18:14:10 -0700 Subject: [PATCH 113/168] Added tag jdk7-b136 for changeset cc86c97af00b --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index d305fff8865..02abc6c38a9 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -110,3 +110,4 @@ abe04c59a556a3821c30bd8839e3c74f5d4281d1 jdk7-b132 8e1148c7911b02e00a727461525f239da025cab7 jdk7-b133 d56b326ae0544fc16c3e0d0285876f3c82054db2 jdk7-b134 4aa9916693dc1078580c1865e6f2584046851e5a jdk7-b135 +1759daa85d33800bd578853f9531f9de73f70fc7 jdk7-b136 From b7dd5b7d0a52551235b6096171a53cb14ddf94a0 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 31 Mar 2011 18:14:11 -0700 Subject: [PATCH 114/168] Added tag jdk7-b136 for changeset f69a163a9b51 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 938b0888cb5..c00bbca035e 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -110,3 +110,4 @@ ba1fac1c2083196422a12130db174334179a4d44 jdk7-b130 359d0c8c00a02d3a094c19f8a485b2217c99a4e0 jdk7-b133 545de8303fec939db3892f7c324dd7df197e8f09 jdk7-b134 d5fc61f18043765705ef22b57a68c924ab2f1a5b jdk7-b135 +c81d289c9a532d6e94af3c09d856a2a20529040f jdk7-b136 From 4ddb181ec8c6d4975ef11653b1d77c011aa30ce1 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 31 Mar 2011 18:14:29 -0700 Subject: [PATCH 115/168] Added tag jdk7-b136 for changeset 6aa795396cc8 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 3dc82c74e43..aee1d2128e3 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -110,3 +110,4 @@ e3d011d59a33acef79eff7523bef069557e91002 jdk7-b132 e77e98f936e83d94c9b56cc7af218dc822a06122 jdk7-b133 3d7acdbb72cab55deedfd35f60d4732abc9d6ac4 jdk7-b134 9d0a61ac567b983da7cc8f4a7030f2245bb6dbab jdk7-b135 +ed0f7f1f9511db4f9615b1426d22f8b961629275 jdk7-b136 From 92c64a56aeb204e71e4e983171a38c2abb3429b3 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 31 Mar 2011 19:09:02 -0700 Subject: [PATCH 116/168] 7005628: Clarify NPE behavior of Throwable.addSuppressed(null) Reviewed-by: dholmes, mchung, jjb --- .../java/lang/ArithmeticException.java | 13 ++-- .../java/lang/NullPointerException.java | 24 +++--- .../classes/java/lang/OutOfMemoryError.java | 13 ++-- .../share/classes/java/lang/Throwable.java | 78 ++++++++++++------- .../lang/Throwable/SuppressedExceptions.java | 54 +++++++------ 5 files changed, 113 insertions(+), 69 deletions(-) diff --git a/jdk/src/share/classes/java/lang/ArithmeticException.java b/jdk/src/share/classes/java/lang/ArithmeticException.java index 7787bd947fc..0d6ed9164ef 100644 --- a/jdk/src/share/classes/java/lang/ArithmeticException.java +++ b/jdk/src/share/classes/java/lang/ArithmeticException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. 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 @@ -30,15 +30,18 @@ package java.lang; * example, an integer "divide by zero" throws an * instance of this class. * + * {@code ArithmeticException} objects may be constructed by the + * virtual machine as if {@linkplain Throwable#Throwable(String, + * Throwable, boolean) suppression were disabled}. + * * @author unascribed * @since JDK1.0 */ -public -class ArithmeticException extends RuntimeException { +public class ArithmeticException extends RuntimeException { private static final long serialVersionUID = 2256477558314496007L; /** - * Constructs an ArithmeticException with no detail + * Constructs an {@code ArithmeticException} with no detail * message. */ public ArithmeticException() { @@ -46,7 +49,7 @@ class ArithmeticException extends RuntimeException { } /** - * Constructs an ArithmeticException with the specified + * Constructs an {@code ArithmeticException} with the specified * detail message. * * @param s the detail message. diff --git a/jdk/src/share/classes/java/lang/NullPointerException.java b/jdk/src/share/classes/java/lang/NullPointerException.java index 24105eab27e..0472710f23f 100644 --- a/jdk/src/share/classes/java/lang/NullPointerException.java +++ b/jdk/src/share/classes/java/lang/NullPointerException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. 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,20 +26,24 @@ package java.lang; /** - * Thrown when an application attempts to use null in a + * Thrown when an application attempts to use {@code null} in a * case where an object is required. These include: *

    - *
  • Calling the instance method of a null object. - *
  • Accessing or modifying the field of a null object. - *
  • Taking the length of null as if it were an array. - *
  • Accessing or modifying the slots of null as if it + *
  • Calling the instance method of a {@code null} object. + *
  • Accessing or modifying the field of a {@code null} object. + *
  • Taking the length of {@code null} as if it were an array. + *
  • Accessing or modifying the slots of {@code null} as if it * were an array. - *
  • Throwing null as if it were a Throwable + *
  • Throwing {@code null} as if it were a {@code Throwable} * value. *
*

* Applications should throw instances of this class to indicate - * other illegal uses of the null object. + * other illegal uses of the {@code null} object. + * + * {@code NullPointerException} objects may be constructed by the + * virtual machine as if {@linkplain Throwable#Throwable(String, + * Throwable, boolean) suppression were disabled}. * * @author unascribed * @since JDK1.0 @@ -49,14 +53,14 @@ class NullPointerException extends RuntimeException { private static final long serialVersionUID = 5162710183389028792L; /** - * Constructs a NullPointerException with no detail message. + * Constructs a {@code NullPointerException} with no detail message. */ public NullPointerException() { super(); } /** - * Constructs a NullPointerException with the specified + * Constructs a {@code NullPointerException} with the specified * detail message. * * @param s the detail message. diff --git a/jdk/src/share/classes/java/lang/OutOfMemoryError.java b/jdk/src/share/classes/java/lang/OutOfMemoryError.java index 8cec23f762a..37b0ae6f476 100644 --- a/jdk/src/share/classes/java/lang/OutOfMemoryError.java +++ b/jdk/src/share/classes/java/lang/OutOfMemoryError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. 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 @@ -30,22 +30,25 @@ package java.lang; * because it is out of memory, and no more memory could be made * available by the garbage collector. * + * {@code OutOfMemoryError} objects may be constructed by the virtual + * machine as if {@linkplain Throwable#Throwable(String, Throwable, + * boolean) suppression were disabled}. + * * @author unascribed * @since JDK1.0 */ -public -class OutOfMemoryError extends VirtualMachineError { +public class OutOfMemoryError extends VirtualMachineError { private static final long serialVersionUID = 8228564086184010517L; /** - * Constructs an OutOfMemoryError with no detail message. + * Constructs an {@code OutOfMemoryError} with no detail message. */ public OutOfMemoryError() { super(); } /** - * Constructs an OutOfMemoryError with the specified + * Constructs an {@code OutOfMemoryError} with the specified * detail message. * * @param s the detail message. diff --git a/jdk/src/share/classes/java/lang/Throwable.java b/jdk/src/share/classes/java/lang/Throwable.java index 2b80259d0b8..2784238efa4 100644 --- a/jdk/src/share/classes/java/lang/Throwable.java +++ b/jdk/src/share/classes/java/lang/Throwable.java @@ -52,7 +52,7 @@ import java.util.*; * throwable can {@linkplain Throwable#addSuppressed suppress} other * throwables from being propagated. Finally, the throwable can also * contain a cause: another throwable that caused this - * throwable to get thrown. The recording of this causal information + * throwable to be constructed. The recording of this causal information * is referred to as the chained exception facility, as the * cause can, itself, have a cause, and so on, leading to a "chain" of * exceptions, each caused by another. @@ -282,6 +282,41 @@ public class Throwable implements Serializable { this.cause = cause; } + /** + * Constructs a new throwable with the specified detail message, + * cause, and {@linkplain #addSuppressed suppression} enabled or + * disabled. If suppression is disabled, {@link #getSuppressed} + * for this object will return a zero-length array and calls to + * {@link #addSuppressed} that would otherwise append an exception + * to the suppressed list will have no effect. + * + *

Note that the other constructors of {@code Throwable} treat + * suppression as being enabled. Subclasses of {@code Throwable} + * should document any conditions under which suppression is + * disabled. Disabling of suppression should only occur in + * exceptional circumstances where special requirements exist, + * such as a virtual machine reusing exception objects under + * low-memory situations. + * + * @param message the detail message. + * @param cause the cause. (A {@code null} value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @param enableSuppression whether or not suppression is enabled or disabled + * + * @see OutOfMemoryError + * @see NullPointerException + * @see ArithmeticException + * @since 1.7 + */ + protected Throwable(String message, Throwable cause, + boolean enableSuppression) { + fillInStackTrace(); + detailMessage = message; + this.cause = cause; + if (!enableSuppression) + suppressedExceptions = null; + } + /** * Returns the detail message string of this throwable. * @@ -830,13 +865,10 @@ public class Throwable implements Serializable { * typically called (automatically and implicitly) by the {@code * try}-with-resources statement. * - * If the first exception to be suppressed is {@code null}, that - * indicates suppressed exception information will not be - * recorded for this exception. Subsequent calls to this method - * will not record any suppressed exceptions. Otherwise, - * attempting to suppress {@code null} after an exception has - * already been successfully suppressed results in a {@code - * NullPointerException}. + *

The suppression behavior is enabled unless disabled + * {@linkplain #Throwable(String, Throwable, boolean) via a + * constructor}. When suppression is disabled, this method does + * nothing other than to validate its argument. * *

Note that when one exception {@linkplain * #initCause(Throwable) causes} another exception, the first @@ -874,33 +906,23 @@ public class Throwable implements Serializable { * suppressed exceptions * @throws IllegalArgumentException if {@code exception} is this * throwable; a throwable cannot suppress itself. - * @throws NullPointerException if {@code exception} is null and - * an exception has already been suppressed by this exception + * @throws NullPointerException if {@code exception} is {@code null} * @since 1.7 */ public final synchronized void addSuppressed(Throwable exception) { if (exception == this) throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE); - if (exception == null) { - if (suppressedExceptions == SUPPRESSED_SENTINEL) { - suppressedExceptions = null; // No suppression information recorded - return; - } else - throw new NullPointerException(NULL_CAUSE_MESSAGE); - } else { - assert exception != null && exception != this; + if (exception == null) + throw new NullPointerException(NULL_CAUSE_MESSAGE); - if (suppressedExceptions == null) // Suppressed exceptions not recorded - return; + if (suppressedExceptions == null) // Suppressed exceptions not recorded + return; - if (suppressedExceptions == SUPPRESSED_SENTINEL) - suppressedExceptions = new ArrayList<>(1); + if (suppressedExceptions == SUPPRESSED_SENTINEL) + suppressedExceptions = new ArrayList<>(1); - assert suppressedExceptions != SUPPRESSED_SENTINEL; - - suppressedExceptions.add(exception); - } + suppressedExceptions.add(exception); } private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0]; @@ -910,7 +932,9 @@ public class Throwable implements Serializable { * suppressed, typically by the {@code try}-with-resources * statement, in order to deliver this exception. * - * If no exceptions were suppressed, an empty array is returned. + * If no exceptions were suppressed or {@linkplain + * Throwable(String, Throwable, boolean) suppression is disabled}, + * an empty array is returned. * * @return an array containing all of the exceptions that were * suppressed to deliver this exception. diff --git a/jdk/test/java/lang/Throwable/SuppressedExceptions.java b/jdk/test/java/lang/Throwable/SuppressedExceptions.java index f1c30b358ad..b987600dca3 100644 --- a/jdk/test/java/lang/Throwable/SuppressedExceptions.java +++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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,7 @@ import java.util.*; /* * @test - * @bug 6911258 6962571 6963622 6991528 + * @bug 6911258 6962571 6963622 6991528 7005628 * @summary Basic tests of suppressed exceptions * @author Joseph D. Darcy */ @@ -50,14 +50,6 @@ public class SuppressedExceptions { } catch (IllegalArgumentException iae) { ; // Expected } - - throwable.addSuppressed(null); // Immutable suppression list - try { - throwable.addSuppressed(throwable); - throw new RuntimeException("IllegalArgumentException for self-suppresion not thrown."); - } catch (IllegalArgumentException iae) { - ; // Expected - } } private static void basicSupressionTest() { @@ -153,19 +145,19 @@ public class SuppressedExceptions { (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, }; - ByteArrayInputStream bais = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(bais); + try(ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + ObjectInputStream ois = new ObjectInputStream(bais)) { + Object o = ois.readObject(); + Throwable throwable = (Throwable) o; - Object o = ois.readObject(); - Throwable throwable = (Throwable) o; + System.err.println("TESTING SERIALIZED EXCEPTION"); - System.err.println("TESTING SERIALIZED EXCEPTION"); - - Throwable[] t0 = throwable.getSuppressed(); - if (t0.length != 0) { // Will fail if t0 is null. - throw new RuntimeException(message); + Throwable[] t0 = throwable.getSuppressed(); + if (t0.length != 0) { // Will fail if t0 is null. + throw new RuntimeException(message); + } + throwable.printStackTrace(); } - throwable.printStackTrace(); } private static void selfReference() { @@ -183,8 +175,7 @@ public class SuppressedExceptions { } private static void noModification() { - Throwable t = new Throwable(); - t.addSuppressed(null); + Throwable t = new NoSuppression(false); Throwable[] t0 = t.getSuppressed(); if (t0.length != 0) @@ -196,5 +187,24 @@ public class SuppressedExceptions { t0 = t.getSuppressed(); if (t0.length != 0) throw new RuntimeException("Bad nonzero length of suppressed exceptions."); + + Throwable suppressed = new ArithmeticException(); + t = new NoSuppression(true); // Suppression enabled + // Make sure addSuppressed(null) throws an NPE + try { + t.addSuppressed(null); + } catch(NullPointerException e) { + ; // Expected + } + t.addSuppressed(suppressed); + t0 = t.getSuppressed(); + if (t0.length != 1 || t0[0] != suppressed) + throw new RuntimeException("Expected suppression did not occur."); + } + + private static class NoSuppression extends Throwable { + public NoSuppression(boolean enableSuppression) { + super("The medium.", null, enableSuppression); + } } } From be712a0152eab8b2d02ce957cab4acb8ca723387 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Fri, 1 Apr 2011 12:30:13 +0100 Subject: [PATCH 117/168] 7032633: javac -Xlint:all warns about flush() within try on an auto-closeable resource Missing name check before calling MethodSymbol.overrides causes wrong warnings to be issued Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Attr.java | 1 + .../javac/TryWithResources/T7032633.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 langtools/test/tools/javac/TryWithResources/T7032633.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index b4fc90f3d9b..bba81ad62b8 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2289,6 +2289,7 @@ public class Attr extends JCTree.Visitor { sitesym.kind == VAR && ((VarSymbol)sitesym).isResourceVariable() && sym.kind == MTH && + sym.name.equals(names.close) && sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) && env.info.lint.isEnabled(LintCategory.TRY)) { log.warning(LintCategory.TRY, tree, "try.explicit.close.call"); diff --git a/langtools/test/tools/javac/TryWithResources/T7032633.java b/langtools/test/tools/javac/TryWithResources/T7032633.java new file mode 100644 index 00000000000..81164c89df7 --- /dev/null +++ b/langtools/test/tools/javac/TryWithResources/T7032633.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7032633 + * @summary javac -Xlint:all warns about flush() within try on an auto-closeable resource + * @compile -Xlint:try -Werror T7032633.java + */ + +import java.io.IOException; +import java.io.OutputStream; + +public class T7032633 { + void test() throws IOException { + try (OutputStream out = System.out) { + out.flush(); + } + } +} From f61376e61bf58d7d045516518af9e951f32234e4 Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Fri, 1 Apr 2011 12:06:59 -0700 Subject: [PATCH 118/168] Added tag hs21-b06 for changeset 8908d8654a39 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 56937856e86..fcb97013f75 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -159,3 +159,4 @@ a8d643a4db47c7b58e0bcb49c77b5c3610de86a8 hs21-b03 b898f0fc3cedc972d884d31a751afd75969531cf jdk7-b135 b898f0fc3cedc972d884d31a751afd75969531cf hs21-b05 bd586e392d93b7ed7a1636dcc8da2b6a4203a102 jdk7-b136 +bd586e392d93b7ed7a1636dcc8da2b6a4203a102 hs21-b06 From e78547586a8e07f8ab7c05c20ac8a3da49654728 Mon Sep 17 00:00:00 2001 From: Clemens Eisserer Date: Fri, 1 Apr 2011 12:45:45 -0700 Subject: [PATCH 119/168] 7029934: Xrender: Text is truncated with 64 bit Linux JRE Reviewed-by: bae, flar, ceisserer --- .../native/sun/java2d/x11/XRBackendNative.c | 66 +++++++++++++++---- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c index f56e904a669..eb1ee48ecef 100644 --- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c +++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c @@ -644,7 +644,7 @@ Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative for (i=0; i < glyphCnt; i++) { GlyphInfo *jginfo = (GlyphInfo *) jlong_to_ptr(glyphInfoPtrs[i]); - gid[i] = (Glyph) (0xffffffff & ((unsigned int) jginfo->cellInfo)); + gid[i] = (Glyph) (0x0ffffffffL & ((unsigned long)(jginfo->cellInfo))); xginfo[i].x = (-jginfo->topLeftX); xginfo[i].y = (-jginfo->topLeftY); xginfo[i].width = jginfo->width; @@ -666,16 +666,56 @@ Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative JNIEXPORT void JNICALL Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative (JNIEnv *env, jclass cls, jint glyphSet, jintArray gidArray, jint glyphCnt) { - jint *gids; - int i; - if ((gids = (jint *) (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL)) == NULL) { + /* The glyph ids are 32 bit but may be stored in a 64 bit long on + * a 64 bit architecture. So optimise the 32 bit case to avoid + * extra stack or heap allocations by directly referencing the + * underlying Java array and only allocate on 64 bit. + */ + if (sizeof(jint) == sizeof(Glyph)) { + jint *gids = + (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL); + if (gids == NULL) { + return; + } else { + XRenderFreeGlyphs(awt_display, + (GlyphSet)glyphSet, (Glyph *)gids, glyphCnt); + (*env)->ReleasePrimitiveArrayCritical(env, gidArray, + gids, JNI_ABORT); + } return; + } else { + Glyph stack_ids[64]; + Glyph *gids = NULL; + jint* jgids = NULL; + int i; + + if (glyphCnt <= 64) { + gids = stack_ids; + } else { + gids = (Glyph *)malloc(sizeof(Glyph) * glyphCnt); + if (gids == NULL) { + return; + } + } + jgids = (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL); + if (jgids == NULL) { + if (gids != stack_ids) { + free(gids); + } + return; + } + for (i=0; i < glyphCnt; i++) { + gids[i] = jgids[i]; + } + XRenderFreeGlyphs(awt_display, + (GlyphSet) glyphSet, gids, glyphCnt); + (*env)->ReleasePrimitiveArrayCritical(env, gidArray, + jgids, JNI_ABORT); + if (gids != stack_ids) { + free(gids); + } } - - XRenderFreeGlyphs (awt_display, (GlyphSet) glyphSet, (Glyph *) gids, glyphCnt); - - (*env)->ReleasePrimitiveArrayCritical(env, gidArray, gids, JNI_ABORT); } JNIEXPORT jint JNICALL @@ -692,9 +732,9 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative jint *ids; jint *elts; XGlyphElt32 *xelts; - Glyph *xids; + unsigned int *xids; XGlyphElt32 selts[24]; - Glyph sids[256]; + unsigned int sids[256]; int charCnt = 0; if (eltCnt <= 24) { @@ -709,7 +749,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative if (glyphCnt <= 256) { xids = &sids[0]; } else { - xids = (Glyph *) malloc(sizeof(Glyph) * glyphCnt); + xids = (unsigned int*)malloc(sizeof(unsigned int) * glyphCnt); if (xids == NULL) { if (xelts != &selts[0]) { free(xelts); @@ -742,7 +782,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative } for (i=0; i < glyphCnt; i++) { - xids[i] = (Glyph) ids[i]; + xids[i] = ids[i]; } for (i=0; i < eltCnt; i++) { @@ -750,7 +790,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative xelts[i].xOff = elts[i*4 + 1]; xelts[i].yOff = elts[i*4 + 2]; xelts[i].glyphset = (GlyphSet) elts[i*4 + 3]; - xelts[i].chars = (unsigned int *) &xids[charCnt]; + xelts[i].chars = &xids[charCnt]; charCnt += xelts[i].nchars; } From 56980cf411680ca905c6eaab892df334f1b0e817 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 1 Apr 2011 20:21:14 -0700 Subject: [PATCH 120/168] 7032930: A way to specify MS Mincho to be used in dialoginput on windows JA locale Reviewed-by: igor, jgodinez --- .../classes/sun/awt/FontConfiguration.java | 8 ++ .../classes/sun/font/FontManagerForSGE.java | 7 ++ .../classes/sun/font/SunFontManager.java | 19 +++- .../sun/java2d/SunGraphicsEnvironment.java | 12 +++ .../sun/awt/Win32GraphicsEnvironment.java | 18 ---- .../TestSGEuseAlternateFontforJALocales.java | 99 +++++++++++++++++++ 6 files changed, 142 insertions(+), 21 deletions(-) create mode 100644 jdk/test/sun/java2d/SunGraphicsEnvironment/TestSGEuseAlternateFontforJALocales.java diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java index ba8f6e56a01..231f6a46779 100644 --- a/jdk/src/share/classes/sun/awt/FontConfiguration.java +++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java @@ -82,6 +82,10 @@ public abstract class FontConfiguration { * one to ensure proper static initialisation takes place. */ public FontConfiguration(SunFontManager fm) { + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .info("Creating standard Font Configuration"); + } if (FontUtilities.debugFonts() && logger == null) { logger = PlatformLogger.getLogger("sun.awt.FontConfiguration"); } @@ -111,6 +115,10 @@ public abstract class FontConfiguration { boolean preferLocaleFonts, boolean preferPropFonts) { fontManager = fm; + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger() + .info("Creating alternate Font Configuration"); + } this.preferLocaleFonts = preferLocaleFonts; this.preferPropFonts = preferPropFonts; /* fontConfig should be initialised by default constructor, and diff --git a/jdk/src/share/classes/sun/font/FontManagerForSGE.java b/jdk/src/share/classes/sun/font/FontManagerForSGE.java index 7290a9efa69..b12128463eb 100644 --- a/jdk/src/share/classes/sun/font/FontManagerForSGE.java +++ b/jdk/src/share/classes/sun/font/FontManagerForSGE.java @@ -54,4 +54,11 @@ public interface FontManagerForSGE extends FontManager { public Font[] getAllInstalledFonts(); public String[] getInstalledFontFamilyNames(Locale requestedLocale); + + /* Modifies the behaviour of a subsequent call to preferLocaleFonts() + * to use Mincho instead of Gothic for dialoginput in JA locales + * on windows. Not needed on other platforms. + */ + public void useAlternateFontforJALocales(); + } diff --git a/jdk/src/share/classes/sun/font/SunFontManager.java b/jdk/src/share/classes/sun/font/SunFontManager.java index e9b3bf171d0..a80bcddb0e2 100644 --- a/jdk/src/share/classes/sun/font/SunFontManager.java +++ b/jdk/src/share/classes/sun/font/SunFontManager.java @@ -2874,7 +2874,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { * on windows. Not needed on other platforms. */ public synchronized void useAlternateFontforJALocales() { - + if (FontUtilities.isLogging()) { + FontUtilities.getLogger() + .info("Entered useAlternateFontforJALocales()."); + } if (!FontUtilities.isWindows) { return; } @@ -2897,7 +2900,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { } public synchronized void preferLocaleFonts() { - + if (FontUtilities.isLogging()) { + FontUtilities.getLogger().info("Entered preferLocaleFonts()."); + } /* Test if re-ordering will have any effect */ if (!FontConfiguration.willReorderForStartupLocale()) { return; @@ -2928,7 +2933,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { } public synchronized void preferProportionalFonts() { - + if (FontUtilities.isLogging()) { + FontUtilities.getLogger() + .info("Entered preferProportionalFonts()."); + } /* If no proportional fonts are configured, there's no need * to take any action. */ @@ -3456,6 +3464,11 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { initCompositeFonts(FontConfiguration fontConfig, ConcurrentHashMap altNameCache) { + if (FontUtilities.isLogging()) { + FontUtilities.getLogger() + .info("Initialising composite fonts"); + } + int numCoreFonts = fontConfig.getNumberCoreFonts(); String[] fcFonts = fontConfig.getPlatformFontNames(); for (int f=0; f Date: Fri, 1 Apr 2011 20:44:31 -0700 Subject: [PATCH 121/168] 7033237: Bump the HS21 build number to 07 Update the HS21 build number to 07 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index b581b833334..b5312a500ae 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011 HS_MAJOR_VER=21 HS_MINOR_VER=0 -HS_BUILD_NUMBER=06 +HS_BUILD_NUMBER=07 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 From e3d10322c18d990b07d42b6e16e133c28856c1c8 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Sun, 3 Apr 2011 17:00:50 -0700 Subject: [PATCH 122/168] 7028405: (javac) remove unused JSR-292 code Reviewed-by: jrose, mcimadamore --- .../src/share/classes/com/sun/tools/javac/code/Symtab.java | 5 ----- .../share/classes/com/sun/tools/javac/comp/MemberEnter.java | 3 +-- .../share/classes/com/sun/tools/javac/jvm/ClassReader.java | 3 +-- .../src/share/classes/com/sun/tools/javac/util/Names.java | 2 -- langtools/test/tools/javac/meth/InvokeMH.java | 2 +- langtools/test/tools/javac/meth/TestCP.java | 2 +- langtools/test/tools/javac/meth/XlintWarn.java | 2 +- 7 files changed, 5 insertions(+), 14 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java index 547d01ef729..303bdeb5cbe 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java @@ -125,9 +125,7 @@ public class Symtab { public final Type stringBuilderType; public final Type cloneableType; public final Type serializableType; - public final Type transientMethodHandleType; // transient - 292 public final Type methodHandleType; - public final Type transientPolymorphicSignatureType; // transient - 292 public final Type polymorphicSignatureType; public final Type throwableType; public final Type errorType; @@ -436,9 +434,7 @@ public class Symtab { cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); - transientMethodHandleType = enterClass("java.dyn.MethodHandle"); // transient - 292 methodHandleType = enterClass("java.lang.invoke.MethodHandle"); - transientPolymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); // transient - 292 polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature"); errorType = enterClass("java.lang.Error"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); @@ -485,7 +481,6 @@ public class Symtab { synthesizeEmptyInterfaceIfMissing(autoCloseableType); synthesizeEmptyInterfaceIfMissing(cloneableType); synthesizeEmptyInterfaceIfMissing(serializableType); - synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292 synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType); synthesizeBoxTypeIfMissing(doubleType); synthesizeBoxTypeIfMissing(floatType); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java index 672f0d95b27..d7583989614 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java @@ -788,8 +788,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer { // Internally to java.lang.invoke, a @PolymorphicSignature annotation // acts like a classfile attribute. if (!c.type.isErroneous() && - (types.isSameType(c.type, syms.polymorphicSignatureType) || - types.isSameType(c.type, syms.transientPolymorphicSignatureType))) { + types.isSameType(c.type, syms.polymorphicSignatureType)) { if (!target.hasMethodHandles()) { // Somebody is compiling JDK7 source code to a JDK6 target. // Make it an error, since it is unlikely but important. diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 3fbdc2eb77d..a259929afd3 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -1321,8 +1321,7 @@ public class ClassReader implements Completer { else proxies.append(proxy); if (majorVersion >= V51.major && - (proxy.type.tsym == syms.polymorphicSignatureType.tsym || - proxy.type.tsym == syms.transientPolymorphicSignatureType.tsym)) { + proxy.type.tsym == syms.polymorphicSignatureType.tsym) { sym.flags_field |= POLYMORPHIC_SIGNATURE; } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java index 995d4bfff68..ba38d6545f1 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java @@ -73,7 +73,6 @@ public class Names { public final Name java_io_Serializable; public final Name serialVersionUID; public final Name java_lang_Enum; - public final Name transient_java_dyn_MethodHandle; // transient - 292 public final Name java_lang_invoke_MethodHandle; public final Name package_info; public final Name ConstantValue; @@ -184,7 +183,6 @@ public class Names { java_lang_Cloneable = fromString("java.lang.Cloneable"); java_io_Serializable = fromString("java.io.Serializable"); java_lang_Enum = fromString("java.lang.Enum"); - transient_java_dyn_MethodHandle = fromString("java.dyn.MethodHandle"); //transient - 292 java_lang_invoke_MethodHandle = fromString("java.lang.invoke.MethodHandle"); package_info = fromString("package-info"); serialVersionUID = fromString("serialVersionUID"); diff --git a/langtools/test/tools/javac/meth/InvokeMH.java b/langtools/test/tools/javac/meth/InvokeMH.java index e0f3809cadc..281d08d2e30 100644 --- a/langtools/test/tools/javac/meth/InvokeMH.java +++ b/langtools/test/tools/javac/meth/InvokeMH.java @@ -42,7 +42,7 @@ package meth; -import java.dyn.MethodHandle; +import java.lang.invoke.MethodHandle; public class InvokeMH { void test(MethodHandle mh_SiO, diff --git a/langtools/test/tools/javac/meth/TestCP.java b/langtools/test/tools/javac/meth/TestCP.java index b254b3daf00..c71f4a5d84e 100644 --- a/langtools/test/tools/javac/meth/TestCP.java +++ b/langtools/test/tools/javac/meth/TestCP.java @@ -35,7 +35,7 @@ import com.sun.tools.classfile.Code_attribute; import com.sun.tools.classfile.ConstantPool.*; import com.sun.tools.classfile.Method; -import java.dyn.*; +import java.lang.invoke.*; import java.io.*; public class TestCP { diff --git a/langtools/test/tools/javac/meth/XlintWarn.java b/langtools/test/tools/javac/meth/XlintWarn.java index 385439989b8..4f79117fda6 100644 --- a/langtools/test/tools/javac/meth/XlintWarn.java +++ b/langtools/test/tools/javac/meth/XlintWarn.java @@ -30,7 +30,7 @@ * @compile -Werror -Xlint:cast XlintWarn.java */ -import java.dyn.*; +import java.lang.invoke.*; class XlintWarn { void test(MethodHandle mh) throws Throwable { From e0f158c0a060ee5ab642873e77f022b12ff4d475 Mon Sep 17 00:00:00 2001 From: Yuka Kamiya Date: Mon, 4 Apr 2011 15:24:05 +0900 Subject: [PATCH 123/168] 7033174: (tz) Support tzdata2011e Reviewed-by: okutsu --- jdk/make/sun/javazic/tzdata/VERSION | 2 +- jdk/make/sun/javazic/tzdata/africa | 44 ++++++++++++++++++++++++ jdk/make/sun/javazic/tzdata/southamerica | 20 +++++++++-- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/jdk/make/sun/javazic/tzdata/VERSION b/jdk/make/sun/javazic/tzdata/VERSION index 0b57ca90d10..c19847f5a11 100644 --- a/jdk/make/sun/javazic/tzdata/VERSION +++ b/jdk/make/sun/javazic/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2011d +tzdata2011e diff --git a/jdk/make/sun/javazic/tzdata/africa b/jdk/make/sun/javazic/tzdata/africa index ce560077e00..bea5f8157bb 100644 --- a/jdk/make/sun/javazic/tzdata/africa +++ b/jdk/make/sun/javazic/tzdata/africa @@ -734,6 +734,48 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou # http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html # +# From Dan Abitol (2011-03-30): +# ...Rules for Africa/Casablanca are the following (24h format) +# The 3rd april 2011 at 00:00:00, [it] will be 3rd april 1:00:00 +# The 31th july 2011 at 00:59:59, [it] will be 31th July 00:00:00 +# ...Official links of change in morocco +# The change was broadcast on the FM Radio +# I ve called ANRT (telecom regulations in Morocco) at +# +212.537.71.84.00 +# +# http://www.anrt.net.ma/fr/ +# +# They said that +# +# http://www.map.ma/fr/sections/accueil/l_heure_legale_au_ma/view +# +# is the official publication to look at. +# They said that the decision was already taken. +# +# More articles in the press +# +# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-lev +# +# e.html +# +# http://www.lematin.ma/Actualite/Express/Article.asp?id=148923 +# +# +# http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim +# anche-prochain-5538.html +# + +# From Petr Machata (2011-03-30): +# They have it written in English here: +# +# http://www.map.ma/eng/sections/home/morocco_to_spring_fo/view +# +# +# It says there that "Morocco will resume its standard time on July 31, +# 2011 at midnight." Now they don't say whether they mean midnight of +# wall clock time (i.e. 11pm UTC), but that's what I would assume. It has +# also been like that in the past. + # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Morocco 1939 only - Sep 12 0:00 1:00 S @@ -757,6 +799,8 @@ Rule Morocco 2009 only - Jun 1 0:00 1:00 S Rule Morocco 2009 only - Aug 21 0:00 0 - Rule Morocco 2010 only - May 2 0:00 1:00 S Rule Morocco 2010 only - Aug 8 0:00 0 - +Rule Morocco 2011 only - Apr 3 0:00 1:00 S +Rule Morocco 2011 only - Jul 31 0 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 0:00 Morocco WE%sT 1984 Mar 16 diff --git a/jdk/make/sun/javazic/tzdata/southamerica b/jdk/make/sun/javazic/tzdata/southamerica index a11df76f6e9..7afec35d696 100644 --- a/jdk/make/sun/javazic/tzdata/southamerica +++ b/jdk/make/sun/javazic/tzdata/southamerica @@ -1193,6 +1193,19 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # From Arthur David Olson (2011-03-02): # The emol.com article mentions a water shortage as the cause of the # postponement, which may mean that it's not a permanent change. + +# From Glenn Eychaner (2011-03-28): +# The article: +# +# http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E} +# +# +# In English: +# Chile's clocks will go back an hour this year on the 7th of May instead +# of this Saturday. They will go forward again the 3rd Saturday in +# August, not in October as they have since 1968. This is a pilot plan +# which will be reevaluated in 2012. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Chile 1927 1932 - Sep 1 0:00 1:00 S Rule Chile 1928 1932 - Apr 1 0:00 0 - @@ -1222,13 +1235,16 @@ Rule Chile 1997 only - Mar 30 3:00u 0 - Rule Chile 1998 only - Mar Sun>=9 3:00u 0 - Rule Chile 1998 only - Sep 27 4:00u 1:00 S Rule Chile 1999 only - Apr 4 3:00u 0 - -Rule Chile 1999 max - Oct Sun>=9 4:00u 1:00 S +Rule Chile 1999 2010 - Oct Sun>=9 4:00u 1:00 S +Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S +Rule Chile 2012 max - Oct Sun>=9 4:00u 1:00 S Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 - # N.B.: the end of March 29 in Chile is March 30 in Universal time, # which is used below in specifying the transition. Rule Chile 2008 only - Mar 30 3:00u 0 - Rule Chile 2009 only - Mar Sun>=9 3:00u 0 - -Rule Chile 2010 2011 - Apr Sun>=1 3:00u 0 - +Rule Chile 2010 only - Apr Sun>=1 3:00u 0 - +Rule Chile 2011 only - May Sun>=2 3:00u 0 - Rule Chile 2012 max - Mar Sun>=9 3:00u 0 - # IATA SSIM anomalies: (1992-02) says 1992-03-14; # (1996-09) says 1998-03-08. Ignore these. From b85845f9dab6f72bfbbd2713cb79118e48d8ebf9 Mon Sep 17 00:00:00 2001 From: Alex Menkov Date: Mon, 4 Apr 2011 13:22:40 +0400 Subject: [PATCH 124/168] 7026275: TEST_BUG: test/javax/sound/sampled/Clip/ClipSetPos.java throws uncatched IllegalArgumentException Reviewed-by: dav --- jdk/test/javax/sound/sampled/Clip/ClipSetPos.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jdk/test/javax/sound/sampled/Clip/ClipSetPos.java b/jdk/test/javax/sound/sampled/Clip/ClipSetPos.java index 2968c9b735f..715274fe65f 100644 --- a/jdk/test/javax/sound/sampled/Clip/ClipSetPos.java +++ b/jdk/test/javax/sound/sampled/Clip/ClipSetPos.java @@ -33,6 +33,7 @@ import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; +import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; public class ClipSetPos { @@ -48,12 +49,16 @@ public class ClipSetPos { boolean testPassed = true; Clip clip = null; try { - clip = AudioSystem.getClip(); + clip = (Clip)AudioSystem.getLine(new DataLine.Info(Clip.class, audioFormat)); clip.open(audioFormat, dataBuffer, 0, dataBuffer.length); } catch (LineUnavailableException ex) { log(ex); log("Cannot test (this is not failure)"); return; + } catch (IllegalArgumentException ex) { + log(ex); + log("Cannot test (this is not failure)"); + return; } log("clip: " + clip.getClass().getName()); From 650afe234d49305aba159bcdcafc12b4eb12c4e4 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Mon, 4 Apr 2011 19:55:10 +0400 Subject: [PATCH 125/168] 7025987: Nimbus L&F increases insets unexpectedly Reviewed-by: alexp --- .../javax/swing/plaf/nimbus/LoweredBorder.java | 17 +++++++++-------- jdk/test/javax/swing/border/Test4856008.java | 8 ++++++-- jdk/test/javax/swing/border/Test6978482.java | 8 ++++++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java index 46fc84adf67..768d7721974 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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,13 +26,11 @@ package javax.swing.plaf.nimbus; import javax.swing.border.Border; import javax.swing.JComponent; -import javax.swing.plaf.UIResource; import java.awt.Insets; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Color; -import java.awt.Transparency; import java.awt.RenderingHints; import java.awt.Dimension; import java.awt.image.BufferedImage; @@ -58,7 +56,9 @@ class LoweredBorder extends AbstractRegionPainter implements Border { @Override protected Object[] getExtendedCacheKeys(JComponent c) { - return new Object[] {c.getBackground()}; + return (c != null) + ? new Object[] { c.getBackground() } + : null; } /** @@ -85,6 +85,7 @@ class LoweredBorder extends AbstractRegionPainter implements Border { */ protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) { + Color color = (c == null) ? Color.BLACK : c.getBackground(); BufferedImage img1 = new BufferedImage(IMG_SIZE,IMG_SIZE, BufferedImage.TYPE_INT_ARGB); BufferedImage img2 = new BufferedImage(IMG_SIZE,IMG_SIZE, @@ -93,14 +94,14 @@ class LoweredBorder extends AbstractRegionPainter implements Border { Graphics2D g2 = (Graphics2D)img1.getGraphics(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2.setColor(c.getBackground()); + g2.setColor(color); g2.fillRoundRect(2,0,26,26,RADIUS,RADIUS); g2.dispose(); // draw shadow InnerShadowEffect effect = new InnerShadowEffect(); effect.setDistance(1); effect.setSize(3); - effect.setColor(getLighter(c.getBackground(),2.1f)); + effect.setColor(getLighter(color, 2.1f)); effect.setAngle(90); effect.applyEffect(img1,img2,IMG_SIZE,IMG_SIZE); // draw outline to img2 @@ -108,7 +109,7 @@ class LoweredBorder extends AbstractRegionPainter implements Border { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setClip(0,28,IMG_SIZE,1); - g2.setColor(getLighter(c.getBackground(),0.90f)); + g2.setColor(getLighter(color, 0.90f)); g2.drawRoundRect(2,1,25,25,RADIUS,RADIUS); g2.dispose(); // draw final image @@ -150,7 +151,7 @@ class LoweredBorder extends AbstractRegionPainter implements Border { * @param c the component for which this border insets value applies */ public Insets getBorderInsets(Component c) { - return INSETS; + return (Insets) INSETS.clone(); } /** diff --git a/jdk/test/javax/swing/border/Test4856008.java b/jdk/test/javax/swing/border/Test4856008.java index a98e474fbaf..7c0da08e930 100644 --- a/jdk/test/javax/swing/border/Test4856008.java +++ b/jdk/test/javax/swing/border/Test4856008.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4856008 + * @bug 4856008 7025987 * @summary Tests border insets * @author Sergey Malenkov */ @@ -59,6 +59,7 @@ import javax.swing.plaf.basic.BasicBorders; import javax.swing.plaf.basic.BasicToolBarUI; import javax.swing.plaf.metal.MetalBorders; import javax.swing.plaf.metal.MetalComboBoxEditor; +import javax.swing.plaf.nimbus.NimbusLookAndFeel; import sun.swing.plaf.synth.SynthFileChooserUI; @@ -134,6 +135,9 @@ public class Test4856008 { //+ SynthFileChooserUI.UIBorder: new SynthFileChooser().getUIBorder(), + + //+ LoweredBorder: + new NimbusLookAndFeel().getDefaults().getBorder("TitledBorder.border"), }; public static void main(String[] args) { diff --git a/jdk/test/javax/swing/border/Test6978482.java b/jdk/test/javax/swing/border/Test6978482.java index 8bf6b9b33d4..804970f2210 100644 --- a/jdk/test/javax/swing/border/Test6978482.java +++ b/jdk/test/javax/swing/border/Test6978482.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 6978482 + * @bug 6978482 7025987 * @summary Tests unchecked casts * @author Sergey Malenkov */ @@ -58,6 +58,7 @@ import javax.swing.plaf.basic.BasicBorders; import javax.swing.plaf.basic.BasicToolBarUI; import javax.swing.plaf.metal.MetalBorders; import javax.swing.plaf.metal.MetalComboBoxEditor; +import javax.swing.plaf.nimbus.NimbusLookAndFeel; import sun.swing.plaf.synth.SynthFileChooserUI; @@ -132,6 +133,9 @@ public class Test6978482 { //+ SynthFileChooserUI.UIBorder: new SynthFileChooser().getUIBorder(), + + //+ LoweredBorder: + new NimbusLookAndFeel().getDefaults().getBorder("TitledBorder.border"), }; public static void main(String[] args) { From fba270080e9a75f1fca8c7844fd27b463d1a5465 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 4 Apr 2011 18:09:53 +0100 Subject: [PATCH 126/168] 7029979: (fs) Path.toRealPath(boolean) should be toRealPath(LinkOption...) Reviewed-by: sherman --- jdk/src/share/classes/java/nio/file/Path.java | 29 +++++++++-------- jdk/src/share/classes/sun/nio/fs/Util.java | 18 +++++++++++ .../sun/util/calendar/ZoneInfoFile.java | 2 +- .../sun/nio/zipfs/ZipFileSystemProvider.java | 6 ++-- .../zipfs/src/com/sun/nio/zipfs/ZipPath.java | 2 +- .../sun/nio/fs/LinuxFileSystemProvider.java | 8 ++--- .../sun/nio/fs/SolarisFileSystemProvider.java | 8 ++--- .../sun/nio/fs/UnixFileSystemProvider.java | 18 ++--------- .../solaris/classes/sun/nio/fs/UnixPath.java | 8 ++--- .../sun/nio/fs/UnixSecureDirectoryStream.java | 18 ++--------- .../sun/nio/fs/WindowsFileSystemProvider.java | 18 ++--------- .../classes/sun/nio/fs/WindowsPath.java | 4 +-- .../java/nio/file/Files/CheckPermissions.java | 8 ++--- .../nio/file/Files/PassThroughFileSystem.java | 4 +-- jdk/test/java/nio/file/Path/Misc.java | 31 ++++++++++--------- 15 files changed, 81 insertions(+), 101 deletions(-) diff --git a/jdk/src/share/classes/java/nio/file/Path.java b/jdk/src/share/classes/java/nio/file/Path.java index 618f0226363..cefd2d2fd04 100644 --- a/jdk/src/share/classes/java/nio/file/Path.java +++ b/jdk/src/share/classes/java/nio/file/Path.java @@ -550,18 +550,21 @@ public interface Path *

If this path is relative then its absolute path is first obtained, * as if by invoking the {@link #toAbsolutePath toAbsolutePath} method. * - *

The {@code resolveLinks} parameter specifies if symbolic links - * should be resolved. This parameter is ignored when symbolic links are - * not supported. Where supported, and the parameter has the value {@code - * true} then symbolic links are resolved to their final target. Where the - * parameter has the value {@code false} then this method does not resolve - * symbolic links. Some implementations allow special names such as - * "{@code ..}" to refer to the parent directory. When deriving the real - * path, and a "{@code ..}" (or equivalent) is preceded by a - * non-"{@code ..}" name then an implementation will typically causes both - * names to be removed. When not resolving symbolic links and the preceding - * name is a symbolic link then the names are only removed if it guaranteed - * that the resulting path will locate the same file as this path. + *

The {@code options} array may be used to indicate how symbolic links + * are handled. By default, symbolic links are resolved to their final + * target. If the option {@link LinkOption#NOFOLLOW_LINKS NOFOLLOW_LINKS} is + * present then this method does not resolve symbolic links. + * + * Some implementations allow special names such as "{@code ..}" to refer to + * the parent directory. When deriving the real path, and a + * "{@code ..}" (or equivalent) is preceded by a non-"{@code ..}" name then + * an implementation will typically cause both names to be removed. When + * not resolving symbolic links and the preceding name is a symbolic link + * then the names are only removed if it guaranteed that the resulting path + * will locate the same file as this path. + * + * @param options + * options indicating how symbolic links are handled * * @return an absolute path represent the real path of the file * located by this object @@ -576,7 +579,7 @@ public interface Path * checkPropertyAccess} method is invoked to check access to the * system property {@code user.dir} */ - Path toRealPath(boolean resolveLinks) throws IOException; + Path toRealPath(LinkOption... options) throws IOException; /** * Returns a {@link File} object representing this path. Where this {@code diff --git a/jdk/src/share/classes/sun/nio/fs/Util.java b/jdk/src/share/classes/sun/nio/fs/Util.java index 76287011169..6c94710dd8d 100644 --- a/jdk/src/share/classes/sun/nio/fs/Util.java +++ b/jdk/src/share/classes/sun/nio/fs/Util.java @@ -26,6 +26,7 @@ package sun.nio.fs; import java.util.*; +import java.nio.file.*; /** * Utility methods @@ -80,4 +81,21 @@ class Util { } return set; } + + /** + * Returns {@code true} if symbolic links should be followed + */ + static boolean followLinks(LinkOption... options) { + boolean followLinks = true; + for (LinkOption option: options) { + if (option == LinkOption.NOFOLLOW_LINKS) { + followLinks = false; + } else if (option == null) { + throw new NullPointerException(); + } else { + throw new AssertionError("Should not get here"); + } + } + return followLinks; + } } diff --git a/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java index c6251ade512..891817776aa 100644 --- a/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java +++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java @@ -479,7 +479,7 @@ public class ZoneInfoFile { String zi = System.getProperty("java.home") + File.separator + "lib" + File.separator + "zi"; try { - zi = FileSystems.getDefault().getPath(zi).toRealPath(true).toString(); + zi = FileSystems.getDefault().getPath(zi).toRealPath().toString(); } catch(Exception e) { } return zi; diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java index d8aa305d29b..530c8864ba6 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java @@ -99,7 +99,7 @@ public class ZipFileSystemProvider extends FileSystemProvider { synchronized(filesystems) { Path realPath = null; if (ensureFile(path)) { - realPath = path.toRealPath(true); + realPath = path.toRealPath(); if (filesystems.containsKey(realPath)) throw new FileSystemAlreadyExistsException(); } @@ -154,7 +154,7 @@ public class ZipFileSystemProvider extends FileSystemProvider { synchronized (filesystems) { ZipFileSystem zipfs = null; try { - zipfs = filesystems.get(uriToPath(uri).toRealPath(true)); + zipfs = filesystems.get(uriToPath(uri).toRealPath()); } catch (IOException x) { // ignore the ioe from toRealPath(), return FSNFE } @@ -310,7 +310,7 @@ public class ZipFileSystemProvider extends FileSystemProvider { ////////////////////////////////////////////////////////////// void removeFileSystem(Path zfpath, ZipFileSystem zfs) throws IOException { synchronized (filesystems) { - zfpath = zfpath.toRealPath(true); + zfpath = zfpath.toRealPath(); if (filesystems.get(zfpath) == zfs) filesystems.remove(zfpath); } diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java index 1232a27ff1f..8c97818b244 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java @@ -150,7 +150,7 @@ public class ZipPath implements Path { } @Override - public ZipPath toRealPath(boolean resolveLinks) throws IOException { + public ZipPath toRealPath(LinkOption... options) throws IOException { ZipPath realPath = new ZipPath(zfs, getResolvedPath()).toAbsolutePath(); realPath.checkAccess(); return realPath; diff --git a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java index 6659ff5ede4..0b8aa14e188 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java +++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java @@ -56,11 +56,11 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider { { if (type == DosFileAttributeView.class) { return (V) new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); } if (type == UserDefinedFileAttributeView.class) { return (V) new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); } return super.getFileAttributeView(obj, type, options); } @@ -72,11 +72,11 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider { { if (name.equals("dos")) { return new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); } if (name.equals("user")) { return new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); } return super.getFileAttributeView(obj, name, options); } diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java index 98c3ae8699c..eca619be1d0 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java +++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java @@ -57,11 +57,11 @@ public class SolarisFileSystemProvider extends UnixFileSystemProvider { { if (type == AclFileAttributeView.class) { return (V) new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); } if (type == UserDefinedFileAttributeView.class) { return(V) new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); } return super.getFileAttributeView(obj, type, options); } @@ -73,10 +73,10 @@ public class SolarisFileSystemProvider extends UnixFileSystemProvider { { if (name.equals("acl")) return new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); if (name.equals("user")) return new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), - followLinks(options)); + Util.followLinks(options)); return super.getFileAttributeView(obj, name, options); } } diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java index 8ec672a306b..1bee2d0b386 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java +++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java @@ -105,20 +105,6 @@ public abstract class UnixFileSystemProvider return (UnixPath)obj; } - boolean followLinks(LinkOption... options) { - boolean followLinks = true; - for (LinkOption option: options) { - if (option == LinkOption.NOFOLLOW_LINKS) { - followLinks = false; - continue; - } - if (option == null) - throw new NullPointerException(); - throw new AssertionError("Should not get here"); - } - return followLinks; - } - @Override @SuppressWarnings("unchecked") public V getFileAttributeView(Path obj, @@ -126,7 +112,7 @@ public abstract class UnixFileSystemProvider LinkOption... options) { UnixPath file = UnixPath.toUnixPath(obj); - boolean followLinks = followLinks(options); + boolean followLinks = Util.followLinks(options); if (type == BasicFileAttributeView.class) return (V) UnixFileAttributeViews.createBasicView(file, followLinks); if (type == PosixFileAttributeView.class) @@ -163,7 +149,7 @@ public abstract class UnixFileSystemProvider LinkOption... options) { UnixPath file = UnixPath.toUnixPath(obj); - boolean followLinks = followLinks(options); + boolean followLinks = Util.followLinks(options); if (name.equals("basic")) return UnixFileAttributeViews.createBasicView(file, followLinks); if (name.equals("posix")) diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java index b392b56b7e9..dfa1e0f0d7e 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java +++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java @@ -819,13 +819,13 @@ class UnixPath } @Override - public Path toRealPath(boolean resolveLinks) throws IOException { + public Path toRealPath(LinkOption... options) throws IOException { checkRead(); UnixPath absolute = toAbsolutePath(); - // if resolveLinks is true then use realpath - if (resolveLinks) { + // if resolving links then use realpath + if (Util.followLinks(options)) { try { byte[] rp = realpath(absolute); return new UnixPath(getFileSystem(), rp); @@ -834,7 +834,7 @@ class UnixPath } } - // if resolveLinks is false then eliminate "." and also ".." + // if not resolving links then eliminate "." and also ".." // where the previous element is not a link. UnixPath result = fs.rootDirectory(); for (int i=0; i V @@ -172,7 +158,7 @@ public class WindowsFileSystemProvider WindowsPath file = WindowsPath.toWindowsPath(obj); if (view == null) throw new NullPointerException(); - boolean followLinks = followLinks(options); + boolean followLinks = Util.followLinks(options); if (view == BasicFileAttributeView.class) return (V) WindowsFileAttributeViews.createBasicView(file, followLinks); if (view == DosFileAttributeView.class) @@ -209,7 +195,7 @@ public class WindowsFileSystemProvider @Override public DynamicFileAttributeView getFileAttributeView(Path obj, String name, LinkOption... options) { WindowsPath file = WindowsPath.toWindowsPath(obj); - boolean followLinks = followLinks(options); + boolean followLinks = Util.followLinks(options); if (name.equals("basic")) return WindowsFileAttributeViews.createBasicView(file, followLinks); if (name.equals("dos")) diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java b/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java index eb35de8167e..0f6d5f8c242 100644 --- a/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java +++ b/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java @@ -831,9 +831,9 @@ class WindowsPath extends AbstractPath { } @Override - public WindowsPath toRealPath(boolean resolveLinks) throws IOException { + public WindowsPath toRealPath(LinkOption... options) throws IOException { checkRead(); - String rp = WindowsLinkSupport.getRealPath(this, resolveLinks); + String rp = WindowsLinkSupport.getRealPath(this, Util.followLinks(options)); return createFromNormalizedPath(getFileSystem(), rp); } diff --git a/jdk/test/java/nio/file/Files/CheckPermissions.java b/jdk/test/java/nio/file/Files/CheckPermissions.java index 8137a358d42..4c9dcca85f3 100644 --- a/jdk/test/java/nio/file/Files/CheckPermissions.java +++ b/jdk/test/java/nio/file/Files/CheckPermissions.java @@ -521,19 +521,19 @@ public class CheckPermissions { // -- toRealPath -- prepare(); - file.toRealPath(true); + file.toRealPath(); assertCheckRead(file); prepare(); - file.toRealPath(false); + file.toRealPath(LinkOption.NOFOLLOW_LINKS); assertCheckRead(file); prepare(); - Paths.get(".").toRealPath(true); + Paths.get(".").toRealPath(); assertCheckPropertyAccess("user.dir"); prepare(); - Paths.get(".").toRealPath(false); + Paths.get(".").toRealPath(LinkOption.NOFOLLOW_LINKS); assertCheckPropertyAccess("user.dir"); // -- register -- diff --git a/jdk/test/java/nio/file/Files/PassThroughFileSystem.java b/jdk/test/java/nio/file/Files/PassThroughFileSystem.java index 31345a8bf36..e460e358265 100644 --- a/jdk/test/java/nio/file/Files/PassThroughFileSystem.java +++ b/jdk/test/java/nio/file/Files/PassThroughFileSystem.java @@ -486,8 +486,8 @@ class PassThroughFileSystem extends FileSystem { } @Override - public Path toRealPath(boolean resolveLinks) throws IOException { - return wrap(delegate.toRealPath(resolveLinks)); + public Path toRealPath(LinkOption... options) throws IOException { + return wrap(delegate.toRealPath(options)); } @Override diff --git a/jdk/test/java/nio/file/Path/Misc.java b/jdk/test/java/nio/file/Path/Misc.java index b2bf03e3510..3f997d1752e 100644 --- a/jdk/test/java/nio/file/Path/Misc.java +++ b/jdk/test/java/nio/file/Path/Misc.java @@ -22,12 +22,13 @@ */ /* @test - * @bug 4313887 6838333 + * @bug 4313887 6838333 7029979 * @summary Unit test for miscellenous java.nio.file.Path methods * @library .. */ import java.nio.file.*; +import static java.nio.file.LinkOption.*; import java.io.*; public class Misc { @@ -96,65 +97,65 @@ public class Misc { final Path link = dir.resolve("link"); /** - * Test: totRealPath(true) will access same file as toRealPath(false) + * Test: totRealPath() will access same file as toRealPath(NOFOLLOW_LINKS) */ - assertTrue(Files.isSameFile(file.toRealPath(true), file.toRealPath(false))); + assertTrue(Files.isSameFile(file.toRealPath(), file.toRealPath(NOFOLLOW_LINKS))); /** * Test: toRealPath should fail if file does not exist */ Path doesNotExist = dir.resolve("DoesNotExist"); try { - doesNotExist.toRealPath(true); + doesNotExist.toRealPath(); throw new RuntimeException("IOException expected"); } catch (IOException expected) { } try { - doesNotExist.toRealPath(false); + doesNotExist.toRealPath(NOFOLLOW_LINKS); throw new RuntimeException("IOException expected"); } catch (IOException expected) { } /** - * Test: toRealPath(true) should resolve links + * Test: toRealPath() should resolve links */ if (supportsLinks) { Files.createSymbolicLink(link, file.toAbsolutePath()); - assertTrue(link.toRealPath(true).equals(file.toRealPath(true))); + assertTrue(link.toRealPath().equals(file.toRealPath())); Files.delete(link); } /** - * Test: toRealPath(false) should not resolve links + * Test: toRealPath(NOFOLLOW_LINKS) should not resolve links */ if (supportsLinks) { Files.createSymbolicLink(link, file.toAbsolutePath()); - assertTrue(link.toRealPath(false).getFileName().equals(link.getFileName())); + assertTrue(link.toRealPath(NOFOLLOW_LINKS).getFileName().equals(link.getFileName())); Files.delete(link); } /** - * Test: toRealPath(false) with broken link + * Test: toRealPath(NOFOLLOW_LINKS) with broken link */ if (supportsLinks) { Path broken = Files.createSymbolicLink(link, doesNotExist); - assertTrue(link.toRealPath(false).getFileName().equals(link.getFileName())); + assertTrue(link.toRealPath(NOFOLLOW_LINKS).getFileName().equals(link.getFileName())); Files.delete(link); } /** * Test: toRealPath should eliminate "." */ - assertTrue(dir.resolve(".").toRealPath(true).equals(dir.toRealPath(true))); - assertTrue(dir.resolve(".").toRealPath(false).equals(dir.toRealPath(false))); + assertTrue(dir.resolve(".").toRealPath().equals(dir.toRealPath())); + assertTrue(dir.resolve(".").toRealPath(NOFOLLOW_LINKS).equals(dir.toRealPath(NOFOLLOW_LINKS))); /** * Test: toRealPath should eliminate ".." when it doesn't follow a * symbolic link */ Path subdir = Files.createDirectory(dir.resolve("subdir")); - assertTrue(subdir.resolve("..").toRealPath(true).equals(dir.toRealPath(true))); - assertTrue(subdir.resolve("..").toRealPath(false).equals(dir.toRealPath(false))); + assertTrue(subdir.resolve("..").toRealPath().equals(dir.toRealPath())); + assertTrue(subdir.resolve("..").toRealPath(NOFOLLOW_LINKS).equals(dir.toRealPath(NOFOLLOW_LINKS))); Files.delete(subdir); // clean-up From 39b8c8c057682a5f1aaaa32c7e0f35999779480f Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 4 Apr 2011 18:10:38 +0100 Subject: [PATCH 127/168] 7029979: (fs) Path.toRealPath(boolean) should be toRealPath(LinkOption...) Reviewed-by: mcimadamore, jjg --- .../share/classes/com/sun/tools/javac/nio/PathFileObject.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java index 46c1e651e53..f47d56ce455 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java +++ b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java @@ -37,6 +37,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; import java.nio.file.Files; +import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; import javax.lang.model.element.Modifier; @@ -170,7 +171,7 @@ abstract class PathFileObject implements JavaFileObject { if (pn.equalsIgnoreCase(sn)) { try { // allow for Windows - return path.toRealPath(false).getFileName().toString().equals(sn); + return path.toRealPath(LinkOption.NOFOLLOW_LINKS).getFileName().toString().equals(sn); } catch (IOException e) { } } From a50069aa794854efd3cb527dc4f9b9615c3d6265 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 4 Apr 2011 18:12:46 +0100 Subject: [PATCH 128/168] 7033568: (file) Miscellaneous typos Reviewed-by: michaelm, mduigou --- jdk/src/share/classes/java/nio/file/Files.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/java/nio/file/Files.java b/jdk/src/share/classes/java/nio/file/Files.java index 8b7af13544c..77847e7fcc1 100644 --- a/jdk/src/share/classes/java/nio/file/Files.java +++ b/jdk/src/share/classes/java/nio/file/Files.java @@ -2067,7 +2067,7 @@ public final class Files { * * @return {@code true} if the file is a symbolic link; {@code false} if * the file does not exist, is not a symbolic link, or it cannot - * be determined if the file is symbolic link or not. + * be determined if the file is a symbolic link or not. * * @throws SecurityException * In the case of the default provider, and a security manager is @@ -2106,7 +2106,7 @@ public final class Files { * * @return {@code true} if the file is a directory; {@code false} if * the file does not exist, is not a directory, or it cannot - * be determined if the file is directory or not. + * be determined if the file is a directory or not. * * @throws SecurityException * In the case of the default provider, and a security manager is @@ -2142,8 +2142,8 @@ public final class Files { * options indicating how symbolic links are handled * * @return {@code true} if the file is a regular file; {@code false} if - * the file does not exist, is not a direcregular filetory, or it - * cannot be determined if the file is regular file or not. + * the file does not exist, is not a regular file, or it + * cannot be determined if the file is a regular file or not. * * @throws SecurityException * In the case of the default provider, and a security manager is From 0069129f00e501953503f27ba46ddd4e3912cd7f Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Mon, 4 Apr 2011 10:14:23 -0700 Subject: [PATCH 129/168] 7010344: Some of the html files do not have element in right context Reviewed-by: jjg --- .../html/AnnotationTypeWriterImpl.java | 11 ++- .../doclets/formats/html/ClassWriterImpl.java | 11 ++- .../doclets/formats/html/LinkFactoryImpl.java | 5 +- .../doclets/formats/html/LinkInfoImpl.java | 6 +- .../TestDeprecatedDocs.java | 7 +- .../com/sun/javadoc/testHref/TestHref.java | 7 +- .../TestHtmlDefinitionListTag.java | 8 +- .../testLinkOption/TestLinkOption.java | 7 +- .../TestNewLanguageFeatures.java | 80 ++++++++++--------- .../testTypeParams/TestTypeParameters.java | 58 +++++++++----- .../testTypeParams/pkg/ClassUseTest3.java | 37 +++++++++ .../sun/javadoc/testTypeParams/pkg/Foo4.java | 26 ++++++ .../testTypeParams/pkg/ParamTest2.java | 27 +++++++ 13 files changed, 203 insertions(+), 87 deletions(-) create mode 100644 langtools/test/com/sun/javadoc/testTypeParams/pkg/ClassUseTest3.java create mode 100644 langtools/test/com/sun/javadoc/testTypeParams/pkg/Foo4.java create mode 100644 langtools/test/com/sun/javadoc/testTypeParams/pkg/ParamTest2.java diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java index 3ccd20ca6d2..83886defa9c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java @@ -216,12 +216,15 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter pre.addContent(modifiers); LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false); - Content name = new RawHtml (annotationType.name() + - getTypeParameterLinks(linkInfo)); + Content annotationName = new StringContent(annotationType.name()); + Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); if (configuration().linksource) { - addSrcLink(annotationType, name, pre); + addSrcLink(annotationType, annotationName, pre); + pre.addContent(parameterLinks); } else { - pre.addContent(HtmlTree.STRONG(name)); + Content span = HtmlTree.SPAN(HtmlStyle.strong, annotationName); + span.addContent(parameterLinks); + pre.addContent(span); } annotationInfoTree.addContent(pre); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java index 474a75ec080..cc8411ee7cd 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java @@ -228,12 +228,15 @@ public class ClassWriterImpl extends SubWriterHolderWriter LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false); //Let's not link to ourselves in the signature. linkInfo.linkToSelf = false; - Content name = new RawHtml (classDoc.name() + - getTypeParameterLinks(linkInfo)); + Content className = new StringContent(classDoc.name()); + Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); if (configuration().linksource) { - addSrcLink(classDoc, name, pre); + addSrcLink(classDoc, className, pre); + pre.addContent(parameterLinks); } else { - pre.addContent(HtmlTree.STRONG(name)); + Content span = HtmlTree.SPAN(HtmlStyle.strong, className); + span.addContent(parameterLinks); + pre.addContent(span); } if (!isInterface) { Type superclass = Util.getFirstVisibleSuperClass(classDoc, diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java index 8129b8190f6..3e4b96886d9 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 @@ -69,9 +69,6 @@ public class LinkFactoryImpl extends LinkFactory { StringBuffer label = new StringBuffer( classLinkInfo.getClassLinkLabel(m_writer.configuration)); classLinkInfo.displayLength += label.length(); - if (noLabel && classLinkInfo.excludeTypeParameterLinks) { - label.append(getTypeParameterLinks(linkInfo).toString()); - } Configuration configuration = ConfigurationImpl.getInstance(); LinkOutputImpl linkOutput = new LinkOutputImpl(); if (classDoc.isIncluded()) { diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java index cef8b5d8a58..c9a176c1262 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 @@ -408,10 +408,6 @@ public class LinkInfoImpl extends LinkInfo { case CONTEXT_PACKAGE: case CONTEXT_CLASS_USE: - excludeTypeBoundsLinks = true; - excludeTypeParameterLinks = true; - break; - case CONTEXT_CLASS_HEADER: case CONTEXT_CLASS_SIGNATURE: excludeTypeParameterLinks = true; diff --git a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java index 80a5718f4a6..c7c946ae73c 100644 --- a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java +++ b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 @@ -27,8 +27,7 @@ * @summary * @author jamieh * @library ../lib/ - * @build JavadocTester - * @build TestDeprecatedDocs + * @build JavadocTester TestDeprecatedDocs * @run main TestDeprecatedDocs */ @@ -77,7 +76,7 @@ public class TestDeprecatedDocs extends JavadocTester { {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"}, {TARGET_FILE2, "

@Deprecated" + NL +
-                 "public class DeprecatedClassByAnnotation" + NL +
+                 "public class DeprecatedClassByAnnotation" + NL +
                  "extends java.lang.Object
"}, {TARGET_FILE2, "
@Deprecated" + NL +
diff --git a/langtools/test/com/sun/javadoc/testHref/TestHref.java b/langtools/test/com/sun/javadoc/testHref/TestHref.java
index 6763287399e..d7952f63c14 100644
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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
@@ -27,8 +27,7 @@
  * @summary  Verify that spaces do not appear in hrefs and anchors.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestHref
+ * @build    JavadocTester TestHref
  * @run main TestHref
  */
 
@@ -81,7 +80,7 @@ public class TestHref extends JavadocTester {
 
         //Signature does not link to the page itself.
         {BUG_ID + FS + "pkg" + FS + "C4.html",
-            "public abstract class C4<E extends C4<E>>"
+            "public abstract class C4<E extends C4<E>>"
         },
     };
     private static final String[][] NEGATED_TEST =
diff --git a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
index f8a28232384..508175a1949 100644
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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
@@ -29,8 +29,7 @@
  * @summary This test verifies the nesting of definition list tags.
  * @author Bhavesh Patel
  * @library ../lib/
- * @build JavadocTester
- * @build TestHtmlDefinitionListTag
+ * @build JavadocTester TestHtmlDefinitionListTag
  * @run main TestHtmlDefinitionListTag
  */
 
@@ -43,7 +42,8 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
     // Optional Element should print properly nested definition list tags
     // for default value.
     private static final String[][] TEST_ALL = {
-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "
public class C1" + NL +
+        {BUG_ID + FS + "pkg1" + FS + "C1.html", "
public class " +
+                 "C1" + NL +
                  "extends java.lang.Object" + NL + "implements java.io.Serializable
"}, {BUG_ID + FS + "pkg1" + FS + "C4.html", "
" + NL + "
Default:
" + NL + "
true
" + NL + diff --git a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java b/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java index 159d5f23819..18a1d2b7e47 100644 --- a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java +++ b/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 @@ -28,8 +28,7 @@ * right files. * @author jamieh * @library ../lib/ - * @build JavadocTester - * @build TestLinkOption + * @build JavadocTester TestLinkOption * @run main TestLinkOption */ @@ -62,7 +61,7 @@ public class TestLinkOption extends JavadocTester { "Object
 p3)" }, {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html", - "
public abstract class StringBuilderChild" + NL +
+                "
public abstract class StringBuilderChild" + NL +
                 "extends Object
" }, diff --git a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java index 89a5bc144a1..059393768a2 100644 --- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -23,14 +23,13 @@ /* * @test - * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 + * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 * @summary Run Javadoc on a set of source files that demonstrate new * language features. Check the output to ensure that the new * language features are properly documented. * @author jamieh * @library ../lib/ - * @build JavadocTester - * @build TestNewLanguageFeatures + * @build JavadocTester TestNewLanguageFeatures * @run main TestNewLanguageFeatures */ @@ -53,9 +52,10 @@ public class TestNewLanguageFeatures extends JavadocTester { //Make sure enum header is correct. {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin"}, //Make sure enum signature is correct. - {BUG_ID + FS + "pkg" + FS + "Coin.html", "
public enum Coin" + NL +
-                "extends java.lang.Enum<Coin>
" + {BUG_ID + FS + "pkg" + FS + "Coin.html", "
public enum " +
+                     "Coin" + NL +
+                     "extends java.lang.Enum<Coin>
" }, //Check for enum constant section {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Constants" + @@ -118,8 +118,8 @@ public class TestNewLanguageFeatures extends JavadocTester { //Signature of subclass that has type parameters. {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html", - "
public class TypeParameterSubClass<T extends " +
-                "java.lang.String>" + NL + "extends " +
+                "
public class TypeParameterSubClass<T extends " +
+                "java.lang.String>" + NL + "extends " +
                 "" +
                 "TypeParameterSuperClass<T>
"}, @@ -168,7 +168,7 @@ public class TestNewLanguageFeatures extends JavadocTester { "Annotation Type AnnotationType"}, //Make sure the signature is correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "public @interface AnnotationType"}, + "public @interface AnnotationType"}, //Make sure member summary headings are correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", "

Required Element Summary

"}, @@ -198,8 +198,8 @@ public class TestNewLanguageFeatures extends JavadocTester { "optional" + "=\"Class Annotation\"," + NL + " " + - "required=1994)" + NL + "public class " + - "AnnotationTypeUsage" + NL + "extends java.lang.Object
"}, + "required=1994)" + NL + "public class " + + "AnnotationTypeUsage" + NL + "extends java.lang.Object
"}, //FIELD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", @@ -299,7 +299,7 @@ public class TestNewLanguageFeatures extends JavadocTester { {BUG_ID + FS + "pkg1" + FS + "B.html", "
@A"},
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "public interface B
"}, + "public interface B
"}, //============================================================== @@ -320,9 +320,11 @@ public class TestNewLanguageFeatures extends JavadocTester { "Foo " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", - "ClassUseTest1" + - "<T extends Foo & Foo2> " + "ClassUseTest1<T extends " + + "Foo" + + " & " + + "Foo2> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", "Methods in " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", - "" + - "ClassUseTest1<T extends Foo & Foo2>" + - " " + "ClassUseTest1<T extends " + + "Foo" + + " & " + + "Foo2> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", "Methods in " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", - "ClassUseTest2<T " + - "extends ParamTest<Foo3>> " + "ClassUseTest2<T extends " + + "" + + "ParamTest<" + + "Foo3>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", "Methods in  " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", - "" + - "ClassUseTest2<T extends ParamTest<Foo3>>" + - " " + "ClassUseTest2<T extends " + + "" + + "ParamTest<" + + "Foo3>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", "Methods in " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", - "" + - "ClassUseTest3<T extends ParamTest2<java.util.List" + - "<? extends Foo4>>> " + "ClassUseTest3<T extends " + + "" + + "ParamTest2<java.util.List<? extends " + + "" + + "Foo4>>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "Methods in " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", - "" + - "ClassUseTest3<T extends ParamTest2<java.util.List" + - "<? extends Foo4>>> " + "ClassUseTest3<T extends " + + "" + + "ParamTest2<java.util.List<? extends " + + "" + + "Foo4>>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", "Methods in <W extends java.lang.String,V extends " + - "java.util.List> 
java.lang.Object
"}, + "java.util.List> 
java.lang.Object" + }, {BUG_ID + FS + "pkg" + FS + "C.html", - "<T> java.lang.Object"}, + "<T> java.lang.Object" + }, {BUG_ID + FS + "pkg" + FS + "package-summary.html", - "C<E extends Parent>"}, + "C
<E extends Parent>" + }, + {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "Foo4.html", + "" + + "ClassUseTest3<T extends ParamTest2<java.util.List<? extends " + + "Foo4>>>" + }, //Nested type parameters {BUG_ID + FS + "pkg" + FS + "C.html", "" + NL + "" + NL + - ""}, - + "" + }, + }; + private static final String[][] TEST2 = { + {BUG_ID + FS + "pkg" + FS + "ClassUseTest3.html", + "public class " + + "ClassUseTest3<T extends ParamTest2<java.util.List<? extends " + + "Foo4>>>" + } }; private static final String[][] NEGATED_TEST = NO_TEST; - /** * The entry point of the test. * @param args the array of command line arguments. */ public static void main(String[] args) { TestTypeParameters tester = new TestTypeParameters(); - run(tester, ARGS, TEST, NEGATED_TEST); + run(tester, ARGS1, TEST1, NEGATED_TEST); + run(tester, ARGS2, TEST2, NEGATED_TEST); tester.printSummary(); } diff --git a/langtools/test/com/sun/javadoc/testTypeParams/pkg/ClassUseTest3.java b/langtools/test/com/sun/javadoc/testTypeParams/pkg/ClassUseTest3.java new file mode 100644 index 00000000000..d7a06ec8118 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testTypeParams/pkg/ClassUseTest3.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +import java.util.*; + +public class ClassUseTest3 >> { + + public ClassUseTest3(Set p) {} + + public >> ParamTest2> method(T t) { + return null; + } + + public void method(Set p) {} +} diff --git a/langtools/test/com/sun/javadoc/testTypeParams/pkg/Foo4.java b/langtools/test/com/sun/javadoc/testTypeParams/pkg/Foo4.java new file mode 100644 index 00000000000..fdf1ea38076 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testTypeParams/pkg/Foo4.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +public class Foo4 {} diff --git a/langtools/test/com/sun/javadoc/testTypeParams/pkg/ParamTest2.java b/langtools/test/com/sun/javadoc/testTypeParams/pkg/ParamTest2.java new file mode 100644 index 00000000000..597c49e6d0a --- /dev/null +++ b/langtools/test/com/sun/javadoc/testTypeParams/pkg/ParamTest2.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +public class ParamTest2 { +} From e1a6f9cdeac6ba3e287f7e934dcbc81f302afb1f Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 4 Apr 2011 18:35:16 +0100 Subject: [PATCH 130/168] 7030249: Eliminate use of LoadLibrary and other clean-ups Reviewed-by: ohair, chegar, mchung --- jdk/make/java/java/Makefile | 4 +- jdk/make/java/management/Makefile | 3 +- .../com/sun/management/OperatingSystem_md.c | 80 +++----------- .../native/java/io/WinNTFileSystem_md.c | 28 ++--- .../windows/native/java/lang/java_props_md.c | 56 +++------- .../native/sun/management/FileSystemImpl.c | 103 ++---------------- .../sun/nio/fs/WindowsNativeDispatcher.c | 87 +++------------ .../security/provider/WinCAPISeedGenerator.c | 34 +----- 8 files changed, 77 insertions(+), 318 deletions(-) diff --git a/jdk/make/java/java/Makefile b/jdk/make/java/java/Makefile index 9a2627096f0..bc81588407d 100644 --- a/jdk/make/java/java/Makefile +++ b/jdk/make/java/java/Makefile @@ -198,10 +198,12 @@ INSTALL_DOT_LIB = true # # What to link? +# On Windows, shell32 is not normally required and so it is delay loaded. # ifeq ($(PLATFORM),windows) OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \ - -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib + -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib \ + shell32.lib delayimp.lib /DELAYLOAD:shell32.dll else OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \ -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH) diff --git a/jdk/make/java/management/Makefile b/jdk/make/java/management/Makefile index ebf3640b812..45c06da9cc9 100644 --- a/jdk/make/java/management/Makefile +++ b/jdk/make/java/management/Makefile @@ -86,7 +86,8 @@ OTHER_INCLUDES += \ -I$(SHARE_SRC)/native/sun/management ifeq ($(PLATFORM),windows) - OTHER_LDLIBS += $(JVMLIB) + # Need process status helper API (psapi) on Windows + OTHER_LDLIBS += $(JVMLIB) psapi.lib endif # diff --git a/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c b/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c index c8e72bf73a7..9422ee2dc86 100644 --- a/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c +++ b/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c @@ -30,6 +30,7 @@ #include "management.h" #include "com_sun_management_OperatingSystem.h" +#include #include #include @@ -53,41 +54,12 @@ static jlong jlong_from(jint h, jint l) { return result; } -// From psapi.h -typedef struct _PROCESS_MEMORY_COUNTERS { - DWORD cb; - DWORD PageFaultCount; - SIZE_T PeakWorkingSetSize; - SIZE_T WorkingSetSize; - SIZE_T QuotaPeakPagedPoolUsage; - SIZE_T QuotaPagedPoolUsage; - SIZE_T QuotaPeakNonPagedPoolUsage; - SIZE_T QuotaNonPagedPoolUsage; - SIZE_T PagefileUsage; - SIZE_T PeakPagefileUsage; -} PROCESS_MEMORY_COUNTERS; - -static HINSTANCE hInstPsapi = NULL; -typedef BOOL (WINAPI *LPFNGETPROCESSMEMORYINFO)(HANDLE, PROCESS_MEMORY_COUNTERS*, DWORD); - -static jboolean is_nt = JNI_FALSE; static HANDLE main_process; JNIEXPORT void JNICALL Java_com_sun_management_OperatingSystem_initialize (JNIEnv *env, jclass cls) { - OSVERSIONINFO oi; - oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&oi); - switch(oi.dwPlatformId) { - case VER_PLATFORM_WIN32_WINDOWS: is_nt = JNI_FALSE; break; - case VER_PLATFORM_WIN32_NT: is_nt = JNI_TRUE; break; - default: - throw_internal_error(env, "Unsupported Platform"); - return; - } - main_process = GetCurrentProcess(); } @@ -95,31 +67,12 @@ JNIEXPORT jlong JNICALL Java_com_sun_management_OperatingSystem_getCommittedVirtualMemorySize0 (JNIEnv *env, jobject mbean) { - - /* - * In bytes. NT/2000/XP only - using GetProcessMemoryInfo from psapi.dll - */ - static LPFNGETPROCESSMEMORYINFO lpfnGetProcessMemoryInfo = NULL; - static volatile jboolean psapi_inited = JNI_FALSE; PROCESS_MEMORY_COUNTERS pmc; - - if (!is_nt) return -1; - - if (!psapi_inited) { - psapi_inited = JNI_TRUE; - if ((hInstPsapi = LoadLibrary("PSAPI.DLL")) == NULL) return -1; - if ((lpfnGetProcessMemoryInfo = (LPFNGETPROCESSMEMORYINFO) - GetProcAddress( hInstPsapi, "GetProcessMemoryInfo")) == NULL) { - FreeLibrary(hInstPsapi); - return -1; - } + if (GetProcessMemoryInfo(main_process, &pmc, sizeof(PROCESS_MEMORY_COUNTERS)) == 0) { + return (jlong)-1L; + } else { + return (jlong) pmc.PagefileUsage; } - - if (lpfnGetProcessMemoryInfo == NULL) return -1; - - lpfnGetProcessMemoryInfo(main_process, &pmc, - sizeof(PROCESS_MEMORY_COUNTERS)); - return (jlong) pmc.PagefileUsage; } JNIEXPORT jlong JNICALL @@ -148,20 +101,15 @@ Java_com_sun_management_OperatingSystem_getProcessCpuTime FILETIME process_creation_time, process_exit_time, process_user_time, process_kernel_time; - // Windows NT only - if (is_nt) { - // Using static variables declared above - // Units are 100-ns intervals. Convert to ns. - GetProcessTimes(main_process, &process_creation_time, - &process_exit_time, - &process_kernel_time, &process_user_time); - return (jlong_from(process_user_time.dwHighDateTime, - process_user_time.dwLowDateTime) + - jlong_from(process_kernel_time.dwHighDateTime, - process_kernel_time.dwLowDateTime)) * 100; - } else { - return -1; - } + // Using static variables declared above + // Units are 100-ns intervals. Convert to ns. + GetProcessTimes(main_process, &process_creation_time, + &process_exit_time, + &process_kernel_time, &process_user_time); + return (jlong_from(process_user_time.dwHighDateTime, + process_user_time.dwLowDateTime) + + jlong_from(process_kernel_time.dwHighDateTime, + process_kernel_time.dwLowDateTime)) * 100; } JNIEXPORT jlong JNICALL diff --git a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c index 566b697eb8f..6e377b2e67f 100644 --- a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c +++ b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c @@ -23,9 +23,9 @@ * questions. */ -/* Access APIs for Win2K and above */ +/* Access APIs for WinXP and above */ #ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 +#define _WIN32_WINNT 0x0501 #endif #include @@ -60,13 +60,17 @@ static GetFinalPathNameByHandleProc GetFinalPathNameByHandle_func; JNIEXPORT void JNICALL Java_java_io_WinNTFileSystem_initIDs(JNIEnv *env, jclass cls) { - HANDLE handle; + HMODULE handle; jclass fileClass = (*env)->FindClass(env, "java/io/File"); if (!fileClass) return; ids.path = (*env)->GetFieldID(env, fileClass, "path", "Ljava/lang/String;"); - handle = LoadLibrary("kernel32"); - if (handle != NULL) { + + // GetFinalPathNameByHandle requires Windows Vista or newer + if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT), + (LPCWSTR)&CreateFileW, &handle) != 0) + { GetFinalPathNameByHandle_func = (GetFinalPathNameByHandleProc) GetProcAddress(handle, "GetFinalPathNameByHandleW"); } @@ -824,8 +828,6 @@ Java_java_io_WinNTFileSystem_getDriveDirectory(JNIEnv *env, jobject this, return ret; } -typedef BOOL (WINAPI* GetVolumePathNameProc) (LPCWSTR, LPWSTR, DWORD); - JNIEXPORT jlong JNICALL Java_java_io_WinNTFileSystem_getSpace0(JNIEnv *env, jobject this, jobject file, jint t) @@ -834,14 +836,7 @@ Java_java_io_WinNTFileSystem_getSpace0(JNIEnv *env, jobject this, jlong rv = 0L; WCHAR *pathbuf = fileToNTPath(env, file, ids.path); - HMODULE h = LoadLibrary("kernel32"); - GetVolumePathNameProc getVolumePathNameW = NULL; - if (h) { - getVolumePathNameW - = (GetVolumePathNameProc)GetProcAddress(h, "GetVolumePathNameW"); - } - - if (getVolumePathNameW(pathbuf, volname, MAX_PATH_LENGTH)) { + if (GetVolumePathNameW(pathbuf, volname, MAX_PATH_LENGTH)) { ULARGE_INTEGER totalSpace, freeSpace, usableSpace; if (GetDiskFreeSpaceExW(volname, &usableSpace, &totalSpace, &freeSpace)) { switch(t) { @@ -860,9 +855,6 @@ Java_java_io_WinNTFileSystem_getSpace0(JNIEnv *env, jobject this, } } - if (h) { - FreeLibrary(h); - } free(pathbuf); return rv; } diff --git a/jdk/src/windows/native/java/lang/java_props_md.c b/jdk/src/windows/native/java/lang/java_props_md.c index 5b9332fb111..c66efbaf2fb 100644 --- a/jdk/src/windows/native/java/lang/java_props_md.c +++ b/jdk/src/windows/native/java/lang/java_props_md.c @@ -196,42 +196,23 @@ getHomeFromRegistry() /* * Code to figure out the user's home directory using shell32.dll */ -typedef HRESULT (WINAPI *GetSpecialFolderType)(HWND, int, LPITEMIDLIST *); -typedef BOOL (WINAPI *GetPathFromIDListType)(LPCITEMIDLIST, LPSTR); - WCHAR* getHomeFromShell32() { - HMODULE lib = LoadLibraryW(L"SHELL32.DLL"); - GetSpecialFolderType do_get_folder; - GetPathFromIDListType do_get_path; HRESULT rc; LPITEMIDLIST item_list = 0; WCHAR *p; WCHAR path[MAX_PATH+1]; int size = MAX_PATH+1; - if (lib == 0) { - // We can't load the library !!?? - return NULL; - } - - do_get_folder = (GetSpecialFolderType)GetProcAddress(lib, "SHGetSpecialFolderLocation"); - do_get_path = (GetPathFromIDListType)GetProcAddress(lib, "SHGetPathFromIDListW"); - - if (do_get_folder == 0 || do_get_path == 0) { - // the library doesn't hold the right functions !!?? - return NULL; - } - - rc = (*do_get_folder)(NULL, CSIDL_DESKTOPDIRECTORY, &item_list); + rc = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOPDIRECTORY, &item_list); if (!SUCCEEDED(rc)) { // we can't find the shell folder. return NULL; } path[0] = 0; - (*do_get_path)(item_list, (LPSTR)path); + SHGetPathFromIDListW(item_list, (LPWSTR)path); /* Get the parent of Desktop directory */ p = wcsrchr(path, L'\\'); @@ -253,17 +234,7 @@ getHomeFromShell32() static boolean haveMMX(void) { - boolean mmx = 0; - HMODULE lib = LoadLibrary("KERNEL32"); - if (lib != NULL) { - BOOL (WINAPI *isProcessorFeaturePresent)(DWORD) = - (BOOL (WINAPI *)(DWORD)) - GetProcAddress(lib, "IsProcessorFeaturePresent"); - if (isProcessorFeaturePresent != NULL) - mmx = isProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE); - FreeLibrary(lib); - } - return mmx; + return IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE); } static const char * @@ -532,10 +503,19 @@ GetJavaProperties(JNIEnv* env) if (uname != NULL && wcslen(uname) > 0) { sprops.user_name = _wcsdup(uname); } else { - WCHAR buf[100]; - int buflen = sizeof(buf); - sprops.user_name = - GetUserNameW(buf, &buflen) ? _wcsdup(buf) : L"unknown"; + DWORD buflen = 0; + if (GetUserNameW(NULL, &buflen) == 0 && + GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + uname = (WCHAR*)malloc(buflen * sizeof(WCHAR)); + if (uname != NULL && GetUserNameW(uname, &buflen) == 0) { + free(uname); + uname = NULL; + } + } else { + uname = NULL; + } + sprops.user_name = (uname != NULL) ? uname : L"unknown"; } } @@ -633,8 +613,8 @@ GetJavaProperties(JNIEnv* env) /* Current directory */ { WCHAR buf[MAX_PATH]; - GetCurrentDirectoryW(sizeof(buf), buf); - sprops.user_dir = _wcsdup(buf); + if (GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR), buf) != 0) + sprops.user_dir = _wcsdup(buf); } sprops.file_separator = "\\"; diff --git a/jdk/src/windows/native/sun/management/FileSystemImpl.c b/jdk/src/windows/native/sun/management/FileSystemImpl.c index 57abea98541..0747121d35a 100644 --- a/jdk/src/windows/native/sun/management/FileSystemImpl.c +++ b/jdk/src/windows/native/sun/management/FileSystemImpl.c @@ -36,45 +36,6 @@ */ #define ANY_ACCESS (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE) -/* - * Function prototypes for security functions - we can't statically - * link because these functions aren't on Windows 9x. - */ -typedef BOOL (WINAPI *GetFileSecurityFunc) - (LPCTSTR lpFileName, SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, - LPDWORD lpnLengthNeeded); - -typedef BOOL (WINAPI *GetSecurityDescriptorOwnerFunc) - (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pOwner, - LPBOOL lpbOwnerDefaulted); - -typedef BOOL (WINAPI *GetSecurityDescriptorDaclFunc) - (PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, - PACL *pDacl, LPBOOL lpbDaclDefaulted); - -typedef BOOL (WINAPI *GetAclInformationFunc) - (PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, - ACL_INFORMATION_CLASS dwAclInformationClass); - -typedef BOOL (WINAPI *GetAceFunc) - (PACL pAcl, DWORD dwAceIndex, LPVOID *pAce); - -typedef BOOL (WINAPI *EqualSidFunc)(PSID pSid1, PSID pSid2); - - -/* Addresses of the security functions */ -static GetFileSecurityFunc GetFileSecurity_func; -static GetSecurityDescriptorOwnerFunc GetSecurityDescriptorOwner_func; -static GetSecurityDescriptorDaclFunc GetSecurityDescriptorDacl_func; -static GetAclInformationFunc GetAclInformation_func; -static GetAceFunc GetAce_func; -static EqualSidFunc EqualSid_func; - -/* True if this OS is NT kernel based (NT/2000/XP) */ -static int isNT; - - /* * Returns JNI_TRUE if the specified file is on a file system that supports * persistent ACLs (On NTFS file systems returns true, on FAT32 file systems @@ -165,7 +126,7 @@ static SECURITY_DESCRIPTOR* getFileSecurityDescriptor(JNIEnv* env, const char* p SECURITY_INFORMATION info = OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION; - (*GetFileSecurity_func)(path, info , 0, 0, &len); + GetFileSecurityA(path, info , 0, 0, &len); if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed"); return NULL; @@ -174,7 +135,7 @@ static SECURITY_DESCRIPTOR* getFileSecurityDescriptor(JNIEnv* env, const char* p if (sd == NULL) { JNU_ThrowOutOfMemoryError(env, 0); } else { - if (!(*GetFileSecurity_func)(path, info, sd, len, &len)) { + if (!(*GetFileSecurityA)(path, info, sd, len, &len)) { JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed"); free(sd); return NULL; @@ -191,7 +152,7 @@ static SID* getFileOwner(JNIEnv* env, SECURITY_DESCRIPTOR* sd) { SID* owner; BOOL defaulted; - if (!(*GetSecurityDescriptorOwner_func)(sd, &owner, &defaulted)) { + if (!GetSecurityDescriptorOwner(sd, &owner, &defaulted)) { JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorOwner failed"); return NULL; } @@ -206,7 +167,7 @@ static ACL* getFileDACL(JNIEnv* env, SECURITY_DESCRIPTOR* sd) { ACL *acl; int defaulted, present; - if (!(*GetSecurityDescriptorDacl_func)(sd, &present, &acl, &defaulted)) { + if (!GetSecurityDescriptorDacl(sd, &present, &acl, &defaulted)) { JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorDacl failed"); return NULL; } @@ -235,8 +196,8 @@ static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) { /* * Get the ACE count */ - if (!(*GetAclInformation_func)(acl, (void *) &acl_size_info, sizeof(acl_size_info), - AclSizeInformation)) { + if (!GetAclInformation(acl, (void *) &acl_size_info, sizeof(acl_size_info), + AclSizeInformation)) { JNU_ThrowIOExceptionWithLastError(env, "GetAclInformation failed"); return JNI_FALSE; } @@ -250,7 +211,7 @@ static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) { ACCESS_ALLOWED_ACE *access; SID* sid; - if (!(*GetAce_func)(acl, i, &ace)) { + if (!GetAce(acl, i, &ace)) { JNU_ThrowIOExceptionWithLastError(env, "GetAce failed"); return -1; } @@ -280,51 +241,7 @@ static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) { JNIEXPORT void JNICALL Java_sun_management_FileSystemImpl_init0 (JNIEnv *env, jclass ignored) { - OSVERSIONINFO ver; - HINSTANCE hInst; - - /* - * Get the OS version. If dwPlatformId is VER_PLATFORM_WIN32_NT - * it means we're running on a Windows NT, 2000, or XP machine. - */ - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx(&ver); - isNT = (ver.dwPlatformId == VER_PLATFORM_WIN32_NT); - if (!isNT) { - return; - } - - /* - * On NT/2000/XP we need the addresses of the security functions - */ - hInst = LoadLibrary("ADVAPI32.DLL"); - if (hInst == NULL) { - JNU_ThrowIOExceptionWithLastError(env, "Unable to load ADVAPI32.DLL"); - return; - } - - - GetFileSecurity_func = (GetFileSecurityFunc)GetProcAddress(hInst, "GetFileSecurityA"); - GetSecurityDescriptorOwner_func = - (GetSecurityDescriptorOwnerFunc)GetProcAddress(hInst, "GetSecurityDescriptorOwner"); - GetSecurityDescriptorDacl_func = - (GetSecurityDescriptorDaclFunc)GetProcAddress(hInst, "GetSecurityDescriptorDacl"); - GetAclInformation_func = - (GetAclInformationFunc)GetProcAddress(hInst, "GetAclInformation"); - GetAce_func = (GetAceFunc)GetProcAddress(hInst, "GetAce"); - EqualSid_func = (EqualSidFunc)GetProcAddress(hInst, "EqualSid"); - - if (GetFileSecurity_func == NULL || - GetSecurityDescriptorDacl_func == NULL || - GetSecurityDescriptorDacl_func == NULL || - GetAclInformation_func == NULL || - GetAce_func == NULL || - EqualSid_func == NULL) - { - JNU_ThrowIOExceptionWithLastError(env, - "Unable to get address of security functions"); - return; - } + /* nothing to do */ } /* @@ -339,10 +256,6 @@ JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isSecuritySupporte jboolean isCopy; const char* path; - if (!isNT) { - return JNI_FALSE; - } - path = JNU_GetStringPlatformChars(env, str, &isCopy); if (path != NULL) { res = isSecuritySupported(env, path); diff --git a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c index d9d8a9d7cb2..7324950e9ef 100644 --- a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c +++ b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c @@ -24,7 +24,7 @@ */ #ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 +#define _WIN32_WINNT 0x0501 #endif #include @@ -36,6 +36,7 @@ #include #include #include +#include #include "jni.h" #include "jni_util.h" @@ -77,40 +78,20 @@ static jfieldID backupResult_context; /** - * Win32 APIs not defined in Visual Studio 2003 header files + * Win32 APIs not available in Windows XP */ - -typedef enum { - FindStreamInfoStandard -} MY_STREAM_INFO_LEVELS; - -typedef struct _MY_WIN32_FIND_STREAM_DATA { - LARGE_INTEGER StreamSize; - WCHAR cStreamName[MAX_PATH + 36]; -} MY_WIN32_FIND_STREAM_DATA; - -typedef HANDLE (WINAPI* FindFirstStream_Proc)(LPCWSTR, MY_STREAM_INFO_LEVELS, LPVOID, DWORD); +typedef HANDLE (WINAPI* FindFirstStream_Proc)(LPCWSTR, STREAM_INFO_LEVELS, LPVOID, DWORD); typedef BOOL (WINAPI* FindNextStream_Proc)(HANDLE, LPVOID); typedef BOOLEAN (WINAPI* CreateSymbolicLinkProc) (LPCWSTR, LPCWSTR, DWORD); -typedef BOOL (WINAPI* CreateHardLinkProc) (LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES); typedef BOOL (WINAPI* GetFinalPathNameByHandleProc) (HANDLE, LPWSTR, DWORD, DWORD); -typedef BOOL (WINAPI* ConvertSidToStringSidProc) (PSID, LPWSTR*); -typedef BOOL (WINAPI* ConvertStringSidToSidProc) (LPWSTR, PSID*); -typedef DWORD (WINAPI* GetLengthSidProc) (PSID); - static FindFirstStream_Proc FindFirstStream_func; static FindNextStream_Proc FindNextStream_func; static CreateSymbolicLinkProc CreateSymbolicLink_func; -static CreateHardLinkProc CreateHardLink_func; static GetFinalPathNameByHandleProc GetFinalPathNameByHandle_func; -static ConvertSidToStringSidProc ConvertSidToStringSid_func; -static ConvertStringSidToSidProc ConvertStringSidToSid_func; -static GetLengthSidProc GetLengthSid_func; - static void throwWindowsException(JNIEnv* env, DWORD lastError) { jobject x = JNU_NewObjectByName(env, "sun/nio/fs/WindowsException", "(I)V", lastError); @@ -190,33 +171,23 @@ Java_sun_nio_fs_WindowsNativeDispatcher_initIDs(JNIEnv* env, jclass this) backupResult_bytesTransferred = (*env)->GetFieldID(env, clazz, "bytesTransferred", "I"); backupResult_context = (*env)->GetFieldID(env, clazz, "context", "J"); - - h = LoadLibrary("kernel32"); - if (h != INVALID_HANDLE_VALUE) { + // get handle to kernel32 + if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT), + (LPCWSTR)&CreateFileW, &h) != 0) + { + // requires Windows Server 2003 or newer FindFirstStream_func = (FindFirstStream_Proc)GetProcAddress(h, "FindFirstStreamW"); FindNextStream_func = (FindNextStream_Proc)GetProcAddress(h, "FindNextStreamW"); + + // requires Windows Vista or newer CreateSymbolicLink_func = (CreateSymbolicLinkProc)GetProcAddress(h, "CreateSymbolicLinkW"); - CreateHardLink_func = - (CreateHardLinkProc)GetProcAddress(h, "CreateHardLinkW"); GetFinalPathNameByHandle_func = (GetFinalPathNameByHandleProc)GetProcAddress(h, "GetFinalPathNameByHandleW"); - FreeLibrary(h); } - - h = LoadLibrary("advapi32"); - if (h != INVALID_HANDLE_VALUE) { - ConvertSidToStringSid_func = - (ConvertSidToStringSidProc)GetProcAddress(h, "ConvertSidToStringSidW"); - ConvertStringSidToSid_func = - (ConvertStringSidToSidProc)GetProcAddress(h, "ConvertStringSidToSidW"); - GetLengthSid_func = - (GetLengthSidProc)GetProcAddress(h, "GetLengthSid"); - FreeLibrary(h); - } - } JNIEXPORT jstring JNICALL @@ -413,7 +384,7 @@ JNIEXPORT void JNICALL Java_sun_nio_fs_WindowsNativeDispatcher_FindFirstStream0(JNIEnv* env, jclass this, jlong address, jobject obj) { - MY_WIN32_FIND_STREAM_DATA data; + WIN32_FIND_STREAM_DATA data; LPCWSTR lpFileName = jlong_to_ptr(address); HANDLE handle; @@ -443,7 +414,7 @@ JNIEXPORT jstring JNICALL Java_sun_nio_fs_WindowsNativeDispatcher_FindNextStream(JNIEnv* env, jclass this, jlong handle) { - MY_WIN32_FIND_STREAM_DATA data; + WIN32_FIND_STREAM_DATA data; HANDLE h = (HANDLE)jlong_to_ptr(handle); if (FindNextStream_func == NULL) { @@ -909,12 +880,7 @@ Java_sun_nio_fs_WindowsNativeDispatcher_GetLengthSid(JNIEnv* env, jclass this, jlong address) { PSID sid = jlong_to_ptr(address); - - if (GetLengthSid_func == NULL) { - JNU_ThrowInternalError(env, "Should not get here"); - return 0; - } - return (jint)(*GetLengthSid_func)(sid); + return (jint)GetLengthSid(sid); } @@ -924,13 +890,7 @@ Java_sun_nio_fs_WindowsNativeDispatcher_ConvertSidToStringSid(JNIEnv* env, { PSID sid = jlong_to_ptr(address); LPWSTR string; - - if (ConvertSidToStringSid_func == NULL) { - JNU_ThrowInternalError(env, "Should not get here"); - return NULL; - } - - if ((*ConvertSidToStringSid_func)(sid, &string) == 0) { + if (ConvertSidToStringSidW(sid, &string) == 0) { throwWindowsException(env, GetLastError()); return NULL; } else { @@ -947,15 +907,8 @@ Java_sun_nio_fs_WindowsNativeDispatcher_ConvertStringSidToSid0(JNIEnv* env, { LPWSTR lpStringSid = jlong_to_ptr(address); PSID pSid; - - if (ConvertStringSidToSid_func == NULL) { - JNU_ThrowInternalError(env, "Should not get here"); - return (jlong)0; - } - - if ((*ConvertStringSidToSid_func)(lpStringSid, &pSid) == 0) + if (ConvertStringSidToSidW(lpStringSid, &pSid) == 0) throwWindowsException(env, GetLastError()); - return ptr_to_jlong(pSid); } @@ -1137,11 +1090,7 @@ Java_sun_nio_fs_WindowsNativeDispatcher_CreateHardLink0(JNIEnv* env, LPCWSTR newFile = jlong_to_ptr(newFileAddress); LPCWSTR existingFile = jlong_to_ptr(existingFileAddress); - if (CreateHardLink_func == NULL) { - JNU_ThrowInternalError(env, "Should not get here"); - return; - } - if ((*CreateHardLink_func)(newFile, existingFile, NULL) == 0) + if (CreateHardLinkW(newFile, existingFile, NULL) == 0) throwWindowsException(env, GetLastError()); } diff --git a/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c b/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c index d9d91080ddb..968650da591 100644 --- a/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c +++ b/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c @@ -33,11 +33,6 @@ #include #include "sun_security_provider_NativeSeedGenerator.h" -/* Typedefs for runtime linking. */ -typedef BOOL (WINAPI *CryptAcquireContextType)(HCRYPTPROV*, LPCTSTR, LPCTSTR, DWORD, DWORD); -typedef BOOL (WINAPI *CryptGenRandomType)(HCRYPTPROV, DWORD, BYTE*); -typedef BOOL (WINAPI *CryptReleaseContextType)(HCRYPTPROV, DWORD); - /* * Get a random seed from the MS CryptoAPI. Return true if successful, false * otherwise. @@ -49,48 +44,27 @@ typedef BOOL (WINAPI *CryptReleaseContextType)(HCRYPTPROV, DWORD); JNIEXPORT jboolean JNICALL Java_sun_security_provider_NativeSeedGenerator_nativeGenerateSeed (JNIEnv *env, jclass clazz, jbyteArray randArray) { - HMODULE lib; - CryptAcquireContextType acquireContext; - CryptGenRandomType genRandom; - CryptReleaseContextType releaseContext; - HCRYPTPROV hCryptProv; jboolean result = JNI_FALSE; jsize numBytes; jbyte* randBytes; - lib = LoadLibrary("ADVAPI32.DLL"); - if (lib == NULL) { - return result; - } - - acquireContext = (CryptAcquireContextType)GetProcAddress(lib, "CryptAcquireContextA"); - genRandom = (CryptGenRandomType)GetProcAddress(lib, "CryptGenRandom"); - releaseContext = (CryptReleaseContextType)GetProcAddress(lib, "CryptReleaseContext"); - - if (acquireContext == NULL || genRandom == NULL || releaseContext == NULL) { - FreeLibrary(lib); - return result; - } - - if (acquireContext(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, 0) == FALSE) { + if (CryptAcquireContextA(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, 0) == FALSE) { /* If CSP context hasn't been created, create one. */ - if (acquireContext(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, + if (CryptAcquireContextA(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET) == FALSE) { - FreeLibrary(lib); return result; } } numBytes = (*env)->GetArrayLength(env, randArray); randBytes = (*env)->GetByteArrayElements(env, randArray, NULL); - if (genRandom(hCryptProv, numBytes, randBytes)) { + if (CryptGenRandom(hCryptProv, numBytes, randBytes)) { result = JNI_TRUE; } (*env)->ReleaseByteArrayElements(env, randArray, randBytes, 0); - releaseContext(hCryptProv, 0); - FreeLibrary(lib); + CryptReleaseContext(hCryptProv, 0); return result; } From f6697e15da4e2666b049d1c18171855cfe5bfde0 Mon Sep 17 00:00:00 2001 From: Alexander Potochkin Date: Mon, 4 Apr 2011 21:37:10 +0400 Subject: [PATCH 131/168] 7032791: TableCellRenderer.getTableCellRendererComponent() doesn't accept null JTable with GTK+ L&F Reviewed-by: rupashka --- .../share/classes/javax/swing/plaf/synth/SynthTableUI.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java index 621be2400f4..b1e6a092910 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java @@ -786,9 +786,9 @@ public class SynthTableUI extends BasicTableUI hasFocus, row, column); setIcon(null); - Class columnClass = table.getColumnClass(column); - configureValue(value, columnClass); - + if (table != null) { + configureValue(value, table.getColumnClass(column)); + } return this; } From 434827d86e3e7b9253e83cd621918cb624c982ff Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 4 Apr 2011 11:22:45 -0700 Subject: [PATCH 132/168] 6543593: (reflect) Clarify private final field mutability Reviewed-by: dholmes, alanb, mduigou --- .../java/lang/reflect/Constructor.java | 2 +- .../classes/java/lang/reflect/Field.java | 100 +++++++++++------- .../classes/java/lang/reflect/Method.java | 2 +- 3 files changed, 61 insertions(+), 43 deletions(-) diff --git a/jdk/src/share/classes/java/lang/reflect/Constructor.java b/jdk/src/share/classes/java/lang/reflect/Constructor.java index 601eafe066d..b125e1131fa 100644 --- a/jdk/src/share/classes/java/lang/reflect/Constructor.java +++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java @@ -495,7 +495,7 @@ public final * this object represents * * @exception IllegalAccessException if this {@code Constructor} object - * enforces Java language access control and the underlying + * is enforcing Java language access control and the underlying * constructor is inaccessible. * @exception IllegalArgumentException if the number of actual * and formal parameters differ; if an unwrapping diff --git a/jdk/src/share/classes/java/lang/reflect/Field.java b/jdk/src/share/classes/java/lang/reflect/Field.java index 77884d46bbe..49dcee8200a 100644 --- a/jdk/src/share/classes/java/lang/reflect/Field.java +++ b/jdk/src/share/classes/java/lang/reflect/Field.java @@ -340,7 +340,7 @@ class Field extends AccessibleObject implements Member { * instance of the class or interface declaring the underlying * field, the method throws an {@code IllegalArgumentException}. * - *

If this {@code Field} object enforces Java language access control, and + *

If this {@code Field} object is enforcing Java language access control, and * the underlying field is inaccessible, the method throws an * {@code IllegalAccessException}. * If the underlying field is static, the class that declared the @@ -360,8 +360,9 @@ class Field extends AccessibleObject implements Member { * {@code obj}; primitive values are wrapped in an appropriate * object before being returned * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof). @@ -383,8 +384,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the {@code boolean} field * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -410,8 +412,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the {@code byte} field * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -439,8 +442,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the field converted to type {@code char} * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -468,8 +472,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the field converted to type {@code short} * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -497,8 +502,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the field converted to type {@code int} * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -526,8 +532,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the field converted to type {@code long} * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -555,8 +562,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the field converted to type {@code float} * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -584,8 +592,9 @@ class Field extends AccessibleObject implements Member { * from * @return the value of the field converted to type {@code double} * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is inaccessible. * @exception IllegalArgumentException if the specified object is not * an instance of the class or interface declaring the * underlying field (or a subclass or implementor @@ -621,14 +630,14 @@ class Field extends AccessibleObject implements Member { * an instance of the class or interface declaring the underlying * field, the method throws an {@code IllegalArgumentException}. * - *

If this {@code Field} object enforces Java language access control, and + *

If this {@code Field} object is enforcing Java language access control, and * the underlying field is inaccessible, the method throws an * {@code IllegalAccessException}. * *

If the underlying field is final, the method throws an - * {@code IllegalAccessException} unless - * {@code setAccessible(true)} has succeeded for this field - * and this field is non-static. Setting a final field in this way + * {@code IllegalAccessException} unless {@code setAccessible(true)} + * has succeeded for this {@code Field} object + * and the field is non-static. Setting a final field in this way * is meaningful only during deserialization or reconstruction of * instances of classes with blank final fields, before they are * made available for access by other parts of a program. Use in @@ -658,8 +667,9 @@ class Field extends AccessibleObject implements Member { * @param value the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -686,8 +696,9 @@ class Field extends AccessibleObject implements Member { * @param z the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -715,8 +726,9 @@ class Field extends AccessibleObject implements Member { * @param b the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -744,8 +756,9 @@ class Field extends AccessibleObject implements Member { * @param c the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -773,8 +786,9 @@ class Field extends AccessibleObject implements Member { * @param s the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -802,8 +816,9 @@ class Field extends AccessibleObject implements Member { * @param i the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -831,8 +846,9 @@ class Field extends AccessibleObject implements Member { * @param l the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -860,8 +876,9 @@ class Field extends AccessibleObject implements Member { * @param f the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), @@ -889,8 +906,9 @@ class Field extends AccessibleObject implements Member { * @param d the new value for the field of {@code obj} * being modified * - * @exception IllegalAccessException if the underlying field - * is inaccessible. + * @exception IllegalAccessException if this {@code Field} object + * is enforcing Java language access control and the underlying + * field is either inaccessible or final. * @exception IllegalArgumentException if the specified object is not an * instance of the class or interface declaring the underlying * field (or a subclass or implementor thereof), diff --git a/jdk/src/share/classes/java/lang/reflect/Method.java b/jdk/src/share/classes/java/lang/reflect/Method.java index 51eaf2dff50..c8776370a83 100644 --- a/jdk/src/share/classes/java/lang/reflect/Method.java +++ b/jdk/src/share/classes/java/lang/reflect/Method.java @@ -565,7 +565,7 @@ public final * {@code args} * * @exception IllegalAccessException if this {@code Method} object - * enforces Java language access control and the underlying + * is enforcing Java language access control and the underlying * method is inaccessible. * @exception IllegalArgumentException if the method is an * instance method and the specified object argument From 363df8be6ac1ffe076e1109964e56b5b3f395885 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Mon, 4 Apr 2011 11:30:55 -0700 Subject: [PATCH 133/168] 6751338: ZIP inflater/deflater performance To use GetPrimitiveArrayCritical for bye array access Reviewed-by: bristor, alanb --- .../java/util/zip/DeflaterOutputStream.java | 11 +- jdk/src/share/native/java/util/zip/Deflater.c | 49 ++- jdk/src/share/native/java/util/zip/Inflater.c | 59 ++-- .../java/util/zip/FlaterCriticalArray.java | 295 ++++++++++++++++++ .../java/util/zip/InflaterBufferSize.java | 163 ++++++++++ 5 files changed, 498 insertions(+), 79 deletions(-) create mode 100644 jdk/test/java/util/zip/FlaterCriticalArray.java create mode 100644 jdk/test/java/util/zip/InflaterBufferSize.java diff --git a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java index e7a78cb5ce1..96ade216719 100644 --- a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java +++ b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java @@ -206,14 +206,9 @@ class DeflaterOutputStream extends FilterOutputStream { return; } if (!def.finished()) { - // Deflate no more than stride bytes at a time. This avoids - // excess copying in deflateBytes (see Deflater.c) - int stride = buf.length; - for (int i = 0; i < len; i+= stride) { - def.setInput(b, off + i, Math.min(stride, len - i)); - while (!def.needsInput()) { - deflate(); - } + def.setInput(b, off, len); + while (!def.needsInput()) { + deflate(); } } } diff --git a/jdk/src/share/native/java/util/zip/Deflater.c b/jdk/src/share/native/java/util/zip/Deflater.c index 3b32750a298..6cad24e480a 100644 --- a/jdk/src/share/native/java/util/zip/Deflater.c +++ b/jdk/src/share/native/java/util/zip/Deflater.c @@ -129,34 +129,28 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr, if ((*env)->GetBooleanField(env, this, setParamsID)) { int level = (*env)->GetIntField(env, this, levelID); int strategy = (*env)->GetIntField(env, this, strategyID); - - in_buf = (jbyte *) malloc(this_len); - if (in_buf == 0) { + in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0); + if (in_buf == NULL) { // Throw OOME only when length is not zero if (this_len != 0) JNU_ThrowOutOfMemoryError(env, 0); return 0; } - (*env)->GetByteArrayRegion(env, this_buf, this_off, this_len, in_buf); - out_buf = (jbyte *) malloc(len); - if (out_buf == 0) { - free(in_buf); + out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0); + if (out_buf == NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0); if (len != 0) JNU_ThrowOutOfMemoryError(env, 0); return 0; } - strm->next_in = (Bytef *) in_buf; - strm->next_out = (Bytef *) out_buf; + strm->next_in = (Bytef *) (in_buf + this_off); + strm->next_out = (Bytef *) (out_buf + off); strm->avail_in = this_len; strm->avail_out = len; res = deflateParams(strm, level, strategy); - - if (res == Z_OK) { - (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf); - } - free(out_buf); - free(in_buf); + (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0); + (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0); switch (res) { case Z_OK: @@ -174,33 +168,28 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr, } } else { jboolean finish = (*env)->GetBooleanField(env, this, finishID); - in_buf = (jbyte *) malloc(this_len); - if (in_buf == 0) { + in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0); + if (in_buf == NULL) { if (this_len != 0) JNU_ThrowOutOfMemoryError(env, 0); return 0; } - (*env)->GetByteArrayRegion(env, this_buf, this_off, this_len, in_buf); - - out_buf = (jbyte *) malloc(len); - if (out_buf == 0) { - free(in_buf); + out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0); + if (out_buf == NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0); if (len != 0) JNU_ThrowOutOfMemoryError(env, 0); + return 0; } - strm->next_in = (Bytef *) in_buf; - strm->next_out = (Bytef *) out_buf; + strm->next_in = (Bytef *) (in_buf + this_off); + strm->next_out = (Bytef *) (out_buf + off); strm->avail_in = this_len; strm->avail_out = len; res = deflate(strm, finish ? Z_FINISH : flush); - - if (res == Z_STREAM_END || res == Z_OK) { - (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf); - } - free(out_buf); - free(in_buf); + (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0); + (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0); switch (res) { case Z_STREAM_END: diff --git a/jdk/src/share/native/java/util/zip/Inflater.c b/jdk/src/share/native/java/util/zip/Inflater.c index dbf9a1357ae..e5296fcf4c6 100644 --- a/jdk/src/share/native/java/util/zip/Inflater.c +++ b/jdk/src/share/native/java/util/zip/Inflater.c @@ -38,8 +38,6 @@ #include "zlib.h" #include "java_util_zip_Inflater.h" -#define MIN2(x, y) ((x) < (y) ? (x) : (y)) - #define ThrowDataFormatException(env, msg) \ JNU_ThrowByName(env, "java/util/zip/DataFormatException", msg) @@ -111,71 +109,50 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr, jarray b, jint off, jint len) { z_stream *strm = jlong_to_ptr(addr); - jarray this_buf = (jarray)(*env)->GetObjectField(env, this, bufID); jint this_off = (*env)->GetIntField(env, this, offID); jint this_len = (*env)->GetIntField(env, this, lenID); + jbyte *in_buf; jbyte *out_buf; int ret; - /* - * Avoid excess copying. - * zlib stream usually has a few bytes of overhead for header info - * (depends on the underlying data) - * - * (a) 5 bytes per 16KB - * (b) 6 bytes for entire stream - * (c) 4 bytes for gzip header - * (d) 2 bytes for crc - * - * Use 20 bytes as the "safe cutoff" number. - */ - jint in_len = MIN2(this_len, len + 20); - jint consumed; - in_buf = (jbyte *) malloc(in_len); - if (in_buf == 0) { - if (in_len != 0) + in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0); + if (in_buf == NULL) { + if (this_len != 0) JNU_ThrowOutOfMemoryError(env, 0); return 0; } - (*env)->GetByteArrayRegion(env, this_buf, this_off, in_len, in_buf); - - out_buf = (jbyte *) malloc(len); - if (out_buf == 0) { - free(in_buf); + out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0); + if (out_buf == NULL) { + (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0); if (len != 0) JNU_ThrowOutOfMemoryError(env, 0); return 0; } - - strm->next_in = (Bytef *) in_buf; - strm->next_out = (Bytef *) out_buf; - strm->avail_in = in_len; + strm->next_in = (Bytef *) (in_buf + this_off); + strm->next_out = (Bytef *) (out_buf + off); + strm->avail_in = this_len; strm->avail_out = len; ret = inflate(strm, Z_PARTIAL_FLUSH); - - if (ret == Z_STREAM_END || ret == Z_OK) { - (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf); - } - free(out_buf); - free(in_buf); + (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0); + (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0); switch (ret) { case Z_STREAM_END: (*env)->SetBooleanField(env, this, finishedID, JNI_TRUE); /* fall through */ case Z_OK: - consumed = in_len - strm->avail_in; - (*env)->SetIntField(env, this, offID, this_off + consumed); - (*env)->SetIntField(env, this, lenID, this_len - consumed); + this_off += this_len - strm->avail_in; + (*env)->SetIntField(env, this, offID, this_off); + (*env)->SetIntField(env, this, lenID, strm->avail_in); return len - strm->avail_out; case Z_NEED_DICT: (*env)->SetBooleanField(env, this, needDictID, JNI_TRUE); /* Might have consumed some input here! */ - consumed = in_len - strm->avail_in; - (*env)->SetIntField(env, this, offID, this_off + consumed); - (*env)->SetIntField(env, this, lenID, this_len - consumed); + this_off += this_len - strm->avail_in; + (*env)->SetIntField(env, this, offID, this_off); + (*env)->SetIntField(env, this, lenID, strm->avail_in); return 0; case Z_BUF_ERROR: return 0; diff --git a/jdk/test/java/util/zip/FlaterCriticalArray.java b/jdk/test/java/util/zip/FlaterCriticalArray.java new file mode 100644 index 00000000000..3d90195dea2 --- /dev/null +++ b/jdk/test/java/util/zip/FlaterCriticalArray.java @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * ZIP inflater/deflater performance. + */ + +/* + * Run this test on JDK 6 and on later + * JDKs to compare results: + * java -server -Xms1024M -Xmx1024M -Ddebug=true FlaterCriticalArray + * + * The performance issues can be readily seen on JDK 6, and so this code is + * written to compile on that platform: it does *not* use any JDK 7 - specific + * features. + */ + +import java.io.*; +import java.nio.*; +import java.util.*; +import java.util.zip.*; + +public class FlaterCriticalArray { + // If true, print information about performance + private static final boolean debug = System.getProperty("debug") != null; + + private static void debug(String s) { + if (debug) System.out.println(s); + } + + private static void debug(String name, String inOut, long time, int length) { + debug(name + ": Duration of " + inOut + "(in ms): " + time); + debug(name + ": " + inOut + "d data length: " + length + " bytes"); + } + + private static byte[] grow(byte[] a, int capacity) { + while (a.length < capacity) { + byte[] a2 = new byte[a.length * 2]; + System.arraycopy(a, 0, a2, 0, a.length); + a = a2; + } + return a; + } + + private static byte[] trim(byte[] a, int length) { + byte[] res = new byte[length]; + System.arraycopy(a, 0, res, 0, length); + return res; + } + + /* + * Base class for individual test cases + */ + abstract static private class TestCase { + protected String name; // For information in debug messages + protected byte data[]; // Data to be deflated and subsequently inflated + protected int level; // Compression level for deflater + + protected TestCase(String name, byte data[]) { + this(name, data, -1); + } + + protected TestCase(String name, byte data[], int level) { + this.name = name; + this.data = data; + this.level = level; + } + + public void runTest() throws Throwable { + long time0, time1; + byte deflated[], inflated[]; + + debug(""); + + time0 = System.currentTimeMillis(); + deflated = deflate(data, level); + time1 = System.currentTimeMillis(); + inform("Deflate", time1 - time0, deflated.length); + + time0 = System.currentTimeMillis(); + inflated = inflate(deflated); + time1 = System.currentTimeMillis(); + inform("Inflate", time1 - time0, inflated.length); + + check(Arrays.equals(data, inflated), + name + ": Inflated and deflated arrays do not match"); + } + + private void inform(String inOut, long duration, int length) { + debug(name, inOut, duration, length); + } + + abstract protected byte[] deflate(byte data[], int level) throws Throwable; + + abstract protected byte[] inflate(byte deflated[]) throws Throwable; + } + + /* + * Following are the individual test cases + */ + + private static class StrideTest extends TestCase { + static final int STRIDE = 1024; + + public StrideTest(byte data[], int level) { + super("STRIDE", data, level); + } + + protected byte[] deflate(byte in[], int level) throws Throwable { + final int len = in.length; + final Deflater deflater = new Deflater(level); + final byte[] smallBuffer = new byte[32]; + byte[] flated = new byte[32]; + int count = 0; + for (int i = 0; i 0); + return trim(flated, count); + } + + protected byte[] inflate(byte in[]) throws Throwable { + final int len = in.length; + final Inflater inflater = new Inflater(); + final byte[] smallBuffer = new byte[3200]; + + byte[] flated = new byte[32]; + int count = 0; + + for (int i = 0; i 0) { + flated = grow(flated, count + n); + System.arraycopy(smallBuffer, 0, flated, count, n); + count += n; + } + } + } + return trim(flated, count); + } + } + + private static class NoStrideTest extends TestCase { + public NoStrideTest(byte data[], int level) { + super("NO STRIDE", data, level); + } + + public byte[] deflate(byte in[], int level) throws Throwable { + final Deflater flater = new Deflater(level); + flater.setInput(in); + flater.finish(); + final byte[] smallBuffer = new byte[32]; + byte[] flated = new byte[32]; + int count = 0; + int n; + while ((n = flater.deflate(smallBuffer)) > 0) { + flated = grow(flated, count + n); + System.arraycopy(smallBuffer, 0, flated, count, n); + count += n; + } + return trim(flated, count); + } + + public byte[] inflate(byte in[]) throws Throwable { + final Inflater flater = new Inflater(); + flater.setInput(in); + final byte[] smallBuffer = new byte[32]; + byte[] flated = new byte[32]; + int count = 0; + int n; + while ((n = flater.inflate(smallBuffer)) > 0) { + flated = grow(flated, count + n); + System.arraycopy(smallBuffer, 0, flated, count, n); + count += n; + } + return trim(flated, count); + } + } + + /** + * Check Deflater{In,Out}putStream by way of GZIP{In,Out}putStream + */ + private static class GZIPTest extends TestCase { + public GZIPTest(byte data[]) { + super("GZIP", data); + } + + public byte[] deflate(byte data[], int ignored) throws Throwable { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStream gzos = new GZIPOutputStream(baos); + gzos.write(data, 0, data.length); + gzos.close(); + return baos.toByteArray(); + } + + public byte[] inflate(byte deflated[]) throws Throwable { + InputStream bais = new ByteArrayInputStream(deflated); + GZIPInputStream gzis = new GZIPInputStream(bais); + byte[] inflated = new byte[data.length]; + int numRead = 0; + int count = 0; + while ((numRead = gzis.read(inflated, count, data.length - count)) > 0) { + count += numRead; + } + check(count == data.length, name + ": Read " + count + "; expected " + data.length); + return inflated; + } + } + + public static void realMain(String[] args) throws Throwable { + byte data[]; + int level = -1; + if (args.length > 0) { + level = Integer.parseInt(args[0]); + } + debug("Using level " + level); + + if (args.length > 1) { + FileInputStream fis = new FileInputStream(args[1]); + int len = fis.available(); + data = new byte[len]; + check(fis.read(data, 0, len) == len, "Did not read complete file"); + debug("Original data from " + args[1]); + fis.close(); + } else { + ByteBuffer bb = ByteBuffer.allocate(8); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + for (int i = 0; i < 1024 * 64; i++) { // data length + bb.putDouble(0, Math.random()); + baos.write(bb.array(), 0, 8); + } + data = baos.toByteArray(); + debug("Original data from random byte array"); + } + debug("Original data length: " + data.length + " bytes"); + + new StrideTest(data, level).runTest(); + new NoStrideTest(data, level).runTest(); + new GZIPTest(data).runTest(); + } + + //--------------------- Infrastructure --------------------------- + static volatile int passed = 0, failed = 0; + static void pass() {passed++;} + static void pass(String msg) {System.out.println(msg); passed++;} + static void fail() {failed++; Thread.dumpStack();} + static void fail(String msg) {System.out.println(msg); fail();} + static void unexpected(Throwable t) {failed++; t.printStackTrace();} + static void unexpected(Throwable t, String msg) { + System.out.println(msg); failed++; t.printStackTrace();} + static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;} + static boolean check(boolean cond, String msg) {if (cond) pass(); else fail(msg); return cond;} + static void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else fail(x + " not equal to " + y);} + public static void main(String[] args) throws Throwable { + try {realMain(args);} catch (Throwable t) {unexpected(t);} + System.out.println("\nPassed = " + passed + " failed = " + failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} diff --git a/jdk/test/java/util/zip/InflaterBufferSize.java b/jdk/test/java/util/zip/InflaterBufferSize.java new file mode 100644 index 00000000000..cf5363fca3e --- /dev/null +++ b/jdk/test/java/util/zip/InflaterBufferSize.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 6571338 + * @summary Inflater should not require a buffer to the inflate() methods + * larger than 1 byte. + */ + +import java.io.*; +import java.nio.*; +import java.util.*; +import java.util.zip.*; + +public class InflaterBufferSize { + private static final int DATA_LEN = 1024 *64; + private static byte[] data; + + // If true, print extra info. + private static final boolean debug = System.getProperty("debug") != null; + + private static void debug(String s) { + if (debug) System.out.println(s); + } + + private static void createData() { + ByteBuffer bb = ByteBuffer.allocate(8); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + for (int i = 0; i < DATA_LEN; i++) { + bb.putDouble(0, Math.random()); + baos.write(bb.array(), 0, 8); + } + data = baos.toByteArray(); + } + + private static byte[] grow(byte[] a, int capacity) { + while (a.length < capacity) { + byte[] a2 = new byte[a.length * 2]; + System.arraycopy(a, 0, a2, 0, a.length); + a = a2; + } + return a; + } + + private static byte[] trim(byte[] a, int length) { + byte[] res = new byte[length]; + System.arraycopy(a, 0, res, 0, length); + return res; + } + + private static byte[] deflate(byte[] in, int level) throws Throwable { + final Deflater flater = new Deflater(level); + flater.setInput(in); + flater.finish(); + final byte[] smallBuffer = new byte[32]; + byte[] flated = new byte[32]; + int count = 0; + int n; + while ((n = flater.deflate(smallBuffer)) > 0) { + flated = grow(flated, count + n); + System.arraycopy(smallBuffer, 0, flated, count, n); + count += n; + } + return trim(flated, count); + } + + private static byte[] inflate(byte[] in) throws Throwable { + final Inflater flater = new Inflater(); + flater.setInput(in); + // This is the buffer of interest. It should be possible to use any + // non-zero size. + final byte[] smallBuffer = new byte[1]; + byte[] flated = new byte[32]; + int count = 0; + int n; + while ((n = flater.inflate(smallBuffer)) > 0) { + flated = grow(flated, count + n); + System.arraycopy(smallBuffer, 0, flated, count, n); + count += n; + } + return trim(flated, count); + } + + public static void realMain(String[] args) throws Throwable { + byte deflated[], inflated[]; + + int level = -1; + if (args.length > 0) { + level = Integer.parseInt(args[0]); + } + debug("Using level " + level); + + if (args.length > 1) { + FileInputStream fis = new FileInputStream(args[1]); + int len = fis.available(); + data = new byte[len]; + check(fis.read(data, 0, len) == len, "Did not read complete file"); + debug("Original data from " + args[1]); + fis.close(); + } else { + createData(); + debug("Original data from random byte array"); + } + debug("Original data length: " + data.length + " bytes"); + + debug(""); + deflated = deflate(data, level); + debug("Deflated data length: " + deflated.length + " bytes"); + + inflated = inflate(deflated); + debug("Inflated data length: "+ inflated.length + " bytes" ); + + if (!check(Arrays.equals(data, inflated), + "Inflated and deflated arrays do not match")) { + OutputStream os = new BufferedOutputStream(new FileOutputStream("deflated.zip")); + try { + os.write(deflated); + } finally { + os.close(); + } + } + } + + //--------------------- Infrastructure --------------------------- + static volatile int passed = 0, failed = 0; + static void pass() {passed++;} + static void pass(String msg) {System.out.println(msg); passed++;} + static void fail() {failed++; Thread.dumpStack();} + static void fail(String msg) {System.out.println(msg); fail();} + static void unexpected(Throwable t) {failed++; t.printStackTrace();} + static void unexpected(Throwable t, String msg) { + System.out.println(msg); failed++; t.printStackTrace();} + static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;} + static boolean check(boolean cond, String msg) {if (cond) pass(); else fail(msg); return cond;} + static void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else fail(x + " not equal to " + y);} + public static void main(String[] args) throws Throwable { + try {realMain(args);} catch (Throwable t) {unexpected(t);} + System.out.println("\nPassed = " + passed + " failed = " + failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} From fad93836a2d2585cc7e0ed7089c143f6c3b1631e Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Mon, 4 Apr 2011 11:55:05 -0700 Subject: [PATCH 134/168] 6565585: Remove critical section in Method.invoke, Constructor.newInstance, Field.getFieldAccessor improving performance Reviewed-by: alanb, dholmes, briangoetz --- .../java/lang/reflect/AccessibleObject.java | 70 +++++++++++++++++ .../java/lang/reflect/Constructor.java | 33 ++++---- .../classes/java/lang/reflect/Field.java | 21 +----- .../classes/java/lang/reflect/Method.java | 75 ++++++++----------- 4 files changed, 117 insertions(+), 82 deletions(-) diff --git a/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java b/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java index c324add6957..69b08ebe720 100644 --- a/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java +++ b/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java @@ -26,6 +26,7 @@ package java.lang.reflect; import java.security.AccessController; +import sun.reflect.Reflection; import sun.reflect.ReflectionFactory; import java.lang.annotation.Annotation; @@ -201,4 +202,73 @@ public class AccessibleObject implements AnnotatedElement { public Annotation[] getDeclaredAnnotations() { throw new AssertionError("All subclasses should override this method"); } + + + // Shared access checking logic. + + // For non-public members or members in package-private classes, + // it is necessary to perform somewhat expensive security checks. + // If the security check succeeds for a given class, it will + // always succeed (it is not affected by the granting or revoking + // of permissions); we speed up the check in the common case by + // remembering the last Class for which the check succeeded. + // + // The simple security check for Constructor is to see if + // the caller has already been seen, verified, and cached. + // (See also Class.newInstance(), which uses a similar method.) + // + // A more complicated security check cache is needed for Method and Field + // The cache can be either null (empty cache), a 2-array of {caller,target}, + // or a caller (with target implicitly equal to this.clazz). + // In the 2-array case, the target is always different from the clazz. + volatile Object securityCheckCache; + + void checkAccess(Class caller, Class clazz, Object obj, int modifiers) + throws IllegalAccessException + { + if (caller == clazz) { // quick check + return; // ACCESS IS OK + } + Object cache = securityCheckCache; // read volatile + Class targetClass = clazz; + if (obj != null + && Modifier.isProtected(modifiers) + && ((targetClass = obj.getClass()) != clazz)) { + // Must match a 2-list of { caller, targetClass }. + if (cache instanceof Class[]) { + Class[] cache2 = (Class[]) cache; + if (cache2[1] == targetClass && + cache2[0] == caller) { + return; // ACCESS IS OK + } + // (Test cache[1] first since range check for [1] + // subsumes range check for [0].) + } + } else if (cache == caller) { + // Non-protected case (or obj.class == this.clazz). + return; // ACCESS IS OK + } + + // If no return, fall through to the slow path. + slowCheckMemberAccess(caller, clazz, obj, modifiers, targetClass); + } + + // Keep all this slow stuff out of line: + void slowCheckMemberAccess(Class caller, Class clazz, Object obj, int modifiers, + Class targetClass) + throws IllegalAccessException + { + Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); + + // Success: Update the cache. + Object cache = ((targetClass == clazz) + ? caller + : new Class[] { caller, targetClass }); + + // Note: The two cache elements are not volatile, + // but they are effectively final. The Java memory model + // guarantees that the initializing stores for the cache + // elements will occur before the volatile write. + securityCheckCache = cache; // write volatile + } } diff --git a/jdk/src/share/classes/java/lang/reflect/Constructor.java b/jdk/src/share/classes/java/lang/reflect/Constructor.java index b125e1131fa..2451c54e82d 100644 --- a/jdk/src/share/classes/java/lang/reflect/Constructor.java +++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java @@ -74,14 +74,6 @@ public final private byte[] annotations; private byte[] parameterAnnotations; - // For non-public members or members in package-private classes, - // it is necessary to perform somewhat expensive security checks. - // If the security check succeeds for a given class, it will - // always succeed (it is not affected by the granting or revoking - // of permissions); we speed up the check in the common case by - // remembering the last Class for which the check succeeded. - private volatile Class securityCheckCache; - // Generics infrastructure // Accessor for factory private GenericsFactory getFactory() { @@ -518,16 +510,17 @@ public final if (!override) { if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) { Class caller = Reflection.getCallerClass(2); - if (securityCheckCache != caller) { - Reflection.ensureMemberAccess(caller, clazz, null, modifiers); - securityCheckCache = caller; - } + + checkAccess(caller, clazz, null, modifiers); } } if ((clazz.getModifiers() & Modifier.ENUM) != 0) throw new IllegalArgumentException("Cannot reflectively create enum objects"); - if (constructorAccessor == null) acquireConstructorAccessor(); - return (T) constructorAccessor.newInstance(initargs); + ConstructorAccessor ca = constructorAccessor; // read volatile + if (ca == null) { + ca = acquireConstructorAccessor(); + } + return (T) ca.newInstance(initargs); } /** @@ -560,18 +553,20 @@ public final // ConstructorAccessor for a given Constructor. However, avoiding // synchronization will probably make the implementation more // scalable. - private void acquireConstructorAccessor() { + private ConstructorAccessor acquireConstructorAccessor() { // First check to see if one has been created yet, and take it // if so. ConstructorAccessor tmp = null; if (root != null) tmp = root.getConstructorAccessor(); if (tmp != null) { constructorAccessor = tmp; - return; + } else { + // Otherwise fabricate one and propagate it up to the root + tmp = reflectionFactory.newConstructorAccessor(this); + setConstructorAccessor(tmp); } - // Otherwise fabricate one and propagate it up to the root - tmp = reflectionFactory.newConstructorAccessor(this); - setConstructorAccessor(tmp); + + return tmp; } // Returns ConstructorAccessor for this Constructor object, not diff --git a/jdk/src/share/classes/java/lang/reflect/Field.java b/jdk/src/share/classes/java/lang/reflect/Field.java index 49dcee8200a..f7647d6dc8f 100644 --- a/jdk/src/share/classes/java/lang/reflect/Field.java +++ b/jdk/src/share/classes/java/lang/reflect/Field.java @@ -79,11 +79,6 @@ class Field extends AccessibleObject implements Member { // potentially many Field objects pointing to it.) private Field root; - // More complicated security check cache needed here than for - // Class.newInstance() and Constructor.newInstance() - private Class securityCheckCache; - private Class securityCheckTargetClassCache; - // Generics infrastructure private String getGenericSignature() {return signature;} @@ -954,6 +949,7 @@ class Field extends AccessibleObject implements Member { tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck); setFieldAccessor(tmp, overrideFinalCheck); } + return tmp; } @@ -983,21 +979,8 @@ class Field extends AccessibleObject implements Member { if (!override) { if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) { Class caller = Reflection.getCallerClass(4); - Class targetClass = ((obj == null || !Modifier.isProtected(modifiers)) - ? clazz - : obj.getClass()); - synchronized (this) { - if ((securityCheckCache == caller) - && (securityCheckTargetClassCache == targetClass)) { - return; - } - } - Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); - synchronized (this) { - securityCheckCache = caller; - securityCheckTargetClassCache = targetClass; - } + checkAccess(caller, clazz, obj, modifiers); } } } diff --git a/jdk/src/share/classes/java/lang/reflect/Method.java b/jdk/src/share/classes/java/lang/reflect/Method.java index c8776370a83..1de15570511 100644 --- a/jdk/src/share/classes/java/lang/reflect/Method.java +++ b/jdk/src/share/classes/java/lang/reflect/Method.java @@ -83,11 +83,6 @@ public final // potentially many Method objects pointing to it.) private Method root; - // More complicated security check cache needed here than for - // Class.newInstance() and Constructor.newInstance() - private Class securityCheckCache; - private Class securityCheckTargetClassCache; - // Generics infrastructure private String getGenericSignature() {return signature;} @@ -402,28 +397,28 @@ public final */ public String toString() { try { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); int mod = getModifiers() & Modifier.methodModifiers(); if (mod != 0) { - sb.append(Modifier.toString(mod) + " "); + sb.append(Modifier.toString(mod)).append(' '); } - sb.append(Field.getTypeName(getReturnType()) + " "); - sb.append(Field.getTypeName(getDeclaringClass()) + "."); - sb.append(getName() + "("); + sb.append(Field.getTypeName(getReturnType())).append(' '); + sb.append(Field.getTypeName(getDeclaringClass())).append('.'); + sb.append(getName()).append('('); Class[] params = parameterTypes; // avoid clone for (int j = 0; j < params.length; j++) { sb.append(Field.getTypeName(params[j])); if (j < (params.length - 1)) - sb.append(","); + sb.append(','); } - sb.append(")"); + sb.append(')'); Class[] exceptions = exceptionTypes; // avoid clone if (exceptions.length > 0) { sb.append(" throws "); for (int k = 0; k < exceptions.length; k++) { sb.append(exceptions[k].getName()); if (k < (exceptions.length - 1)) - sb.append(","); + sb.append(','); } } return sb.toString(); @@ -475,15 +470,15 @@ public final StringBuilder sb = new StringBuilder(); int mod = getModifiers() & Modifier.methodModifiers(); if (mod != 0) { - sb.append(Modifier.toString(mod) + " "); + sb.append(Modifier.toString(mod)).append(' '); } TypeVariable[] typeparms = getTypeParameters(); if (typeparms.length > 0) { boolean first = true; - sb.append("<"); + sb.append('<'); for(TypeVariable typeparm: typeparms) { if (!first) - sb.append(","); + sb.append(','); // Class objects can't occur here; no need to test // and call Class.getName(). sb.append(typeparm.toString()); @@ -494,10 +489,11 @@ public final Type genRetType = getGenericReturnType(); sb.append( ((genRetType instanceof Class)? - Field.getTypeName((Class)genRetType):genRetType.toString()) + " "); + Field.getTypeName((Class)genRetType):genRetType.toString())) + .append(' '); - sb.append(Field.getTypeName(getDeclaringClass()) + "."); - sb.append(getName() + "("); + sb.append(Field.getTypeName(getDeclaringClass())).append('.'); + sb.append(getName()).append('('); Type[] params = getGenericParameterTypes(); for (int j = 0; j < params.length; j++) { String param = (params[j] instanceof Class)? @@ -507,9 +503,9 @@ public final param = param.replaceFirst("\\[\\]$", "..."); sb.append(param); if (j < (params.length - 1)) - sb.append(","); + sb.append(','); } - sb.append(")"); + sb.append(')'); Type[] exceptions = getGenericExceptionTypes(); if (exceptions.length > 0) { sb.append(" throws "); @@ -518,7 +514,7 @@ public final ((Class)exceptions[k]).getName(): exceptions[k].toString()); if (k < (exceptions.length - 1)) - sb.append(","); + sb.append(','); } } return sb.toString(); @@ -591,26 +587,15 @@ public final if (!override) { if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) { Class caller = Reflection.getCallerClass(1); - Class targetClass = ((obj == null || !Modifier.isProtected(modifiers)) - ? clazz - : obj.getClass()); - boolean cached; - synchronized (this) { - cached = (securityCheckCache == caller) - && (securityCheckTargetClassCache == targetClass); - } - if (!cached) { - Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); - synchronized (this) { - securityCheckCache = caller; - securityCheckTargetClassCache = targetClass; - } - } + checkAccess(caller, clazz, obj, modifiers); } } - if (methodAccessor == null) acquireMethodAccessor(); - return methodAccessor.invoke(obj, args); + MethodAccessor ma = methodAccessor; // read volatile + if (ma == null) { + ma = acquireMethodAccessor(); + } + return ma.invoke(obj, args); } /** @@ -654,18 +639,20 @@ public final // (though not efficient) to generate more than one MethodAccessor // for a given Method. However, avoiding synchronization will // probably make the implementation more scalable. - private void acquireMethodAccessor() { + private MethodAccessor acquireMethodAccessor() { // First check to see if one has been created yet, and take it // if so MethodAccessor tmp = null; if (root != null) tmp = root.getMethodAccessor(); if (tmp != null) { methodAccessor = tmp; - return; + } else { + // Otherwise fabricate one and propagate it up to the root + tmp = reflectionFactory.newMethodAccessor(this); + setMethodAccessor(tmp); } - // Otherwise fabricate one and propagate it up to the root - tmp = reflectionFactory.newMethodAccessor(this); - setMethodAccessor(tmp); + + return tmp; } // Returns MethodAccessor for this Method object, not looking up From efb31c007946f872d3180fe1c19a4b0dc63d8517 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 4 Apr 2011 15:11:06 -0700 Subject: [PATCH 135/168] 7029905: demo applets missing some html files Reviewed-by: omajid, mchung, igor --- jdk/make/mkdemo/jfc/Font2DTest/Makefile | 2 +- jdk/make/mkdemo/jfc/Java2D/Makefile | 2 +- jdk/make/mkdemo/jfc/SwingApplet/Makefile | 2 +- jdk/make/mkdemo/jfc/SwingSet2/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/make/mkdemo/jfc/Font2DTest/Makefile b/jdk/make/mkdemo/jfc/Font2DTest/Makefile index eab16a56b8c..bf60090be40 100644 --- a/jdk/make/mkdemo/jfc/Font2DTest/Makefile +++ b/jdk/make/mkdemo/jfc/Font2DTest/Makefile @@ -33,7 +33,7 @@ DEMONAME = Font2DTest include $(BUILDDIR)/common/Defs.gmk DEMO_ROOT = $(SHARE_SRC)/demo/jfc/$(DEMONAME) -DEMO_TOPFILES = ./README.txt +DEMO_TOPFILES = ./README.txt ./$(DEMONAME).html DEMO_MAINCLASS = $(DEMONAME) DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME) diff --git a/jdk/make/mkdemo/jfc/Java2D/Makefile b/jdk/make/mkdemo/jfc/Java2D/Makefile index beea7c8b47c..edd60bb3cef 100644 --- a/jdk/make/mkdemo/jfc/Java2D/Makefile +++ b/jdk/make/mkdemo/jfc/Java2D/Makefile @@ -33,7 +33,7 @@ DEMONAME = Java2Demo include $(BUILDDIR)/common/Defs.gmk DEMO_ROOT = $(CLOSED_SRC)/share/demo/jfc/Java2D -DEMO_TOPFILES = ./Java2Demo.html ./README.txt +DEMO_TOPFILES = ./README.txt ./$(DEMONAME).html DEMO_MAINCLASS = java2d.Java2Demo DEMO_DESTDIR = $(DEMODIR)/jfc/Java2D diff --git a/jdk/make/mkdemo/jfc/SwingApplet/Makefile b/jdk/make/mkdemo/jfc/SwingApplet/Makefile index 3f8ca5d5bed..ba2395585c7 100644 --- a/jdk/make/mkdemo/jfc/SwingApplet/Makefile +++ b/jdk/make/mkdemo/jfc/SwingApplet/Makefile @@ -33,7 +33,7 @@ DEMONAME = SwingApplet include $(BUILDDIR)/common/Defs.gmk DEMO_ROOT = $(SHARE_SRC)/demo/jfc/$(DEMONAME) -DEMO_TOPFILES = ./README.txt +DEMO_TOPFILES = ./README.txt ./$(DEMONAME).html DEMO_MAINCLASS = $(DEMONAME) DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME) diff --git a/jdk/make/mkdemo/jfc/SwingSet2/Makefile b/jdk/make/mkdemo/jfc/SwingSet2/Makefile index 2a4881c8937..837d1668c88 100644 --- a/jdk/make/mkdemo/jfc/SwingSet2/Makefile +++ b/jdk/make/mkdemo/jfc/SwingSet2/Makefile @@ -33,7 +33,7 @@ DEMONAME = SwingSet2 include $(BUILDDIR)/common/Defs.gmk DEMO_ROOT = $(CLOSED_SRC)/share/demo/jfc/$(DEMONAME) -DEMO_TOPFILES = ./README.txt +DEMO_TOPFILES = ./README.txt ./$(DEMONAME).html DEMO_MAINCLASS = $(DEMONAME) DEMO_MANIFEST_ATTR = SplashScreen-Image: resources/images/splash.png DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME) From 863e692b16fd6b991e2493264c090b5b737fa877 Mon Sep 17 00:00:00 2001 From: Robert Strout II Date: Mon, 4 Apr 2011 18:03:23 -0700 Subject: [PATCH 136/168] 6989729: jarreorder warnings (classlists files are out of date) Reviewed-by: ohair --- jdk/make/tools/sharing/classlist.linux | 79 ------------------------ jdk/make/tools/sharing/classlist.solaris | 78 ----------------------- jdk/make/tools/sharing/classlist.windows | 61 ------------------ 3 files changed, 218 deletions(-) diff --git a/jdk/make/tools/sharing/classlist.linux b/jdk/make/tools/sharing/classlist.linux index d07236da9e9..3d73d7fc731 100644 --- a/jdk/make/tools/sharing/classlist.linux +++ b/jdk/make/tools/sharing/classlist.linux @@ -104,9 +104,7 @@ sun/reflect/ReflectionFactory java/lang/ref/Reference$Lock java/lang/ref/Reference$ReferenceHandler java/lang/ref/Finalizer$FinalizerThread -java/util/Hashtable$EmptyEnumerator java/util/Enumeration -java/util/Hashtable$EmptyIterator java/util/Iterator java/util/Hashtable$Entry java/nio/charset/Charset @@ -192,8 +190,6 @@ java/io/ExpiringCache$1 java/util/LinkedHashMap java/util/LinkedHashMap$Entry java/lang/StringBuilder -java/io/File$1 -sun/misc/JavaIODeleteOnExitAccess sun/misc/SharedSecrets java/lang/ClassLoader$3 java/lang/StringCoding$StringEncoder @@ -207,7 +203,6 @@ sun/misc/NativeSignalHandler java/io/Console java/io/Console$1 sun/misc/JavaIOAccess -java/io/Console$1$1 java/lang/Shutdown java/util/ArrayList java/lang/Shutdown$Lock @@ -330,7 +325,6 @@ java/util/Hashtable$Enumerator java/beans/PropertyChangeEvent java/util/EventObject java/awt/Component$AWTTreeLock -sun/awt/DebugHelper sun/awt/NativeLibLoader sun/security/action/LoadLibraryAction java/awt/GraphicsEnvironment @@ -341,7 +335,6 @@ java/lang/ProcessEnvironment$ExternalData java/lang/ProcessEnvironment$Value java/lang/ProcessEnvironment$StringEnvironment java/util/Collections$UnmodifiableMap -sun/awt/DebugHelperStub java/awt/Toolkit java/awt/Toolkit$3 sun/util/CoreResourceBundleControl @@ -391,9 +384,7 @@ sun/awt/X11GraphicsEnvironment sun/java2d/SunGraphicsEnvironment sun/java2d/FontSupport sun/awt/DisplayChangedListener -sun/java2d/SunGraphicsEnvironment$TTFilter java/io/FilenameFilter -sun/java2d/SunGraphicsEnvironment$T1Filter sun/awt/X11GraphicsEnvironment$1 sun/awt/SunToolkit sun/awt/WindowClosingSupport @@ -403,7 +394,6 @@ sun/awt/InputMethodSupport java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject java/util/concurrent/locks/Condition sun/awt/AWTAutoShutdown -sun/awt/AWTAutoShutdown$PeerMap sun/awt/SunToolkit$6 java/awt/Dialog$ModalExclusionType java/lang/Enum @@ -425,7 +415,6 @@ sun/font/CompositeFont java/util/HashMap$Values java/util/HashMap$ValueIterator java/util/HashMap$HashIterator -sun/font/FontManager$1 java/awt/Font java/awt/geom/AffineTransform sun/font/AttributeValues @@ -463,13 +452,11 @@ sun/font/StrikeCache sun/java2d/Disposer sun/java2d/Disposer$1 sun/font/StrikeCache$1 -sun/font/FontManager$FontRegistrationInfo sun/awt/motif/MFontConfiguration sun/awt/FontConfiguration sun/awt/FontDescriptor java/util/Scanner java/util/regex/Pattern -java/util/regex/Pattern$8 java/util/regex/Pattern$Node java/util/regex/Pattern$LastNode java/util/regex/Pattern$GroupHead @@ -509,7 +496,6 @@ java/util/regex/Pattern$BitClass java/util/regex/Pattern$BmpCharProperty java/util/regex/Pattern$6 java/util/regex/Pattern$CharProperty$1 -java/util/regex/Pattern$10 sun/nio/ch/FileChannelImpl java/nio/channels/FileChannel java/nio/channels/ByteChannel @@ -565,7 +551,6 @@ java/text/DecimalFormatSymbols java/text/spi/DecimalFormatSymbolsProvider java/util/Currency java/util/Currency$1 -java/util/CurrencyData java/util/spi/CurrencyNameProvider sun/util/resources/CurrencyNames sun/util/resources/LocaleNamesBundle @@ -582,7 +567,6 @@ java/util/regex/Pattern$GroupCurly java/util/regex/Pattern$5 java/util/regex/Pattern$Loop java/util/regex/Pattern$Prolog -java/util/regex/Pattern$9 java/util/regex/Pattern$BranchConn java/util/regex/Pattern$Branch java/nio/channels/spi/AbstractInterruptibleChannel$1 @@ -635,11 +619,8 @@ java/awt/image/DirectColorModel java/awt/image/PackedColorModel java/awt/color/ColorSpace java/awt/color/ICC_Profile -sun/awt/color/ProfileDeferralInfo -sun/awt/color/ProfileDeferralMgr java/awt/color/ICC_ProfileRGB java/awt/color/ICC_Profile$1 -sun/awt/color/ProfileActivator java/awt/color/ICC_ColorSpace sun/java2d/pipe/NullPipe sun/java2d/pipe/PixelDrawPipe @@ -662,8 +643,6 @@ sun/java2d/pipe/TextRenderer sun/java2d/pipe/SpanClipRenderer sun/java2d/pipe/Region sun/java2d/pipe/RegionIterator -sun/java2d/pipe/DuctusShapeRenderer -sun/java2d/pipe/DuctusRenderer sun/java2d/pipe/AlphaPaintPipe sun/java2d/pipe/SpanShapeRenderer$Composite sun/java2d/pipe/SpanShapeRenderer @@ -737,7 +716,6 @@ sun/awt/X11/XWrapperBase sun/awt/X11/Native sun/awt/X11/Native$1 java/awt/EventQueue -sun/awt/X11/XToolkit$7 java/util/EmptyStackException java/lang/reflect/InvocationTargetException java/awt/EventDispatchThread @@ -746,10 +724,7 @@ java/awt/event/MouseEvent sun/awt/PeerEvent java/awt/event/InvocationEvent java/awt/ActiveEvent -java/awt/EventQueueItem sun/awt/X11/XToolkit$1 -sun/awt/X11/XToolkit$XErrorHandler -sun/awt/X11/XToolkit$5 sun/awt/X11/XEventDispatcher sun/awt/SunToolkit$ModalityListenerList sun/awt/ModalityListener @@ -761,21 +736,18 @@ java/util/LinkedList java/util/Deque java/util/Queue java/util/AbstractSequentialList -java/util/LinkedList$Entry sun/awt/X11/AwtScreenData sun/awt/X11/XWM sun/awt/X11/MWMConstants sun/awt/X11/XAtom java/awt/Insets sun/awt/X11/XWM$1 -sun/awt/X11/XWM$2 sun/awt/X11/XSetWindowAttributes sun/awt/X11/XErrorEvent sun/awt/X11/XNETProtocol sun/awt/X11/XStateProtocol sun/awt/X11/XLayerProtocol sun/awt/X11/XProtocol -sun/awt/X11/XProtocol$1 sun/awt/X11/WindowPropertyGetter sun/awt/X11/UnsafeXDisposerRecord sun/awt/X11/XPropertyCache @@ -783,7 +755,6 @@ sun/awt/X11/XWINProtocol sun/awt/X11/XAtomList sun/awt/X11/XToolkit$3 sun/awt/X11/XAnyEvent -sun/awt/X11/IXAnyEvent java/awt/Window$WindowDisposerRecord java/awt/KeyboardFocusManager java/awt/KeyEventDispatcher @@ -794,7 +765,6 @@ java/awt/DefaultKeyboardFocusManager java/awt/DefaultFocusTraversalPolicy java/awt/ContainerOrderFocusTraversalPolicy java/awt/FocusTraversalPolicy -java/awt/MutableBoolean java/util/Collections$UnmodifiableSet sun/awt/HeadlessToolkit sun/awt/X11/XKeyboardFocusManagerPeer @@ -856,7 +826,6 @@ sun/java2d/DefaultDisposerRecord sun/java2d/x11/X11Renderer sun/awt/X11/XGlobalCursorManager sun/awt/GlobalCursorManager -sun/awt/X11/XToolkit$6 java/awt/Cursor$CursorDisposer java/awt/AWTException java/awt/HeadlessException @@ -888,7 +857,6 @@ java/awt/event/MouseListener java/awt/event/MouseMotionListener java/awt/event/MouseWheelListener java/awt/event/InputMethodListener -java/awt/Component$NativeInLightFixer java/awt/event/ContainerListener javax/accessibility/AccessibleContext sun/reflect/UnsafeObjectFieldAccessorImpl @@ -969,7 +937,6 @@ javax/swing/RepaintManager$DisplayChangedHandler javax/swing/SwingPaintEventDispatcher sun/awt/PaintEventDispatcher javax/swing/UIManager$2 -javax/swing/UIManager$3 java/awt/PopupMenu java/awt/Menu java/awt/MenuItem @@ -1062,8 +1029,6 @@ javax/swing/plaf/basic/BasicLabelUI javax/swing/plaf/LabelUI javax/swing/plaf/metal/DefaultMetalTheme$FontDelegate$1 javax/swing/plaf/basic/BasicHTML -javax/swing/SystemEventQueueUtilities -javax/swing/SystemEventQueueUtilities$SystemEventQueue sun/awt/NullComponentPeer java/awt/event/WindowEvent java/awt/EventQueue$1 @@ -1084,11 +1049,9 @@ java/io/ByteArrayOutputStream sun/misc/ExtensionDependency java/lang/Package sun/security/util/ManifestEntryVerifier -sun/security/provider/Sun java/security/Provider java/security/Provider$ServiceKey java/security/Provider$EngineDescription -sun/security/provider/Sun$1 java/security/Security java/security/Security$1 sun/misc/FloatingDecimal @@ -1133,7 +1096,6 @@ javax/swing/text/AttributeSet javax/swing/text/SimpleAttributeSet$EmptyAttributeSet javax/swing/text/StyleContext$NamedStyle javax/swing/text/Style -javax/swing/text/SimpleAttributeSet$1 javax/swing/text/StyleContext$SmallAttributeSet javax/swing/text/AbstractDocument$BidiRootElement javax/swing/text/AbstractDocument$BranchElement @@ -1267,7 +1229,6 @@ sun/nio/cs/UTF_16 sun/nio/cs/UTF_16$Decoder sun/nio/cs/UnicodeDecoder sun/font/FileFontStrike -sun/font/FileFont$FileFontDisposer sun/font/TrueTypeGlyphMapper sun/font/CMap sun/font/CMap$NullCMapClass @@ -1281,20 +1242,12 @@ java/util/zip/Inflater sun/awt/EventQueueItem sun/awt/SunToolkit$3 sun/awt/X11/XExposeEvent -sun/awt/X11/ComponentAccessor -sun/awt/X11/ComponentAccessor$1 sun/reflect/UnsafeBooleanFieldAccessorImpl sun/awt/event/IgnorePaintEvent java/awt/image/DataBufferInt java/awt/image/SinglePixelPackedSampleModel sun/awt/image/IntegerInterleavedRaster -sun/java2d/x11/X11RemoteOffScreenImage -sun/awt/image/RemoteOffScreenImage sun/awt/image/OffScreenImage -sun/java2d/x11/X11RemoteOffScreenImage$X11RemoteSurfaceManager -sun/awt/image/OffScreenSurfaceManager -sun/awt/image/CachingSurfaceManager -sun/awt/image/RasterListener sun/awt/image/BufImgSurfaceData sun/java2d/opengl/GLXGraphicsConfig sun/java2d/opengl/OGLGraphicsConfig @@ -1302,7 +1255,6 @@ sun/java2d/x11/X11SurfaceData$X11PixmapSurfaceData sun/awt/image/WritableRasterNative sun/awt/image/DataBufferNative sun/java2d/SurfaceManagerFactory -sun/java2d/x11/X11CachingSurfaceManager sun/java2d/opengl/GLXSurfaceData sun/java2d/opengl/OGLSurfaceData sun/font/CompositeGlyphMapper @@ -1332,10 +1284,7 @@ java/lang/ProcessBuilder java/lang/ProcessImpl java/lang/UNIXProcess java/lang/Process -java/lang/UNIXProcess$Gate java/lang/UNIXProcess$1 -java/lang/UNIXProcess$1$1 -java/lang/UNIXProcess$1$1$1 java/net/ServerSocket java/util/Random java/util/concurrent/atomic/AtomicLong @@ -1422,7 +1371,6 @@ java/awt/event/MouseAdapter javax/swing/ToolTipManager$insideTimerAction javax/swing/ToolTipManager$outsideTimerAction javax/swing/ToolTipManager$stillInsideTimerAction -javax/swing/ToolTipManager$Actions sun/swing/UIAction javax/swing/Action javax/swing/ToolTipManager$MoveBeforeEnterListener @@ -1715,7 +1663,6 @@ javax/swing/plaf/basic/BasicToolBarUI$Handler javax/swing/border/EtchedBorder javax/swing/JToolBar$Separator javax/swing/plaf/basic/BasicToolBarSeparatorUI -sun/awt/color/CMM java/applet/Applet java/awt/Panel com/sun/awt/AWTUtilities @@ -1752,7 +1699,6 @@ java/awt/Window$1DisposeAction java/awt/LightweightDispatcher$2 sun/awt/X11/XReparentEvent sun/awt/X11/XWindowAttributes -javax/swing/SystemEventQueueUtilities$ComponentWorkRequest sun/awt/X11/XFocusChangeEvent sun/awt/X11/XComponentPeer$1 sun/awt/X11/XUnmapEvent @@ -1771,7 +1717,6 @@ javax/swing/JComponent$2 sun/net/www/MimeTable java/net/FileNameMap sun/net/www/MimeTable$1 -sun/net/www/MimeTable$2 sun/net/www/MimeEntry java/net/URLConnection$1 java/text/SimpleDateFormat @@ -1957,7 +1902,6 @@ javax/swing/JTree$TreeModelHandler javax/swing/tree/VariableHeightLayoutCache$TreeStateNode javax/swing/tree/DefaultMutableTreeNode javax/swing/tree/MutableTreeNode -javax/swing/tree/DefaultMutableTreeNode$1 javax/swing/tree/DefaultMutableTreeNode$PreorderEnumeration javax/swing/event/TableColumnModelEvent java/text/ParseException @@ -2014,21 +1958,13 @@ javax/swing/plaf/basic/BasicSliderUI$PropertyChangeHandler sun/java2d/HeadlessGraphicsEnvironment java/util/Hashtable$KeySet java/awt/FontFormatException -sun/java2d/SunGraphicsEnvironment$2 sun/font/Type1Font$1 java/nio/channels/FileChannel$MapMode sun/nio/ch/FileChannelImpl$Unmapper sun/nio/ch/Util$3 java/nio/DirectByteBufferR java/nio/charset/Charset$3 -sun/nio/cs/ext/ExtendedCharsets sun/nio/cs/AbstractCharsetProvider -sun/nio/cs/ext/SJIS -sun/nio/cs/ext/SJIS$Decoder -sun/nio/cs/ext/DelegatableDecoder -sun/nio/cs/ext/JIS_X_0208_Decoder -sun/nio/cs/ext/DoubleByteDecoder -sun/nio/cs/ext/JIS_X_0201$Decoder sun/nio/cs/SingleByteDecoder java/lang/CharacterData00 javax/swing/DefaultListModel @@ -2145,7 +2081,6 @@ sun/security/jca/GetInstance$Instance java/security/MessageDigest$Delegate sun/security/provider/ByteArrayAccess java/io/ObjectStreamClass$ClassDataSlot -java/io/ObjectInputStream$CallbackContext sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl java/security/SignatureException java/security/InvalidKeyException @@ -2194,8 +2129,6 @@ java/security/spec/AlgorithmParameterSpec java/math/MutableBigInteger java/math/SignedMutableBigInteger java/awt/EventQueue$1AWTInvocationLock -javax/swing/SystemEventQueueUtilities$RunnableCanvas -javax/swing/SystemEventQueueUtilities$RunnableCanvasGraphics java/awt/Component$FlipBufferStrategy java/awt/SentEvent sun/awt/X11/XDestroyWindowEvent @@ -2231,18 +2164,13 @@ sun/swing/BakedArrayList javax/swing/plaf/synth/SynthLookAndFeel$Handler javax/swing/plaf/synth/SynthDefaultLookup com/sun/java/swing/plaf/gtk/GTKEngine -com/sun/java/swing/plaf/gtk/GTKDefaultEngine com/sun/java/swing/plaf/gtk/GTKEngine$Settings com/sun/java/swing/plaf/gtk/GTKStyleFactory com/sun/java/swing/plaf/gtk/PangoFonts -sun/font/FontManager$FontConfigInfo com/sun/java/swing/plaf/gtk/GTKLookAndFeel$WeakPCL javax/swing/plaf/synth/Region javax/swing/plaf/synth/SynthLookAndFeel$AATextListener -com/sun/java/swing/plaf/gtk/GTKNativeEngine -com/sun/java/swing/plaf/gtk/GTKNativeEngine$WidgetType com/sun/java/swing/plaf/gtk/GTKRegion -com/sun/java/swing/plaf/gtk/GTKDefaultStyle com/sun/java/swing/plaf/gtk/GTKStyle com/sun/java/swing/plaf/gtk/GTKConstants javax/swing/plaf/synth/SynthStyle @@ -2268,7 +2196,6 @@ javax/swing/plaf/synth/SynthButtonUI javax/swing/plaf/synth/SynthToggleButtonUI javax/swing/plaf/basic/BasicBorders$FieldBorder javax/swing/plaf/synth/SynthMenuBarUI -javax/swing/plaf/synth/DefaultMenuLayout javax/swing/plaf/synth/SynthMenuUI javax/swing/plaf/synth/SynthUI com/sun/java/swing/plaf/gtk/GTKIconFactory @@ -2332,7 +2259,6 @@ java/net/SocketPermission javax/security/auth/AuthPermission java/lang/Thread$1 java/util/logging/LogManager$5 -java/util/logging/LogManager$6 sun/applet/StdAppletViewerFactory sun/applet/AppletViewerFactory sun/applet/AppletViewer$UserActionListener @@ -2343,7 +2269,6 @@ sun/misc/MessageUtils sun/applet/AppletPanel$10 java/security/Policy$1 sun/security/provider/PolicyFile$1 -sun/security/provider/PolicyInfo sun/security/provider/PolicyFile$3 sun/security/util/PropertyExpander sun/security/provider/PolicyParser @@ -2353,12 +2278,10 @@ sun/security/provider/PolicyParser$PermissionEntry sun/security/provider/PolicyFile$PolicyEntry sun/security/provider/PolicyFile$6 sun/security/provider/PolicyFile$7 -sun/security/provider/SelfPermission java/net/SocketPermissionCollection java/util/PropertyPermissionCollection sun/applet/AppletPanel$9 sun/applet/AppletClassLoader -sun/applet/AppletClassLoader$4 sun/applet/AppletThreadGroup sun/applet/AppContextCreator sun/applet/AppletPanel$1 @@ -2372,10 +2295,8 @@ java/awt/peer/MenuItemPeer sun/awt/X11/XMenuItemPeer java/awt/MenuShortcut sun/awt/X11/XMenuWindow -sun/awt/X11/XMenuBarPeer$1 sun/awt/X11/XMenuItemPeer$TextMetrics sun/awt/AppContext$3 -sun/awt/MostRecentThreadAppContext sun/awt/X11/XMenuBarPeer$MappingData sun/awt/X11/XBaseMenuWindow$MappingData sun/applet/AppletViewer$1 diff --git a/jdk/make/tools/sharing/classlist.solaris b/jdk/make/tools/sharing/classlist.solaris index f987ca59d44..8955d32898f 100644 --- a/jdk/make/tools/sharing/classlist.solaris +++ b/jdk/make/tools/sharing/classlist.solaris @@ -104,9 +104,7 @@ sun/reflect/ReflectionFactory java/lang/ref/Reference$Lock java/lang/ref/Reference$ReferenceHandler java/lang/ref/Finalizer$FinalizerThread -java/util/Hashtable$EmptyEnumerator java/util/Enumeration -java/util/Hashtable$EmptyIterator java/util/Iterator java/util/Hashtable$Entry java/nio/charset/Charset @@ -198,8 +196,6 @@ java/io/ExpiringCache java/io/ExpiringCache$1 java/util/LinkedHashMap java/util/LinkedHashMap$Entry -java/io/File$1 -sun/misc/JavaIODeleteOnExitAccess sun/misc/SharedSecrets java/lang/ClassLoader$3 java/lang/StringCoding$StringEncoder @@ -213,7 +209,6 @@ sun/misc/NativeSignalHandler java/io/Console java/io/Console$1 sun/misc/JavaIOAccess -java/io/Console$1$1 java/lang/Shutdown java/util/ArrayList java/lang/Shutdown$Lock @@ -332,7 +327,6 @@ java/util/Hashtable$Enumerator java/beans/PropertyChangeEvent java/util/EventObject java/awt/Component$AWTTreeLock -sun/awt/DebugHelper sun/awt/NativeLibLoader sun/security/action/LoadLibraryAction java/awt/GraphicsEnvironment @@ -343,7 +337,6 @@ java/lang/ProcessEnvironment$ExternalData java/lang/ProcessEnvironment$Value java/lang/ProcessEnvironment$StringEnvironment java/util/Collections$UnmodifiableMap -sun/awt/DebugHelperStub java/awt/Toolkit java/awt/Toolkit$3 sun/util/CoreResourceBundleControl @@ -393,9 +386,7 @@ sun/awt/X11GraphicsEnvironment sun/java2d/SunGraphicsEnvironment sun/java2d/FontSupport sun/awt/DisplayChangedListener -sun/java2d/SunGraphicsEnvironment$TTFilter java/io/FilenameFilter -sun/java2d/SunGraphicsEnvironment$T1Filter sun/awt/X11GraphicsEnvironment$1 sun/awt/SunToolkit sun/awt/WindowClosingSupport @@ -405,7 +396,6 @@ sun/awt/InputMethodSupport java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject java/util/concurrent/locks/Condition sun/awt/AWTAutoShutdown -sun/awt/AWTAutoShutdown$PeerMap sun/awt/SunToolkit$6 java/awt/Dialog$ModalExclusionType java/lang/Enum @@ -426,7 +416,6 @@ sun/font/CompositeFont java/util/HashMap$Values java/util/HashMap$ValueIterator java/util/HashMap$HashIterator -sun/font/FontManager$1 java/awt/Font java/awt/geom/AffineTransform sun/font/AttributeValues @@ -464,7 +453,6 @@ sun/font/StrikeCache sun/java2d/Disposer sun/java2d/Disposer$1 sun/font/StrikeCache$1 -sun/font/FontManager$FontRegistrationInfo sun/awt/motif/MFontConfiguration sun/awt/FontConfiguration sun/awt/FontDescriptor @@ -509,11 +497,8 @@ java/awt/image/DirectColorModel java/awt/image/PackedColorModel java/awt/color/ColorSpace java/awt/color/ICC_Profile -sun/awt/color/ProfileDeferralInfo -sun/awt/color/ProfileDeferralMgr java/awt/color/ICC_ProfileRGB java/awt/color/ICC_Profile$1 -sun/awt/color/ProfileActivator java/awt/color/ICC_ColorSpace sun/java2d/pipe/NullPipe sun/java2d/pipe/PixelDrawPipe @@ -536,8 +521,6 @@ sun/java2d/pipe/TextRenderer sun/java2d/pipe/SpanClipRenderer sun/java2d/pipe/Region sun/java2d/pipe/RegionIterator -sun/java2d/pipe/DuctusShapeRenderer -sun/java2d/pipe/DuctusRenderer sun/java2d/pipe/AlphaPaintPipe sun/java2d/pipe/SpanShapeRenderer$Composite sun/java2d/pipe/SpanShapeRenderer @@ -611,7 +594,6 @@ sun/awt/X11/XWrapperBase sun/awt/X11/Native sun/awt/X11/Native$1 java/awt/EventQueue -sun/awt/X11/XToolkit$7 java/util/EmptyStackException java/lang/reflect/InvocationTargetException java/awt/EventDispatchThread @@ -620,10 +602,7 @@ java/awt/event/MouseEvent sun/awt/PeerEvent java/awt/event/InvocationEvent java/awt/ActiveEvent -java/awt/EventQueueItem sun/awt/X11/XToolkit$1 -sun/awt/X11/XToolkit$XErrorHandler -sun/awt/X11/XToolkit$5 sun/awt/X11/XEventDispatcher sun/awt/SunToolkit$ModalityListenerList sun/awt/ModalityListener @@ -635,21 +614,18 @@ java/util/LinkedList java/util/Deque java/util/Queue java/util/AbstractSequentialList -java/util/LinkedList$Entry sun/awt/X11/AwtScreenData sun/awt/X11/XWM sun/awt/X11/MWMConstants sun/awt/X11/XAtom java/awt/Insets sun/awt/X11/XWM$1 -sun/awt/X11/XWM$2 sun/awt/X11/XSetWindowAttributes sun/awt/X11/XErrorEvent sun/awt/X11/XNETProtocol sun/awt/X11/XStateProtocol sun/awt/X11/XLayerProtocol sun/awt/X11/XProtocol -sun/awt/X11/XProtocol$1 java/lang/Long$LongCache sun/awt/X11/WindowPropertyGetter sun/awt/X11/UnsafeXDisposerRecord @@ -659,7 +635,6 @@ sun/awt/X11/XAtomList sun/awt/X11/XToolkit$3 java/awt/Window$WindowDisposerRecord sun/awt/X11/XAnyEvent -sun/awt/X11/IXAnyEvent java/awt/KeyboardFocusManager java/awt/KeyEventDispatcher java/awt/KeyEventPostProcessor @@ -669,7 +644,6 @@ java/awt/DefaultKeyboardFocusManager java/awt/DefaultFocusTraversalPolicy java/awt/ContainerOrderFocusTraversalPolicy java/awt/FocusTraversalPolicy -java/awt/MutableBoolean java/util/Collections$UnmodifiableSet sun/awt/HeadlessToolkit sun/awt/X11/XKeyboardFocusManagerPeer @@ -728,7 +702,6 @@ sun/java2d/DefaultDisposerRecord sun/java2d/x11/X11Renderer sun/awt/X11/XGlobalCursorManager sun/awt/GlobalCursorManager -sun/awt/X11/XToolkit$6 java/awt/Cursor$CursorDisposer java/awt/AWTException java/awt/HeadlessException @@ -760,7 +733,6 @@ java/awt/event/MouseListener java/awt/event/MouseMotionListener java/awt/event/MouseWheelListener java/awt/event/InputMethodListener -java/awt/Component$NativeInLightFixer java/awt/event/ContainerListener javax/accessibility/AccessibleContext sun/reflect/UnsafeObjectFieldAccessorImpl @@ -845,7 +817,6 @@ javax/swing/RepaintManager$DisplayChangedHandler javax/swing/SwingPaintEventDispatcher sun/awt/PaintEventDispatcher javax/swing/UIManager$2 -javax/swing/UIManager$3 java/awt/PopupMenu java/awt/Menu java/awt/MenuItem @@ -941,8 +912,6 @@ javax/swing/plaf/basic/BasicLabelUI javax/swing/plaf/LabelUI javax/swing/plaf/metal/DefaultMetalTheme$FontDelegate$1 javax/swing/plaf/basic/BasicHTML -javax/swing/SystemEventQueueUtilities -javax/swing/SystemEventQueueUtilities$SystemEventQueue sun/awt/NullComponentPeer java/awt/event/WindowEvent java/awt/EventQueue$1 @@ -954,11 +923,8 @@ sun/awt/dnd/SunDropTargetEvent java/awt/event/ActionEvent sun/awt/X11/XReparentEvent sun/awt/X11/XWindowAttributes -sun/awt/X11/ComponentAccessor -sun/awt/X11/ComponentAccessor$1 sun/awt/EventQueueItem sun/awt/SunToolkit$3 -javax/swing/SystemEventQueueUtilities$ComponentWorkRequest java/applet/Applet java/awt/Panel com/sun/awt/AWTUtilities @@ -974,17 +940,14 @@ java/io/ByteArrayOutputStream sun/misc/ExtensionDependency java/lang/Package sun/security/util/ManifestEntryVerifier -sun/security/provider/Sun java/security/Provider java/security/Provider$ServiceKey java/security/Provider$EngineDescription -sun/security/provider/Sun$1 java/security/Security java/security/Security$1 sun/misc/FloatingDecimal sun/misc/FloatingDecimal$1 java/util/regex/Pattern -java/util/regex/Pattern$8 java/util/regex/Pattern$Node java/util/regex/Pattern$LastNode java/util/regex/Pattern$GroupHead @@ -1068,7 +1031,6 @@ javax/swing/text/AttributeSet javax/swing/text/SimpleAttributeSet$EmptyAttributeSet javax/swing/text/StyleContext$NamedStyle javax/swing/text/Style -javax/swing/text/SimpleAttributeSet$1 javax/swing/text/StyleContext$SmallAttributeSet javax/swing/text/AbstractDocument$BidiRootElement javax/swing/text/AbstractDocument$BranchElement @@ -1232,7 +1194,6 @@ sun/nio/cs/UTF_16 sun/nio/cs/UTF_16$Decoder sun/nio/cs/UnicodeDecoder sun/font/FileFontStrike -sun/font/FileFont$FileFontDisposer sun/font/TrueTypeGlyphMapper sun/font/CMap sun/font/CMap$NullCMapClass @@ -1242,17 +1203,9 @@ sun/font/CMap$CMapFormat12 java/awt/FontFormatException sun/java2d/HeadlessGraphicsEnvironment java/nio/charset/Charset$3 -sun/nio/cs/ext/ExtendedCharsets sun/nio/cs/AbstractCharsetProvider -sun/nio/cs/ext/EUC_KR -sun/nio/cs/ext/EUC_KR$Decoder -sun/nio/cs/ext/DoubleByteDecoder sun/font/NativeFont -sun/nio/cs/ext/MS950 -sun/nio/cs/ext/MS950$Decoder java/lang/CharacterData00 -sun/nio/cs/ext/GBK -sun/nio/cs/ext/GBK$Decoder sun/font/CMap$CMapFormat2 sun/font/FontDesignMetrics$KeyReference sun/awt/image/PNGImageDecoder @@ -1264,13 +1217,7 @@ sun/awt/event/IgnorePaintEvent java/awt/image/DataBufferInt java/awt/image/SinglePixelPackedSampleModel sun/awt/image/IntegerInterleavedRaster -sun/java2d/x11/X11RemoteOffScreenImage -sun/awt/image/RemoteOffScreenImage sun/awt/image/OffScreenImage -sun/java2d/x11/X11RemoteOffScreenImage$X11RemoteSurfaceManager -sun/awt/image/OffScreenSurfaceManager -sun/awt/image/CachingSurfaceManager -sun/awt/image/RasterListener sun/awt/image/BufImgSurfaceData sun/java2d/opengl/GLXGraphicsConfig sun/java2d/opengl/OGLGraphicsConfig @@ -1278,7 +1225,6 @@ sun/java2d/x11/X11SurfaceData$X11PixmapSurfaceData sun/awt/image/WritableRasterNative sun/awt/image/DataBufferNative sun/java2d/SurfaceManagerFactory -sun/java2d/x11/X11CachingSurfaceManager sun/java2d/opengl/GLXSurfaceData sun/java2d/opengl/OGLSurfaceData sun/font/CompositeGlyphMapper @@ -1419,7 +1365,6 @@ java/awt/event/MouseAdapter javax/swing/ToolTipManager$insideTimerAction javax/swing/ToolTipManager$outsideTimerAction javax/swing/ToolTipManager$stillInsideTimerAction -javax/swing/ToolTipManager$Actions sun/swing/UIAction javax/swing/Action javax/swing/ToolTipManager$MoveBeforeEnterListener @@ -1712,7 +1657,6 @@ javax/swing/border/EtchedBorder javax/swing/JToolBar$Separator javax/swing/plaf/basic/BasicToolBarSeparatorUI sun/font/FontDesignMetrics$MetricsKey -sun/awt/color/CMM javax/swing/KeyboardManager$ComponentKeyStrokePair sun/awt/EmbeddedFrame sun/awt/im/InputMethodContext @@ -1763,7 +1707,6 @@ javax/swing/JComponent$2 sun/net/www/MimeTable java/net/FileNameMap sun/net/www/MimeTable$1 -sun/net/www/MimeTable$2 sun/net/www/MimeEntry java/net/URLConnection$1 java/text/SimpleDateFormat @@ -1785,7 +1728,6 @@ java/text/DecimalFormatSymbols java/text/spi/DecimalFormatSymbolsProvider java/util/Currency java/util/Currency$1 -java/util/CurrencyData java/util/spi/CurrencyNameProvider sun/util/resources/CurrencyNames sun/util/resources/CurrencyNames_en_US @@ -1964,7 +1906,6 @@ javax/swing/JTree$TreeModelHandler javax/swing/tree/VariableHeightLayoutCache$TreeStateNode javax/swing/tree/DefaultMutableTreeNode javax/swing/tree/MutableTreeNode -javax/swing/tree/DefaultMutableTreeNode$1 javax/swing/tree/DefaultMutableTreeNode$PreorderEnumeration javax/swing/event/TableColumnModelEvent java/text/ParseException @@ -2019,7 +1960,6 @@ javax/swing/plaf/basic/BasicSliderUI$ScrollListener javax/swing/plaf/metal/MetalSliderUI$MetalPropertyListener javax/swing/plaf/basic/BasicSliderUI$PropertyChangeHandler java/util/Hashtable$KeySet -sun/java2d/SunGraphicsEnvironment$5 sun/font/Type1Font$1 java/nio/channels/FileChannel$MapMode sun/nio/ch/FileChannelImpl$Unmapper @@ -2134,7 +2074,6 @@ sun/security/jca/ProviderList$3 sun/security/jca/ProviderList$1 sun/security/jca/ProviderList$2 sun/security/jca/ProviderConfig$2 -sun/security/jca/ProviderConfig$4 sun/security/util/PropertyExpander sun/security/jca/ProviderConfig$1 sun/security/jca/ProviderConfig$3 @@ -2192,7 +2131,6 @@ java/security/spec/KeySpec java/security/KeyFactory sun/security/jca/ProviderList$ServiceList sun/security/jca/ProviderList$ServiceList$1 -sun/security/rsa/SunRsaSign sun/security/rsa/RSAKeyFactory java/security/KeyFactorySpi java/security/spec/RSAPublicKeySpec @@ -2276,9 +2214,7 @@ java/lang/AssertionError java/io/NotSerializableException java/io/ObjectStreamException java/security/InvalidParameterException -java/util/Collections$EmptySet$1 java/io/ObjectStreamClass$ClassDataSlot -java/io/ObjectInputStream$CallbackContext sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl java/io/ObjectOutputStream$BlockDataOutputStream java/io/ObjectOutputStream$HandleTable @@ -2294,11 +2230,8 @@ java/security/interfaces/DSAPrivateKey java/security/spec/InvalidKeySpecException java/security/spec/DSAParameterSpec java/security/spec/AlgorithmParameterSpec -javax/crypto/SecretKey sun/security/util/MemoryCache$HardCacheEntry java/awt/EventQueue$1AWTInvocationLock -javax/swing/SystemEventQueueUtilities$RunnableCanvas -javax/swing/SystemEventQueueUtilities$RunnableCanvasGraphics java/awt/Component$FlipBufferStrategy java/awt/SentEvent sun/awt/X11/XDestroyWindowEvent @@ -2331,18 +2264,14 @@ sun/swing/BakedArrayList javax/swing/plaf/synth/SynthLookAndFeel$Handler javax/swing/plaf/synth/SynthDefaultLookup com/sun/java/swing/plaf/gtk/GTKEngine -com/sun/java/swing/plaf/gtk/GTKNativeEngine javax/swing/plaf/synth/Region -com/sun/java/swing/plaf/gtk/GTKNativeEngine$WidgetType com/sun/java/swing/plaf/gtk/GTKRegion sun/swing/ImageCache com/sun/java/swing/plaf/gtk/GTKEngine$Settings com/sun/java/swing/plaf/gtk/GTKStyleFactory com/sun/java/swing/plaf/gtk/PangoFonts -sun/font/FontManager$FontConfigInfo com/sun/java/swing/plaf/gtk/GTKLookAndFeel$WeakPCL javax/swing/plaf/synth/SynthLookAndFeel$AATextListener -com/sun/java/swing/plaf/gtk/GTKNativeStyle com/sun/java/swing/plaf/gtk/GTKStyle com/sun/java/swing/plaf/gtk/GTKConstants javax/swing/plaf/synth/SynthStyle @@ -2370,7 +2299,6 @@ javax/swing/plaf/synth/SynthButtonUI javax/swing/plaf/synth/SynthToggleButtonUI javax/swing/plaf/basic/BasicBorders$FieldBorder javax/swing/plaf/synth/SynthMenuBarUI -javax/swing/plaf/synth/DefaultMenuLayout javax/swing/plaf/synth/SynthMenuUI javax/swing/plaf/synth/SynthUI com/sun/java/swing/plaf/gtk/GTKIconFactory @@ -2424,7 +2352,6 @@ java/net/SocketPermission javax/security/auth/AuthPermission java/lang/Thread$1 java/util/logging/LogManager$5 -java/util/logging/LogManager$6 sun/applet/StdAppletViewerFactory sun/applet/AppletViewerFactory sun/applet/AppletViewer$UserActionListener @@ -2435,7 +2362,6 @@ sun/misc/MessageUtils sun/applet/AppletPanel$10 java/security/Policy$1 sun/security/provider/PolicyFile$1 -sun/security/provider/PolicyInfo sun/security/provider/PolicyFile$3 sun/security/provider/PolicyParser sun/security/util/PolicyUtil @@ -2444,12 +2370,10 @@ sun/security/provider/PolicyParser$PermissionEntry sun/security/provider/PolicyFile$PolicyEntry sun/security/provider/PolicyFile$6 sun/security/provider/PolicyFile$7 -sun/security/provider/SelfPermission java/net/SocketPermissionCollection java/util/PropertyPermissionCollection sun/applet/AppletPanel$9 sun/applet/AppletClassLoader -sun/applet/AppletClassLoader$4 sun/applet/AppletThreadGroup sun/applet/AppContextCreator sun/applet/AppletPanel$1 @@ -2463,9 +2387,7 @@ java/awt/peer/MenuItemPeer sun/awt/X11/XMenuItemPeer java/awt/MenuShortcut sun/awt/X11/XMenuWindow -sun/awt/X11/XMenuBarPeer$1 sun/awt/AppContext$3 -sun/awt/MostRecentThreadAppContext sun/awt/X11/XMenuItemPeer$TextMetrics sun/awt/X11/XMenuBarPeer$MappingData sun/awt/X11/XBaseMenuWindow$MappingData diff --git a/jdk/make/tools/sharing/classlist.windows b/jdk/make/tools/sharing/classlist.windows index f1a5a693b9e..1bf64407f92 100644 --- a/jdk/make/tools/sharing/classlist.windows +++ b/jdk/make/tools/sharing/classlist.windows @@ -104,9 +104,7 @@ sun/reflect/ReflectionFactory java/lang/ref/Reference$Lock java/lang/ref/Reference$ReferenceHandler java/lang/ref/Finalizer$FinalizerThread -java/util/Hashtable$EmptyEnumerator java/util/Enumeration -java/util/Hashtable$EmptyIterator java/util/Iterator java/util/Hashtable$Entry sun/misc/Version @@ -165,11 +163,9 @@ sun/reflect/ReflectionFactory$1 sun/reflect/NativeConstructorAccessorImpl sun/reflect/DelegatingConstructorAccessorImpl sun/misc/VM -sun/nio/cs/MS1252$Encoder sun/nio/cs/SingleByteEncoder java/nio/charset/CharsetEncoder java/nio/charset/CodingErrorAction -sun/nio/cs/MS1252$Decoder sun/nio/cs/SingleByteDecoder java/nio/charset/CharsetDecoder java/nio/ByteBuffer @@ -195,8 +191,6 @@ java/io/ExpiringCache java/io/ExpiringCache$1 java/util/LinkedHashMap java/util/LinkedHashMap$Entry -java/io/File$1 -sun/misc/JavaIODeleteOnExitAccess sun/misc/SharedSecrets java/lang/ClassLoader$3 java/io/ExpiringCache$Entry @@ -209,7 +203,6 @@ sun/misc/NativeSignalHandler java/io/Console java/io/Console$1 sun/misc/JavaIOAccess -java/io/Console$1$1 java/lang/Shutdown java/util/ArrayList java/lang/Shutdown$Lock @@ -333,10 +326,8 @@ java/util/Hashtable$Enumerator java/beans/PropertyChangeEvent java/util/EventObject java/awt/Component$AWTTreeLock -sun/awt/DebugHelper sun/awt/NativeLibLoader sun/security/action/LoadLibraryAction -sun/awt/DebugHelperStub java/awt/Toolkit java/awt/Toolkit$3 sun/util/CoreResourceBundleControl @@ -402,9 +393,7 @@ java/awt/geom/Point2D sun/awt/Win32GraphicsEnvironment sun/java2d/SunGraphicsEnvironment sun/java2d/FontSupport -sun/java2d/SunGraphicsEnvironment$TTFilter java/io/FilenameFilter -sun/java2d/SunGraphicsEnvironment$T1Filter sun/awt/windows/WToolkit sun/awt/SunToolkit sun/awt/WindowClosingSupport @@ -414,7 +403,6 @@ sun/awt/InputMethodSupport java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject java/util/concurrent/locks/Condition sun/awt/AWTAutoShutdown -sun/awt/AWTAutoShutdown$PeerMap sun/awt/SunToolkit$6 java/awt/Dialog$ModalExclusionType java/awt/Dialog @@ -429,7 +417,6 @@ sun/awt/windows/WPanelPeer java/awt/peer/PanelPeer sun/awt/windows/WCanvasPeer java/awt/peer/CanvasPeer -sun/awt/windows/WToolkit$5 java/awt/Color java/awt/Paint java/awt/Transparency @@ -446,11 +433,8 @@ java/awt/event/MouseListener java/awt/event/MouseMotionListener java/awt/event/MouseWheelListener java/awt/event/InputMethodListener -java/awt/EventQueueItem -java/awt/Component$NativeInLightFixer java/awt/event/ContainerListener javax/accessibility/AccessibleContext -sun/awt/windows/WToolkit$6 java/io/ObjectOutputStream java/io/ObjectOutput java/io/DataOutput @@ -509,11 +493,8 @@ java/awt/image/DirectColorModel java/awt/image/PackedColorModel java/awt/color/ColorSpace java/awt/color/ICC_Profile -sun/awt/color/ProfileDeferralInfo -sun/awt/color/ProfileDeferralMgr java/awt/color/ICC_ProfileRGB java/awt/color/ICC_Profile$1 -sun/awt/color/ProfileActivator java/awt/color/ICC_ColorSpace sun/java2d/pipe/NullPipe sun/java2d/pipe/PixelDrawPipe @@ -536,8 +517,6 @@ sun/java2d/pipe/TextRenderer sun/java2d/pipe/SpanClipRenderer sun/java2d/pipe/Region sun/java2d/pipe/RegionIterator -sun/java2d/pipe/DuctusShapeRenderer -sun/java2d/pipe/DuctusRenderer sun/java2d/pipe/AlphaPaintPipe sun/java2d/pipe/SpanShapeRenderer$Composite sun/java2d/pipe/SpanShapeRenderer @@ -552,10 +531,8 @@ java/awt/Image$1 sun/awt/image/SurfaceManager$ImageAccessor sun/awt/image/SurfaceManager sun/awt/image/VolatileSurfaceManager -sun/java2d/windows/Win32OffScreenSurfaceData sun/java2d/windows/WindowsFlags sun/java2d/windows/WindowsFlags$1 -sun/java2d/windows/DDBlitLoops sun/java2d/loops/Blit sun/java2d/loops/GraphicsPrimitive sun/java2d/loops/GraphicsPrimitiveMgr @@ -599,11 +576,8 @@ sun/java2d/loops/GraphicsPrimitiveProxy sun/java2d/loops/GeneralRenderer sun/java2d/loops/GraphicsPrimitiveMgr$1 sun/java2d/loops/GraphicsPrimitiveMgr$2 -sun/java2d/windows/Win32SurfaceData sun/java2d/windows/GDIBlitLoops sun/java2d/windows/GDIRenderer -sun/java2d/windows/DDBlitLoops$DelegateBlitBgLoop -sun/java2d/windows/DDRenderer sun/awt/windows/WToolkit$1 sun/awt/SunDisplayChanger sun/java2d/SunGraphicsEnvironment$1 @@ -615,7 +589,6 @@ sun/font/CompositeFont java/util/HashMap$Values java/util/HashMap$ValueIterator java/util/HashMap$HashIterator -sun/font/FontManager$1 sun/font/TrueTypeFont java/awt/font/FontRenderContext java/awt/RenderingHints @@ -632,7 +605,6 @@ sun/font/StrikeCache sun/java2d/Disposer sun/java2d/Disposer$1 sun/font/StrikeCache$1 -sun/font/FontManager$FontRegistrationInfo sun/awt/windows/WFontConfiguration sun/awt/FontConfiguration sun/awt/FontDescriptor @@ -670,12 +642,10 @@ java/util/LinkedList java/util/Deque java/util/Queue java/util/AbstractSequentialList -java/util/LinkedList$Entry java/awt/DefaultKeyboardFocusManager java/awt/DefaultFocusTraversalPolicy java/awt/ContainerOrderFocusTraversalPolicy java/awt/FocusTraversalPolicy -java/awt/MutableBoolean java/util/Collections$UnmodifiableSet sun/awt/HeadlessToolkit sun/awt/KeyboardFocusManagerPeerImpl @@ -690,7 +660,6 @@ sun/awt/PaintEventDispatcher java/awt/event/InvocationEvent java/awt/ActiveEvent java/awt/MenuComponent -sun/awt/EventQueueItem sun/awt/SunToolkit$3 java/util/EmptyStackException java/lang/reflect/InvocationTargetException @@ -857,7 +826,6 @@ javax/swing/RepaintManager javax/swing/RepaintManager$DisplayChangedHandler javax/swing/SwingPaintEventDispatcher javax/swing/UIManager$2 -javax/swing/UIManager$3 com/sun/swing/internal/plaf/metal/resources/metal sun/util/ResourceBundleEnumeration com/sun/swing/internal/plaf/basic/resources/basic @@ -921,9 +889,6 @@ java/util/Collections$SynchronizedCollection javax/swing/plaf/basic/BasicHTML sun/awt/AppContext$PostShutdownEventRunnable sun/awt/AWTAutoShutdown$1 -javax/swing/SystemEventQueueUtilities -javax/swing/SystemEventQueueUtilities$ComponentWorkRequest -javax/swing/SystemEventQueueUtilities$SystemEventQueue sun/awt/NullComponentPeer java/awt/GraphicsCallback$PaintCallback java/awt/GraphicsCallback @@ -942,17 +907,14 @@ java/io/ByteArrayOutputStream sun/misc/ExtensionDependency java/lang/Package sun/security/util/ManifestEntryVerifier -sun/security/provider/Sun java/security/Provider java/security/Provider$ServiceKey java/security/Provider$EngineDescription -sun/security/provider/Sun$1 java/security/Security java/security/Security$1 sun/misc/FloatingDecimal sun/misc/FloatingDecimal$1 java/util/regex/Pattern -java/util/regex/Pattern$8 java/util/regex/Pattern$Node java/util/regex/Pattern$LastNode java/util/regex/Pattern$GroupHead @@ -1034,7 +996,6 @@ javax/swing/text/AttributeSet javax/swing/text/SimpleAttributeSet$EmptyAttributeSet javax/swing/text/StyleContext$NamedStyle javax/swing/text/Style -javax/swing/text/SimpleAttributeSet$1 javax/swing/text/StyleContext$SmallAttributeSet javax/swing/text/AbstractDocument$BidiRootElement javax/swing/text/AbstractDocument$BranchElement @@ -1153,7 +1114,6 @@ java/nio/ShortBuffer sun/nio/cs/UTF_16 sun/nio/cs/UTF_16$Decoder sun/font/FileFontStrike -sun/font/FileFont$FileFontDisposer sun/font/TrueTypeGlyphMapper sun/font/CMap sun/font/CMap$NullCMapClass @@ -1178,9 +1138,6 @@ java/util/Date sun/util/calendar/CalendarSystem sun/awt/image/OffScreenImage sun/java2d/SurfaceManagerFactory -sun/java2d/windows/WinCachingSurfaceManager -sun/awt/image/CachingSurfaceManager -sun/awt/image/RasterListener sun/util/calendar/Gregorian sun/util/calendar/BaseCalendar sun/util/calendar/AbstractCalendar @@ -1297,7 +1254,6 @@ java/awt/event/MouseAdapter javax/swing/ToolTipManager$insideTimerAction javax/swing/ToolTipManager$outsideTimerAction javax/swing/ToolTipManager$stillInsideTimerAction -javax/swing/ToolTipManager$Actions sun/swing/UIAction javax/swing/Action javax/swing/ToolTipManager$MoveBeforeEnterListener @@ -1665,7 +1621,6 @@ javax/swing/JComponent$2 sun/net/www/MimeTable java/net/FileNameMap sun/net/www/MimeTable$1 -sun/net/www/MimeTable$2 sun/net/www/MimeEntry java/net/URLConnection$1 java/text/SimpleDateFormat @@ -1687,7 +1642,6 @@ java/text/DecimalFormatSymbols java/text/spi/DecimalFormatSymbolsProvider java/util/Currency java/util/Currency$1 -java/util/CurrencyData java/util/spi/CurrencyNameProvider sun/util/resources/CurrencyNames sun/util/resources/CurrencyNames_en_US @@ -1707,7 +1661,6 @@ java/io/PushbackInputStream java/util/zip/CRC32 java/util/zip/Checksum java/awt/TrayIcon -java/awt/EventDispatchThread$StopDispatchEvent java/lang/Thread$State javax/swing/SwingUtilities$SharedOwnerFrame javax/swing/JTable @@ -1722,7 +1675,6 @@ sun/print/PrinterGraphicsConfig javax/swing/JRadioButton java/lang/ClassFormatError sun/java2d/opengl/OGLGraphicsConfig -sun/java2d/windows/WinVolatileSurfaceManager java/awt/print/PrinterGraphics java/awt/PrintGraphics javax/swing/JTabbedPane @@ -1863,7 +1815,6 @@ javax/swing/JTree$TreeModelHandler javax/swing/tree/VariableHeightLayoutCache$TreeStateNode javax/swing/tree/DefaultMutableTreeNode javax/swing/tree/MutableTreeNode -javax/swing/tree/DefaultMutableTreeNode$1 javax/swing/tree/DefaultMutableTreeNode$PreorderEnumeration javax/swing/event/TableColumnModelEvent java/text/ParseException @@ -1918,9 +1869,6 @@ javax/swing/plaf/metal/MetalSliderUI$MetalPropertyListener javax/swing/plaf/basic/BasicSliderUI$PropertyChangeHandler sun/java2d/HeadlessGraphicsEnvironment java/util/Hashtable$KeySet -sun/font/FontManager$2 -sun/java2d/SunGraphicsEnvironment$2 -sun/java2d/SunGraphicsEnvironment$3 javax/swing/DefaultListModel javax/swing/event/ListDataEvent javax/sound/sampled/DataLine @@ -1959,7 +1907,6 @@ sun/net/InetAddressCachePolicy$1 sun/security/action/GetIntegerAction sun/net/InetAddressCachePolicy$2 java/net/InetAddress$CacheEntry -java/net/PlainDatagramSocketImpl java/net/DatagramSocketImpl java/text/Collator java/text/spi/CollatorProvider @@ -2030,7 +1977,6 @@ java/io/ObjectStreamClass$MemberSignature java/math/BigInteger java/security/interfaces/DSAParams java/io/ObjectStreamClass$ClassDataSlot -java/io/ObjectInputStream$CallbackContext java/io/ObjectStreamClass$4 java/io/ObjectStreamClass$5 java/security/MessageDigest @@ -2076,8 +2022,6 @@ java/security/spec/DSAParameterSpec java/math/MutableBigInteger java/math/SignedMutableBigInteger java/awt/EventQueue$1AWTInvocationLock -javax/swing/SystemEventQueueUtilities$RunnableCanvas -javax/swing/SystemEventQueueUtilities$RunnableCanvasGraphics java/awt/LightweightDispatcher$2 java/awt/Component$FlipBufferStrategy javax/swing/JTable$2 @@ -2191,7 +2135,6 @@ java/net/SocketPermission javax/security/auth/AuthPermission java/lang/Thread$1 java/util/logging/LogManager$5 -java/util/logging/LogManager$6 sun/applet/StdAppletViewerFactory sun/applet/AppletViewerFactory sun/applet/AppletViewer$UserActionListener @@ -2202,7 +2145,6 @@ sun/misc/MessageUtils sun/applet/AppletPanel$10 java/security/Policy$1 sun/security/provider/PolicyFile$1 -sun/security/provider/PolicyInfo sun/security/provider/PolicyFile$3 sun/security/util/PropertyExpander sun/security/provider/PolicyParser @@ -2214,17 +2156,14 @@ sun/security/provider/PolicyFile$PolicyEntry sun/security/provider/PolicyParser$ParsingException sun/security/provider/PolicyFile$6 sun/security/provider/PolicyFile$7 -sun/security/provider/SelfPermission java/net/SocketPermissionCollection java/util/PropertyPermissionCollection sun/applet/AppletPanel$9 sun/applet/AppletClassLoader -sun/applet/AppletClassLoader$4 sun/applet/AppletThreadGroup sun/applet/AppContextCreator sun/applet/AppletPanel$1 sun/awt/AppContext$3 -sun/awt/MostRecentThreadAppContext sun/awt/windows/WMenuBarPeer java/awt/peer/MenuBarPeer java/awt/peer/MenuComponentPeer From c9e484d473e041c2324268308fba44f1ba89a3de Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Tue, 5 Apr 2011 14:12:31 -0700 Subject: [PATCH 137/168] 7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass Update the copyright to be 2010 on all changed files in OpenJDK Reviewed-by: ohair --- .../src/share/classes/sun/jvm/hotspot/CommandProcessor.java | 2 +- .../src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java | 2 +- .../sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java | 2 +- .../classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java | 2 +- .../share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java | 2 +- .../classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java | 2 +- .../share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java | 2 +- .../src/share/classes/sun/jvm/hotspot/memory/StringTable.java | 2 +- .../src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java | 2 +- .../src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java | 2 +- .../src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java | 2 +- hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java | 2 +- .../agent/src/share/classes/sun/jvm/hotspot/oops/Method.java | 2 +- .../agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java | 2 +- .../share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java | 2 +- .../agent/src/share/classes/sun/jvm/hotspot/types/Field.java | 2 +- .../classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java | 2 +- .../src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java | 2 +- .../share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java | 2 +- hotspot/make/linux/Makefile | 2 +- hotspot/make/linux/makefiles/arm.make | 2 +- hotspot/make/linux/makefiles/gcc.make | 2 +- hotspot/make/linux/makefiles/mapfile-vers-debug | 2 +- hotspot/make/linux/makefiles/mapfile-vers-product | 2 +- hotspot/make/linux/makefiles/ppc.make | 2 +- hotspot/make/linux/makefiles/sparcWorks.make | 2 +- hotspot/make/linux/makefiles/top.make | 2 +- hotspot/make/linux/makefiles/vm.make | 2 +- hotspot/make/solaris/makefiles/adlc.make | 2 +- hotspot/make/solaris/makefiles/buildtree.make | 2 +- hotspot/make/solaris/makefiles/rules.make | 2 +- hotspot/make/solaris/makefiles/top.make | 2 +- hotspot/make/solaris/makefiles/vm.make | 2 +- hotspot/make/windows/create_obj_files.sh | 2 +- hotspot/make/windows/makefiles/launcher.make | 2 +- hotspot/make/windows/makefiles/vm.make | 2 +- hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp | 2 +- hotspot/src/cpu/sparc/vm/dump_sparc.cpp | 2 +- hotspot/src/cpu/sparc/vm/jni_sparc.h | 2 +- hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp | 2 +- hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp | 2 +- hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp | 2 +- hotspot/src/cpu/x86/vm/jni_x86.h | 2 +- hotspot/src/cpu/x86/vm/vm_version_x86.cpp | 2 +- hotspot/src/cpu/zero/vm/jni_zero.h | 2 +- hotspot/src/os/linux/vm/jvm_linux.cpp | 2 +- hotspot/src/os/linux/vm/osThread_linux.cpp | 2 +- hotspot/src/os/linux/vm/os_linux.inline.hpp | 2 +- hotspot/src/os/linux/vm/thread_linux.inline.hpp | 2 +- hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp | 2 +- hotspot/src/os/solaris/dtrace/jhelper.d | 2 +- hotspot/src/os/solaris/dtrace/libjvm_db.c | 2 +- hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp | 2 +- hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp | 2 +- hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 2 +- hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp | 2 +- hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp | 2 +- hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp | 2 +- hotspot/src/share/tools/hsdis/hsdis-demo.c | 2 +- hotspot/src/share/tools/hsdis/hsdis.c | 2 +- hotspot/src/share/vm/adlc/main.cpp | 2 +- hotspot/src/share/vm/adlc/output_c.cpp | 2 +- hotspot/src/share/vm/asm/assembler.cpp | 2 +- hotspot/src/share/vm/asm/assembler.hpp | 2 +- hotspot/src/share/vm/asm/codeBuffer.hpp | 2 +- hotspot/src/share/vm/c1/c1_Compilation.hpp | 2 +- hotspot/src/share/vm/c1/c1_Defs.hpp | 2 +- hotspot/src/share/vm/c1/c1_FpuStackSim.hpp | 2 +- hotspot/src/share/vm/c1/c1_FrameMap.cpp | 2 +- hotspot/src/share/vm/c1/c1_FrameMap.hpp | 2 +- hotspot/src/share/vm/c1/c1_LIRAssembler.cpp | 2 +- hotspot/src/share/vm/c1/c1_LIRAssembler.hpp | 2 +- hotspot/src/share/vm/c1/c1_LinearScan.cpp | 2 +- hotspot/src/share/vm/c1/c1_LinearScan.hpp | 2 +- hotspot/src/share/vm/c1/c1_MacroAssembler.hpp | 2 +- hotspot/src/share/vm/c1/c1_globals.hpp | 2 +- hotspot/src/share/vm/ci/ciClassList.hpp | 2 +- hotspot/src/share/vm/ci/ciEnv.cpp | 2 +- hotspot/src/share/vm/ci/ciEnv.hpp | 2 +- hotspot/src/share/vm/ci/ciKlass.cpp | 2 +- hotspot/src/share/vm/ci/ciObjArrayKlass.cpp | 2 +- hotspot/src/share/vm/ci/ciObject.hpp | 2 +- hotspot/src/share/vm/ci/ciObjectFactory.hpp | 2 +- hotspot/src/share/vm/ci/ciSignature.cpp | 2 +- hotspot/src/share/vm/ci/ciSignature.hpp | 2 +- hotspot/src/share/vm/ci/ciSymbol.cpp | 2 +- hotspot/src/share/vm/ci/ciSymbol.hpp | 2 +- hotspot/src/share/vm/ci/compilerInterface.hpp | 2 +- hotspot/src/share/vm/classfile/classFileError.cpp | 2 +- hotspot/src/share/vm/classfile/classFileStream.hpp | 2 +- hotspot/src/share/vm/classfile/classLoader.cpp | 2 +- hotspot/src/share/vm/classfile/classLoader.hpp | 2 +- hotspot/src/share/vm/classfile/dictionary.cpp | 2 +- hotspot/src/share/vm/classfile/dictionary.hpp | 2 +- hotspot/src/share/vm/classfile/javaAssertions.cpp | 2 +- hotspot/src/share/vm/classfile/loaderConstraints.cpp | 2 +- hotspot/src/share/vm/classfile/loaderConstraints.hpp | 2 +- hotspot/src/share/vm/classfile/placeholders.cpp | 2 +- hotspot/src/share/vm/classfile/placeholders.hpp | 2 +- hotspot/src/share/vm/classfile/resolutionErrors.cpp | 2 +- hotspot/src/share/vm/classfile/resolutionErrors.hpp | 2 +- hotspot/src/share/vm/classfile/stackMapFrame.cpp | 2 +- hotspot/src/share/vm/classfile/stackMapFrame.hpp | 2 +- hotspot/src/share/vm/classfile/stackMapTable.cpp | 2 +- hotspot/src/share/vm/classfile/stackMapTable.hpp | 2 +- hotspot/src/share/vm/classfile/verificationType.cpp | 2 +- hotspot/src/share/vm/classfile/verificationType.hpp | 2 +- hotspot/src/share/vm/classfile/verifier.hpp | 2 +- hotspot/src/share/vm/code/codeBlob.cpp | 2 +- hotspot/src/share/vm/code/codeCache.hpp | 2 +- hotspot/src/share/vm/code/compiledIC.cpp | 2 +- hotspot/src/share/vm/code/compiledIC.hpp | 2 +- hotspot/src/share/vm/code/dependencies.cpp | 2 +- hotspot/src/share/vm/code/icBuffer.cpp | 2 +- hotspot/src/share/vm/code/relocInfo.cpp | 2 +- hotspot/src/share/vm/code/relocInfo.hpp | 2 +- hotspot/src/share/vm/code/vmreg.hpp | 2 +- hotspot/src/share/vm/compiler/compileLog.hpp | 2 +- hotspot/src/share/vm/compiler/compilerOracle.cpp | 2 +- hotspot/src/share/vm/compiler/compilerOracle.hpp | 2 +- hotspot/src/share/vm/compiler/disassembler.cpp | 2 +- hotspot/src/share/vm/compiler/disassembler.hpp | 2 +- .../concurrentMarkSweep/compactibleFreeListSpace.cpp | 2 +- .../share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp | 2 +- .../src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp | 2 +- .../src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp | 2 +- .../gc_implementation/parallelScavenge/psPromotionManager.cpp | 2 +- .../vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp | 2 +- .../src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp | 2 +- .../src/share/vm/gc_implementation/shared/allocationStats.hpp | 2 +- .../share/vm/gc_implementation/shared/concurrentGCThread.cpp | 2 +- hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp | 2 +- hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp | 2 +- hotspot/src/share/vm/gc_interface/collectedHeap.cpp | 2 +- hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp | 2 +- hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp | 2 +- hotspot/src/share/vm/interpreter/cppInterpreter.hpp | 2 +- hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp | 2 +- hotspot/src/share/vm/interpreter/interpreter.hpp | 2 +- hotspot/src/share/vm/interpreter/interpreterGenerator.hpp | 2 +- hotspot/src/share/vm/interpreter/linkResolver.hpp | 2 +- hotspot/src/share/vm/interpreter/templateInterpreter.hpp | 2 +- .../src/share/vm/interpreter/templateInterpreterGenerator.hpp | 2 +- hotspot/src/share/vm/interpreter/templateTable.hpp | 2 +- hotspot/src/share/vm/memory/barrierSet.cpp | 2 +- hotspot/src/share/vm/memory/classify.cpp | 2 +- hotspot/src/share/vm/memory/compactingPermGenGen.cpp | 2 +- hotspot/src/share/vm/memory/genCollectedHeap.cpp | 2 +- hotspot/src/share/vm/memory/genMarkSweep.cpp | 2 +- hotspot/src/share/vm/memory/heap.cpp | 2 +- hotspot/src/share/vm/memory/heapInspection.cpp | 2 +- hotspot/src/share/vm/memory/iterator.hpp | 2 +- hotspot/src/share/vm/memory/restore.cpp | 2 +- hotspot/src/share/vm/memory/serialize.cpp | 2 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 2 +- hotspot/src/share/vm/memory/universe.hpp | 2 +- hotspot/src/share/vm/oops/arrayKlass.cpp | 2 +- hotspot/src/share/vm/oops/arrayOop.cpp | 2 +- hotspot/src/share/vm/oops/cpCacheKlass.hpp | 2 +- hotspot/src/share/vm/oops/generateOopMap.hpp | 2 +- hotspot/src/share/vm/oops/klass.cpp | 2 +- hotspot/src/share/vm/oops/markOop.hpp | 2 +- hotspot/src/share/vm/oops/symbol.cpp | 2 +- hotspot/src/share/vm/oops/symbol.hpp | 2 +- hotspot/src/share/vm/oops/typeArrayOop.hpp | 2 +- hotspot/src/share/vm/opto/buildOopMap.cpp | 2 +- hotspot/src/share/vm/opto/c2_globals.hpp | 2 +- hotspot/src/share/vm/opto/c2compiler.cpp | 2 +- hotspot/src/share/vm/opto/chaitin.cpp | 2 +- hotspot/src/share/vm/opto/gcm.cpp | 2 +- hotspot/src/share/vm/opto/graphKit.cpp | 2 +- hotspot/src/share/vm/opto/graphKit.hpp | 2 +- hotspot/src/share/vm/opto/idealKit.cpp | 2 +- hotspot/src/share/vm/opto/idealKit.hpp | 2 +- hotspot/src/share/vm/opto/lcm.cpp | 2 +- hotspot/src/share/vm/opto/locknode.hpp | 2 +- hotspot/src/share/vm/opto/loopTransform.cpp | 2 +- hotspot/src/share/vm/opto/loopUnswitch.cpp | 2 +- hotspot/src/share/vm/opto/loopopts.cpp | 2 +- hotspot/src/share/vm/opto/matcher.cpp | 2 +- hotspot/src/share/vm/opto/matcher.hpp | 2 +- hotspot/src/share/vm/opto/memnode.hpp | 2 +- hotspot/src/share/vm/opto/node.cpp | 2 +- hotspot/src/share/vm/opto/output.cpp | 2 +- hotspot/src/share/vm/opto/output.hpp | 2 +- hotspot/src/share/vm/opto/parse1.cpp | 2 +- hotspot/src/share/vm/opto/parse2.cpp | 2 +- hotspot/src/share/vm/opto/regmask.cpp | 2 +- hotspot/src/share/vm/opto/regmask.hpp | 2 +- hotspot/src/share/vm/opto/runtime.cpp | 2 +- hotspot/src/share/vm/opto/stringopts.cpp | 2 +- hotspot/src/share/vm/opto/type.hpp | 2 +- hotspot/src/share/vm/precompiled.hpp | 2 +- hotspot/src/share/vm/prims/forte.cpp | 2 +- hotspot/src/share/vm/prims/jni_md.h | 2 +- hotspot/src/share/vm/prims/jvm_misc.hpp | 2 +- hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp | 2 +- hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp | 2 +- hotspot/src/share/vm/prims/jvmtiEventController.cpp | 2 +- hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp | 2 +- hotspot/src/share/vm/prims/jvmtiTagMap.hpp | 2 +- hotspot/src/share/vm/runtime/deoptimization.hpp | 2 +- hotspot/src/share/vm/runtime/dtraceJSDT.hpp | 2 +- hotspot/src/share/vm/runtime/fieldDescriptor.hpp | 2 +- hotspot/src/share/vm/runtime/fieldType.cpp | 2 +- hotspot/src/share/vm/runtime/fieldType.hpp | 2 +- hotspot/src/share/vm/runtime/fprofiler.cpp | 2 +- hotspot/src/share/vm/runtime/fprofiler.hpp | 2 +- hotspot/src/share/vm/runtime/frame.hpp | 2 +- hotspot/src/share/vm/runtime/frame.inline.hpp | 2 +- hotspot/src/share/vm/runtime/handles.hpp | 2 +- hotspot/src/share/vm/runtime/icache.hpp | 2 +- hotspot/src/share/vm/runtime/interfaceSupport.cpp | 2 +- hotspot/src/share/vm/runtime/interfaceSupport.hpp | 2 +- hotspot/src/share/vm/runtime/javaCalls.cpp | 2 +- hotspot/src/share/vm/runtime/javaCalls.hpp | 2 +- hotspot/src/share/vm/runtime/javaFrameAnchor.hpp | 2 +- hotspot/src/share/vm/runtime/jniHandles.cpp | 2 +- hotspot/src/share/vm/runtime/objectMonitor.cpp | 2 +- hotspot/src/share/vm/runtime/reflection.hpp | 2 +- hotspot/src/share/vm/runtime/reflectionUtils.hpp | 2 +- hotspot/src/share/vm/runtime/registerMap.hpp | 2 +- hotspot/src/share/vm/runtime/rframe.cpp | 2 +- hotspot/src/share/vm/runtime/safepoint.cpp | 2 +- hotspot/src/share/vm/runtime/signature.cpp | 2 +- hotspot/src/share/vm/runtime/signature.hpp | 2 +- hotspot/src/share/vm/runtime/stackValueCollection.cpp | 2 +- hotspot/src/share/vm/runtime/statSampler.cpp | 2 +- hotspot/src/share/vm/runtime/stubCodeGenerator.cpp | 2 +- hotspot/src/share/vm/runtime/sweeper.cpp | 2 +- hotspot/src/share/vm/runtime/synchronizer.cpp | 2 +- hotspot/src/share/vm/runtime/threadLocalStorage.hpp | 2 +- hotspot/src/share/vm/runtime/vframe.cpp | 2 +- hotspot/src/share/vm/runtime/vmStructs.hpp | 2 +- hotspot/src/share/vm/runtime/vm_operations.cpp | 2 +- hotspot/src/share/vm/runtime/vm_operations.hpp | 2 +- hotspot/src/share/vm/runtime/vm_version.cpp | 2 +- hotspot/src/share/vm/runtime/vm_version.hpp | 2 +- hotspot/src/share/vm/services/attachListener.cpp | 2 +- hotspot/src/share/vm/services/attachListener.hpp | 2 +- hotspot/src/share/vm/services/classLoadingService.cpp | 2 +- hotspot/src/share/vm/services/management.hpp | 2 +- hotspot/src/share/vm/services/memoryManager.cpp | 2 +- hotspot/src/share/vm/services/memoryPool.cpp | 2 +- hotspot/src/share/vm/services/memoryService.cpp | 2 +- hotspot/src/share/vm/shark/sharkNativeWrapper.cpp | 2 +- hotspot/src/share/vm/utilities/copy.hpp | 2 +- hotspot/src/share/vm/utilities/debug.cpp | 2 +- hotspot/src/share/vm/utilities/debug.hpp | 2 +- hotspot/src/share/vm/utilities/elfSymbolTable.cpp | 2 +- hotspot/src/share/vm/utilities/exceptions.cpp | 2 +- hotspot/src/share/vm/utilities/exceptions.hpp | 2 +- hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp | 2 +- hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp | 2 +- hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp | 2 +- hotspot/src/share/vm/utilities/hashtable.cpp | 2 +- hotspot/src/share/vm/utilities/hashtable.hpp | 2 +- hotspot/src/share/vm/utilities/hashtable.inline.hpp | 2 +- hotspot/src/share/vm/utilities/ostream.hpp | 2 +- hotspot/src/share/vm/utilities/taskqueue.hpp | 2 +- hotspot/src/share/vm/utilities/utf8.cpp | 2 +- hotspot/src/share/vm/utilities/utf8.hpp | 2 +- hotspot/src/share/vm/utilities/xmlstream.cpp | 2 +- hotspot/src/share/vm/utilities/xmlstream.hpp | 2 +- 265 files changed, 265 insertions(+), 265 deletions(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java index e4a6b6b9879..eacc59d8226 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java index fcaf4766811..fd35915831f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java index 67962adefb6..d1f9f70dbec 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java index 3a62c2dad0c..dab8fc7cff4 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java index a42479d5385..14edf8f74ec 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java index a6b2a743ec2..248308baa7f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java index 5574910a320..be9ee583868 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java index bfbeb26cc1a..8bf42f0415e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java index cfee9fbe004..1c0a676810a 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java index f1babff8cb6..9bb918b8765 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java index 35a9d194037..30f3497e53d 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java index ccb5e5b46b0..506d4d3ae0c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java index ed551bc74e4..3a4061937e1 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java index 964e3a8de3f..ed4ea43d8a0 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java index 3896c67d77c..e9202edb8e5 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java index 2ef0e48c958..c6794b7f143 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java index 147e3bd5590..1b01316cbf6 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java index 65437b7082f..3c2e0f965c2 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java index 1ae9dfaf48a..73932a43033 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/linux/Makefile b/hotspot/make/linux/Makefile index ec1e60b7c2d..49ac97c199e 100644 --- a/hotspot/make/linux/Makefile +++ b/hotspot/make/linux/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/linux/makefiles/arm.make b/hotspot/make/linux/makefiles/arm.make index 3c5dc2ca151..e210303dc98 100644 --- a/hotspot/make/linux/makefiles/arm.make +++ b/hotspot/make/linux/makefiles/arm.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. # diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make index 28105c41a1a..d7537331e4c 100644 --- a/hotspot/make/linux/makefiles/gcc.make +++ b/hotspot/make/linux/makefiles/gcc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/linux/makefiles/mapfile-vers-debug b/hotspot/make/linux/makefiles/mapfile-vers-debug index 7022aba2e39..332c8af9329 100644 --- a/hotspot/make/linux/makefiles/mapfile-vers-debug +++ b/hotspot/make/linux/makefiles/mapfile-vers-debug @@ -3,7 +3,7 @@ # # -# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/linux/makefiles/mapfile-vers-product b/hotspot/make/linux/makefiles/mapfile-vers-product index 201252d2d29..052da7c3c7e 100644 --- a/hotspot/make/linux/makefiles/mapfile-vers-product +++ b/hotspot/make/linux/makefiles/mapfile-vers-product @@ -3,7 +3,7 @@ # # -# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/linux/makefiles/ppc.make b/hotspot/make/linux/makefiles/ppc.make index 50ac9fe0d8c..a3a19bc246a 100644 --- a/hotspot/make/linux/makefiles/ppc.make +++ b/hotspot/make/linux/makefiles/ppc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. # diff --git a/hotspot/make/linux/makefiles/sparcWorks.make b/hotspot/make/linux/makefiles/sparcWorks.make index 818ef42b088..6e6c8418d6f 100644 --- a/hotspot/make/linux/makefiles/sparcWorks.make +++ b/hotspot/make/linux/makefiles/sparcWorks.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/linux/makefiles/top.make b/hotspot/make/linux/makefiles/top.make index 41c50940d25..1b674dce957 100644 --- a/hotspot/make/linux/makefiles/top.make +++ b/hotspot/make/linux/makefiles/top.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make index d564055c539..ff6f527eeb2 100644 --- a/hotspot/make/linux/makefiles/vm.make +++ b/hotspot/make/linux/makefiles/vm.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/solaris/makefiles/adlc.make b/hotspot/make/solaris/makefiles/adlc.make index 981e187f729..4bcecf607cd 100644 --- a/hotspot/make/solaris/makefiles/adlc.make +++ b/hotspot/make/solaris/makefiles/adlc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/solaris/makefiles/buildtree.make b/hotspot/make/solaris/makefiles/buildtree.make index 8cca8a07ebb..591ae3c5855 100644 --- a/hotspot/make/solaris/makefiles/buildtree.make +++ b/hotspot/make/solaris/makefiles/buildtree.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/solaris/makefiles/rules.make b/hotspot/make/solaris/makefiles/rules.make index 4f2cc860805..c5bd00f957c 100644 --- a/hotspot/make/solaris/makefiles/rules.make +++ b/hotspot/make/solaris/makefiles/rules.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/solaris/makefiles/top.make b/hotspot/make/solaris/makefiles/top.make index 893e9c00cab..64797bbb2fd 100644 --- a/hotspot/make/solaris/makefiles/top.make +++ b/hotspot/make/solaris/makefiles/top.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make index 5ad02c00c53..5db3daeda64 100644 --- a/hotspot/make/solaris/makefiles/vm.make +++ b/hotspot/make/solaris/makefiles/vm.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/windows/create_obj_files.sh b/hotspot/make/windows/create_obj_files.sh index 0c8276962e6..59fe3a6932c 100644 --- a/hotspot/make/windows/create_obj_files.sh +++ b/hotspot/make/windows/create_obj_files.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/windows/makefiles/launcher.make b/hotspot/make/windows/makefiles/launcher.make index 7868032d590..2a5df63bdac 100644 --- a/hotspot/make/windows/makefiles/launcher.make +++ b/hotspot/make/windows/makefiles/launcher.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make index 4bcdd4a3bbe..1ee86646137 100644 --- a/hotspot/make/windows/makefiles/vm.make +++ b/hotspot/make/windows/makefiles/vm.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp index c3556e2147e..2905687ebce 100644 --- a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/sparc/vm/dump_sparc.cpp b/hotspot/src/cpu/sparc/vm/dump_sparc.cpp index afe0d4f5952..19929f52ba0 100644 --- a/hotspot/src/cpu/sparc/vm/dump_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/dump_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/sparc/vm/jni_sparc.h b/hotspot/src/cpu/sparc/vm/jni_sparc.h index 2e177a8692e..5cb443ba943 100644 --- a/hotspot/src/cpu/sparc/vm/jni_sparc.h +++ b/hotspot/src/cpu/sparc/vm/jni_sparc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp index a5bcc5e7738..93fa1fc87ca 100644 --- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp index 7549281f0ba..6ee9c6239d5 100644 --- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp index a2913f6f055..16196cd3609 100644 --- a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/x86/vm/jni_x86.h b/hotspot/src/cpu/x86/vm/jni_x86.h index 9715d0e3237..d06bb5ca247 100644 --- a/hotspot/src/cpu/x86/vm/jni_x86.h +++ b/hotspot/src/cpu/x86/vm/jni_x86.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp index 9f352e3e9af..fa2084450ba 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All Rights Reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/cpu/zero/vm/jni_zero.h b/hotspot/src/cpu/zero/vm/jni_zero.h index 132a6bbb60d..6ac4f63ead3 100644 --- a/hotspot/src/cpu/zero/vm/jni_zero.h +++ b/hotspot/src/cpu/zero/vm/jni_zero.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os/linux/vm/jvm_linux.cpp b/hotspot/src/os/linux/vm/jvm_linux.cpp index 6e305b80211..ba84788a1b7 100644 --- a/hotspot/src/os/linux/vm/jvm_linux.cpp +++ b/hotspot/src/os/linux/vm/jvm_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os/linux/vm/osThread_linux.cpp b/hotspot/src/os/linux/vm/osThread_linux.cpp index bf454ff9003..8ff88a9e34f 100644 --- a/hotspot/src/os/linux/vm/osThread_linux.cpp +++ b/hotspot/src/os/linux/vm/osThread_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os/linux/vm/os_linux.inline.hpp b/hotspot/src/os/linux/vm/os_linux.inline.hpp index c2301be5052..0bddce86bcc 100644 --- a/hotspot/src/os/linux/vm/os_linux.inline.hpp +++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os/linux/vm/thread_linux.inline.hpp b/hotspot/src/os/linux/vm/thread_linux.inline.hpp index 93e1d481ef7..2a5dcddb7ca 100644 --- a/hotspot/src/os/linux/vm/thread_linux.inline.hpp +++ b/hotspot/src/os/linux/vm/thread_linux.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp index adfd1718538..022643161a1 100644 --- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp +++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os/solaris/dtrace/jhelper.d b/hotspot/src/os/solaris/dtrace/jhelper.d index 0a93d25cc35..75e74269576 100644 --- a/hotspot/src/os/solaris/dtrace/jhelper.d +++ b/hotspot/src/os/solaris/dtrace/jhelper.d @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os/solaris/dtrace/libjvm_db.c b/hotspot/src/os/solaris/dtrace/libjvm_db.c index 82cef0912bc..8caac23e9e2 100644 --- a/hotspot/src/os/solaris/dtrace/libjvm_db.c +++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp b/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp index c88d4fadea0..60baff5066c 100644 --- a/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp +++ b/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index a9984d0e615..62131ee6f10 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index b5e159076d5..ba484b9fde5 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index afeb60a93f4..32c2d0a5191 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index e9724f1cd8e..971f600fe30 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index 2de4d6969bd..78e93ea6652 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/tools/hsdis/hsdis-demo.c b/hotspot/src/share/tools/hsdis/hsdis-demo.c index 9981a71e33a..e83a0425c50 100644 --- a/hotspot/src/share/tools/hsdis/hsdis-demo.c +++ b/hotspot/src/share/tools/hsdis/hsdis-demo.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/tools/hsdis/hsdis.c b/hotspot/src/share/tools/hsdis/hsdis.c index 189eecde3e1..daea404f955 100644 --- a/hotspot/src/share/tools/hsdis/hsdis.c +++ b/hotspot/src/share/tools/hsdis/hsdis.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp index 88a75e684b1..47e207a4b13 100644 --- a/hotspot/src/share/vm/adlc/main.cpp +++ b/hotspot/src/share/vm/adlc/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/adlc/output_c.cpp b/hotspot/src/share/vm/adlc/output_c.cpp index ddf1f99343b..c0ef3894622 100644 --- a/hotspot/src/share/vm/adlc/output_c.cpp +++ b/hotspot/src/share/vm/adlc/output_c.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp index 2f739393f58..86011e97496 100644 --- a/hotspot/src/share/vm/asm/assembler.cpp +++ b/hotspot/src/share/vm/asm/assembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp index db0fbadbd5c..829e5618413 100644 --- a/hotspot/src/share/vm/asm/assembler.hpp +++ b/hotspot/src/share/vm/asm/assembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp index dfcd1cf0a27..e9b2950b98c 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.hpp +++ b/hotspot/src/share/vm/asm/codeBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_Compilation.hpp b/hotspot/src/share/vm/c1/c1_Compilation.hpp index 0d0fe1d3017..376b6f3372e 100644 --- a/hotspot/src/share/vm/c1/c1_Compilation.hpp +++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_Defs.hpp b/hotspot/src/share/vm/c1/c1_Defs.hpp index 564e7b3cb5f..bebb3b0bebe 100644 --- a/hotspot/src/share/vm/c1/c1_Defs.hpp +++ b/hotspot/src/share/vm/c1/c1_Defs.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp index 3e8adbe14c4..a1e4c383204 100644 --- a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp +++ b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp index 74eab9bd08e..ea50b276f44 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp index 266ae094057..288fc5c1bf4 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp index 510bf2f92a5..3417bda7830 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp index 074027a8719..857b663f7cf 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp index 043ea39cdb5..ef41cfd3224 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp index 3436cb5c2be..51789ebd85d 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp index 9887c2af61d..55d98035016 100644 --- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp +++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp index fd890cf7e47..110371d19e2 100644 --- a/hotspot/src/share/vm/c1/c1_globals.hpp +++ b/hotspot/src/share/vm/c1/c1_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciClassList.hpp b/hotspot/src/share/vm/ci/ciClassList.hpp index 01deadd7ef3..bc96594a3eb 100644 --- a/hotspot/src/share/vm/ci/ciClassList.hpp +++ b/hotspot/src/share/vm/ci/ciClassList.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index 14018b4729c..66e23490c09 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciEnv.hpp b/hotspot/src/share/vm/ci/ciEnv.hpp index 53c3ee15d9d..17b556fc4b5 100644 --- a/hotspot/src/share/vm/ci/ciEnv.hpp +++ b/hotspot/src/share/vm/ci/ciEnv.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciKlass.cpp b/hotspot/src/share/vm/ci/ciKlass.cpp index 03aeff4f265..2169b376c51 100644 --- a/hotspot/src/share/vm/ci/ciKlass.cpp +++ b/hotspot/src/share/vm/ci/ciKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp b/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp index c5cd7009c47..2fcf2c9be6d 100644 --- a/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp +++ b/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciObject.hpp b/hotspot/src/share/vm/ci/ciObject.hpp index 0a93d9f1149..2542d150b6b 100644 --- a/hotspot/src/share/vm/ci/ciObject.hpp +++ b/hotspot/src/share/vm/ci/ciObject.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.hpp b/hotspot/src/share/vm/ci/ciObjectFactory.hpp index 50f585f47a9..12185f2262f 100644 --- a/hotspot/src/share/vm/ci/ciObjectFactory.hpp +++ b/hotspot/src/share/vm/ci/ciObjectFactory.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciSignature.cpp b/hotspot/src/share/vm/ci/ciSignature.cpp index b68f3f8caf2..037ba8a8fef 100644 --- a/hotspot/src/share/vm/ci/ciSignature.cpp +++ b/hotspot/src/share/vm/ci/ciSignature.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciSignature.hpp b/hotspot/src/share/vm/ci/ciSignature.hpp index 5ac1170eeee..f455600e7ac 100644 --- a/hotspot/src/share/vm/ci/ciSignature.hpp +++ b/hotspot/src/share/vm/ci/ciSignature.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciSymbol.cpp b/hotspot/src/share/vm/ci/ciSymbol.cpp index e1fe49f1e75..d253e596af3 100644 --- a/hotspot/src/share/vm/ci/ciSymbol.cpp +++ b/hotspot/src/share/vm/ci/ciSymbol.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/ciSymbol.hpp b/hotspot/src/share/vm/ci/ciSymbol.hpp index ec2a588cbf1..aae171a01d3 100644 --- a/hotspot/src/share/vm/ci/ciSymbol.hpp +++ b/hotspot/src/share/vm/ci/ciSymbol.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/ci/compilerInterface.hpp b/hotspot/src/share/vm/ci/compilerInterface.hpp index b3a7d75fc08..66abdbdc513 100644 --- a/hotspot/src/share/vm/ci/compilerInterface.hpp +++ b/hotspot/src/share/vm/ci/compilerInterface.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/classFileError.cpp b/hotspot/src/share/vm/classfile/classFileError.cpp index f72ec11996d..a9c55fb73a5 100644 --- a/hotspot/src/share/vm/classfile/classFileError.cpp +++ b/hotspot/src/share/vm/classfile/classFileError.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/classFileStream.hpp b/hotspot/src/share/vm/classfile/classFileStream.hpp index 3c94a1edf1e..cf6f0e5f3bf 100644 --- a/hotspot/src/share/vm/classfile/classFileStream.hpp +++ b/hotspot/src/share/vm/classfile/classFileStream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index 3536352979c..88dd6166856 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp index 95c36bd87f1..6f816837ae7 100644 --- a/hotspot/src/share/vm/classfile/classLoader.hpp +++ b/hotspot/src/share/vm/classfile/classLoader.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp index f3e8be25cfa..b15446c6f19 100644 --- a/hotspot/src/share/vm/classfile/dictionary.cpp +++ b/hotspot/src/share/vm/classfile/dictionary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/dictionary.hpp b/hotspot/src/share/vm/classfile/dictionary.hpp index 157ce15c0a6..98e01695001 100644 --- a/hotspot/src/share/vm/classfile/dictionary.hpp +++ b/hotspot/src/share/vm/classfile/dictionary.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/javaAssertions.cpp b/hotspot/src/share/vm/classfile/javaAssertions.cpp index e56b617c53d..7884881dedc 100644 --- a/hotspot/src/share/vm/classfile/javaAssertions.cpp +++ b/hotspot/src/share/vm/classfile/javaAssertions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/loaderConstraints.cpp b/hotspot/src/share/vm/classfile/loaderConstraints.cpp index 97ab80b3cae..5e25e4cbd02 100644 --- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp +++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/loaderConstraints.hpp b/hotspot/src/share/vm/classfile/loaderConstraints.hpp index 1efec51d5d5..60612f5dba3 100644 --- a/hotspot/src/share/vm/classfile/loaderConstraints.hpp +++ b/hotspot/src/share/vm/classfile/loaderConstraints.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/placeholders.cpp b/hotspot/src/share/vm/classfile/placeholders.cpp index 9099f28cb51..ef877b1033e 100644 --- a/hotspot/src/share/vm/classfile/placeholders.cpp +++ b/hotspot/src/share/vm/classfile/placeholders.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/placeholders.hpp b/hotspot/src/share/vm/classfile/placeholders.hpp index 852bf769426..667c59b8c70 100644 --- a/hotspot/src/share/vm/classfile/placeholders.hpp +++ b/hotspot/src/share/vm/classfile/placeholders.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/resolutionErrors.cpp b/hotspot/src/share/vm/classfile/resolutionErrors.cpp index c61c6689b39..ed31224e010 100644 --- a/hotspot/src/share/vm/classfile/resolutionErrors.cpp +++ b/hotspot/src/share/vm/classfile/resolutionErrors.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/resolutionErrors.hpp b/hotspot/src/share/vm/classfile/resolutionErrors.hpp index fed9c083ddf..03fcf4957bb 100644 --- a/hotspot/src/share/vm/classfile/resolutionErrors.hpp +++ b/hotspot/src/share/vm/classfile/resolutionErrors.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/stackMapFrame.cpp b/hotspot/src/share/vm/classfile/stackMapFrame.cpp index 38fe483fb96..19f903c662f 100644 --- a/hotspot/src/share/vm/classfile/stackMapFrame.cpp +++ b/hotspot/src/share/vm/classfile/stackMapFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/stackMapFrame.hpp b/hotspot/src/share/vm/classfile/stackMapFrame.hpp index a07df0ce56f..d99808bce10 100644 --- a/hotspot/src/share/vm/classfile/stackMapFrame.hpp +++ b/hotspot/src/share/vm/classfile/stackMapFrame.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/stackMapTable.cpp b/hotspot/src/share/vm/classfile/stackMapTable.cpp index f6a0b427386..41de52d8b2d 100644 --- a/hotspot/src/share/vm/classfile/stackMapTable.cpp +++ b/hotspot/src/share/vm/classfile/stackMapTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/stackMapTable.hpp b/hotspot/src/share/vm/classfile/stackMapTable.hpp index 2d2798a717a..08e9bd25465 100644 --- a/hotspot/src/share/vm/classfile/stackMapTable.hpp +++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/verificationType.cpp b/hotspot/src/share/vm/classfile/verificationType.cpp index 0e994fcf4be..3e204f7940b 100644 --- a/hotspot/src/share/vm/classfile/verificationType.cpp +++ b/hotspot/src/share/vm/classfile/verificationType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/verificationType.hpp b/hotspot/src/share/vm/classfile/verificationType.hpp index dcf8927f9ef..260d8cea509 100644 --- a/hotspot/src/share/vm/classfile/verificationType.hpp +++ b/hotspot/src/share/vm/classfile/verificationType.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/classfile/verifier.hpp b/hotspot/src/share/vm/classfile/verifier.hpp index 97f51c9579f..66868587ea0 100644 --- a/hotspot/src/share/vm/classfile/verifier.hpp +++ b/hotspot/src/share/vm/classfile/verifier.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp index b90ed8cbdda..dead37cc336 100644 --- a/hotspot/src/share/vm/code/codeBlob.cpp +++ b/hotspot/src/share/vm/code/codeBlob.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp index 42ea1b68940..9107bbcc167 100644 --- a/hotspot/src/share/vm/code/codeCache.hpp +++ b/hotspot/src/share/vm/code/codeCache.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/compiledIC.cpp b/hotspot/src/share/vm/code/compiledIC.cpp index b374257061e..3496f70debc 100644 --- a/hotspot/src/share/vm/code/compiledIC.cpp +++ b/hotspot/src/share/vm/code/compiledIC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp index 979dcd52300..fe1cfb30bf8 100644 --- a/hotspot/src/share/vm/code/compiledIC.hpp +++ b/hotspot/src/share/vm/code/compiledIC.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp index fb0d1cf42ee..c1529652053 100644 --- a/hotspot/src/share/vm/code/dependencies.cpp +++ b/hotspot/src/share/vm/code/dependencies.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/icBuffer.cpp b/hotspot/src/share/vm/code/icBuffer.cpp index 90dbf934a47..ed704575ede 100644 --- a/hotspot/src/share/vm/code/icBuffer.cpp +++ b/hotspot/src/share/vm/code/icBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/relocInfo.cpp b/hotspot/src/share/vm/code/relocInfo.cpp index 0264f20607f..43a8eef0625 100644 --- a/hotspot/src/share/vm/code/relocInfo.cpp +++ b/hotspot/src/share/vm/code/relocInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp index 7dc11fee084..9f5ad21d940 100644 --- a/hotspot/src/share/vm/code/relocInfo.hpp +++ b/hotspot/src/share/vm/code/relocInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/code/vmreg.hpp b/hotspot/src/share/vm/code/vmreg.hpp index cd00dd42836..d57e6f89bb0 100644 --- a/hotspot/src/share/vm/code/vmreg.hpp +++ b/hotspot/src/share/vm/code/vmreg.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/compiler/compileLog.hpp b/hotspot/src/share/vm/compiler/compileLog.hpp index ae7d01c724c..0c997cecc6c 100644 --- a/hotspot/src/share/vm/compiler/compileLog.hpp +++ b/hotspot/src/share/vm/compiler/compileLog.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/compiler/compilerOracle.cpp b/hotspot/src/share/vm/compiler/compilerOracle.cpp index 178a045dcfd..6ac45b41345 100644 --- a/hotspot/src/share/vm/compiler/compilerOracle.cpp +++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/compiler/compilerOracle.hpp b/hotspot/src/share/vm/compiler/compilerOracle.hpp index 7e6b5cf09a6..7a32967b920 100644 --- a/hotspot/src/share/vm/compiler/compilerOracle.hpp +++ b/hotspot/src/share/vm/compiler/compilerOracle.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp index 4b1ad9ab8bf..48813b6cb89 100644 --- a/hotspot/src/share/vm/compiler/disassembler.cpp +++ b/hotspot/src/share/vm/compiler/disassembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/compiler/disassembler.hpp b/hotspot/src/share/vm/compiler/disassembler.hpp index 03b377065b7..376154075bb 100644 --- a/hotspot/src/share/vm/compiler/disassembler.hpp +++ b/hotspot/src/share/vm/compiler/disassembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index 67cf3c70464..50e073d24aa 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp index a8c7e7e9a2e..50cc99d0994 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp index aaf44b02d3f..d9b41613444 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp index b081ad09f4d..c7a651f03fe 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp index 2a35caccdf1..4c8b1159526 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index 39f7f6a3e12..ad58a90fcd8 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp index 1848a1db281..880f0678904 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp index de44096c1f3..c297477fd60 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp index 4e089c14cde..104ff1954fe 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp index c16ec595cef..262d35065d2 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp index caa6efed1c8..5325fee218b 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp index 3ddcda650dd..584c24c821a 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp index 6ffd07c97cb..6b99a8f6298 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp index 1f59ee47ceb..599fd188cb4 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp index c0dc4b61b40..3715a521204 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp index 45d7921c07f..4997a443257 100644 --- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp index b324f953e30..c27805e3ec9 100644 --- a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp +++ b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/interpreter.hpp b/hotspot/src/share/vm/interpreter/interpreter.hpp index 698a2edcd8f..0ab0be74770 100644 --- a/hotspot/src/share/vm/interpreter/interpreter.hpp +++ b/hotspot/src/share/vm/interpreter/interpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp index 1a228e20795..7bc43eccb21 100644 --- a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp +++ b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/linkResolver.hpp b/hotspot/src/share/vm/interpreter/linkResolver.hpp index 9d2bd57965d..3d4c6f40e2a 100644 --- a/hotspot/src/share/vm/interpreter/linkResolver.hpp +++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp index 40717ec5677..4db0a419ca8 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp index dc63589ed42..3e1615e7a22 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp index d38623247e4..f91ecc70213 100644 --- a/hotspot/src/share/vm/interpreter/templateTable.hpp +++ b/hotspot/src/share/vm/interpreter/templateTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/barrierSet.cpp b/hotspot/src/share/vm/memory/barrierSet.cpp index 1209764d452..8cd966f5fc9 100644 --- a/hotspot/src/share/vm/memory/barrierSet.cpp +++ b/hotspot/src/share/vm/memory/barrierSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/classify.cpp b/hotspot/src/share/vm/memory/classify.cpp index afd534d3194..c7beddeef03 100644 --- a/hotspot/src/share/vm/memory/classify.cpp +++ b/hotspot/src/share/vm/memory/classify.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/compactingPermGenGen.cpp b/hotspot/src/share/vm/memory/compactingPermGenGen.cpp index a57994c0f0d..3754628b852 100644 --- a/hotspot/src/share/vm/memory/compactingPermGenGen.cpp +++ b/hotspot/src/share/vm/memory/compactingPermGenGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 84551154a7d..2165c21dfa7 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index 8d67a7988b1..802c646e1d9 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/heap.cpp b/hotspot/src/share/vm/memory/heap.cpp index 2d46b611241..dcf1e41e0e4 100644 --- a/hotspot/src/share/vm/memory/heap.cpp +++ b/hotspot/src/share/vm/memory/heap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp index 545a580c6cf..1042ff43b94 100644 --- a/hotspot/src/share/vm/memory/heapInspection.cpp +++ b/hotspot/src/share/vm/memory/heapInspection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/iterator.hpp b/hotspot/src/share/vm/memory/iterator.hpp index ca36ab4dee9..b5f8e0ef639 100644 --- a/hotspot/src/share/vm/memory/iterator.hpp +++ b/hotspot/src/share/vm/memory/iterator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/restore.cpp b/hotspot/src/share/vm/memory/restore.cpp index db7f9e9eb84..263867e6fff 100644 --- a/hotspot/src/share/vm/memory/restore.cpp +++ b/hotspot/src/share/vm/memory/restore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/serialize.cpp b/hotspot/src/share/vm/memory/serialize.cpp index 629620c8357..65f05bdf846 100644 --- a/hotspot/src/share/vm/memory/serialize.cpp +++ b/hotspot/src/share/vm/memory/serialize.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index c346995f71b..37c17b03861 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/memory/universe.hpp b/hotspot/src/share/vm/memory/universe.hpp index df2b15b4223..86682682ffb 100644 --- a/hotspot/src/share/vm/memory/universe.hpp +++ b/hotspot/src/share/vm/memory/universe.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/arrayKlass.cpp b/hotspot/src/share/vm/oops/arrayKlass.cpp index b17a30570a7..5693f8eb869 100644 --- a/hotspot/src/share/vm/oops/arrayKlass.cpp +++ b/hotspot/src/share/vm/oops/arrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/arrayOop.cpp b/hotspot/src/share/vm/oops/arrayOop.cpp index 896b7bff5e5..62a971a6182 100644 --- a/hotspot/src/share/vm/oops/arrayOop.cpp +++ b/hotspot/src/share/vm/oops/arrayOop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/cpCacheKlass.hpp b/hotspot/src/share/vm/oops/cpCacheKlass.hpp index 4a1532cffef..9a784fd21a7 100644 --- a/hotspot/src/share/vm/oops/cpCacheKlass.hpp +++ b/hotspot/src/share/vm/oops/cpCacheKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/generateOopMap.hpp b/hotspot/src/share/vm/oops/generateOopMap.hpp index 92437407d3c..a635e2abdee 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.hpp +++ b/hotspot/src/share/vm/oops/generateOopMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index 6f6a39a6409..499bf53a96f 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/markOop.hpp b/hotspot/src/share/vm/oops/markOop.hpp index 0dca58494ec..9501c1ed642 100644 --- a/hotspot/src/share/vm/oops/markOop.hpp +++ b/hotspot/src/share/vm/oops/markOop.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/symbol.cpp b/hotspot/src/share/vm/oops/symbol.cpp index ef2040ae051..4c508475064 100644 --- a/hotspot/src/share/vm/oops/symbol.cpp +++ b/hotspot/src/share/vm/oops/symbol.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/symbol.hpp b/hotspot/src/share/vm/oops/symbol.hpp index 63c1df4f126..269c2b72128 100644 --- a/hotspot/src/share/vm/oops/symbol.hpp +++ b/hotspot/src/share/vm/oops/symbol.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/oops/typeArrayOop.hpp b/hotspot/src/share/vm/oops/typeArrayOop.hpp index c39987be5c7..e0133fd9dbc 100644 --- a/hotspot/src/share/vm/oops/typeArrayOop.hpp +++ b/hotspot/src/share/vm/oops/typeArrayOop.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/buildOopMap.cpp b/hotspot/src/share/vm/opto/buildOopMap.cpp index 32a174729c7..fc731604eaa 100644 --- a/hotspot/src/share/vm/opto/buildOopMap.cpp +++ b/hotspot/src/share/vm/opto/buildOopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index 033074dadf6..a23c13d3fac 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp index 7b0b9be59a6..713e3f1d1a1 100644 --- a/hotspot/src/share/vm/opto/c2compiler.cpp +++ b/hotspot/src/share/vm/opto/c2compiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp index 3c363e9ffaf..21b4716b39d 100644 --- a/hotspot/src/share/vm/opto/chaitin.cpp +++ b/hotspot/src/share/vm/opto/chaitin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp index 2122f7ca733..f714d01f03c 100644 --- a/hotspot/src/share/vm/opto/gcm.cpp +++ b/hotspot/src/share/vm/opto/gcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index b20513e67c1..794a0f7171c 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index 2f7a7d5ab05..1302184fcbd 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/idealKit.cpp b/hotspot/src/share/vm/opto/idealKit.cpp index bc7aaaa6a9a..a143a6492e0 100644 --- a/hotspot/src/share/vm/opto/idealKit.cpp +++ b/hotspot/src/share/vm/opto/idealKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/idealKit.hpp b/hotspot/src/share/vm/opto/idealKit.hpp index 8192a446288..1ece1425918 100644 --- a/hotspot/src/share/vm/opto/idealKit.hpp +++ b/hotspot/src/share/vm/opto/idealKit.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index fd3343c3c71..1767bce2d00 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/locknode.hpp b/hotspot/src/share/vm/opto/locknode.hpp index 64a1027a73c..05630e22d4a 100644 --- a/hotspot/src/share/vm/opto/locknode.hpp +++ b/hotspot/src/share/vm/opto/locknode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 4c49ee0e634..9c5a7e034fd 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/loopUnswitch.cpp b/hotspot/src/share/vm/opto/loopUnswitch.cpp index fa8e58a44c8..544b845f8b0 100644 --- a/hotspot/src/share/vm/opto/loopUnswitch.cpp +++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index ae62e609f3f..831c6cb6e42 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 48ff22d10c9..08a04198477 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp index e8d3c99f853..5a34bea6478 100644 --- a/hotspot/src/share/vm/opto/matcher.hpp +++ b/hotspot/src/share/vm/opto/matcher.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp index 0c072fc211a..9608b3382d3 100644 --- a/hotspot/src/share/vm/opto/memnode.hpp +++ b/hotspot/src/share/vm/opto/memnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index a6d87f06ae2..33bfeb68214 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index a57508b418e..1205cc2639d 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/output.hpp b/hotspot/src/share/vm/opto/output.hpp index 51eaa5c5e2b..50b6e76035e 100644 --- a/hotspot/src/share/vm/opto/output.hpp +++ b/hotspot/src/share/vm/opto/output.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index 589a541048e..497042c1f03 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp index 162878e6aa8..808a2bdeb3a 100644 --- a/hotspot/src/share/vm/opto/parse2.cpp +++ b/hotspot/src/share/vm/opto/parse2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp index 3841a42fc53..ce220f01be9 100644 --- a/hotspot/src/share/vm/opto/regmask.cpp +++ b/hotspot/src/share/vm/opto/regmask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/regmask.hpp b/hotspot/src/share/vm/opto/regmask.hpp index 7c3e7182580..e50ff84ca16 100644 --- a/hotspot/src/share/vm/opto/regmask.hpp +++ b/hotspot/src/share/vm/opto/regmask.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index b0544fef2ec..c2ddea145d1 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index c039480118f..7f5f318dbf7 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index 56ea820a734..4d08d50d542 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/precompiled.hpp b/hotspot/src/share/vm/precompiled.hpp index 1b804cbf215..87129d11847 100644 --- a/hotspot/src/share/vm/precompiled.hpp +++ b/hotspot/src/share/vm/precompiled.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/forte.cpp b/hotspot/src/share/vm/prims/forte.cpp index 3c48f01d245..023921c33b6 100644 --- a/hotspot/src/share/vm/prims/forte.cpp +++ b/hotspot/src/share/vm/prims/forte.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/jni_md.h b/hotspot/src/share/vm/prims/jni_md.h index 72aa1dc3977..7fa58291109 100644 --- a/hotspot/src/share/vm/prims/jni_md.h +++ b/hotspot/src/share/vm/prims/jni_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/jvm_misc.hpp b/hotspot/src/share/vm/prims/jvm_misc.hpp index 18795124660..2b46e362393 100644 --- a/hotspot/src/share/vm/prims/jvm_misc.hpp +++ b/hotspot/src/share/vm/prims/jvm_misc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp index fa08cf712d0..d12d69cee71 100644 --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp index 42cb9f23986..60a5ffb0956 100644 --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/jvmtiEventController.cpp b/hotspot/src/share/vm/prims/jvmtiEventController.cpp index ccb22b550b8..6b7b72b7ae6 100644 --- a/hotspot/src/share/vm/prims/jvmtiEventController.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEventController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp index bf0778b535a..c5f4bdd4b84 100644 --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/prims/jvmtiTagMap.hpp b/hotspot/src/share/vm/prims/jvmtiTagMap.hpp index 9abdd9b37a1..2a460edc1e0 100644 --- a/hotspot/src/share/vm/prims/jvmtiTagMap.hpp +++ b/hotspot/src/share/vm/prims/jvmtiTagMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/deoptimization.hpp b/hotspot/src/share/vm/runtime/deoptimization.hpp index c62616fcb74..d515339d64e 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.hpp +++ b/hotspot/src/share/vm/runtime/deoptimization.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp index d6c80c7374a..bff43108439 100644 --- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp +++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp index ced38aed21c..00f8864a807 100644 --- a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp +++ b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/fieldType.cpp b/hotspot/src/share/vm/runtime/fieldType.cpp index 00247f1723e..ef929b9c559 100644 --- a/hotspot/src/share/vm/runtime/fieldType.cpp +++ b/hotspot/src/share/vm/runtime/fieldType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/fieldType.hpp b/hotspot/src/share/vm/runtime/fieldType.hpp index 13ecf15a643..0da4f370622 100644 --- a/hotspot/src/share/vm/runtime/fieldType.hpp +++ b/hotspot/src/share/vm/runtime/fieldType.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp index 4efc3a936d1..3c100aa4c98 100644 --- a/hotspot/src/share/vm/runtime/fprofiler.cpp +++ b/hotspot/src/share/vm/runtime/fprofiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/fprofiler.hpp b/hotspot/src/share/vm/runtime/fprofiler.hpp index 2731dea7b6b..60e51d2eb2f 100644 --- a/hotspot/src/share/vm/runtime/fprofiler.hpp +++ b/hotspot/src/share/vm/runtime/fprofiler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp index 4750f3a5a69..a48c2af37ea 100644 --- a/hotspot/src/share/vm/runtime/frame.hpp +++ b/hotspot/src/share/vm/runtime/frame.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/frame.inline.hpp b/hotspot/src/share/vm/runtime/frame.inline.hpp index 739a50b9a25..b80b042dcbe 100644 --- a/hotspot/src/share/vm/runtime/frame.inline.hpp +++ b/hotspot/src/share/vm/runtime/frame.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/handles.hpp b/hotspot/src/share/vm/runtime/handles.hpp index de069d34acc..d9d71e67010 100644 --- a/hotspot/src/share/vm/runtime/handles.hpp +++ b/hotspot/src/share/vm/runtime/handles.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/icache.hpp b/hotspot/src/share/vm/runtime/icache.hpp index 7ffce5b140d..d460a0ffba6 100644 --- a/hotspot/src/share/vm/runtime/icache.hpp +++ b/hotspot/src/share/vm/runtime/icache.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.cpp b/hotspot/src/share/vm/runtime/interfaceSupport.cpp index 33c6b3eb8c3..cec374fa69d 100644 --- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp +++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.hpp b/hotspot/src/share/vm/runtime/interfaceSupport.hpp index 02e8e7bc5f1..b119006035d 100644 --- a/hotspot/src/share/vm/runtime/interfaceSupport.hpp +++ b/hotspot/src/share/vm/runtime/interfaceSupport.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/javaCalls.cpp b/hotspot/src/share/vm/runtime/javaCalls.cpp index 79ecaa480c8..aaa2805e7e7 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.cpp +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp index 535bcc15957..af29462dd9f 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.hpp +++ b/hotspot/src/share/vm/runtime/javaCalls.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp index af5d7728411..501e59e1c60 100644 --- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp +++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/jniHandles.cpp b/hotspot/src/share/vm/runtime/jniHandles.cpp index 31595688fe5..e9c791d51dd 100644 --- a/hotspot/src/share/vm/runtime/jniHandles.cpp +++ b/hotspot/src/share/vm/runtime/jniHandles.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/objectMonitor.cpp b/hotspot/src/share/vm/runtime/objectMonitor.cpp index 2aade711829..e2b4bf2d760 100644 --- a/hotspot/src/share/vm/runtime/objectMonitor.cpp +++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/reflection.hpp b/hotspot/src/share/vm/runtime/reflection.hpp index 1f669349543..90a3c0c0e3c 100644 --- a/hotspot/src/share/vm/runtime/reflection.hpp +++ b/hotspot/src/share/vm/runtime/reflection.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/reflectionUtils.hpp b/hotspot/src/share/vm/runtime/reflectionUtils.hpp index 712aa51fb3c..c9eecaa2324 100644 --- a/hotspot/src/share/vm/runtime/reflectionUtils.hpp +++ b/hotspot/src/share/vm/runtime/reflectionUtils.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/registerMap.hpp b/hotspot/src/share/vm/runtime/registerMap.hpp index da597d40ed4..5dd677ac4e1 100644 --- a/hotspot/src/share/vm/runtime/registerMap.hpp +++ b/hotspot/src/share/vm/runtime/registerMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/rframe.cpp b/hotspot/src/share/vm/runtime/rframe.cpp index f99d4d1a237..c52d16ff3d5 100644 --- a/hotspot/src/share/vm/runtime/rframe.cpp +++ b/hotspot/src/share/vm/runtime/rframe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index bd9a9e6eb32..bc729c4cd43 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/signature.cpp b/hotspot/src/share/vm/runtime/signature.cpp index d13d3e10e10..cb4af90385f 100644 --- a/hotspot/src/share/vm/runtime/signature.cpp +++ b/hotspot/src/share/vm/runtime/signature.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/signature.hpp b/hotspot/src/share/vm/runtime/signature.hpp index 11ab3e2d1e4..2d7a35dd03d 100644 --- a/hotspot/src/share/vm/runtime/signature.hpp +++ b/hotspot/src/share/vm/runtime/signature.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/stackValueCollection.cpp b/hotspot/src/share/vm/runtime/stackValueCollection.cpp index bc391e599aa..110f7120d4f 100644 --- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp +++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp index bbb947737be..0b24def2497 100644 --- a/hotspot/src/share/vm/runtime/statSampler.cpp +++ b/hotspot/src/share/vm/runtime/statSampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp index ba395194f7f..63fa6730f2c 100644 --- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp +++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp index c845b1761b6..535e337f378 100644 --- a/hotspot/src/share/vm/runtime/sweeper.cpp +++ b/hotspot/src/share/vm/runtime/sweeper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp index fd0b3da40ec..d51be5c2b57 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.cpp +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp index 2ca4260d902..c936216871b 100644 --- a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp +++ b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/vframe.cpp b/hotspot/src/share/vm/runtime/vframe.cpp index 9624c4983e1..323d7359847 100644 --- a/hotspot/src/share/vm/runtime/vframe.cpp +++ b/hotspot/src/share/vm/runtime/vframe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/vmStructs.hpp b/hotspot/src/share/vm/runtime/vmStructs.hpp index 7bf6d93d064..355746eb420 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.hpp +++ b/hotspot/src/share/vm/runtime/vmStructs.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/vm_operations.cpp b/hotspot/src/share/vm/runtime/vm_operations.cpp index 8a0cbe785b3..cb5d1381480 100644 --- a/hotspot/src/share/vm/runtime/vm_operations.cpp +++ b/hotspot/src/share/vm/runtime/vm_operations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp index 77ffeb3bc63..77f262f6eda 100644 --- a/hotspot/src/share/vm/runtime/vm_operations.hpp +++ b/hotspot/src/share/vm/runtime/vm_operations.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp index 4afc8cea3b9..cd44c03da26 100644 --- a/hotspot/src/share/vm/runtime/vm_version.cpp +++ b/hotspot/src/share/vm/runtime/vm_version.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp index 28b243f41ba..6fcbb6ac4df 100644 --- a/hotspot/src/share/vm/runtime/vm_version.hpp +++ b/hotspot/src/share/vm/runtime/vm_version.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp index 6ebafe96509..71d107d8046 100644 --- a/hotspot/src/share/vm/services/attachListener.cpp +++ b/hotspot/src/share/vm/services/attachListener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/services/attachListener.hpp b/hotspot/src/share/vm/services/attachListener.hpp index 68cd834fe65..ba8fb93227b 100644 --- a/hotspot/src/share/vm/services/attachListener.hpp +++ b/hotspot/src/share/vm/services/attachListener.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/services/classLoadingService.cpp b/hotspot/src/share/vm/services/classLoadingService.cpp index 83979a8e57d..0f3ad684cbe 100644 --- a/hotspot/src/share/vm/services/classLoadingService.cpp +++ b/hotspot/src/share/vm/services/classLoadingService.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/services/management.hpp b/hotspot/src/share/vm/services/management.hpp index ec2d77ce088..1598f2261e4 100644 --- a/hotspot/src/share/vm/services/management.hpp +++ b/hotspot/src/share/vm/services/management.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/services/memoryManager.cpp b/hotspot/src/share/vm/services/memoryManager.cpp index 41b8d82f84b..e13b6437645 100644 --- a/hotspot/src/share/vm/services/memoryManager.cpp +++ b/hotspot/src/share/vm/services/memoryManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/services/memoryPool.cpp b/hotspot/src/share/vm/services/memoryPool.cpp index 6036bbe70b5..8a83606b026 100644 --- a/hotspot/src/share/vm/services/memoryPool.cpp +++ b/hotspot/src/share/vm/services/memoryPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/services/memoryService.cpp b/hotspot/src/share/vm/services/memoryService.cpp index ee9471083a9..eca4d6418b7 100644 --- a/hotspot/src/share/vm/services/memoryService.cpp +++ b/hotspot/src/share/vm/services/memoryService.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp b/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp index e4b3347c5c9..ef4337233f5 100644 --- a/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp +++ b/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/share/vm/utilities/copy.hpp b/hotspot/src/share/vm/utilities/copy.hpp index 8772fe44f06..3dcbfeee2ce 100644 --- a/hotspot/src/share/vm/utilities/copy.hpp +++ b/hotspot/src/share/vm/utilities/copy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index 204b360b15b..cb5efc08d07 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp index 75a9a27bd6b..63c69e63f64 100644 --- a/hotspot/src/share/vm/utilities/debug.hpp +++ b/hotspot/src/share/vm/utilities/debug.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/elfSymbolTable.cpp b/hotspot/src/share/vm/utilities/elfSymbolTable.cpp index 22773aa546b..0fa039c4fbf 100644 --- a/hotspot/src/share/vm/utilities/elfSymbolTable.cpp +++ b/hotspot/src/share/vm/utilities/elfSymbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/exceptions.cpp b/hotspot/src/share/vm/utilities/exceptions.cpp index 1d6ab0835ca..5d8a33b4d2e 100644 --- a/hotspot/src/share/vm/utilities/exceptions.cpp +++ b/hotspot/src/share/vm/utilities/exceptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/exceptions.hpp b/hotspot/src/share/vm/utilities/exceptions.hpp index 8651604be5c..5649f4e600d 100644 --- a/hotspot/src/share/vm/utilities/exceptions.hpp +++ b/hotspot/src/share/vm/utilities/exceptions.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp index cc244b4a78d..4ba099ace3b 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp index e11fa58fa90..fca43e0d787 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp index 2d6d7daf853..36549993a9e 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp index aad68f13760..7e937966c8d 100644 --- a/hotspot/src/share/vm/utilities/hashtable.cpp +++ b/hotspot/src/share/vm/utilities/hashtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/hashtable.hpp b/hotspot/src/share/vm/utilities/hashtable.hpp index 21747e6855b..a4f0e9012d4 100644 --- a/hotspot/src/share/vm/utilities/hashtable.hpp +++ b/hotspot/src/share/vm/utilities/hashtable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/hashtable.inline.hpp b/hotspot/src/share/vm/utilities/hashtable.inline.hpp index 09995537b2b..8cd2f89d0c8 100644 --- a/hotspot/src/share/vm/utilities/hashtable.inline.hpp +++ b/hotspot/src/share/vm/utilities/hashtable.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/ostream.hpp b/hotspot/src/share/vm/utilities/ostream.hpp index 047cdac5821..b5eeb2a8307 100644 --- a/hotspot/src/share/vm/utilities/ostream.hpp +++ b/hotspot/src/share/vm/utilities/ostream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp index 79f293444d9..5527e2fb62c 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.hpp +++ b/hotspot/src/share/vm/utilities/taskqueue.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/utf8.cpp b/hotspot/src/share/vm/utilities/utf8.cpp index c8c630032b9..be7d1881546 100644 --- a/hotspot/src/share/vm/utilities/utf8.cpp +++ b/hotspot/src/share/vm/utilities/utf8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/utf8.hpp b/hotspot/src/share/vm/utilities/utf8.hpp index 182b6335e1e..c56d550ec9d 100644 --- a/hotspot/src/share/vm/utilities/utf8.hpp +++ b/hotspot/src/share/vm/utilities/utf8.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/xmlstream.cpp b/hotspot/src/share/vm/utilities/xmlstream.cpp index 8d6a0483970..c82010c1ba9 100644 --- a/hotspot/src/share/vm/utilities/xmlstream.cpp +++ b/hotspot/src/share/vm/utilities/xmlstream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 diff --git a/hotspot/src/share/vm/utilities/xmlstream.hpp b/hotspot/src/share/vm/utilities/xmlstream.hpp index a2f39317a4a..98fec3c427f 100644 --- a/hotspot/src/share/vm/utilities/xmlstream.hpp +++ b/hotspot/src/share/vm/utilities/xmlstream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. 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 From 4819e529c3e2630ae46499d3b82fcc6433c8b0e8 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 5 Apr 2011 17:24:44 -0700 Subject: [PATCH 138/168] 7033960: Do not check for mapfiles when fastdebug building Reviewed-by: dcubed --- jdk/make/common/shared/Defs-linux.gmk | 11 +++++++++-- jdk/make/common/shared/Defs-solaris.gmk | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/jdk/make/common/shared/Defs-linux.gmk b/jdk/make/common/shared/Defs-linux.gmk index 4960ecd4de9..ecdf5d77ee4 100644 --- a/jdk/make/common/shared/Defs-linux.gmk +++ b/jdk/make/common/shared/Defs-linux.gmk @@ -187,6 +187,12 @@ HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH) # Special define for checking the binaries +# Debug builds should downgrade warnings to just info +MAPFILE_WARNING-DBG=INFO +MAPFILE_WARNING-OPT=WARNING +MAPFILE_WARNING-=WARNING +MAPFILE_WARNING=$(MAPFILE_WARNING-$(VARIANT)) + # Macro to check it's input file for banned dependencies and verify the # binary built properly. Relies on process exit code. ifndef CROSS_COMPILE_ARCH @@ -194,7 +200,7 @@ define binary_file_verification # binary_file ( \ $(ECHO) "Checking for mapfile use in: $1" && \ if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \ - $(ECHO) "WARNING: File was not built with a mapfile: $1"; \ + $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \ fi && \ $(ECHO) "Library loads for: $1" && \ $(LDD) $1 && \ @@ -208,4 +214,5 @@ define binary_file_verification $(ECHO) "Skipping binary file verification for cross-compile build" \ ) endef -endif \ No newline at end of file +endif + diff --git a/jdk/make/common/shared/Defs-solaris.gmk b/jdk/make/common/shared/Defs-solaris.gmk index 7e5c90a20ba..be18063509c 100644 --- a/jdk/make/common/shared/Defs-solaris.gmk +++ b/jdk/make/common/shared/Defs-solaris.gmk @@ -188,6 +188,12 @@ HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH) # Special define for checking the binaries +# Debug builds should downgrade warnings to just info +MAPFILE_WARNING-DBG=INFO +MAPFILE_WARNING-OPT=WARNING +MAPFILE_WARNING-=WARNING +MAPFILE_WARNING=$(MAPFILE_WARNING-$(VARIANT)) + # Macro to check it's input file for banned dependencies and verify the # binary built properly. Relies on process exit code. ifndef CROSS_COMPILE_ARCH @@ -195,7 +201,7 @@ define binary_file_verification # binary_file ( \ $(ECHO) "Checking for mapfile use in: $1" && \ if [ "`$(NM) -g -D $1 | $(EGREP) -v 'UNDEF' | $(EGREP) 'SUNWprivate'`" = "" ] ; then \ - $(ECHO) "WARNING: File was not built with a mapfile: $1"; \ + $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \ fi && \ $(ECHO) "Library loads for: $1" && \ $(LDD) $1 && \ @@ -209,4 +215,5 @@ define binary_file_verification $(ECHO) "Skipping binary file verification for cross-compile build" \ ) endef -endif \ No newline at end of file +endif + From e858be00387c027ac6aa93c8608288d6659c04ba Mon Sep 17 00:00:00 2001 From: Yong Jeffrey Huang Date: Tue, 5 Apr 2011 21:09:17 -0700 Subject: [PATCH 139/168] 7020583: Some currency names are missing in some locales Reviewed-by: naoto --- .../resources/CurrencyNames_de.properties | 178 ++++--- .../resources/CurrencyNames_es.properties | 103 ++-- .../resources/CurrencyNames_fr.properties | 288 +++++----- .../resources/CurrencyNames_it.properties | 103 ++-- .../resources/CurrencyNames_ja.properties | 105 ++-- .../resources/CurrencyNames_ko.properties | 132 +++-- .../resources/CurrencyNames_sv.properties | 455 ++++++++-------- .../resources/CurrencyNames_zh_CN.properties | 105 ++-- .../resources/CurrencyNames_zh_TW.properties | 173 +++--- jdk/test/sun/text/resources/LocaleData | 496 ++++++++++++++++++ .../sun/text/resources/LocaleDataTest.java | 2 +- 11 files changed, 1474 insertions(+), 666 deletions(-) diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_de.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_de.properties index 609472e3398..b77e202a121 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_de.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_de.properties @@ -1,49 +1,70 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# adp=Andorranische Pesete aed=UAE Dirham -afa=Afghani (1927-2002) -afn=Afghani all=Lek amd=Dram ang=Niederl. Antillen Gulden @@ -52,7 +73,8 @@ ars=Argentinischer Peso ats=\u00d6sterreichischer Schilling aud=Australischer Dollar awg=Aruba Florin -azm=Aserbeidschan Manat +azm=Aserbaidschan-Manat (1993-2006) +azn=Aserbaidschan-Manat bam=Konvertierbare Mark bbd=Barbados-Dollar bdt=Taka @@ -63,7 +85,6 @@ bhd=Bahrain-Dinar bif=Burundi-Franc bmd=Bermuda-Dollar bnd=Brunei-Dollar -bob=Boliviano bov=Mvdol brl=Real bsd=Bahama-Dollar @@ -80,11 +101,11 @@ clp=Chilenischer Peso cny=Renminbi Yuan cop=Kolumbianischer Peso crc=Costa Rica Colon +csd=Alter Serbischer Dinar cup=Kubanischer Peso cve=Kap Verde Escudo -cyp=Zypern Pfund +cyp=Zypern-Pfund czk=Tschechische Krone -dem=Deutsche Mark djf=Dschibuti-Franc dkk=D\u00e4nische Krone dop=Dominikanischer Peso @@ -92,24 +113,24 @@ dzd=Algerischer Dinar eek=Estnische Krone egp=\u00c4gyptisches Pfund ern=Nakfa -esp=Spanische Pesete +esp=Spanische Peseta etb=Birr -eur=Euro fim=Finnische Mark -fjd=Fidschi Dollar -fkp=Falkland Pfund +fjd=Fidschi-Dollar +fkp=Falkland-Pfund frf=Franz\u00f6sischer Franc gbp=Pfund Sterling gel=Georgischer Lari ghc=Cedi -gip=Gibraltar Pfund +ghs=Ghanaische Cedi +gip=Gibraltar-Pfund gmd=Dalasi -gnf=Guinea Franc +gnf=Guinea-Franc grd=Griechische Drachme gtq=Quetzal gwp=Guinea Bissau Peso -gyd=Guyana Dollar -hkd=Hongkong Dollar +gyd=Guyana-Dollar +hkd=Hongkong-Dollar hnl=Lempira hrk=Kuna htg=Gourde @@ -121,11 +142,11 @@ inr=Indische Rupie iqd=Irak Dinar irr=Rial isk=Isl\u00e4ndische Krone -itl=Italienische Lire -jmd=Jamaika Dollar +itl=Italienische Lira +jmd=Jamaika-Dollar jod=Jordanischer Dinar jpy=Yen -kes=Kenia Schilling +kes=Kenia-Schilling kgs=Som khr=Riel kmf=Komoren Franc @@ -146,27 +167,26 @@ lyd=Libyscher Dinar mad=Marokkanischer Dirham mdl=Moldau Leu mga=Madagaskar Ariary -mgf=Madagaskar Franc +mgf=Madagaskar-Franc mkd=Denar mmk=Kyat mnt=Tugrik mop=Pataca mro=Ouguiya mtl=Maltesische Lira -mur=Mauritius Rupie +mur=Mauritius-Rupie mvr=Rufiyaa -mwk=Malawi Kwacha mxn=Mexikanischer Peso -mxv=Mexican Unidad de Inversion (UDI) myr=Malaysischer Ringgit -mzm=Metical -nad=Namibia Dollar +mzm=Alter Metical +mzn=Metical +nad=Namibia-Dollar ngn=Naira nio=Gold-Cordoba nlg=Holl\u00e4ndischer Gulden nok=Norwegische Krone npr=Nepalesische Rupie -nzd=Neuseeland Dollar +nzd=Neuseeland-Dollar omr=Rial Omani pab=Balboa pen=Neuer Sol @@ -178,23 +198,25 @@ pte=Portugiesischer Escudo pyg=Guarani qar=Katar Riyal rol=Leu +ron=Rum\u00e4nischer Leu +rsd=Serbischer Dinar rub=Russischer Rubel (neu) rur=Russischer Rubel (alt) -rwf=Ruanda Franc -sar=Saudi Riyal -sbd=Salomonen Dollar -scr=Seychellen Rupie +rwf=Ruanda-Franc +sbd=Salomonen-Dollar +scr=Seychellen-Rupie sdd=Sudanesischer Dinar +sdg=Sudanesisches Pfund sek=Schwedische Krone -sgd=Singapur Dollar +sgd=Singapur-Dollar shp=St. Helena Pfund sit=Tolar skk=Slowakische Krone sll=Leone -sos=Somalia Schilling +sos=Somalia-Schilling +srd=Surinamischer Dollar srg=Suriname Gulden std=Dobra -svc=El Salvador Colon syp=Syrisches Pfund szl=Lilangeni thb=Baht @@ -202,26 +224,29 @@ tjs=Tadschikistan Somoni tmm=Turkmenistan-Manat tnd=Tunesischer Dinar top=Pa\u02bbanga -tpe=Timor Escudo -trl=T\u00fcrkische Lira -try=Neue T\u00fcrkische Lira -ttd=Trinidad und Tobago Dollar -twd=Neuer Taiwan Dollar -tzs=Tansania Schilling +tpe=Timor-Escudo +trl=Alte T\u00fcrkische Lira +try=T\u00fcrkische Lira +ttd=Trinidad- und Tobago-Dollar +twd=Neuer Taiwan-Dollar +tzs=Tansania-Schilling uah=Hryvnia -ugx=Uganda Schilling -usd=US Dollar +ugx=Uganda-Schilling +usd=US-Dollar usn=US Dollar (N\u00e4chster Tag) uss=US Dollar (Gleicher Tag) uyu=Uruguayischer Peso uzs=Usbekistan Sum veb=Bolivar +vef=Bol\u00edvar Fuerte vnd=Dong vuv=Vatu wst=Tala xaf=CFA Franc (\u00c4quatorial) -xau=Gold +xag=Unze Silber +xau=Unze Gold xba=Europ\u00e4ische Rechnungseinheit +xbb=Europ\u00e4ische W\u00e4hrungseinheit (XBB) xbc=Europ\u00e4ische Rechnungseinheit (XBC) xbd=Europ\u00e4ische Rechnungseinheit (XBD) xcd=Ostkaribischer Dollar @@ -229,9 +254,12 @@ xdr=Sonderziehungsrechte xfo=Franz\u00f6sischer Gold-Franc xfu=Franz\u00f6sischer UIC-Franc xof=CFA Franc (West) -xpf=CFP Franc -yer=Jemen Rial +xpd=Unze Palladium +xpt=Unze Platin +xts=Testw\u00e4hrung +xxx=Unbekannte W\u00e4hrung +yer=Jemen-Rial yum=Neuer Dinar -zar=Rand +zar=S\u00fcdafrikanischer Rand zmk=Kwacha -zwd=Simbabwe Dollar +zwd=Simbabwe-Dollar diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_es.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_es.properties index 5562e318050..c973b4847a2 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_es.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_es.properties @@ -1,47 +1,70 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# adp=peseta andorrana -aed=dirham de los Emiratos \u00c1rabes Unidos +aed=d\u00edrham de los Emiratos \u00c1rabes Unidos afa=afgani (1927-2002) afn=afgani all=lek alban\u00e9s @@ -52,7 +75,8 @@ ars=peso argentino ats=chel\u00edn austriaco aud=d\u00f3lar australiano awg=flor\u00edn de Aruba -azm=manat azer\u00ed +azm=manat azer\u00ed (1993-2006) +azn=manat azer\u00ed bam=marco convertible de Bosnia-Herzegovina bbd=d\u00f3lar de Barbados bdt=taka de Bangladesh @@ -80,7 +104,7 @@ clp=peso chileno cny=yuan renminbi chino cop=peso colombiano crc=col\u00f3n costarricense -csd=dinar serbio +csd=antiguo dinar serbio cup=peso cubano cve=escudo de Cabo Verde cyp=libra chipriota @@ -102,7 +126,8 @@ fkp=libra de las Islas Malvinas frf=franco franc\u00e9s gbp=libra esterlina brit\u00e1nica gel=lari georgiano -ghc=cedi ghan\u00e9s +ghc=cedi ghan\u00e9s (1979-2007) +ghs=cedi ghan\u00e9s gip=libra de Gibraltar gmd=dalasi gambiano gnf=franco guineano @@ -160,7 +185,8 @@ mwk=kwacha de Malawi mxn=peso mexicano mxv=unidad de inversi\u00f3n (UDI) mexicana myr=ringgit malasio -mzm=metical mozambique\u00f1o +mzm=antiguo metical mozambique\u00f1o +mzn=metical mozambique\u00f1o nad=d\u00f3lar de Namibia ngn=naira nigeriano nio=c\u00f3rdoba oro nicarag\u00fcense @@ -180,6 +206,7 @@ pyg=guaran\u00ed paraguayo qar=riyal de Qatar rol=antiguo leu rumano ron=leu rumano +rsd=dinar serbio rub=rublo ruso rur=rublo ruso (1991-1998) rwf=franco ruand\u00e9s @@ -187,6 +214,7 @@ sar=riyal saud\u00ed sbd=d\u00f3lar de las Islas Salom\u00f3n scr=rupia de Seychelles sdd=dinar sudan\u00e9s +sdg=libra sudanesa sek=corona sueca sgd=d\u00f3lar singapurense shp=libra de Santa Elena @@ -206,7 +234,7 @@ tmm=manat turcomano tnd=dinar tunecino top=pa\u02bbanga tongano tpe=escudo timorense -trl=lira turca +trl=lira turca antigua try=nueva lira turca ttd=d\u00f3lar de Trinidad y Tobago twd=nuevo d\u00f3lar taiwan\u00e9s @@ -219,6 +247,7 @@ uss=d\u00f3lar estadounidense (mismo d\u00eda) uyu=peso uruguayo uzs=sum uzbeko veb=bol\u00edvar venezolano +vef=bol\u00edvar fuerte venezolano vnd=dong vietnamita vuv=vatu vanuatuense wst=tala samoano diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_fr.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_fr.properties index fda23b689e7..3bea1c0216f 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_fr.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_fr.properties @@ -1,224 +1,256 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# adp=peseta andorrane aed=dirham des \u00c9mirats arabes unis -afa=afghani [AFA] +afa=afghani (1927\u20132002) afn=afghani -all=lek +all=lek albanais amd=dram arm\u00e9nien -ang=florin des Antilles +ang=florin antillais aoa=kwanza angolais ars=peso argentin ats=schilling autrichien aud=dollar australien -awg=florin d\u2019Aruba -azm=manat az\u00e9ri -bam=mark bosniaque convertible -bbd=dollar de Barbade -bdt=taka +awg=florin arubais +azm=manat az\u00e9ri (1993-2006) +azn=manat az\u00e9ri +bam=mark convertible bosniaque +bbd=dollar barbadien +bdt=taka bangladeshi bef=franc belge -bgl=lev -bgn=nouveau lev -bhd=dinar de Bahre\u00efn -bif=franc du Burundi -bmd=dollar des Bermudes -bnd=dollar de Brunei +bgl=lev bulgare (1962\u20131999) +bgn=nouveau lev bulgare +bhd=dinar bahre\u00efni +bif=franc burundais +bmd=dollar bermudien +bnd=dollar brun\u00e9ien bob=boliviano -bov=mvdol -brl=r\u00e9al -bsd=dollar des Bahamas -btn=ngultrum -bwp=pula +bov=mvdol bolivien +brl=r\u00e9al br\u00e9silien +bsd=dollar baham\u00e9en +btn=ngultrum bouthanais +bwp=pula botswanais byb=nouveau rouble bi\u00e9lorusse (1994-1999) byr=rouble bi\u00e9lorusse -bzd=dollar de Belize +bzd=dollar b\u00e9liz\u00e9en cad=dollar canadien cdf=franc congolais chf=franc suisse clf=unit\u00e9 d\u2019investissement chilienne clp=peso chilien -cny=Yuan Ren-min-bi +cny=yuan renminbi chinois cop=peso colombien -crc=colon de Costa Rica -csd=dinar serbe +crc=col\u00f3n costaricain +csd=dinar serbo-mont\u00e9n\u00e9grin cup=peso cubain -cve=escudo du Cap-Vert -cyp=livre cypriote +cve=escudo capverdien +cyp=livre chypriote czk=couronne tch\u00e8que -dem=deutsche mark -djf=franc de Djibouti +dem=mark allemand +djf=franc djiboutien dkk=couronne danoise dop=peso dominicain dzd=dinar alg\u00e9rien eek=couronne estonienne egp=livre \u00e9gyptienne -ern=Eritrean Nakfa +ern=nafka \u00e9rythr\u00e9en esp=peseta espagnole -etb=birr +etb=birr \u00e9thiopien eur=euro fim=mark finlandais -fjd=dollar de Fidji -fkp=livre des Falkland (Malvinas) +fjd=dollar fidjien +fkp=livre des Falkland frf=franc fran\u00e7ais gbp=livre sterling -gel=lari +gel=lari g\u00e9orgien ghc=c\u00e9di +ghs=c\u00e9di ghan\u00e9en gip=livre de Gibraltar -gmd=dalasie +gmd=dalasi gambien gnf=franc guin\u00e9en -grd=drachme -gtq=quetzal -gwp=peso de Guin\u00e9e-Bissau +grd=drachme grecque +gtq=quetzal guat\u00e9malt\u00e8que +gwp=peso bissau-guin\u00e9en gyd=dollar du Guyana hkd=dollar de Hong Kong -hnl=lempira -hrk=kuna -htg=gourde -huf=forint -idr=rupiah +hnl=lempira hondurien +hrk=kuna croate +htg=gourde ha\u00eftienne +huf=forint hongrois +idr=roupie indon\u00e9sienne iep=livre irlandaise +ils=nouveau shekel isra\u00e9lien inr=roupie indienne +iqd=dinar irakien irr=rial iranien isk=couronne islandaise itl=lire italienne jmd=dollar jama\u00efcain jod=dinar jordanien -jpy=yen -kes=shilling du Kenya -kgs=som -khr=riel -kmf=franc des Comores +jpy=yen japonais +kes=shilling k\u00e9nyan +kgs=som kirghize +khr=riel cambodgien +kmf=franc comorien kpw=won nord-cor\u00e9en krw=won sud-cor\u00e9en +kwd=dinar kowe\u00eftien kyd=dollar des \u00eeles Ca\u00efmanes -kzt=tenge du Kazakhstan -lak=kip +kzt=tenge kazakh +lak=kip loatien lbp=livre libanaise -lkr=roupie de Sri Lanka +lkr=roupie srilankaise lrd=dollar lib\u00e9rien -lsl=loti +lsl=loti lesothan ltl=litas lituanien luf=franc luxembourgeois lvl=lats letton lyd=dinar lybien mad=dirham marocain mdl=leu moldave -mga=ariary +mga=ariary malgache mgf=franc malgache -mkd=denar -mmk=Myanmar Kyat -mnt=tugrik -mop=pataca -mro=ouguija +mkd=denar mac\u00e9donien +mmk=kyat myanmarais +mnt=tugrik mongol +mop=pataca macanaise +mro=ouguiya mauritanien mtl=lire maltaise mur=roupie mauricienne -mvr=roupie des Maldives -mwk=kwacha [MWK] +mvr=rufiyaa maldivienne +mwk=kwacha malawite mxn=peso mexicain mxv=unit\u00e9 de conversion mexicaine (UDI) -myr=ringgit +myr=ringgit malais mzm=m\u00e9tical +mzn=metical mozambicain nad=dollar namibien -ngn=naira -nio=cordoba d\u2019or +ngn=naira nig\u00e9rian +nio=c\u00f3rdoba oro nicaraguayen nlg=florin n\u00e9erlandais nok=couronne norv\u00e9gienne -npr=roupie du N\u00e9pal +npr=roupie n\u00e9palaise nzd=dollar n\u00e9o-z\u00e9landais omr=rial omani -pab=balboa +pab=balboa panam\u00e9en pen=nouveau sol p\u00e9ruvien -pgk=kina +pgk=kina papouan-n\u00e9o-guin\u00e9en php=peso philippin -pkr=roupie du Pakistan -pln=zloty +pkr=roupie pakistanaise +pln=zloty polonais pte=escudo portugais -pyg=guarani -qar=rial du Qatar +pyg=guaran\u00ed paraguayen +qar=rial qatari rol=ancien leu roumain -ron=nouveau leu roumain -rub=rouble -rur=rouble de Russie (1991-1998) +ron=leu roumain +rsd=dinar serbe +rub=rouble russe +rur=rouble russe (1991\u20131998) rwf=franc rwandais sar=rial saoudien -sbd=dollar des \u00celes Salomon +sbd=dollar des \u00eeles Salomon scr=roupie des Seychelles sdd=dinar soudanais +sdg=livre soudanaise sek=couronne su\u00e9doise sgd=dollar de Singapour shp=livre de Sainte-H\u00e9l\u00e8ne -sit=tolar +sit=tolar slov\u00e8ne skk=couronne slovaque -sll=l\u00e9one -sos=shilling de Somalie +sll=leone sierra-l\u00e9onais +sos=shilling somalien srd=dollar surinamais -srg=florin du Surinam -std=dobra -svc=colon salvadorien +srg=florin surinamais +std=dobra santom\u00e9en +svc=col\u00f3n salvadorien syp=livre syrienne -szl=lilangeni -thb=baht -tjs=somoni du Tadjikistan -tmm=Turkmenistan Manat +szl=lilangeni swazi +thb=baht tha\u00eflandais +tjs=somoni tadjik +tmm=manat turkm\u00e8ne tnd=dinar tunisien -top=pa\u02bbanga -tpe=escudo de Timor +top=pa\u2019anga tongan +tpe=escudo timorais trl=livre turque try=nouvelle livre turque -ttd=dollar de la Trinit\u00e9 -twd=dollar ta\u00efwanais -tzs=shilling de Tanzanie -uah=hryvnia +ttd=dollar trinidadien +twd=nouveau dollar ta\u00efwanais +tzs=shilling tanzanien +uah=hryvnia ukrainienne ugx=shilling ougandais usd=dollar des \u00c9tats-Unis usn=dollar des Etats-Unis (jour suivant) uss=dollar des Etats-Unis (jour m\u00eame) uyu=peso uruguayen -uzs=sum +uzs=sum ouzbek veb=bolivar -vnd=dong -vuv=vatu -wst=tala +vef=bolivar fuerte v\u00e9n\u00e9zu\u00e9lien +vnd=d\u00f4ng vietnamien +vuv=vatu vanuatuan +wst=tala samoan xaf=franc CFA (BEAC) xag=argent xau=or @@ -234,8 +266,10 @@ xof=franc CFA (BCEAO) xpd=palladium xpf=franc CFP xpt=platine -yer=riyal du Y\u00e9men +xts=(devise de test) +xxx=devise inconnue ou non valide +yer=rial y\u00e9m\u00e9nite yum=dinar yougoslave Noviy -zar=rand -zmk=kwacha -zwd=dollar du Zimbabwe +zar=rand sud-africain +zmk=kwacha zambien +zwd=dollar zimbabw\u00e9en diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_it.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_it.properties index de8f523336e..b2953430b5a 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_it.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_it.properties @@ -1,45 +1,68 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# adp=Peseta Andorrana aed=Dirham degli Emirati Arabi Uniti afa=Afgani (1927-2002) @@ -52,7 +75,7 @@ ars=Peso Argentino ats=Scellino Austriaco aud=Dollaro Australiano awg=Fiorino di Aruba -azm=Manat Azero +azm=Manat Azero (1993-2006) bam=Marco Conv. Bosnia-Erzegovina bbd=Dollaro di Barbados bdt=Taka Bangladese @@ -63,7 +86,6 @@ bhd=Dinaro del Bahraini bif=Franco del Burundi bmd=Dollaro delle Bermuda bnd=Dollaro del Brunei -bob=Boliviano bov=Mvdol Boliviano brl=Real Brasiliano bsd=Dollaro delle Bahamas @@ -80,7 +102,6 @@ clp=Peso Cileno cny=Renmimbi Cinese cop=Peso Colombiano crc=Col\u00f3n Costaricano -csd=Dinaro serbo cup=Peso Cubano cve=Escudo del Capo Verde cyp=Sterlina Cipriota @@ -95,7 +116,6 @@ egp=Sterlina Egiziana ern=Nakfa Eritreo esp=Peseta Spagnola etb=Birr Etiopico -eur=Euro fim=Markka Finlandese fjd=Dollaro delle Figi fkp=Sterlina delle Falkland @@ -103,6 +123,7 @@ frf=Franco Francese gbp=Sterlina Inglese gel=Lari Georgiano ghc=Cedi del Ghana +ghs=Cedi ghanese gip=Sterlina di Gibilterra gmd=Dalasi del Gambia gnf=Franco della Guinea @@ -116,7 +137,7 @@ hrk=Kuna Croata htg=Gourde Haitiano huf=Fiorino Ungherese idr=Rupia Indonesiana -iep=Lira Irlandese +iep=Sterlina irlandese ils=Nuovo sheqel israeliano inr=Rupia Indiana iqd=Dinaro Iracheno @@ -127,7 +148,7 @@ jmd=Dollaro Giamaicano jod=Dinaro Giordano jpy=Yen Giapponese kes=Scellino Keniota -kgs=Som Kirghiso +kgs=Som Kirghiso khr=Riel Cambogiano kmf=Franco Comoriano kpw=Won Nordcoreano @@ -160,7 +181,7 @@ mwk=Kwacha Malawiano mxn=Peso Messicano mxv=Unidad de Inversion (UDI) Messicana myr=Ringgit della Malesia -mzm=Metical del Mozambico +mzn=Metical del Mozambico nad=Dollaro Namibiano ngn=Naira Nigeriana nio=C\u00f3rdoba oro nicaraguense @@ -179,6 +200,7 @@ pte=Escudo Portoghese pyg=Guarani del Paraguay qar=Rial del Qatar rol=Leu della Romania +rsd=Dinaro serbo rub=Rublo Russo rur=Rublo della CSI rwf=Franco Ruandese @@ -186,6 +208,7 @@ sar=Ryal Saudita sbd=Dollaro delle Isole Solomon scr=Rupia delle Seychelles sdd=Dinaro Sudanese +sdg=Sterlina sudanese sek=Corona Svedese sgd=Dollaro di Singapore shp=Sterlina di Sant\u2019Elena @@ -193,6 +216,7 @@ sit=Tallero Sloveno skk=Corona Slovacca sll=Leone della Sierra Leone sos=Scellino Somalo +srd=Dollaro surinamese srg=Fiorino del Suriname std=Dobra di Sao Tom\u00e9 e Principe svc=Col\u00f3n Salvadoregno @@ -216,10 +240,12 @@ uss=Dollaro Statunitense (Same day) uyu=Peso Uruguayo uruguaiano uzs=Sum dell\u2019Uzbekistan veb=Bolivar Venezuelano +vef=Bol\u00edvar venezuelano forte vnd=Dong Vietnamita vuv=Vatu di Vanuatu wst=Tala della Samoa Occidentale xaf=Franco CFA BEAC +xag=Argento xau=Oro xba=Unit\u00e0 composita europea xbb=Unit\u00e0 monetaria europea @@ -230,6 +256,7 @@ xdr=Diritti Speciali di Incasso xfo=Franco Oro Francese xfu=Franco UIC Francese xof=Franco CFA BCEAO +xpd=Palladio xpf=Franco CFP xxx=Nessuna valuta yer=Rial dello Yemen diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_ja.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_ja.properties index a514a81fba1..a47623897d0 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_ja.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_ja.properties @@ -1,45 +1,68 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# adp=\u30a2\u30f3\u30c9\u30e9 \u30da\u30bb\u30bf aed=UAE \u30c7\u30a3\u30eb\u30cf\u30e0 afa=\u30a2\u30d5\u30ac\u30cb\u30fc (1927-2002) @@ -52,7 +75,8 @@ ars=\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3 \u30da\u30bd ats=\u30aa\u30fc\u30b9\u30c8\u30ea\u30a2 \u30b7\u30ea\u30f3\u30b0 aud=\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2 \u30c9\u30eb awg=\u30a2\u30eb\u30d0 \u30ae\u30eb\u30c0\u30fc -azm=\u30a2\u30bc\u30eb\u30d0\u30a4\u30b8\u30e3\u30f3 \u30de\u30ca\u30c8 +azm=\u30a2\u30bc\u30eb\u30d0\u30a4\u30b8\u30e3\u30f3 \u30de\u30ca\u30c8 (1993-2006) +azn=\u30a2\u30bc\u30eb\u30d0\u30a4\u30b8\u30e3\u30f3 \u30de\u30ca\u30c8 bam=\u30dc\u30b9\u30cb\u30a2 \u30de\u30eb\u30af (BAM) bbd=\u30d0\u30eb\u30d0\u30c9\u30b9 \u30c9\u30eb bdt=\u30d0\u30f3\u30b0\u30e9\u30c7\u30b7\u30e5 \u30bf\u30ab @@ -102,7 +126,8 @@ fkp=\u30d5\u30a9\u30fc\u30af\u30e9\u30f3\u30c9\uff08\u30de\u30eb\u30d3\u30ca\u30 frf=\u30d5\u30e9\u30f3\u30b9 \u30d5\u30e9\u30f3 gbp=\u82f1\u56fd\u30dd\u30f3\u30c9 gel=\u30b0\u30eb\u30b8\u30a2 \u30e9\u30ea -ghc=\u30ac\u30fc\u30ca \u30bb\u30c7\u30a3 +ghc=\u30ac\u30fc\u30ca \u30bb\u30c7\u30a3 (1979-2007) +ghs=\u30ac\u30fc\u30ca \u30bb\u30c7\u30a3 gip=\u30b8\u30d6\u30e9\u30eb\u30bf\u30eb \u30dd\u30f3\u30c9 gmd=\u30ac\u30f3\u30d3\u30a2 \u30c0\u30e9\u30b7 gnf=\u30ae\u30cb\u30a2 \u30d5\u30e9\u30f3 @@ -161,6 +186,7 @@ mxn=\u30e1\u30ad\u30b7\u30b3 \u30da\u30bd mxv=\u30e1\u30ad\u30b7\u30b3 UDI myr=\u30de\u30ec\u30fc\u30b7\u30a2 \u30ea\u30f3\u30ae\u30c3\u30c8 mzm=\u30e2\u30b6\u30f3\u30d4\u30fc\u30af \u30e1\u30c6\u30a3\u30ab\u30eb +mzn=\u30e2\u30b6\u30f3\u30d3\u30fc\u30af \u30e1\u30c6\u30a3\u30ab\u30eb nad=\u30ca\u30df\u30d3\u30a2 \u30c9\u30eb ngn=\u30ca\u30a4\u30b8\u30a7\u30ea\u30a2 \u30ca\u30a4\u30e9 nio=\u30cb\u30ab\u30e9\u30b0\u30a2 \u30b3\u30eb\u30c9\u30d0 \u30aa\u30ed @@ -178,7 +204,9 @@ pln=\u30dd\u30fc\u30e9\u30f3\u30c9 \u30ba\u30a6\u30a9\u30c6\u30a3 pte=\u30dd\u30eb\u30c8\u30ac\u30eb \u30a8\u30b9\u30af\u30fc\u30c9 pyg=\u30d1\u30e9\u30b0\u30a2\u30a4 \u30b0\u30a2\u30e9\u30cb qar=\u30ab\u30bf\u30fc\u30eb \u30ea\u30a2\u30eb -rol=\u30eb\u30fc\u30de\u30cb\u30a2 \u30ec\u30a4 +rol=\u30eb\u30fc\u30de\u30cb\u30a2 \u65e7\u30ec\u30a4 +ron=\u30eb\u30fc\u30de\u30cb\u30a2 \u30ec\u30a4 +rsd=\u30c7\u30a3\u30ca\u30fc\u30eb (\u30bb\u30eb\u30d3\u30a2) rub=\u30ed\u30b7\u30a2 \u30eb\u30fc\u30d6\u30eb rur=\u30ed\u30b7\u30a2 \u30eb\u30fc\u30d6\u30eb (1991-1998) rwf=\u30eb\u30ef\u30f3\u30c0 \u30d5\u30e9\u30f3 @@ -186,6 +214,7 @@ sar=\u30b5\u30a6\u30b8 \u30ea\u30e4\u30eb sbd=\u30bd\u30ed\u30e2\u30f3\u8af8\u5cf6 \u30c9\u30eb scr=\u30bb\u30a4\u30b7\u30a7\u30eb \u30eb\u30d4\u30fc sdd=\u30b9\u30fc\u30c0\u30f3 \u30c7\u30a3\u30ca\u30fc\u30eb +sdg=\u30b9\u30fc\u30c0\u30f3 \u30dd\u30f3\u30c9 sek=\u30b9\u30a6\u30a7\u30fc\u30c7\u30f3 \u30af\u30ed\u30fc\u30ca sgd=\u30b7\u30f3\u30ac\u30dd\u30fc\u30eb \u30c9\u30eb shp=\u30bb\u30f3\u30c8\u30d8\u30ec\u30ca\u5cf6 \u30dd\u30f3\u30c9 @@ -193,6 +222,7 @@ sit=\u30b9\u30ed\u30d9\u30cb\u30a2 \u30c8\u30e9\u30fc\u30eb skk=\u30b9\u30ed\u30d0\u30ad\u30a2 \u30b3\u30eb\u30ca sll=\u30b7\u30a8\u30e9\u30ec\u30aa\u30cd \u30ec\u30aa\u30f3 sos=\u30bd\u30de\u30ea\u30a2 \u30b7\u30ea\u30f3\u30b0 +srd=\u30b9\u30ea\u30ca\u30e0 \u30c9\u30eb srg=\u30b9\u30ea\u30ca\u30e0 \u30ae\u30eb\u30c0\u30fc std=\u30b5\u30f3\u30c8\u30e1\u30fb\u30d7\u30ea\u30f3\u30b7\u30da \u30c9\u30d6\u30e9 svc=\u30a8\u30eb\u30b5\u30eb\u30d0\u30c9\u30eb \u30b3\u30ed\u30f3 @@ -217,10 +247,12 @@ uss=\u7c73\u30c9\u30eb (\u5f53\u65e5) uyu=\u30a6\u30eb\u30b0\u30a2\u30a4 \u30da\u30bd uzs=\u30a6\u30ba\u30d9\u30ad\u30b9\u30bf\u30f3 \u30b9\u30e0 veb=\u30d9\u30cd\u30ba\u30a8\u30e9 \u30dc\u30ea\u30d0\u30eb +vef=\u30d9\u30cd\u30ba\u30a8\u30e9 \u30dc\u30ea\u30d0\u30eb\u30d5\u30a8\u30eb\u30c6 vnd=\u30d9\u30c8\u30ca\u30e0 \u30c9\u30f3 vuv=\u30d0\u30cc\u30a2\u30c4 \u30d0\u30c4 wst=\u897f\u30b5\u30e2\u30a2 \u30bf\u30e9 xaf=CFA \u30d5\u30e9\u30f3 BEAC +xag=\u9280 xau=\u91d1 xba=\u30e8\u30fc\u30ed\u30c3\u30d1\u6df7\u5408\u5358\u4f4d (EURCO) xbb=\u30e8\u30fc\u30ed\u30c3\u30d1\u901a\u8ca8\u5358\u4f4d (EMU-6) @@ -231,8 +263,13 @@ xdr=\u7279\u5225\u5f15\u304d\u51fa\u3057\u6a29 xfo=\u30d5\u30e9\u30f3\u30b9\u91d1\u30d5\u30e9\u30f3 xfu=\u30d5\u30e9\u30f3\u30b9 UIC \u30d5\u30e9\u30f3 xof=CFA \u30d5\u30e9\u30f3 BCEAO +xpd=\u30d1\u30e9\u30b8\u30a6\u30e0 xpf=CFP \u30d5\u30e9\u30f3 +xpt=\u30d7\u30e9\u30c1\u30ca +xts=\u30c6\u30b9\u30c8\u7528\u901a\u8ca8\u30b3\u30fc\u30c9 +xxx=\u4e0d\u660e\u307e\u305f\u306f\u7121\u52b9\u306a\u901a\u8ca8 yer=\u30a4\u30a8\u30e1\u30f3 \u30ea\u30a2\u30eb yum=\u30e6\u30fc\u30b4\u30b9\u30e9\u30d3\u30a2 \u30b9\u30fc\u30d1\u30fc \u30c7\u30a3\u30ca\u30fc\u30eb zar=\u5357\u30a2\u30d5\u30ea\u30ab \u30e9\u30f3\u30c9 +zmk=\u30b6\u30f3\u30d3\u30a2 \u30af\u30ef\u30c1\u30e3 zwd=\u30b8\u30f3\u30d0\u30d6\u30a8 \u30c9\u30eb diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_ko.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_ko.properties index 733596d4df8..608e5d5c214 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_ko.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_ko.properties @@ -1,58 +1,82 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# adp=\uc548\ub3c4\ub77c \ud398\uc138\ud0c0 -aed=\uc544\ub78d\uc5d0\ubbf8\ub808\uc774\ud2b8 \ub514\ub098\ub974 +aed=\uc544\ub78d\uc5d0\ubbf8\ub9ac\ud2b8 \ub514\ub974\ud568 afa=\uc544\ud504\uac00\ub2c8 (1927-2002) afn=\uc544\ud504\uac00\ub2c8 all=\uc54c\ubc14\ub2c8\uc544 \ub808\ud06c amd=\uc544\ub974\uba54\ub2c8\uc544 \ub4dc\ub78c -ang=\ub124\ub378\ub780\ub4dc \uc548\ud2f8\ub808\uc2a4 \uad74\ub374 +ang=\ub124\ub35c\ub780\ub4dc\ub839 \uc548\ud2f8\ub808\uc2a4 \uae38\ub354 aoa=\uc559\uace8\ub77c \ucf74\uc790 ars=\uc544\ub974\ud5e8\ud2f0\ub098 \ud398\uc18c ats=\ud638\uc8fc \uc2e4\ub9c1 aud=\ud638\uc8fc \ub2ec\ub7ec awg=\uc544\ub8e8\ubc14 \uae38\ub354 -azm=\uc544\uc81c\ub974\ubc14\uc774\uc820 \ub9c8\ub098\ud2b8 +azm=\uc544\uc81c\ub974\ubc14\uc774\uc820 \ub9c8\ub098\ud2b8(1993-2006) +azn=\uc544\uc81c\ub974\ubc14\uc774\uc794 \ub9c8\ub098\ud2b8 bam=\ubcf4\uc2a4\ub2c8\uc544-\ud5e4\ub974\uccb4\uace0\ube44\ub098 \ud0dc\ud658 \ub9c8\ub974\ud06c bbd=\ubc14\ubca0\uc774\ub3c4\uc2a4 \ub2ec\ub7ec bdt=\ubc29\uae00\ub77c\ub370\uc2dc \ud0c0\uce74 @@ -64,6 +88,7 @@ bif=\ubd80\ub8ec\ub514 \ud504\ub791 bmd=\ubc84\ubba4\ub2e4 \ub2ec\ub7ec bnd=\ubd80\ub8e8\ub098\uc774 \ub2ec\ub7ec bob=\ubcfc\ub9ac\ube44\uc544\ub178 +bov=\ubcfc\ub9ac\ube44\uc544\ub178 Mvdol(\uae30\uae08) brl=\ube0c\ub77c\uc9c8 \ub808\uc54c bsd=\ubc14\ud558\ub9c8 \ub2ec\ub7ec btn=\ubd80\ud0c4 \ub20c\ud22c\ub214 @@ -73,11 +98,13 @@ byr=\ubca8\ub77c\ub8e8\uc2a4 \ub8e8\ube14 bzd=\ubca8\ub9ac\uc988 \ub2ec\ub7ec cad=\uce90\ub098\ub2e4 \ub2ec\ub7ec cdf=\ucf69\uace0 \ud504\ub791 \ucf69\uace8\ub77c\uc2a4 -chf=\uc2a4\uc704\uc2a4 \ud504\ub791\ub2ec\ub7ec +chf=\uc2a4\uc704\uc2a4 \ud504\ub791 +clf=\uce60\ub808 UF (Unidades de Fomento) clp=\uce60\ub808 \ud398\uc18c cny=\uc911\uad6d \uc704\uc548 \uc778\ubbfc\ud3d0 cop=\ucf5c\ub86c\ube44\uc544 \ud398\uc18c crc=\ucf54\uc2a4\ud0c0\ub9ac\uce74 \ucf5c\ub860 +csd=\uace0 \uc138\ub974\ube44\uc544 \ub514\ub098\ub974 cup=\ucfe0\ubc14 \ud398\uc18c cve=\uce74\ubcf4\ubca0\ub974\ub370 \uc5d0\uc2a4\ucfe0\ub3c4 cyp=\uc2f8\uc774\ud504\ub7ec\uc2a4 \ud30c\uc6b4\ub4dc @@ -99,7 +126,8 @@ fkp=\ud3ec\ud074\ub79c\ub4dc\uc81c\ub3c4 \ud30c\uc6b4\ub4dc frf=\ud504\ub791\uc2a4 \ud504\ub791 gbp=\uc601\uad6d\ub839 \ud30c\uc6b4\ub4dc \uc2a4\ud138\ub9c1 gel=\uadf8\ub8e8\uc9c0\uc57c \ub77c\ub9ac -ghc=\uac00\ub098 \uc2dc\ub514 +ghc=\uac00\ub098 \uc2dc\ub514 (1979-2007) +ghs=\uac00\ub098 \uc2dc\ub514 gip=\uc9c0\ube0c\ub864\ud130 \ud30c\uc6b4\ub4dc gmd=\uac10\ube44\uc544 \ub2ec\ub77c\uc2dc gnf=\uae30\ub2c8 \ud504\ub791 @@ -155,8 +183,10 @@ mur=\ubaa8\ub9ac\uc154\uc2a4 \ub8e8\ud53c mvr=\ubab0\ub514\ube0c \uc81c\ub3c4 \ub8e8\ud53c\uc544 mwk=\ub9d0\ub77c\uc704 \ucf70\uccd0 mxn=\uba55\uc2dc\ucf54 \ud398\uc18c -myr=\ub9d0\ub808\uc774\uc9c0\uc544 \ub9c1\uae30\ud2b8 -mzm=\ubaa8\uc7a0\ube44\ud06c \uba54\ud2f0\uce7c +mxv=\uba55\uc2dc\ucf54 UDI(Unidad de Inversion) +myr=\ub9d0\ub808\uc774\uc2dc\uc544 \ub9c1\uae43 +mzm=\uace0 \ubaa8\uc7a0\ube44\ud06c \uba54\ud2f0\uce7c +mzn=\ubaa8\uc7a0\ube44\ud06c \uba54\ud2f0\uce7c nad=\ub098\ubbf8\ube44\uc544 \ub2ec\ub7ec ngn=\ub2c8\uc81c\ub974 \ub098\uc774\ub77c nio=\ub2c8\uce74\ub77c\uacfc \ucf54\ub974\ub3c4\ubc14 \uc624\ub85c @@ -175,6 +205,8 @@ pte=\ud3ec\ub974\ud22c\uac08 \uc5d0\uc2a4\ucfe0\ub3c4 pyg=\ud30c\ub77c\uacfc\uc774 \uacfc\ub77c\ub2c8 qar=\uce74\ud0c0\ub974 \ub9ac\uc584 rol=\ub8e8\ub9c8\ub2c8\uc544 \ub808\uc774 +ron=\ub8e8\ub9c8\ub2c8\uc544 \ub808\uc6b0 +rsd=\uc138\ub974\ube44\uc544 \ub514\ub098\ub974 rub=\ub7ec\uc2dc\uc544 \ub8e8\ube14 rur=\ub7ec\uc2dc\uc544 \ub8e8\ube14 (1991-1998) rwf=\ub974\uc644\ub2e4 \ud504\ub791 @@ -182,6 +214,7 @@ sar=\uc0ac\uc6b0\ub514\uc544\ub77c\ube44\uc544 \ub9ac\uc584 sbd=\uc194\ub85c\ubaac \uc81c\ub3c4 \ub2ec\ub7ec scr=\uc138\uc774\uc274 \ub8e8\ud53c sdd=\uc218\ub2e8 \ub514\ub098\ub974 +sdg=\uc218\ub2e8 \ud30c\uc6b4\ub4dc sek=\uc2a4\uc6e8\ub374 \ud06c\ub85c\ub098 sgd=\uc2f1\uac00\ud3f4 \ub2ec\ub7ec shp=\uc138\uc778\ud2b8\ud5ec\ub808\ub098 \ud30c\uc6b4\ub4dc @@ -189,6 +222,7 @@ sit=\uc2ac\ub85c\ubca0\ub2c8\uc544 \ud1a8\ub77c\ub974 skk=\uc2ac\ub85c\ubc14\ud0a4\uc544 \ucf54\ub8e8\ub098 sll=\uc2dc\uc5d0\ub77c\ub9ac\uc628 \ub9ac\uc628 sos=\uc18c\ub9d0\ub9ac\uc544 \uc2e4\ub9c1 +srd=\uc218\ub9ac\ub0a8 \ub2ec\ub7ec srg=\uc218\ub9ac\ub0a8 \uae38\ub354 std=\uc0c1\ud22c\uba54 \ud504\ub9b0\uc2dc\ud398 \ub3c4\ube0c\ub77c svc=\uc5d8\uc0b4\ubc14\ub3c4\ub974 \ucf5c\ub860 @@ -198,28 +232,44 @@ thb=\ud0dc\uad6d \ubc14\ud2b8 tjs=\ud0c0\uc9c0\ud0a4\uc2a4\ud0c4 \uc18c\ubaa8\ub2c8 tmm=\ud22c\ub974\ud06c\uba54\ub2c8\uc2a4\ud0c4 \ub9c8\ub098\ud2b8 tnd=\ud280\ub2c8\uc9c0 \ub514\ub098\ub974 +top=\ud1b5\uac00 \ud30c\uc559\uac00 tpe=\ud2f0\ubaa8\ub974 \uc5d0\uc2a4\ucfe0\ub3c4 -trl=\ud130\uae30 \ub9ac\ub77c -try=\uc0c8\ub85c\uc6b4 \ud130\ud0a4 \ub9ac\ub77c +trl=\ud130\ud0a4 \ub9ac\ub77c +try=\uc2e0 \ud130\ud0a4 \ub9ac\ub77c ttd=\ud2b8\ub9ac\ub2c8\ub2e4\ub4dc \ud1a0\ubc14\uace0 \ub2ec\ub7ec twd=\ub300\ub9cc \uc2e0\uad8c \ub2ec\ub7ec tzs=\ud0c4\uc790\ub2c8\uc544 \uc2e4\ub9c1 uah=\uc6b0\ud06c\ub77c\uc774\ub098 \uadf8\ub9ac\ube0c\ub098 ugx=\uc6b0\uac04\ub2e4 \uc2e4\ub9c1 usd=\ubbf8\uad6d \ub2ec\ub7ec +usn=\ubbf8\uad6d \ub2ec\ub7ec(\ub2e4\uc74c\ub0a0) +uss=\ubbf8\uad6d \ub2ec\ub7ec(\ub2f9\uc77c) uyu=\uc6b0\ub8e8\uacfc\uc774 \ud398\uc18c \uc6b0\ub8e8\uacfc\uc694 uzs=\uc6b0\uc988\ubca0\ud0a4\uc2a4\ud0c4 \uc228 veb=\ubca0\ub124\uc8fc\uc5d8\ub77c \ubcfc\ub9ac\ubc14\ub974 +vef=\ubca0\ub124\uc8fc\uc5d8\ub77c \ubcfc\ub9ac\ubc14\ub974 \ud478\uc5d0\ub974\ub5bc vnd=\ubca0\ud2b8\ub0a8 \ub3d9 vuv=\ubc14\ub204\uc544\ud22c \ubc14\ud22c wst=\uc11c \uc0ac\ubaa8\uc544 \ud0c8\ub77c +xaf=CFA \ud504\ub791 BEAC +xag=\uc740\ud654 xau=\uae08 +xba=\uc720\ub974\ucf54 (\uc720\ub7fd \ud68c\uacc4 \ub2e8\uc704) +xbb=\uc720\ub7fd \ud1b5\ud654 \ub3d9\ub9f9 +xbc=\uc720\ub7fd \uacc4\uc0b0 \ub2e8\uc704 (XBC) +xbd=\uc720\ub7fd \uacc4\uc0b0 \ub2e8\uc704 (XBD) xcd=\ub3d9\uce74\ub9ac\ube0c \ub2ec\ub7ec xdr=\ud2b9\ubcc4\uc778\ucd9c\uad8c xfo=\ud504\ub791\uc2a4 Gold \ud504\ub791 xfu=\ud504\ub791\uc2a4 UIC-\ud504\ub791 +xof=CFA \ud504\ub791 BCEAO +xpd=\ud314\ub77c\ub4d0 +xpf=CFP \ud504\ub791 +xpt=\ubc31\uae08 +xts=\ud14c\uc2a4\ud2b8 \ud1b5\ud654 \ucf54\ub4dc +xxx=\uc54c\uc218\uc5c6\uac70\ub098 \uc720\ud6a8\ud558\uc9c0\uc54a\uc740 \ud1b5\ud654\ub2e8\uc704 yer=\uc608\uba58 \ub9ac\uc54c yum=\uc720\uace0\uc2ac\ub77c\ube44\uc544 \ub178\ube44 \ub514\ub098\ub974 zar=\ub0a8\uc544\ud504\ub9ac\uce74 \ub79c\ub4dc zmk=\uc7d8\ube44\uc544 \ucf70\uccd0 -zwd=\uc9d0\ube44\ube0c\uc6e8 \ub2ec\ub7ec +zwd=\uc9d0\ubc14\ube0c\uc6e8 \ub2ec\ub7ec diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sv.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sv.properties index 94280029274..2d15627b190 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_sv.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_sv.properties @@ -1,230 +1,271 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. -adp=Andorransk peseta -aed=F\u00f6renade arabemiratens dirham -afa=afro-asiatiskt spr\u00e5k (annat) -all=Albansk lek -amd=Armenisk dram -ang=Nederl\u00e4ndsk antillisk gulden -aoa=Angolansk kwanza -ars=Argentinsk peso -ats=\u00d6sterrikisk schilling -aud=Australisk dollar -awg=Aruba-florin -azm=Azerbajdzjansk manat -bam=Konvertibel bosnisk-hercegovinsk mark -bbd=Barbadisk dollar -bdt=Bangladeshisk taka -bef=Belgisk franc -bgl=Bulgarisk h\u00e5rd lev -bgn=Bulgarisk ny lev -bhd=Bahrainsk dinar -bif=Burundisk franc +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# +adp=andorransk peseta +aed=F\u00f6renade Arabemiratens dirham +afa=afghani (1927-2002) +afn=afghani +all=albansk lek +amd=armenisk dram +ang=Nederl\u00e4ndska Antillernas gulden +aoa=angolansk kwanza +ars=argentinsk peso +ats=\u00f6sterrikisk schilling +aud=australisk dollar +awg=Aruba-gulden +azm=azerbajdzjansk manat (1993-2006) +azn=azerbajdzjansk manat +bam=bosnisk-hercegovinsk mark (konvertibel) +bbd=Barbados-dollar +bdt=bangladeshisk taka +bef=belgisk franc +bgn=bulgarisk ny lev +bhd=Bahrain-dinar +bif=burundisk franc bmd=Bermuda-dollar -bnd=Bruneisk dollar -bov=Boliviansk mvdol -brl=Brasiliansk real -bsd=Bahamansk dollar -btn=Bhutanesisk ngultrum -bwp=Botswansk pula -byb=Vitrysk ny rubel (1994-1999) -byr=Vitrysk rubel -bzd=Belizisk dollar -cad=Kanadensisk dollar -cdf=Kongolesisk franc congolais -chf=Schweizisk franc -clf=Chilensk unidad de fomento -clp=Chilensk peso -cny=Kinesisk yuan renminbi -cop=Colombiansk peso -crc=Costarikansk col\u00f3n -cup=Kubansk peso -cve=Kapverdisk escudo -cyp=Cypriotiskt pund -czk=Tjeckisk koruna -dem=Tysk mark -djf=Djiboutisk franc -dkk=Dansk krona -dop=Dominikansk peso -dzd=Algerisk dinar -eek=Estnisk krona -egp=Egyptiskt pund -ern=Eritreansk nakfa -esp=Spansk peseta -etb=Etiopisk birr -eur=Euro -fim=Finsk mark -fjd=Fijiansk dollar +bnd=Brunei-dollar +bob=boliviano +bov=boliviansk mvdol +brl=brasiliansk real +bsd=Bahamas-dollar +btn=bhutanesisk ngultrum +bwp=botswansk pula +byb=vitrysk ny rubel (1994-1999) +byr=vitrysk rubel +bzd=belizisk dollar +cad=kanadensisk dollar +cdf=kongolesisk franc +chf=schweizisk franc +clf=chilensk unidad de fomento +clp=chilensk peso +cny=kinesisk yuan renminbi +cop=colombiansk peso +crc=costarikansk col\u00f3n +csd=jugoslavisk dinar +cup=kubansk peso +cve=kapverdisk escudo +cyp=cypriotiskt pund +czk=tjeckisk koruna +dem=tysk mark +djf=djiboutisk franc +dkk=dansk krona +dop=dominikansk peso +dzd=algerisk dinar +eek=estnisk krona +egp=egyptiskt pund +ern=eritreansk nakfa +esp=spansk peseta +etb=etiopisk birr +eur=euro +fim=finsk mark +fjd=Fiji-dollar fkp=Falklands\u00f6arnas pund -frf=Fransk franc -gbp=Brittiskt pund sterling -gel=Georgisk lari -ghc=Ghanansk cedi -gip=Gibraltiskt pund -gmd=Gambisk dalasi -gnf=Guineansk franc -grd=Grekisk drachma -gtq=Guatemalansk quetzal +frf=fransk franc +gbp=brittiskt pund sterling +gel=georgisk lari +ghc=ghanansk cedi (1979-2007) +ghs=ghanansk cedi +gip=gibraltiskt pund +gmd=gambisk dalasi +gnf=guineansk franc +grd=grekisk drachma +gtq=guatemalansk quetzal gwp=Guinea-Bissau-peso -gyd=Guyanansk dollar +gyd=guyanansk dollar hkd=Hongkong-dollar -hnl=Hoduransk lempira -hrk=Kroatisk kuna -htg=Haitisk gourde -huf=Ungersk forint -idr=Indonesisk rupiah -iep=Irl\u00e4ndskt pund -ils=Israelisk ny shekel -inr=Indisk rupie -iqd=Irakisk dinar -irr=Iransk rial -isk=Isl\u00e4ndsk krona -itl=Italiensk lira -jmd=Jamaicansk dollar -jod=Jordansk dinar -jpy=Japansk yen -kes=Kenyansk shilling -kgs=Kirgizistansk som -khr=Kambodjansk riel -kmf=Komorisk franc -kpw=Nordkoreansk won -krw=Sydkoreansk won -kwd=Kuwaitisk dinar +hnl=honduransk lempira +hrk=kroatisk kuna +htg=haitisk gourde +huf=ungersk forint +idr=indonesisk rupiah +iep=irl\u00e4ndskt pund +ils=israelisk ny shekel +inr=indisk rupie +iqd=irakisk dinar +irr=iransk rial +isk=isl\u00e4ndsk krona +itl=italiensk lira +jmd=Jamaica-dollar +jod=jordansk dinar +jpy=japansk yen +kes=kenyansk shilling +kgs=kirgizisk som +khr=kambodjansk riel +kmf=komorisk franc +kpw=nordkoreansk won +krw=sydkoreansk won +kwd=kuwaitisk dinar kyd=Cayman-dollar -kzt=Kazakisk tenge -lak=Laotisk kip -lbp=Libanesiskt pund -lkr=Srilankesisk rupie -lrd=Liberisk dollar -lsl=Lesothisk loti -ltl=Lettisk lita -luf=Luxemburgsk franc -lvl=Lettisk lats -lyd=Libysk dinar -mad=Marockansk dirham -mdl=Moldavisk leu -mga=Madagaskisk ariary -mgf=Madagaskisk franc -mkd=Makedonisk denar -mmk=Myanmarisk kyat -mnt=Mongolisk tugrik -mop=Macaoisk pataca -mro=Mauretansk ouguiya -mtl=Maltesisk lira -mur=Mauritisk rupie -mvr=Maldivisk rufiyaa -mwk=Malawisk kwacha -mxn=Mexikansk peso -mxv=Mexikansk Unidad de Inversion (UDI) -myr=Malaysisk ringgit -mzm=Mo\u00e7ambikisk metical -nad=Namibisk dollar -ngn=Nigeriansk naira -nio=Nicaraguansk c\u00f3rdoba oro -nlg=Nederl\u00e4ndsk gulden -nok=Norsk krona -npr=Nepalesisk rupie -nzd=Nyzeel\u00e4ndsk dollar -omr=Omansk rial -pab=Panamansk balboa -pen=Peruansk sol nuevo -pgk=Papuansk kina -php=Filippinsk peso -pkr=Pakistansk rupie -pln=Polsk zloty -pte=Portugisisk escudo -pyg=Paraguaysk guarani -qar=Qatarisk rial -rol=Rum\u00e4nsk leu -rub=Rysk rubel -rur=Rysk rubel (1991-1998) -rwf=Rwandisk franc -sar=Saudisk riyal +kzt=kazakisk tenge +lak=laotisk kip +lbp=libanesiskt pund +lkr=srilankesisk rupie +lrd=Liberia-dollar +lsl=lesothisk loti +ltl=litauisk litas +luf=luxemburgsk franc +lvl=lettisk lats +lyd=libysk dinar +mad=marockansk dirham +mdl=moldavisk leu +mga=madagaskisk ariary +mgf=madagaskisk franc +mkd=makedonisk denar +mmk=myanmarisk kyat +mnt=mongolisk tugrik +mop=Macao-pataca +mro=mauretansk ouguiya +mtl=maltesisk lira +mur=mauritisk rupie +mvr=maldivisk rufiyaa +mwk=malawisk kwacha +mxn=mexikansk peso +mxv=mexikansk unidad de inversion +myr=malaysisk ringgit +mzm=gammal mo\u00e7ambikisk metical +mzn=mo\u00e7ambikisk metical +nad=Namibia-dollar +ngn=nigeriansk naira +nio=nicaraguansk c\u00f3rdoba oro +nlg=nederl\u00e4ndsk gulden +nok=norsk krona +npr=nepalesisk rupie +nzd=nyzeel\u00e4ndsk dollar +omr=omansk rial +pab=panamansk balboa +pen=peruansk sol nuevo +pgk=papuansk kina +php=filippinsk peso +pkr=pakistansk rupie +pln=polsk zloty +pte=portugisisk escudo +pyg=paraguaysk guarani +qar=qatarisk rial +rol=gammal rum\u00e4nsk leu +ron=rum\u00e4nsk leu +rsd=Serbisk dinar +rub=rysk rubel +rur=rysk rubel (1991-1998) +rwf=rwandisk franc +sar=saudisk riyal sbd=Salomon-dollar -scr=Seychellisk rupie -sdd=Sudanesisk dinar -sek=Svensk krona -sgd=Singaporiansk dollar +scr=seychellisk rupie +sdd=sudanesisk dinar +sdg=sudanesiskt pund +sek=svensk krona +sgd=Singapore-dollar shp=S\:t Helena-pund -sit=Slovensk tolar -skk=Slovakisk koruna -sll=Sierraleonsk leone -sos=Somalisk shilling -srg=Surinamesisk gulden +sit=slovensk tolar +skk=slovakisk koruna +sll=sierraleonsk leone +sos=somalisk shilling +srd=Surinam-dollar +srg=surinamesisk gulden std=S\u00e3o Tom\u00e9 och Pr\u00edncipe-dobra -svc=Salvadoransk col\u00f3n -syp=Syriskt pund -szl=Swazil\u00e4ndsk lilangeni -thb=Thail\u00e4ndsk baht -tjs=Tadzjikisk somoni -tmm=Turkmensk manat -tnd=Tunisisk dinar -top=Tongansk pa\u02bbanga -tpe=Timoriansk escudo -trl=Turkisk lira -try=Ny turkisk lira -ttd=Trinidadisk dollar -twd=Taiwanesisk ny dollar -tzs=Tanzanisk shilling -uah=Ukrainsk hryvnia -ugx=Ugandisk shilling +svc=salvadoransk col\u00f3n +syp=syriskt pund +szl=swazil\u00e4ndsk lilangeni +thb=thail\u00e4ndsk baht +tjs=tadzjikisk somoni +tmm=turkmensk manat +tnd=tunisisk dinar +top=tongansk pa\u02bbanga +tpe=timoriansk escudo +trl=gammal turkisk lira +try=ny turkisk lira +ttd=Trinidad ochTobago-dollar +twd=taiwanesisk ny dollar +tzs=tanzanisk shilling +uah=ukrainsk hryvnia +ugx=ugandisk shilling usd=US-dollar usn=US-dollar (n\u00e4sta dag) uss=US-dollar (samma dag) -uyu=Uruguayansk peso uruguayo -uzs=Uzbekisk sum -veb=Venezuelansk bolivar -vnd=Vietnamesisk dong -vuv=Vanuatisk vatu -wst=V\u00e4stsamoansk tala -xaf=CFA Franc BEAC -xcd=\u00d6stkaribisk dollar -xfo=Fransk guldfranc -xfu=French UIC-Franc -xof=CFA Franc BCEAO +uyu=uruguayansk peso +uzs=uzbekisk sum +veb=venezuelansk bolivar +vef=venezuelansk bolivar fuerte +vnd=vietnamesisk dong +vuv=vanuatisk vatu +wst=v\u00e4stsamoansk tala +xag=silver +xau=guld +xba=europeisk kompositenhet +xbb=europeisk monet\u00e4r enhet +xbc=europeisk kontoenhet (XBC) +xbd=europeisk kontoenhet (XBD) +xcd=\u00f6stkaribisk dollar +xdr=IMF s\u00e4rskild dragningsr\u00e4tt +xfo=fransk guldfranc +xpd=palladium xpf=CFP-franc -yer=Jemenitisk rial -yum=Dinar (Serbien och Montenegro) -zar=Sydafrikansk rand -zmk=Zambisk kwacha -zwd=Zimbabwisk dollar +xpt=platina +xts=test-valutakod +xxx=ok\u00e4nd eller ogiltig valuta +yer=jemenitisk rial +yum=jugoslavisk ny dinar +zar=sydafrikansk rand +zmk=zambisk kwacha +zwd=Zimbabwe-dollar diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_CN.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_CN.properties index f812deceac5..ed541a1f756 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_CN.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_CN.properties @@ -1,45 +1,68 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# CNY=\uffe5 cny=\u4eba\u6c11\u5e01 adp=\u5b89\u9053\u5c14\u6bd4\u585e\u5854 @@ -48,13 +71,14 @@ afa=\u963f\u5bcc\u6c57\u5c3c (1927-2002) afn=\u963f\u5bcc\u6c57\u5c3c all=\u963f\u5c14\u5df4\u5c3c\u4e9a\u5217\u514b amd=\u4e9a\u7f8e\u5c3c\u4e9a\u5fb7\u62c9\u59c6 -ang=\u53e4\u82f1\u6587 +ang=\u8377\u5170\u5b89\u66ff\u5170\u76fe aoa=\u5b89\u54e5\u62c9\u5bbd\u624e ars=\u963f\u6839\u5ef7\u6bd4\u7d22 ats=\u5965\u5730\u5229\u5148\u4ee4 aud=\u6fb3\u5927\u5229\u4e9a\u5143 awg=\u963f\u9c81\u5df4\u57fa\u5c14\u5fb7\u5143 -azm=\u963f\u585e\u62dc\u7586\u9a6c\u7eb3\u7279 +azm=\u963f\u585e\u62dc\u7586\u9a6c\u7eb3\u7279 (1993-2006) +azn=\u963f\u585e\u62dc\u7586\u9a6c\u7eb3\u7279 bam=\u6ce2\u58eb\u5c3c\u4e9a-\u8d6b\u585e\u54e5\u7ef4\u7eb3\u5151\u6362\u5238 bbd=\u5df4\u5df4\u591a\u65af\u5143 bdt=\u5b5f\u52a0\u62c9\u5854\u5361 @@ -81,7 +105,7 @@ clf=\u667a\u5229 Unidades de Fomento\uff08\u8d44\u91d1\uff09 clp=\u667a\u5229\u6bd4\u7d22 cop=\u54e5\u4f26\u6bd4\u4e9a\u6bd4\u7d22 crc=\u54e5\u65af\u8fbe\u9ece\u52a0\u79d1\u6717 -csd=\u585e\u5c14\u7ef4\u4e9a\u7b2c\u7eb3\u5c14 +csd=\u65e7\u585e\u5c14\u7ef4\u4e9a\u7b2c\u7eb3\u5c14 cup=\u53e4\u5df4\u6bd4\u7d22 cve=\u4f5b\u5f97\u89d2\u57c3\u65af\u5e93\u591a cyp=\u585e\u6d66\u8def\u65af\u9551 @@ -104,6 +128,7 @@ frf=\u6cd5\u56fd\u6cd5\u90ce gbp=\u82f1\u9551 gel=\u4e54\u6cbb\u4e9a\u62c9\u745e ghc=\u52a0\u7eb3\u585e\u7b2c +ghs=\u52a0\u7eb3\u585e\u5730 gip=\u76f4\u5e03\u7f57\u9640\u9551 gmd=\u5188\u6bd4\u4e9a\u8fbe\u62c9\u897f gnf=\u51e0\u5185\u4e9a\u6cd5\u90ce @@ -161,7 +186,8 @@ mwk=\u9a6c\u62c9\u7ef4\u514b\u74e6\u67e5 mxn=\u58a8\u897f\u54e5\u6bd4\u7d22 mxv=\u58a8\u897f\u54e5 Unidad de Inversion (UDI)\uff08\u8d44\u91d1\uff09 myr=\u9a6c\u6765\u897f\u4e9a\u6797\u5409\u7279 -mzm=\u83ab\u6851\u6bd4\u514b\u6885\u8482\u5361\u5c14 +mzm=\u65e7\u83ab\u6851\u6bd4\u514b\u7f8e\u63d0\u5361 +mzn=\u83ab\u6851\u6bd4\u514b\u7f8e\u63d0\u5361 nad=\u7eb3\u7c73\u6bd4\u4e9a\u5143 ngn=\u5c3c\u65e5\u5229\u4e9a\u5948\u62c9 nio=\u5c3c\u52a0\u62c9\u74dc\u91d1\u79d1\u591a\u5df4 @@ -180,6 +206,8 @@ pte=\u8461\u8404\u7259\u57c3\u65af\u5e93\u591a pyg=\u5df4\u62c9\u572d\u74dc\u62c9\u5c3c qar=\u5361\u5854\u5c14\u91cc\u4e9a\u5c14 rol=\u65e7\u7f57\u9a6c\u5c3c\u4e9a\u5217\u4f0a +ron=\u7f57\u9a6c\u5c3c\u4e9a\u5217\u4f0a +rsd=\u585e\u5c14\u7ef4\u4e9a\u7b2c\u7eb3\u5c14 rub=\u4fc4\u56fd\u5362\u5e03 rur=\u4fc4\u56fd\u5362\u5e03 (1991-1998) rwf=\u5362\u65fa\u8fbe\u6cd5\u90ce @@ -189,7 +217,7 @@ scr=\u585e\u820c\u5c14\u5362\u6bd4 sdd=\u82cf\u4e39\u7b2c\u7eb3\u5c14 sek=\u745e\u5178\u514b\u6717 sgd=\u65b0\u52a0\u5761\u5143 -shp=\u5723\u8d6b\u52d2\u62ff\u9551 +shp=\u5723\u8d6b\u52d2\u62ff\u7fa4\u5c9b\u78c5 sit=\u65af\u6d1b\u6587\u5c3c\u4e9a\u6258\u62c9\u5c14 skk=\u65af\u6d1b\u4f10\u514b\u514b\u6717 sll=\u585e\u62c9\u5229\u6602\u5229\u6602 @@ -209,7 +237,7 @@ tpe=\u5e1d\u6c76\u57c3\u65af\u5e93\u591a trl=\u571f\u8033\u5176\u91cc\u62c9 try=\u65b0\u571f\u8033\u5176\u91cc\u62c9 ttd=\u7279\u7acb\u5c3c\u8fbe\u548c\u591a\u5df4\u54e5\u5143 -twd=\u65b0\u53f0\u5e01\u5143 +twd=\u65b0\u53f0\u5e01 tzs=\u5766\u6851\u5c3c\u4e9a\u5148\u4ee4 uah=\u4e4c\u514b\u5170\u683c\u91cc\u592b\u5c3c\u4e9a ugx=\u4e4c\u5e72\u8fbe\u5148\u4ee4 @@ -219,6 +247,7 @@ uss=\u7f8e\u5143\uff08\u5f53\u65e5\uff09 uyu=\u4e4c\u62c9\u572d\u6bd4\u7d22 uzs=\u4e4c\u5179\u522b\u514b\u65af\u82cf\u59c6 veb=\u59d4\u5185\u745e\u62c9\u535a\u5229\u74e6 +vef=\u59d4\u5185\u745e\u62c9\u5f3a\u52bf\u73bb\u5229\u74e6 vnd=\u8d8a\u5357\u76fe vuv=\u74e6\u52aa\u963f\u56fe\u74e6\u56fe wst=\u897f\u8428\u6469\u4e9a\u5854\u62c9 @@ -238,7 +267,7 @@ xpd=\u94af xpf=\u592a\u5e73\u6d0b\u6cd5\u90ce xpt=\u94c2 xts=\u4e3a\u6d4b\u8bd5\u4fdd\u7559\u7684\u4ee3\u7801 -xxx=\u6ca1\u6709\u8d27\u5e01\u7684\u4ea4\u6613 +xxx=\u8d27\u5e01\u672a\u77e5\u6216\u65e0\u6548 yer=\u4e5f\u95e8\u91cc\u4e9a\u5c14 yum=\u5357\u65af\u62c9\u592b\u504c\u5a01\u7b2c\u7eb3\u5c14 zar=\u5357\u975e\u5170\u7279 diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_TW.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_TW.properties index 610ce04dbdb..9630c6eeb68 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_TW.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_zh_TW.properties @@ -1,60 +1,84 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. # # # COPYRIGHT AND PERMISSION NOTICE # -# Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. +# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved. # Distributed under the Terms of Use in http://www.unicode.org/copyright.html. # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of the Unicode data files and any associated documentation (the "Data -# Files") or Unicode software and any associated documentation (the -# "Software") to deal in the Data Files or Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, and/or sell copies of the Data Files or Software, and -# to permit persons to whom the Data Files or Software are furnished to do -# so, provided that (a) the above copyright notice(s) and this permission -# notice appear with all copies of the Data Files or Software, (b) both the -# above copyright notice(s) and this permission notice appear in associated -# documentation, and (c) there is clear notice in each modified Data File or -# in the Software as well as in the documentation associated with the Data -# File(s) or Software that the data or software has been modified. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of the Unicode data files and any associated documentation (the +# "Data Files") or Unicode software and any associated documentation +# (the "Software") to deal in the Data Files or Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, and/or sell copies of the Data +# Files or Software, and to permit persons to whom the Data Files or +# Software are furnished to do so, provided that (a) the above copyright +# notice(s) and this permission notice appear with all copies of the +# Data Files or Software, (b) both the above copyright notice(s) and +# this permission notice appear in associated documentation, and (c) +# there is clear notice in each modified Data File or in the Software as +# well as in the documentation associated with the Data File(s) or +# Software that the data or software has been modified. # -# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -# THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS -# INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR -# CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THE DATA FILES OR SOFTWARE. +# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR +# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR +# SOFTWARE. # -# Except as contained in this notice, the name of a copyright holder shall not -# be used in advertising or otherwise to promote the sale, use or other -# dealings in these Data Files or Software without prior written -# authorization of the copyright holder. -# - -# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# Except as contained in this notice, the name of a copyright holder +# shall not be used in advertising or otherwise to promote the sale, use +# or other dealings in these Data Files or Software without prior +# written authorization of the copyright holder. +# +# Generated automatically from the Common Locale Data Repository. DO NOT EDIT! +# TWD=NT$ twd=\u65b0\u81fa\u5e63 adp=\u5b89\u9053\u723e\u966a\u58eb\u7279 aed=\u963f\u62c9\u4f2f\u806f\u5408\u5927\u516c\u570b\u8fea\u723e\u6c57 -afa=\u975e\u9583\u65cf\u53ca\u975e\u4e9e\u8a9e\u8a00 +afa=\u963f\u5bcc\u6c57\u5c3c (1927-2002) afn=\u963f\u5bcc\u6c57\u5c3c all=\u963f\u723e\u5df4\u5c3c\u4e9e\u5217\u514b amd=\u4e9e\u7f8e\u5c3c\u4e9e\u5fb7\u62c9\u59c6 -ang=\u8377\u862d \u5b89\u68af\u862d \u76fe +ang=\u53e4\u82f1\u6587 aoa=\u5b89\u54e5\u62c9\u5bec\u624e ars=\u963f\u6839\u5ef7\u62ab\u7d22 ats=\u5967\u5730\u5229\u5148\u4ee4 aud=\u6fb3\u5e63 awg=\u963f\u9b6f\u5df4\u76fe -azm=\u963f\u585e\u62dc\u5f4a\u99ac\u7279\u7d0d +azm=\u4e9e\u585e\u62dc\u7136\u99ac\u7d0d\u7279 (1993-2006) +azn=\u4e9e\u585e\u62dc\u7136\u99ac\u7d0d\u7279 bam=\u6ce2\u58eb\u5c3c\u4e9e-\u9ed1\u585e\u54e5\u7dad\u90a3\u53ef\u8f49\u63db\u99ac\u514b bbd=\u5df4\u8c9d\u591a\u5143 bdt=\u5b5f\u52a0\u62c9\u5854\u5361 @@ -66,14 +90,14 @@ bif=\u84b2\u9686\u5730\u6cd5\u90ce bmd=\u767e\u6155\u9054\u5e63 bnd=\u6c76\u840a\u5143 bob=\u73bb\u5229\u7dad\u4e9e\u8ca8\u5e63\u55ae\u4f4d -bov=\u73bb\u5229\u7dad\u4e9e \u5e55\u591a +bov=\u73bb\u5229\u7dad\u4e9e\u5e55\u591a brl=\u5df4\u897f\u91cc\u62c9 bsd=\u5df4\u54c8\u99ac\u5143 btn=\u4e0d\u4e39\u52aa\u624e\u59c6 -bwp=\u6ce2\u672d\u90a3 - \u666e\u62c9 +bwp=\u6ce2\u672d\u90a3\u666e\u62c9 byb=\u767d\u4fc4\u7f85\u65af\u65b0\u76e7\u5e03 (1994-1999) byr=\u767d\u4fc4\u7f85\u65af\u76e7\u5e03 -bzd=\u4f2f\u5229\u8332\u5143 +bzd=\u8c9d\u91cc\u65af\u5143 cad=\u52a0\u5e63 cdf=\u525b\u679c\u6cd5\u90ce chf=\u745e\u58eb\u6cd5\u90ce @@ -82,9 +106,10 @@ clp=\u667a\u5229\u62ab\u7d22 cny=\u4eba\u6c11\u5e63 cop=\u54e5\u502b\u6bd4\u4e9e\u62ab\u7d22 crc=\u54e5\u65af\u5927\u9ece\u52a0\u79d1\u90ce +csd=\u65e7\u585e\u5c14\u7ef4\u4e9a\u7b2c\u7eb3\u5c14 cup=\u53e4\u5df4\u62ab\u7d22 cve=\u7dad\u5fb7\u89d2\u57c3\u65af\u5eab\u591a -cyp=\u8cfd\u6d66\u8def\u65af\u938a +cyp=\u8cfd\u666e\u52d2\u65af\u938a czk=\u6377\u514b\u514b\u6717 dem=\u5fb7\u570b\u99ac\u514b djf=\u5409\u5e03\u5730\u6cd5\u90ce @@ -103,23 +128,24 @@ fkp=\u798f\u514b\u862d\u7fa4\u5cf6\u938a frf=\u6cd5\u570b\u6cd5\u90ce gbp=\u82f1\u938a gel=\u55ac\u6cbb\u62c9\u91cc -ghc=\u8fe6\u7d0d\u4ed9\u8515 +ghc=\u8fe6\u7d0d\u4ed9\u8515 (1979-2007) +ghs=\u8fe6\u7d0d\u4ed9\u8515 gip=\u76f4\u5e03\u7f85\u9640\u938a gmd=\u7518\u6bd4\u4e9e\u9054\u62c9\u897f gnf=\u5e7e\u5167\u4e9e\u6cd5\u90ce grd=\u5e0c\u81d8\u5fb7\u62c9\u514b\u99ac gtq=\u74dc\u5730\u99ac\u62c9\u683c\u67e5\u723e -gwp=\u5e7e\u5167\u4e9e\u62ab\u7d22\u62ab\u7d22 +gwp=\u5e7e\u5167\u4e9e\u6bd4\u7d22\u62ab\u7d22 gyd=\u572d\u4e9e\u90a3\u5143 hkd=\u6e2f\u5143 hnl=\u6d2a\u90fd\u62c9\u65af\u502b\u76ae\u62c9 hrk=\u514b\u7f85\u5730\u4e9e\u5eab\u7d0d htg=\u6d77\u5730\u53e4\u5fb7 -huf=\u5308\u7259\u5229 - \u798f\u6797 -idr=\u5370\u5c3c - \u76e7\u5e03 +huf=\u5308\u7259\u5229\u798f\u6797 +idr=\u5370\u5c3c\u76fe iep=\u611b\u723e\u862d\u938a ils=\u4ee5\u8272\u5217\u65b0\u8b1d\u514b\u723e -inr=\u5370\u5ea6\u76e7\u5e03 +inr=\u5370\u5ea6\u76e7\u6bd4 iqd=\u4f0a\u62c9\u514b\u7b2c\u7d0d\u723e irr=\u4f0a\u6717\u91cc\u4e9e\u723e isk=\u51b0\u5cf6\u514b\u6717 @@ -131,12 +157,12 @@ kes=\u80af\u5c3c\u4e9e\u5148\u4ee4 kgs=\u5409\u723e\u5409\u65af\u7d22\u99ac khr=\u67ec\u57d4\u5be8\u745e\u723e kmf=\u79d1\u6469\u7f85\u6cd5\u90ce -kpw=\u5317\u671d\u9bae\u5e63 -krw=\u97d3\u570b\u571c +kpw=\u5317\u97d3\u571c +krw=\u97d3\u571c kwd=\u79d1\u5a01\u7279\u7b2c\u7d0d\u723e kyd=\u958b\u66fc\u7fa4\u5cf6\u7f8e\u5143 kzt=\u5361\u624e\u514b\u65af\u5766\u5766\u5409 -lak=\u8001\u64be \u958b\u666e +lak=\u8001\u631d\u57fa\u666e lbp=\u9ece\u5df4\u5ae9\u938a lkr=\u65af\u91cc\u862d\u5361\u76e7\u5e03 lrd=\u8cf4\u6bd4\u745e\u4e9e\u5143 @@ -145,7 +171,7 @@ ltl=\u7acb\u9676\u5b9b\u91cc\u5854 luf=\u76e7\u68ee\u5821\u6cd5\u90ce lvl=\u62c9\u812b\u7dad\u4e9e\u62c9\u7279\u9280\u5e63 lyd=\u5229\u6bd4\u4e9e\u7b2c\u7d0d\u723e -mad=\u99ac\u90fd\u62c9\u6587 +mad=\u6469\u6d1b\u54e5\u8fea\u62c9\u59c6 mdl=\u6469\u675c\u96f2\u5217\u4f0a mga=\u99ac\u9054\u52a0\u65af\u52a0\u827e\u745e\u723e mgf=\u99ac\u9054\u52a0\u65af\u52a0\u6cd5\u90ce @@ -158,13 +184,14 @@ mtl=\u99ac\u723e\u4ed6\u91cc\u62c9 mur=\u6a21\u91cc\u897f\u65af\u76e7\u5e03 mvr=\u99ac\u723e\u5730\u592b\u6d77\u5cf6\u76e7\u975e\u4e9e mwk=\u99ac\u62c9\u7dad\u514b\u74e6\u67e5 -mxn=\u58a8\u897f\u54e5 - \u62ab\u7d22 -mxv=\u58a8\u897f\u54e5\u6cd5\u5f8b\u53cd\u8f49(UDI) -myr=\u99ac\u4f86\u897f\u4e9e - \u6797\u5409\u7279 +mxn=\u58a8\u897f\u54e5\u62ab\u7d22 +mxv=\u58a8\u897f\u54e5 Unidad de Inversion (UDI)\uff08\u8d44\u91d1\uff09 +myr=\u99ac\u4f86\u897f\u4e9e\u4ee4\u5409 mzm=\u83ab\u4e09\u6bd4\u514b\u6885\u8482\u5361\u723e +mzn=\u83ab\u4e09\u6bd4\u514b\u7f8e\u63d0\u5361 nad=\u7d0d\u7c73\u6bd4\u4e9e\u5143 ngn=\u5948\u53ca\u5229\u4e9e\u5948\u62c9 -nio=\u5c3c\u52a0\u62c9\u74dc \u91d1\u54e5\u591a\u83ef +nio=\u5c3c\u52a0\u62c9\u74dc\u91d1\u79d1\u591a\u5df4 nlg=\u8377\u862d\u76fe nok=\u632a\u5a01\u514b\u7f85\u7d0d npr=\u5c3c\u6cca\u723e\u76e7\u5e03 @@ -179,60 +206,70 @@ pln=\u6ce2\u862d\u8332\u7f85\u63d0 pte=\u8461\u8404\u7259\u57c3\u65af\u5eab\u591a pyg=\u5df4\u62c9\u572d\u74dc\u62c9\u5c3c qar=\u5361\u9054\u723e\u91cc\u4e9e\u723e -rol=\u7f85\u99ac\u5c3c\u4e9e\u5217\u4f0a +rol=\u65e7\u7f57\u9a6c\u5c3c\u4e9a\u5217\u4f0a +ron=\u7f85\u99ac\u5c3c\u4e9e\u5217\u4f0a +rsd=\u585e\u723e\u7dad\u4e9e\u6234\u7d0d rub=\u4fc4\u7f85\u65af\u76e7\u5e03 rur=\u4fc4\u7f85\u65af\u76e7\u5e03 (1991-1998) rwf=\u76e7\u5b89\u9054\u6cd5\u90ce sar=\u6c99\u70cf\u5730\u91cc\u96c5 sbd=\u7d22\u7f85\u9580\u7fa4\u5cf6\u5143 -scr=\u585e\u820c\u723e\u7fa4\u5cf6\u76e7\u5e03 +scr=\u585e\u5e2d\u723e\u76e7\u6bd4 sdd=\u8607\u4e39\u7b2c\u7d0d\u723e +sdg=\u8607\u4e39\u938a sek=\u745e\u5178\u514b\u7f85\u7d0d sgd=\u65b0\u52a0\u5761\u5e63 -shp=\u8056\u8d6b\u52d2\u62ff \u938a +shp=\u5723\u8d6b\u52d2\u62ff\u7fa4\u5c9b\u78c5 sit=\u65af\u6d1b\u7dad\u5c3c\u4e9e\u6258\u52d2 skk=\u65af\u6d1b\u4f10\u514b\u514b\u6717 sll=\u7345\u5b50\u5c71\u5229\u6602 sos=\u7d22\u99ac\u5229\u4e9e\u5148\u4ee4 -srg=\u8607\u91cc\u5357\u76fe +srd=\u82cf\u91cc\u5357\u5143 +srg=\u8607\u5229\u5357\u57fa\u723e std=\u8056\u591a\u7f8e\u5cf6\u548c\u666e\u6797\u897f\u6bd4\u5cf6\u591a\u5e03\u62c9 -svc=\u611b\u723e \u85a9\u723e\u74e6\u591a\u79d1\u90ce +svc=\u8428\u5c14\u74e6\u591a\u79d1\u6717 syp=\u6558\u5229\u4e9e\u938a -szl=\u65af\u5a01\u58eb\u862d \u91cc\u90ce +szl=\u65af\u5a01\u58eb\u5170\u91cc\u5170\u5409\u5c3c thb=\u6cf0\u9296 -tjs=\u5854\u5409\u514b\u65af\u5766 \u7d22\u83ab\u5c3c +tjs=\u5854\u5409\u514b\u65af\u5766\u7d22\u83ab\u5c3c tmm=\u571f\u5eab\u66fc\u99ac\u7d0d\u7279 tnd=\u7a81\u5c3c\u897f\u4e9e\u7b2c\u7d0d\u723e top=\u6771\u52a0\u6f58\u52a0 -tpe=\u5e1d\u6c76 \u57c3\u65af\u5eab\u591a +tpe=\u5e1d\u6c76\u57c3\u65af\u5e93\u591a trl=\u571f\u8033\u5176\u91cc\u62c9 try=\u65b0\u571f\u8033\u5176\u91cc\u62c9 -ttd=\u5343\u91cc\u9054\u53ca\u6258\u5df4\u54e5r -tzs=\u5766\u6851\u5c3c\u4e9e \u5148\u4ee4 +ttd=\u7279\u7acb\u5c3c\u8fbe\u548c\u591a\u5df4\u54e5\u5143 +tzs=\u5766\u6851\u5c3c\u4e9a\u5148\u4ee4 uah=\u70cf\u514b\u862d\u683c\u91cc\u592b\u90a3 ugx=\u70cf\u5e72\u9054\u5148\u4ee4 usd=\u7f8e\u5143 usn=\u7f8e\u5143 (\u7b2c\u4e8c\u5929) uss=\u7f8e\u5143 (\u540c\u4e00\u5929) uyu=\u70cf\u62c9\u572d\u62ab\u7d22 -uzs=\u70cf\u8332\u5225\u514b\u65af\u5766 \u85a9\u6728 -veb=\u59d4\u5167\u745e\u62c9\u535a\u5229\u74e6 +uzs=\u70cf\u8332\u5225\u514b\u7d22\u59c6 +veb=\u59d4\u5167\u745e\u62c9\u73bb\u5229\u74e6 +vef=\u59d4\u5167\u745e\u62c9\u5f37\u52e2\u73bb\u5229\u74e6 vnd=\u8d8a\u5357\u76fe vuv=\u842c\u90a3\u675c\u842c\u675c wst=\u897f\u85a9\u6469\u4e9e\u5854\u62c9 -xaf=\u897f\u975e \u6cd5\u90ce BEAC +xaf=\u897f\u975e\u6cd5\u90ce BEAC +xag=XAG xau=\u9ec3\u91d1 xba=\u6b50\u6d32\u7d9c\u5408\u55ae\u4f4d xbb=\u6b50\u6d32\u8ca8\u5e63\u55ae\u4f4d XBB -xbc=\u6b50\u6d32\u6703\u8a08\u55ae\u4f4d(XBC) -xbd=\u6b50\u6d32\u6703\u8a08\u55ae\u4f4d(XBD) +xbc=\u6b50\u6d32\u6703\u8a08\u55ae\u4f4d (XBC) +xbd=\u6b50\u6d32\u6703\u8a08\u55ae\u4f4d (XBD) xcd=\u683c\u745e\u90a3\u9054\u5143 xdr=\u7279\u6b8a\u63d0\u6b3e\u6b0a xfo=\u6cd5\u570b\u91d1\u6cd5\u90ce xfu=\u6cd5\u570b UIC \u6cd5\u90ce -xof=\u897f\u975e \u6cd5\u90ce BCEAO +xof=\u897f\u975e\u6cd5\u90ce BCEAO +xpd=\u94af xpf=CFP \u6cd5\u90ce -yer=\u4e5f\u9580\u91cc\u4e9e\u723e +xpt=\u94c2 +xts=XTS +xxx=XXX +yer=\u8449\u9580\u91cc\u96c5 yum=\u5357\u65af\u62c9\u592b\u632a\u5a01\u4e9e\u7b2c\u7d0d\u723e zar=\u5357\u975e\u862d\u7279 zmk=\u5c1a\u6bd4\u4e9e\u514b\u74e6\u67e5 diff --git a/jdk/test/sun/text/resources/LocaleData b/jdk/test/sun/text/resources/LocaleData index 0f538113beb..95078736233 100644 --- a/jdk/test/sun/text/resources/LocaleData +++ b/jdk/test/sun/text/resources/LocaleData @@ -6446,3 +6446,499 @@ CurrencyNames//wst=Samoan Tala CurrencyNames//xxx=Unknown Currency CurrencyNames//yum=Yugoslavian New Dinar (1994-2002) CurrencyNames//zwd=Zimbabwean Dollar (1980-2008) + +# bug 7020583 +CurrencyNames/de/azm=Aserbaidschan-Manat (1993-2006) +CurrencyNames/de/azn=Aserbaidschan-Manat +CurrencyNames/de/csd=Alter Serbischer Dinar +CurrencyNames/de/cyp=Zypern-Pfund +CurrencyNames/de/esp=Spanische Peseta +CurrencyNames/de/fjd=Fidschi-Dollar +CurrencyNames/de/fkp=Falkland-Pfund +CurrencyNames/de/ghs=Ghanaische Cedi +CurrencyNames/de/gip=Gibraltar-Pfund +CurrencyNames/de/gnf=Guinea-Franc +CurrencyNames/de/gyd=Guyana-Dollar +CurrencyNames/de/hkd=Hongkong-Dollar +CurrencyNames/de/itl=Italienische Lira +CurrencyNames/de/jmd=Jamaika-Dollar +CurrencyNames/de/kes=Kenia-Schilling +CurrencyNames/de/mgf=Madagaskar-Franc +CurrencyNames/de/mur=Mauritius-Rupie +CurrencyNames/de/mzm=Alter Metical +CurrencyNames/de/mzn=Metical +CurrencyNames/de/nad=Namibia-Dollar +CurrencyNames/de/nzd=Neuseeland-Dollar +CurrencyNames/de/ron=Rum\u00e4nischer Leu +CurrencyNames/de/rsd=Serbischer Dinar +CurrencyNames/de/rwf=Ruanda-Franc +CurrencyNames/de/sbd=Salomonen-Dollar +CurrencyNames/de/scr=Seychellen-Rupie +CurrencyNames/de/sdg=Sudanesisches Pfund +CurrencyNames/de/sgd=Singapur-Dollar +CurrencyNames/de/sos=Somalia-Schilling +CurrencyNames/de/srd=Surinamischer Dollar +CurrencyNames/de/tpe=Timor-Escudo +CurrencyNames/de/trl=Alte T\u00fcrkische Lira +CurrencyNames/de/try=T\u00fcrkische Lira +CurrencyNames/de/ttd=Trinidad- und Tobago-Dollar +CurrencyNames/de/twd=Neuer Taiwan-Dollar +CurrencyNames/de/tzs=Tansania-Schilling +CurrencyNames/de/ugx=Uganda-Schilling +CurrencyNames/de/usd=US-Dollar +CurrencyNames/de/vef=Bol\u00edvar Fuerte +CurrencyNames/de/xag=Unze Silber +CurrencyNames/de/xau=Unze Gold +CurrencyNames/de/xbb=Europ\u00e4ische W\u00e4hrungseinheit (XBB) +CurrencyNames/de/xpd=Unze Palladium +CurrencyNames/de/xpt=Unze Platin +CurrencyNames/de/xts=Testw\u00e4hrung +CurrencyNames/de/xxx=Unbekannte W\u00e4hrung +CurrencyNames/de/yer=Jemen-Rial +CurrencyNames/de/zar=S\u00fcdafrikanischer Rand +CurrencyNames/de/zwd=Simbabwe-Dollar + +CurrencyNames/es/aed=d\u00edrham de los Emiratos \u00c1rabes Unidos +CurrencyNames/es/azm=manat azer\u00ed (1993-2006) +CurrencyNames/es/azn=manat azer\u00ed +CurrencyNames/es/csd=antiguo dinar serbio +CurrencyNames/es/ghc=cedi ghan\u00e9s (1979-2007) +CurrencyNames/es/ghs=cedi ghan\u00e9s +CurrencyNames/es/mzm=antiguo metical mozambique\u00f1o +CurrencyNames/es/mzn=metical mozambique\u00f1o +CurrencyNames/es/rsd=dinar serbio +CurrencyNames/es/sdg=libra sudanesa +CurrencyNames/es/trl=lira turca antigua +CurrencyNames/es/vef=bol\u00edvar fuerte venezolano + +CurrencyNames/fr/afa=afghani (1927\u20132002) +CurrencyNames/fr/all=lek albanais +CurrencyNames/fr/ang=florin antillais +CurrencyNames/fr/awg=florin arubais +CurrencyNames/fr/azm=manat az\u00e9ri (1993-2006) +CurrencyNames/fr/azn=manat az\u00e9ri +CurrencyNames/fr/bam=mark convertible bosniaque +CurrencyNames/fr/bbd=dollar barbadien +CurrencyNames/fr/bdt=taka bangladeshi +CurrencyNames/fr/bgl=lev bulgare (1962\u20131999) +CurrencyNames/fr/bgn=nouveau lev bulgare +CurrencyNames/fr/bhd=dinar bahre\u00efni +CurrencyNames/fr/bif=franc burundais +CurrencyNames/fr/bmd=dollar bermudien +CurrencyNames/fr/bnd=dollar brun\u00e9ien +CurrencyNames/fr/bov=mvdol bolivien +CurrencyNames/fr/brl=r\u00e9al br\u00e9silien +CurrencyNames/fr/bsd=dollar baham\u00e9en +CurrencyNames/fr/btn=ngultrum bouthanais +CurrencyNames/fr/bwp=pula botswanais +CurrencyNames/fr/bzd=dollar b\u00e9liz\u00e9en +CurrencyNames/fr/cny=yuan renminbi chinois +CurrencyNames/fr/crc=col\u00f3n costaricain +CurrencyNames/fr/csd=dinar serbo-mont\u00e9n\u00e9grin +CurrencyNames/fr/cve=escudo capverdien +CurrencyNames/fr/cyp=livre chypriote +CurrencyNames/fr/dem=mark allemand +CurrencyNames/fr/djf=franc djiboutien +CurrencyNames/fr/ern=nafka \u00e9rythr\u00e9en +CurrencyNames/fr/etb=birr \u00e9thiopien +CurrencyNames/fr/fjd=dollar fidjien +CurrencyNames/fr/fkp=livre des Falkland +CurrencyNames/fr/gel=lari g\u00e9orgien +CurrencyNames/fr/ghs=c\u00e9di ghan\u00e9en +CurrencyNames/fr/gmd=dalasi gambien +CurrencyNames/fr/grd=drachme grecque +CurrencyNames/fr/gtq=quetzal guat\u00e9malt\u00e8que +CurrencyNames/fr/gwp=peso bissau-guin\u00e9en +CurrencyNames/fr/hnl=lempira hondurien +CurrencyNames/fr/hrk=kuna croate +CurrencyNames/fr/htg=gourde ha\u00eftienne +CurrencyNames/fr/huf=forint hongrois +CurrencyNames/fr/idr=roupie indon\u00e9sienne +CurrencyNames/fr/ils=nouveau shekel isra\u00e9lien +CurrencyNames/fr/iqd=dinar irakien +CurrencyNames/fr/jpy=yen japonais +CurrencyNames/fr/kes=shilling k\u00e9nyan +CurrencyNames/fr/kgs=som kirghize +CurrencyNames/fr/khr=riel cambodgien +CurrencyNames/fr/kmf=franc comorien +CurrencyNames/fr/kwd=dinar kowe\u00eftien +CurrencyNames/fr/kzt=tenge kazakh +CurrencyNames/fr/lak=kip loatien +CurrencyNames/fr/lkr=roupie srilankaise +CurrencyNames/fr/lsl=loti lesothan +CurrencyNames/fr/mga=ariary malgache +CurrencyNames/fr/mkd=denar mac\u00e9donien +CurrencyNames/fr/mmk=kyat myanmarais +CurrencyNames/fr/mnt=tugrik mongol +CurrencyNames/fr/mop=pataca macanaise +CurrencyNames/fr/mro=ouguiya mauritanien +CurrencyNames/fr/mvr=rufiyaa maldivienne +CurrencyNames/fr/mwk=kwacha malawite +CurrencyNames/fr/myr=ringgit malais +CurrencyNames/fr/mzn=metical mozambicain +CurrencyNames/fr/ngn=naira nig\u00e9rian +CurrencyNames/fr/nio=c\u00f3rdoba oro nicaraguayen +CurrencyNames/fr/npr=roupie n\u00e9palaise +CurrencyNames/fr/pab=balboa panam\u00e9en +CurrencyNames/fr/pgk=kina papouan-n\u00e9o-guin\u00e9en +CurrencyNames/fr/pkr=roupie pakistanaise +CurrencyNames/fr/pln=zloty polonais +CurrencyNames/fr/pyg=guaran\u00ed paraguayen +CurrencyNames/fr/qar=rial qatari +CurrencyNames/fr/ron=leu roumain +CurrencyNames/fr/rsd=dinar serbe +CurrencyNames/fr/rub=rouble russe +CurrencyNames/fr/rur=rouble russe (1991\u20131998) +CurrencyNames/fr/sbd=dollar des \u00eeles Salomon +CurrencyNames/fr/sdg=livre soudanaise +CurrencyNames/fr/sit=tolar slov\u00e8ne +CurrencyNames/fr/sll=leone sierra-l\u00e9onais +CurrencyNames/fr/sos=shilling somalien +CurrencyNames/fr/srg=florin surinamais +CurrencyNames/fr/std=dobra santom\u00e9en +CurrencyNames/fr/svc=col\u00f3n salvadorien +CurrencyNames/fr/szl=lilangeni swazi +CurrencyNames/fr/thb=baht tha\u00eflandais +CurrencyNames/fr/tjs=somoni tadjik +CurrencyNames/fr/tmm=manat turkm\u00e8ne +CurrencyNames/fr/top=pa\u2019anga tongan +CurrencyNames/fr/tpe=escudo timorais +CurrencyNames/fr/ttd=dollar trinidadien +CurrencyNames/fr/twd=nouveau dollar ta\u00efwanais +CurrencyNames/fr/tzs=shilling tanzanien +CurrencyNames/fr/uah=hryvnia ukrainienne +CurrencyNames/fr/uzs=sum ouzbek +CurrencyNames/fr/vef=bolivar fuerte v\u00e9n\u00e9zu\u00e9lien +CurrencyNames/fr/vnd=d\u00f4ng vietnamien +CurrencyNames/fr/vuv=vatu vanuatuan +CurrencyNames/fr/wst=tala samoan +CurrencyNames/fr/xts=(devise de test) +CurrencyNames/fr/xxx=devise inconnue ou non valide +CurrencyNames/fr/yer=rial y\u00e9m\u00e9nite +CurrencyNames/fr/zar=rand sud-africain +CurrencyNames/fr/zmk=kwacha zambien +CurrencyNames/fr/zwd=dollar zimbabw\u00e9en + +CurrencyNames/it/azm=Manat Azero (1993-2006) +CurrencyNames/it/ghs=Cedi ghanese +CurrencyNames/it/iep=Sterlina irlandese +CurrencyNames/it/mzn=Metical del Mozambico +CurrencyNames/it/rsd=Dinaro serbo +CurrencyNames/it/sdg=Sterlina sudanese +CurrencyNames/it/srd=Dollaro surinamese +CurrencyNames/it/vef=Bol\u00edvar venezuelano forte +CurrencyNames/it/xag=Argento +CurrencyNames/it/xpd=Palladio + +CurrencyNames/ja/azm=\u30a2\u30bc\u30eb\u30d0\u30a4\u30b8\u30e3\u30f3 \u30de\u30ca\u30c8 (1993-2006) +CurrencyNames/ja/azn=\u30a2\u30bc\u30eb\u30d0\u30a4\u30b8\u30e3\u30f3 \u30de\u30ca\u30c8 +CurrencyNames/ja/ghc=\u30ac\u30fc\u30ca \u30bb\u30c7\u30a3 (1979-2007) +CurrencyNames/ja/ghs=\u30ac\u30fc\u30ca \u30bb\u30c7\u30a3 +CurrencyNames/ja/mzn=\u30e2\u30b6\u30f3\u30d3\u30fc\u30af \u30e1\u30c6\u30a3\u30ab\u30eb +CurrencyNames/ja/rol=\u30eb\u30fc\u30de\u30cb\u30a2 \u65e7\u30ec\u30a4 +CurrencyNames/ja/ron=\u30eb\u30fc\u30de\u30cb\u30a2 \u30ec\u30a4 +CurrencyNames/ja/rsd=\u30c7\u30a3\u30ca\u30fc\u30eb (\u30bb\u30eb\u30d3\u30a2) +CurrencyNames/ja/sdg=\u30b9\u30fc\u30c0\u30f3 \u30dd\u30f3\u30c9 +CurrencyNames/ja/srd=\u30b9\u30ea\u30ca\u30e0 \u30c9\u30eb +CurrencyNames/ja/vef=\u30d9\u30cd\u30ba\u30a8\u30e9 \u30dc\u30ea\u30d0\u30eb\u30d5\u30a8\u30eb\u30c6 +CurrencyNames/ja/xag=\u9280 +CurrencyNames/ja/xpd=\u30d1\u30e9\u30b8\u30a6\u30e0 +CurrencyNames/ja/xpt=\u30d7\u30e9\u30c1\u30ca +CurrencyNames/ja/xts=\u30c6\u30b9\u30c8\u7528\u901a\u8ca8\u30b3\u30fc\u30c9 +CurrencyNames/ja/xxx=\u4e0d\u660e\u307e\u305f\u306f\u7121\u52b9\u306a\u901a\u8ca8 +CurrencyNames/ja/zmk=\u30b6\u30f3\u30d3\u30a2 \u30af\u30ef\u30c1\u30e3 + +CurrencyNames/ko/aed=\uc544\ub78d\uc5d0\ubbf8\ub9ac\ud2b8 \ub514\ub974\ud568 +CurrencyNames/ko/ang=\ub124\ub35c\ub780\ub4dc\ub839 \uc548\ud2f8\ub808\uc2a4 \uae38\ub354 +CurrencyNames/ko/azm=\uc544\uc81c\ub974\ubc14\uc774\uc820 \ub9c8\ub098\ud2b8(1993-2006) +CurrencyNames/ko/azn=\uc544\uc81c\ub974\ubc14\uc774\uc794 \ub9c8\ub098\ud2b8 +CurrencyNames/ko/bov=\ubcfc\ub9ac\ube44\uc544\ub178 Mvdol(\uae30\uae08) +CurrencyNames/ko/chf=\uc2a4\uc704\uc2a4 \ud504\ub791 +CurrencyNames/ko/clf=\uce60\ub808 UF (Unidades de Fomento) +CurrencyNames/ko/csd=\uace0 \uc138\ub974\ube44\uc544 \ub514\ub098\ub974 +CurrencyNames/ko/ghc=\uac00\ub098 \uc2dc\ub514 (1979-2007) +CurrencyNames/ko/ghs=\uac00\ub098 \uc2dc\ub514 +CurrencyNames/ko/mxv=\uba55\uc2dc\ucf54 UDI(Unidad de Inversion) +CurrencyNames/ko/myr=\ub9d0\ub808\uc774\uc2dc\uc544 \ub9c1\uae43 +CurrencyNames/ko/mzm=\uace0 \ubaa8\uc7a0\ube44\ud06c \uba54\ud2f0\uce7c +CurrencyNames/ko/mzn=\ubaa8\uc7a0\ube44\ud06c \uba54\ud2f0\uce7c +CurrencyNames/ko/ron=\ub8e8\ub9c8\ub2c8\uc544 \ub808\uc6b0 +CurrencyNames/ko/rsd=\uc138\ub974\ube44\uc544 \ub514\ub098\ub974 +CurrencyNames/ko/sdg=\uc218\ub2e8 \ud30c\uc6b4\ub4dc +CurrencyNames/ko/srd=\uc218\ub9ac\ub0a8 \ub2ec\ub7ec +CurrencyNames/ko/top=\ud1b5\uac00 \ud30c\uc559\uac00 +CurrencyNames/ko/trl=\ud130\ud0a4 \ub9ac\ub77c +CurrencyNames/ko/try=\uc2e0 \ud130\ud0a4 \ub9ac\ub77c +CurrencyNames/ko/usn=\ubbf8\uad6d \ub2ec\ub7ec(\ub2e4\uc74c\ub0a0) +CurrencyNames/ko/uss=\ubbf8\uad6d \ub2ec\ub7ec(\ub2f9\uc77c) +CurrencyNames/ko/vef=\ubca0\ub124\uc8fc\uc5d8\ub77c \ubcfc\ub9ac\ubc14\ub974 \ud478\uc5d0\ub974\ub5bc +CurrencyNames/ko/xaf=CFA \ud504\ub791 BEAC +CurrencyNames/ko/xag=\uc740\ud654 +CurrencyNames/ko/xba=\uc720\ub974\ucf54 (\uc720\ub7fd \ud68c\uacc4 \ub2e8\uc704) +CurrencyNames/ko/xbb=\uc720\ub7fd \ud1b5\ud654 \ub3d9\ub9f9 +CurrencyNames/ko/xbc=\uc720\ub7fd \uacc4\uc0b0 \ub2e8\uc704 (XBC) +CurrencyNames/ko/xbd=\uc720\ub7fd \uacc4\uc0b0 \ub2e8\uc704 (XBD) +CurrencyNames/ko/xof=CFA \ud504\ub791 BCEAO +CurrencyNames/ko/xpd=\ud314\ub77c\ub4d0 +CurrencyNames/ko/xpf=CFP \ud504\ub791 +CurrencyNames/ko/xpt=\ubc31\uae08 +CurrencyNames/ko/xts=\ud14c\uc2a4\ud2b8 \ud1b5\ud654 \ucf54\ub4dc +CurrencyNames/ko/xxx=\uc54c\uc218\uc5c6\uac70\ub098 \uc720\ud6a8\ud558\uc9c0\uc54a\uc740 \ud1b5\ud654\ub2e8\uc704 +CurrencyNames/ko/zwd=\uc9d0\ubc14\ube0c\uc6e8 \ub2ec\ub7ec + +CurrencyNames/sv/adp=andorransk peseta +CurrencyNames/sv/aed=F\u00f6renade Arabemiratens dirham +CurrencyNames/sv/afa=afghani (1927-2002) +CurrencyNames/sv/afn=afghani +CurrencyNames/sv/all=albansk lek +CurrencyNames/sv/amd=armenisk dram +CurrencyNames/sv/ang=Nederl\u00e4ndska Antillernas gulden +CurrencyNames/sv/aoa=angolansk kwanza +CurrencyNames/sv/ars=argentinsk peso +CurrencyNames/sv/ats=\u00f6sterrikisk schilling +CurrencyNames/sv/aud=australisk dollar +CurrencyNames/sv/awg=Aruba-gulden +CurrencyNames/sv/azm=azerbajdzjansk manat (1993-2006) +CurrencyNames/sv/azn=azerbajdzjansk manat +CurrencyNames/sv/bam=bosnisk-hercegovinsk mark (konvertibel) +CurrencyNames/sv/bbd=Barbados-dollar +CurrencyNames/sv/bdt=bangladeshisk taka +CurrencyNames/sv/bef=belgisk franc +CurrencyNames/sv/bgn=bulgarisk ny lev +CurrencyNames/sv/bhd=Bahrain-dinar +CurrencyNames/sv/bif=burundisk franc +CurrencyNames/sv/bnd=Brunei-dollar +CurrencyNames/sv/bob=boliviano +CurrencyNames/sv/bov=boliviansk mvdol +CurrencyNames/sv/brl=brasiliansk real +CurrencyNames/sv/bsd=Bahamas-dollar +CurrencyNames/sv/btn=bhutanesisk ngultrum +CurrencyNames/sv/bwp=botswansk pula +CurrencyNames/sv/byb=vitrysk ny rubel (1994-1999) +CurrencyNames/sv/byr=vitrysk rubel +CurrencyNames/sv/bzd=belizisk dollar +CurrencyNames/sv/cad=kanadensisk dollar +CurrencyNames/sv/cdf=kongolesisk franc +CurrencyNames/sv/chf=schweizisk franc +CurrencyNames/sv/clf=chilensk unidad de fomento +CurrencyNames/sv/clp=chilensk peso +CurrencyNames/sv/cny=kinesisk yuan renminbi +CurrencyNames/sv/cop=colombiansk peso +CurrencyNames/sv/crc=costarikansk col\u00f3n +CurrencyNames/sv/csd=jugoslavisk dinar +CurrencyNames/sv/cup=kubansk peso +CurrencyNames/sv/cve=kapverdisk escudo +CurrencyNames/sv/cyp=cypriotiskt pund +CurrencyNames/sv/czk=tjeckisk koruna +CurrencyNames/sv/dem=tysk mark +CurrencyNames/sv/djf=djiboutisk franc +CurrencyNames/sv/dkk=dansk krona +CurrencyNames/sv/dop=dominikansk peso +CurrencyNames/sv/dzd=algerisk dinar +CurrencyNames/sv/eek=estnisk krona +CurrencyNames/sv/egp=egyptiskt pund +CurrencyNames/sv/ern=eritreansk nakfa +CurrencyNames/sv/esp=spansk peseta +CurrencyNames/sv/etb=etiopisk birr +CurrencyNames/sv/eur=euro +CurrencyNames/sv/fim=finsk mark +CurrencyNames/sv/fjd=Fiji-dollar +CurrencyNames/sv/frf=fransk franc +CurrencyNames/sv/gbp=brittiskt pund sterling +CurrencyNames/sv/gel=georgisk lari +CurrencyNames/sv/ghc=ghanansk cedi (1979-2007) +CurrencyNames/sv/ghs=ghanansk cedi +CurrencyNames/sv/gip=gibraltiskt pund +CurrencyNames/sv/gmd=gambisk dalasi +CurrencyNames/sv/gnf=guineansk franc +CurrencyNames/sv/grd=grekisk drachma +CurrencyNames/sv/gtq=guatemalansk quetzal +CurrencyNames/sv/gyd=guyanansk dollar +CurrencyNames/sv/hnl=honduransk lempira +CurrencyNames/sv/hrk=kroatisk kuna +CurrencyNames/sv/htg=haitisk gourde +CurrencyNames/sv/huf=ungersk forint +CurrencyNames/sv/idr=indonesisk rupiah +CurrencyNames/sv/iep=irl\u00e4ndskt pund +CurrencyNames/sv/ils=israelisk ny shekel +CurrencyNames/sv/inr=indisk rupie +CurrencyNames/sv/iqd=irakisk dinar +CurrencyNames/sv/irr=iransk rial +CurrencyNames/sv/isk=isl\u00e4ndsk krona +CurrencyNames/sv/itl=italiensk lira +CurrencyNames/sv/jmd=Jamaica-dollar +CurrencyNames/sv/jod=jordansk dinar +CurrencyNames/sv/jpy=japansk yen +CurrencyNames/sv/kes=kenyansk shilling +CurrencyNames/sv/kgs=kirgizisk som +CurrencyNames/sv/khr=kambodjansk riel +CurrencyNames/sv/kmf=komorisk franc +CurrencyNames/sv/kpw=nordkoreansk won +CurrencyNames/sv/krw=sydkoreansk won +CurrencyNames/sv/kwd=kuwaitisk dinar +CurrencyNames/sv/kzt=kazakisk tenge +CurrencyNames/sv/lak=laotisk kip +CurrencyNames/sv/lbp=libanesiskt pund +CurrencyNames/sv/lkr=srilankesisk rupie +CurrencyNames/sv/lrd=Liberia-dollar +CurrencyNames/sv/lsl=lesothisk loti +CurrencyNames/sv/ltl=litauisk litas +CurrencyNames/sv/luf=luxemburgsk franc +CurrencyNames/sv/lvl=lettisk lats +CurrencyNames/sv/lyd=libysk dinar +CurrencyNames/sv/mad=marockansk dirham +CurrencyNames/sv/mdl=moldavisk leu +CurrencyNames/sv/mga=madagaskisk ariary +CurrencyNames/sv/mgf=madagaskisk franc +CurrencyNames/sv/mkd=makedonisk denar +CurrencyNames/sv/mmk=myanmarisk kyat +CurrencyNames/sv/mnt=mongolisk tugrik +CurrencyNames/sv/mop=Macao-pataca +CurrencyNames/sv/mro=mauretansk ouguiya +CurrencyNames/sv/mtl=maltesisk lira +CurrencyNames/sv/mur=mauritisk rupie +CurrencyNames/sv/mvr=maldivisk rufiyaa +CurrencyNames/sv/mwk=malawisk kwacha +CurrencyNames/sv/mxn=mexikansk peso +CurrencyNames/sv/mxv=mexikansk unidad de inversion +CurrencyNames/sv/myr=malaysisk ringgit +CurrencyNames/sv/mzm=gammal mo\u00e7ambikisk metical +CurrencyNames/sv/mzn=mo\u00e7ambikisk metical +CurrencyNames/sv/nad=Namibia-dollar +CurrencyNames/sv/ngn=nigeriansk naira +CurrencyNames/sv/nio=nicaraguansk c\u00f3rdoba oro +CurrencyNames/sv/nlg=nederl\u00e4ndsk gulden +CurrencyNames/sv/nok=norsk krona +CurrencyNames/sv/npr=nepalesisk rupie +CurrencyNames/sv/nzd=nyzeel\u00e4ndsk dollar +CurrencyNames/sv/omr=omansk rial +CurrencyNames/sv/pab=panamansk balboa +CurrencyNames/sv/pen=peruansk sol nuevo +CurrencyNames/sv/pgk=papuansk kina +CurrencyNames/sv/php=filippinsk peso +CurrencyNames/sv/pkr=pakistansk rupie +CurrencyNames/sv/pln=polsk zloty +CurrencyNames/sv/pte=portugisisk escudo +CurrencyNames/sv/pyg=paraguaysk guarani +CurrencyNames/sv/qar=qatarisk rial +CurrencyNames/sv/rol=gammal rum\u00e4nsk leu +CurrencyNames/sv/ron=rum\u00e4nsk leu +CurrencyNames/sv/rsd=Serbisk dinar +CurrencyNames/sv/rub=rysk rubel +CurrencyNames/sv/rur=rysk rubel (1991-1998) +CurrencyNames/sv/rwf=rwandisk franc +CurrencyNames/sv/sar=saudisk riyal +CurrencyNames/sv/scr=seychellisk rupie +CurrencyNames/sv/sdd=sudanesisk dinar +CurrencyNames/sv/sdg=sudanesiskt pund +CurrencyNames/sv/sek=svensk krona +CurrencyNames/sv/sgd=Singapore-dollar +CurrencyNames/sv/sit=slovensk tolar +CurrencyNames/sv/skk=slovakisk koruna +CurrencyNames/sv/sll=sierraleonsk leone +CurrencyNames/sv/sos=somalisk shilling +CurrencyNames/sv/srd=Surinam-dollar +CurrencyNames/sv/srg=surinamesisk gulden +CurrencyNames/sv/svc=salvadoransk col\u00f3n +CurrencyNames/sv/syp=syriskt pund +CurrencyNames/sv/szl=swazil\u00e4ndsk lilangeni +CurrencyNames/sv/thb=thail\u00e4ndsk baht +CurrencyNames/sv/tjs=tadzjikisk somoni +CurrencyNames/sv/tmm=turkmensk manat +CurrencyNames/sv/tnd=tunisisk dinar +CurrencyNames/sv/top=tongansk pa\u02bbanga +CurrencyNames/sv/tpe=timoriansk escudo +CurrencyNames/sv/trl=gammal turkisk lira +CurrencyNames/sv/try=ny turkisk lira +CurrencyNames/sv/ttd=Trinidad ochTobago-dollar +CurrencyNames/sv/twd=taiwanesisk ny dollar +CurrencyNames/sv/tzs=tanzanisk shilling +CurrencyNames/sv/uah=ukrainsk hryvnia +CurrencyNames/sv/ugx=ugandisk shilling +CurrencyNames/sv/uyu=uruguayansk peso +CurrencyNames/sv/uzs=uzbekisk sum +CurrencyNames/sv/veb=venezuelansk bolivar +CurrencyNames/sv/vef=venezuelansk bolivar fuerte +CurrencyNames/sv/vnd=vietnamesisk dong +CurrencyNames/sv/vuv=vanuatisk vatu +CurrencyNames/sv/wst=v\u00e4stsamoansk tala +CurrencyNames/sv/xag=silver +CurrencyNames/sv/xau=guld +CurrencyNames/sv/xba=europeisk kompositenhet +CurrencyNames/sv/xbb=europeisk monet\u00e4r enhet +CurrencyNames/sv/xbc=europeisk kontoenhet (XBC) +CurrencyNames/sv/xbd=europeisk kontoenhet (XBD) +CurrencyNames/sv/xcd=\u00f6stkaribisk dollar +CurrencyNames/sv/xdr=IMF s\u00e4rskild dragningsr\u00e4tt +CurrencyNames/sv/xfo=fransk guldfranc +CurrencyNames/sv/xpd=palladium +CurrencyNames/sv/xpt=platina +CurrencyNames/sv/xts=test-valutakod +CurrencyNames/sv/xxx=ok\u00e4nd eller ogiltig valuta +CurrencyNames/sv/yer=jemenitisk rial +CurrencyNames/sv/yum=jugoslavisk ny dinar +CurrencyNames/sv/zar=sydafrikansk rand +CurrencyNames/sv/zmk=zambisk kwacha +CurrencyNames/sv/zwd=Zimbabwe-dollar + +CurrencyNames/zh_CN/ang=\u8377\u5170\u5b89\u66ff\u5170\u76fe +CurrencyNames/zh_CN/azm=\u963f\u585e\u62dc\u7586\u9a6c\u7eb3\u7279 (1993-2006) +CurrencyNames/zh_CN/azn=\u963f\u585e\u62dc\u7586\u9a6c\u7eb3\u7279 +CurrencyNames/zh_CN/csd=\u65e7\u585e\u5c14\u7ef4\u4e9a\u7b2c\u7eb3\u5c14 +CurrencyNames/zh_CN/ghs=\u52a0\u7eb3\u585e\u5730 +CurrencyNames/zh_CN/mzm=\u65e7\u83ab\u6851\u6bd4\u514b\u7f8e\u63d0\u5361 +CurrencyNames/zh_CN/mzn=\u83ab\u6851\u6bd4\u514b\u7f8e\u63d0\u5361 +CurrencyNames/zh_CN/ron=\u7f57\u9a6c\u5c3c\u4e9a\u5217\u4f0a +CurrencyNames/zh_CN/rsd=\u585e\u5c14\u7ef4\u4e9a\u7b2c\u7eb3\u5c14 +CurrencyNames/zh_CN/shp=\u5723\u8d6b\u52d2\u62ff\u7fa4\u5c9b\u78c5 +CurrencyNames/zh_CN/twd=\u65b0\u53f0\u5e01 +CurrencyNames/zh_CN/vef=\u59d4\u5185\u745e\u62c9\u5f3a\u52bf\u73bb\u5229\u74e6 +CurrencyNames/zh_CN/xxx=\u8d27\u5e01\u672a\u77e5\u6216\u65e0\u6548 + +CurrencyNames/zh_TW/afa=\u963f\u5bcc\u6c57\u5c3c (1927-2002) +CurrencyNames/zh_TW/ang=\u53e4\u82f1\u6587 +CurrencyNames/zh_TW/azm=\u4e9e\u585e\u62dc\u7136\u99ac\u7d0d\u7279 (1993-2006) +CurrencyNames/zh_TW/azn=\u4e9e\u585e\u62dc\u7136\u99ac\u7d0d\u7279 +CurrencyNames/zh_TW/bwp=\u6ce2\u672d\u90a3\u666e\u62c9 +CurrencyNames/zh_TW/bzd=\u8c9d\u91cc\u65af\u5143 +CurrencyNames/zh_TW/csd=\u65e7\u585e\u5c14\u7ef4\u4e9a\u7b2c\u7eb3\u5c14 +CurrencyNames/zh_TW/cyp=\u8cfd\u666e\u52d2\u65af\u938a +CurrencyNames/zh_TW/ghc=\u8fe6\u7d0d\u4ed9\u8515 (1979-2007) +CurrencyNames/zh_TW/ghs=\u8fe6\u7d0d\u4ed9\u8515 +CurrencyNames/zh_TW/gwp=\u5e7e\u5167\u4e9e\u6bd4\u7d22\u62ab\u7d22 +CurrencyNames/zh_TW/huf=\u5308\u7259\u5229\u798f\u6797 +CurrencyNames/zh_TW/idr=\u5370\u5c3c\u76fe +CurrencyNames/zh_TW/inr=\u5370\u5ea6\u76e7\u6bd4 +CurrencyNames/zh_TW/kpw=\u5317\u97d3\u571c +CurrencyNames/zh_TW/krw=\u97d3\u571c +CurrencyNames/zh_TW/lak=\u8001\u631d\u57fa\u666e +CurrencyNames/zh_TW/mad=\u6469\u6d1b\u54e5\u8fea\u62c9\u59c6 +CurrencyNames/zh_TW/mxn=\u58a8\u897f\u54e5\u62ab\u7d22 +CurrencyNames/zh_TW/mxv=\u58a8\u897f\u54e5 Unidad de Inversion (UDI)\uff08\u8d44\u91d1\uff09 +CurrencyNames/zh_TW/myr=\u99ac\u4f86\u897f\u4e9e\u4ee4\u5409 +CurrencyNames/zh_TW/mzn=\u83ab\u4e09\u6bd4\u514b\u7f8e\u63d0\u5361 +CurrencyNames/zh_TW/nio=\u5c3c\u52a0\u62c9\u74dc\u91d1\u79d1\u591a\u5df4 +CurrencyNames/zh_TW/rol=\u65e7\u7f57\u9a6c\u5c3c\u4e9a\u5217\u4f0a +CurrencyNames/zh_TW/ron=\u7f85\u99ac\u5c3c\u4e9e\u5217\u4f0a +CurrencyNames/zh_TW/rsd=\u585e\u723e\u7dad\u4e9e\u6234\u7d0d +CurrencyNames/zh_TW/scr=\u585e\u5e2d\u723e\u76e7\u6bd4 +CurrencyNames/zh_TW/sdg=\u8607\u4e39\u938a +CurrencyNames/zh_TW/shp=\u5723\u8d6b\u52d2\u62ff\u7fa4\u5c9b\u78c5 +CurrencyNames/zh_TW/srd=\u82cf\u91cc\u5357\u5143 +CurrencyNames/zh_TW/srg=\u8607\u5229\u5357\u57fa\u723e +CurrencyNames/zh_TW/svc=\u8428\u5c14\u74e6\u591a\u79d1\u6717 +CurrencyNames/zh_TW/szl=\u65af\u5a01\u58eb\u5170\u91cc\u5170\u5409\u5c3c +CurrencyNames/zh_TW/tpe=\u5e1d\u6c76\u57c3\u65af\u5e93\u591a +CurrencyNames/zh_TW/ttd=\u7279\u7acb\u5c3c\u8fbe\u548c\u591a\u5df4\u54e5\u5143 +CurrencyNames/zh_TW/tzs=\u5766\u6851\u5c3c\u4e9a\u5148\u4ee4 +CurrencyNames/zh_TW/uzs=\u70cf\u8332\u5225\u514b\u7d22\u59c6 +CurrencyNames/zh_TW/veb=\u59d4\u5167\u745e\u62c9\u73bb\u5229\u74e6 +CurrencyNames/zh_TW/vef=\u59d4\u5167\u745e\u62c9\u5f37\u52e2\u73bb\u5229\u74e6 +CurrencyNames/zh_TW/xaf=\u897f\u975e\u6cd5\u90ce BEAC +CurrencyNames/zh_TW/xag=XAG +CurrencyNames/zh_TW/xof=\u897f\u975e\u6cd5\u90ce BCEAO +CurrencyNames/zh_TW/xpd=\u94af +CurrencyNames/zh_TW/xpt=\u94c2 +CurrencyNames/zh_TW/xts=XTS +CurrencyNames/zh_TW/xxx=XXX +CurrencyNames/zh_TW/yer=\u8449\u9580\u91cc\u96c5 diff --git a/jdk/test/sun/text/resources/LocaleDataTest.java b/jdk/test/sun/text/resources/LocaleDataTest.java index 311b08a9125..1b7d80ef78d 100644 --- a/jdk/test/sun/text/resources/LocaleDataTest.java +++ b/jdk/test/sun/text/resources/LocaleDataTest.java @@ -33,7 +33,7 @@ * 6379214 6485516 6486607 4225362 4494727 6533691 6531591 6531593 6570259 * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611 * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787 - * 6919624 6998391 7019267 7020960 7025837 + * 6919624 6998391 7019267 7020960 7025837 7020583 * @summary Verify locale data * */ From 502320fdde82a072b4016f5cef234ff90fc9c379 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Wed, 6 Apr 2011 20:15:38 -0700 Subject: [PATCH 140/168] 7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes --- jaxp/build-defs.xml | 2 +- jaxp/build-drop-template.xml | 2 +- jaxp/build.xml | 2 +- jaxp/jaxp.properties | 2 +- jaxp/make/Makefile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jaxp/build-defs.xml b/jaxp/build-defs.xml index 27fb78c888f..7b83ad58066 100644 --- a/jaxp/build-defs.xml +++ b/jaxp/build-defs.xml @@ -1,6 +1,6 @@