--- old/src/jdk.jdi/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Thu Dec 10 01:42:37 2015 +++ new/src/jdk.jdi/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Thu Dec 10 01:42:37 2015 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,8 +45,10 @@ private SoftReference sdeRef = null; private boolean isClassLoaderCached = false; + private boolean isModuleCached = false; private ClassLoaderReference classLoader = null; private ClassObjectReference classObject = null; + private Module module = null; private int status = 0; private boolean isPrepared = false; @@ -219,6 +221,22 @@ return classLoader; } + public Module module() { + if (isModuleCached) { + return module; + } + // Does not need synchronization, since worst-case + // static info is fetched twice + try { + ModuleImpl m = JDWP.ReferenceType.Module.process(vm, this).module; + module = vm.getModule(m.ref()); + isModuleCached = true; + } catch (JDWPException exc) { + throw exc.toJDIException(); + } + return module; + } + public boolean isPublic() { if (modifiers == -1) getModifiers();