1.1 --- a/openide.util.lookup/manifest.mf Sat Oct 31 16:33:02 2009 +0100
1.2 +++ b/openide.util.lookup/manifest.mf Sat Oct 31 17:13:07 2009 +0100
1.3 @@ -1,5 +1,5 @@
1.4 Manifest-Version: 1.0
1.5 OpenIDE-Module: org.openide.util.lookup
1.6 +OpenIDE-Module-Implementation-Version: 1
1.7 OpenIDE-Module-Localizing-Bundle: org/openide/util/lookup/Bundle.properties
1.8 -OpenIDE-Module-Specification-Version: 8.0
1.9
2.1 --- a/openide.util.lookup/nbproject/project.properties Sat Oct 31 16:33:02 2009 +0100
2.2 +++ b/openide.util.lookup/nbproject/project.properties Sat Oct 31 17:13:07 2009 +0100
2.3 @@ -41,3 +41,4 @@
2.4 is.autoload=true
2.5 javac.source=1.5
2.6 javac.compilerargs=-Xlint -Xlint:-serial
2.7 +spec.version.base=8.0.0
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/openide.util.lookup/test/unit/src/org/netbeans/modules/openide/util/ActiveQueueTest.java Sat Oct 31 17:13:07 2009 +0100
3.3 @@ -0,0 +1,132 @@
3.4 +/*
3.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3.6 + *
3.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
3.8 + *
3.9 + * The contents of this file are subject to the terms of either the GNU
3.10 + * General Public License Version 2 only ("GPL") or the Common
3.11 + * Development and Distribution License("CDDL") (collectively, the
3.12 + * "License"). You may not use this file except in compliance with the
3.13 + * License. You can obtain a copy of the License at
3.14 + * http://www.netbeans.org/cddl-gplv2.html
3.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
3.16 + * specific language governing permissions and limitations under the
3.17 + * License. When distributing the software, include this License Header
3.18 + * Notice in each file and include the License file at
3.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
3.20 + * particular file as subject to the "Classpath" exception as provided
3.21 + * by Sun in the GPL Version 2 section of the License file that
3.22 + * accompanied this code. If applicable, add the following below the
3.23 + * License Header, with the fields enclosed by brackets [] replaced by
3.24 + * your own identifying information:
3.25 + * "Portions Copyrighted [year] [name of copyright owner]"
3.26 + *
3.27 + * If you wish your version of this file to be governed by only the CDDL
3.28 + * or only the GPL Version 2, indicate your decision by adding
3.29 + * "[Contributor] elects to include this software in this distribution
3.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
3.31 + * single choice of license, a recipient has the option to distribute
3.32 + * your version of this file under either the CDDL, the GPL Version 2 or
3.33 + * to extend the choice of license to its licensees as provided above.
3.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
3.35 + * Version 2 license, then the option applies only if the new code is
3.36 + * made subject to such option by the copyright holder.
3.37 + *
3.38 + * Contributor(s):
3.39 + *
3.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
3.41 + */
3.42 +
3.43 +package org.netbeans.modules.openide.util;
3.44 +
3.45 +import java.lang.ref.Reference;
3.46 +import java.lang.ref.ReferenceQueue;
3.47 +import java.lang.ref.WeakReference;
3.48 +import java.net.URL;
3.49 +import java.net.URLClassLoader;
3.50 +import org.netbeans.junit.NbTestCase;
3.51 +
3.52 +/**
3.53 + *
3.54 + * @author Jaroslav Tulach <jtulach@netbeans.org>
3.55 + */
3.56 +public class ActiveQueueTest extends NbTestCase{
3.57 +
3.58 + public ActiveQueueTest(String name) {
3.59 + super(name);
3.60 + }
3.61 +
3.62 + public void testMemoryLeak() throws Exception {
3.63 + final Class<?> u1 = ActiveQueue.class;
3.64 + class L extends URLClassLoader {
3.65 + public L() {
3.66 + super(new URL[] {u1.getProtectionDomain().getCodeSource().getLocation()}, u1.getClassLoader().getParent());
3.67 + }
3.68 + @Override
3.69 + protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
3.70 + if (name.equals(u1.getName()) || name.startsWith(u1.getName() + "$")) {
3.71 + Class c = findLoadedClass(name);
3.72 + if (c == null) {
3.73 + c = findClass(name);
3.74 + }
3.75 + if (resolve) {
3.76 + resolveClass(c);
3.77 + }
3.78 + return c;
3.79 + } else {
3.80 + return super.loadClass(name, resolve);
3.81 + }
3.82 + }
3.83 + }
3.84 + ClassLoader l = new L();
3.85 + Class<?> u2 = l.loadClass(u1.getName());
3.86 + assertEquals(l, u2.getClassLoader());
3.87 + Object obj = new Object();
3.88 + @SuppressWarnings("unchecked")
3.89 + ReferenceQueue<Object> q = (ReferenceQueue<Object>) u2.getMethod("queue").invoke(null);
3.90 + RunnableRef ref = new RunnableRef(obj, q);
3.91 + synchronized (ref) {
3.92 + obj = null;
3.93 + assertGC("Ref should be GC'ed as usual", ref);
3.94 + ref.wait();
3.95 + assertTrue("Run method has been executed", ref.executed);
3.96 + }
3.97 + Reference<?> r = new WeakReference<Object>(u2);
3.98 + q = null;
3.99 + u2 = null;
3.100 + l = null;
3.101 + assertGC("#86625: Utilities.class can also be collected now", r);
3.102 + }
3.103 +
3.104 +
3.105 + private static class RunnableRef extends WeakReference<Object>
3.106 + implements Runnable {
3.107 + public boolean wait;
3.108 + public boolean entered;
3.109 + public boolean executed;
3.110 +
3.111 + public RunnableRef (Object o) {
3.112 + this(o, ActiveQueue.queue());
3.113 + }
3.114 +
3.115 + public RunnableRef(Object o, ReferenceQueue<Object> q) {
3.116 + super(o, q);
3.117 + }
3.118 +
3.119 + public synchronized void run () {
3.120 + entered = true;
3.121 + if (wait) {
3.122 + // notify we are here
3.123 + notify ();
3.124 + try {
3.125 + wait ();
3.126 + } catch (InterruptedException ex) {
3.127 + }
3.128 + }
3.129 + executed = true;
3.130 +
3.131 + notifyAll ();
3.132 + }
3.133 + }
3.134 +
3.135 +}
3.136 \ No newline at end of file
4.1 --- a/openide.util/nbproject/project.properties Sat Oct 31 16:33:02 2009 +0100
4.2 +++ b/openide.util/nbproject/project.properties Sat Oct 31 17:13:07 2009 +0100
4.3 @@ -42,7 +42,7 @@
4.4 module.jar.dir=lib
4.5 cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
4.6
4.7 -spec.version.base=7.30.0
4.8 +spec.version.base=8.0
4.9
4.10 # For XMLSerializer, needed for XMLUtil.write to work w/ namespaces under JDK 1.4:
4.11
5.1 --- a/openide.util/nbproject/project.xml Sat Oct 31 16:33:02 2009 +0100
5.2 +++ b/openide.util/nbproject/project.xml Sat Oct 31 17:13:07 2009 +0100
5.3 @@ -45,7 +45,16 @@
5.4 <configuration>
5.5 <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
5.6 <code-name-base>org.openide.util</code-name-base>
5.7 - <module-dependencies/>
5.8 + <module-dependencies>
5.9 + <dependency>
5.10 + <code-name-base>org.openide.util.lookup</code-name-base>
5.11 + <build-prerequisite/>
5.12 + <compile-dependency/>
5.13 + <run-dependency>
5.14 + <implementation-version/>
5.15 + </run-dependency>
5.16 + </dependency>
5.17 + </module-dependencies>
5.18 <test-dependencies>
5.19 <test-type>
5.20 <name>unit</name>
5.21 @@ -58,6 +67,11 @@
5.22 <recursive/>
5.23 <compile-dependency/>
5.24 </test-dependency>
5.25 + <test-dependency>
5.26 + <code-name-base>org.openide.util.lookup</code-name-base>
5.27 + <compile-dependency/>
5.28 + <test/>
5.29 + </test-dependency>
5.30 </test-type>
5.31 </test-dependencies>
5.32 <public-packages>
6.1 --- a/openide.util/test/unit/src/org/openide/util/UtilitiesActiveQueueTest.java Sat Oct 31 16:33:02 2009 +0100
6.2 +++ b/openide.util/test/unit/src/org/openide/util/UtilitiesActiveQueueTest.java Sat Oct 31 17:13:07 2009 +0100
6.3 @@ -114,48 +114,6 @@
6.4 }
6.5 }
6.6
6.7 - public void testMemoryLeak() throws Exception {
6.8 - final Class<?> u1 = Utilities.class;
6.9 - class L extends URLClassLoader {
6.10 - public L() {
6.11 - super(new URL[] {u1.getProtectionDomain().getCodeSource().getLocation()}, u1.getClassLoader().getParent());
6.12 - }
6.13 - protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
6.14 - if (name.equals(u1.getName()) || name.startsWith(u1.getName() + "$")) {
6.15 - Class c = findLoadedClass(name);
6.16 - if (c == null) {
6.17 - c = findClass(name);
6.18 - }
6.19 - if (resolve) {
6.20 - resolveClass(c);
6.21 - }
6.22 - return c;
6.23 - } else {
6.24 - return super.loadClass(name, resolve);
6.25 - }
6.26 - }
6.27 - }
6.28 - ClassLoader l = new L();
6.29 - Class<?> u2 = l.loadClass(u1.getName());
6.30 - assertEquals(l, u2.getClassLoader());
6.31 - Object obj = new Object();
6.32 - @SuppressWarnings("unchecked")
6.33 - ReferenceQueue<Object> q = (ReferenceQueue<Object>) u2.getMethod("activeReferenceQueue").invoke(null);
6.34 - RunnableRef ref = new RunnableRef(obj, q);
6.35 - synchronized (ref) {
6.36 - obj = null;
6.37 - assertGC("Ref should be GC'ed as usual", ref);
6.38 - ref.wait();
6.39 - assertTrue("Run method has been executed", ref.executed);
6.40 - }
6.41 - Reference<?> r = new WeakReference<Object>(u2);
6.42 - q = null;
6.43 - u2 = null;
6.44 - l = null;
6.45 - assertGC("#86625: Utilities.class can also be collected now", r);
6.46 - }
6.47 -
6.48 -
6.49 private static class RunnableRef extends WeakReference<Object>
6.50 implements Runnable {
6.51 public boolean wait;