agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java

Print this page


   1 /*
   2  * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 671                            throws AbsentInformationException {
 672         if (!vm.canGetSourceDebugExtension()) {
 673             throw new UnsupportedOperationException();
 674         }
 675         SDE sde = sourceDebugExtensionInfo();
 676         if (sde == NO_SDE_INFO_MARK) {
 677             throw new AbsentInformationException();
 678         }
 679         return sde.sourceDebugExtension;
 680     }
 681 
 682     private SDE sourceDebugExtensionInfo() {
 683         if (!vm.canGetSourceDebugExtension()) {
 684             return NO_SDE_INFO_MARK;
 685         }
 686         SDE sde = null;
 687         sde = (sdeRef == null) ?  null : (SDE)sdeRef.get();
 688         if (sde == null) {
 689            String extension = null;
 690            if (saKlass instanceof InstanceKlass) {
 691               Symbol sdeSym = ((InstanceKlass)saKlass).getSourceDebugExtension();
 692               extension = (sdeSym != null)? sdeSym.asString() : null;
 693            }
 694            if (extension == null) {
 695               sde = NO_SDE_INFO_MARK;
 696            } else {
 697               sde = new SDE(extension);
 698            }
 699            sdeRef = new SoftReference(sde);
 700         }
 701         return sde;
 702     }
 703 
 704     public List availableStrata() {
 705         SDE sde = sourceDebugExtensionInfo();
 706         if (sde.isValid()) {
 707             return sde.availableStrata();
 708         } else {
 709             List strata = new ArrayList();
 710             strata.add(SDE.BASE_STRATUM_NAME);
 711             return strata;
 712         }


   1 /*
   2  * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 671                            throws AbsentInformationException {
 672         if (!vm.canGetSourceDebugExtension()) {
 673             throw new UnsupportedOperationException();
 674         }
 675         SDE sde = sourceDebugExtensionInfo();
 676         if (sde == NO_SDE_INFO_MARK) {
 677             throw new AbsentInformationException();
 678         }
 679         return sde.sourceDebugExtension;
 680     }
 681 
 682     private SDE sourceDebugExtensionInfo() {
 683         if (!vm.canGetSourceDebugExtension()) {
 684             return NO_SDE_INFO_MARK;
 685         }
 686         SDE sde = null;
 687         sde = (sdeRef == null) ?  null : (SDE)sdeRef.get();
 688         if (sde == null) {
 689            String extension = null;
 690            if (saKlass instanceof InstanceKlass) {
 691               extension = ((InstanceKlass)saKlass).getSourceDebugExtension();

 692            }
 693            if (extension == null) {
 694               sde = NO_SDE_INFO_MARK;
 695            } else {
 696               sde = new SDE(extension);
 697            }
 698            sdeRef = new SoftReference(sde);
 699         }
 700         return sde;
 701     }
 702 
 703     public List availableStrata() {
 704         SDE sde = sourceDebugExtensionInfo();
 705         if (sde.isValid()) {
 706             return sde.availableStrata();
 707         } else {
 708             List strata = new ArrayList();
 709             strata.add(SDE.BASE_STRATUM_NAME);
 710             return strata;
 711         }