Blame SOURCES/codemodel-remove-istack-commons-dependency.patch

e687d6
commit 1c15b90aa77cbc242bcec7ea3b38eb46e4c037cb
e687d6
Author: Juan Hernandez <juan.hernandez@redhat.com>
e687d6
Date:   Sat Mar 31 16:25:02 2012 +0200
e687d6
e687d6
    Remove the dependency on istack-commons
e687d6
e687d6
diff --git a/codemodel-annotation-compiler/pom.xml b/codemodel-annotation-compiler/pom.xml
e687d6
index 100e084..e1459bc 100644
e687d6
--- a/codemodel-annotation-compiler/pom.xml
e687d6
+++ b/codemodel-annotation-compiler/pom.xml
e687d6
@@ -60,17 +60,6 @@
e687d6
             <version>2.6</version>
e687d6
         </dependency>
e687d6
         <dependency>
e687d6
-            <groupId>com.sun.istack</groupId>
e687d6
-            <artifactId>istack-commons-tools</artifactId>
e687d6
-            <version>2.5</version>
e687d6
-            <exclusions>
e687d6
-                <exclusion>
e687d6
-                    <groupId>org.apache.ant</groupId>
e687d6
-                    <artifactId>ant</artifactId>
e687d6
-                </exclusion>
e687d6
-            </exclusions>
e687d6
-        </dependency>
e687d6
-        <dependency>
e687d6
             <groupId>org.apache.ant</groupId>
e687d6
             <artifactId>ant</artifactId>
e687d6
             <version>1.7.0</version>
e687d6
diff --git a/codemodel-annotation-compiler/src/main/java/com/sun/codemodel/ac/ACTask.java b/codemodel-annotation-compiler/src/main/java/com/sun/codemodel/ac/ACTask.java
e687d6
index d5b0a14..c6d799d 100644
e687d6
--- a/codemodel-annotation-compiler/src/main/java/com/sun/codemodel/ac/ACTask.java
e687d6
+++ b/codemodel-annotation-compiler/src/main/java/com/sun/codemodel/ac/ACTask.java
e687d6
@@ -64,7 +64,6 @@ import com.sun.codemodel.JDefinedClass;
e687d6
 import com.sun.codemodel.JMod;
e687d6
 import com.sun.codemodel.JPackage;
e687d6
 import com.sun.codemodel.JType;
e687d6
-import com.sun.istack.tools.MaskingClassLoader;
e687d6
 import java.io.Closeable;
e687d6
 import java.net.MalformedURLException;
e687d6
 import java.net.URL;
e687d6
diff --git a/codemodel-annotation-compiler/src/main/java/com/sun/codemodel/ac/MaskingClassLoader.java b/codemodel-annotation-compiler/src/main/java/com/sun/codemodel/ac/MaskingClassLoader.java
e687d6
new file mode 100644
e687d6
index 0000000..d303c11
e687d6
--- /dev/null
e687d6
+++ b/codemodel-annotation-compiler/src/main/java/com/sun/codemodel/ac/MaskingClassLoader.java
e687d6
@@ -0,0 +1,84 @@
e687d6
+/*
e687d6
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
e687d6
+ *
e687d6
+ * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
e687d6
+ *
e687d6
+ * The contents of this file are subject to the terms of either the GNU
e687d6
+ * General Public License Version 2 only ("GPL") or the Common Development
e687d6
+ * and Distribution License("CDDL") (collectively, the "License").  You
e687d6
+ * may not use this file except in compliance with the License.  You can
e687d6
+ * obtain a copy of the License at
e687d6
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
e687d6
+ * or packager/legal/LICENSE.txt.  See the License for the specific
e687d6
+ * language governing permissions and limitations under the License.
e687d6
+ *
e687d6
+ * When distributing the software, include this License Header Notice in each
e687d6
+ * file and include the License file at packager/legal/LICENSE.txt.
e687d6
+ *
e687d6
+ * GPL Classpath Exception:
e687d6
+ * Oracle designates this particular file as subject to the "Classpath"
e687d6
+ * exception as provided by Oracle in the GPL Version 2 section of the License
e687d6
+ * file that accompanied this code.
e687d6
+ *
e687d6
+ * Modifications:
e687d6
+ * If applicable, add the following below the License Header, with the fields
e687d6
+ * enclosed by brackets [] replaced by your own identifying information:
e687d6
+ * "Portions Copyright [year] [name of copyright owner]"
e687d6
+ *
e687d6
+ * Contributor(s):
e687d6
+ * If you wish your version of this file to be governed by only the CDDL or
e687d6
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
e687d6
+ * elects to include this software in this distribution under the [CDDL or GPL
e687d6
+ * Version 2] license."  If you don't indicate a single choice of license, a
e687d6
+ * recipient has the option to distribute your version of this file under
e687d6
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
e687d6
+ * its licensees as provided above.  However, if you add GPL Version 2 code
e687d6
+ * and therefore, elected the GPL Version 2 license, then the option applies
e687d6
+ * only if the new code is made subject to such option by the copyright
e687d6
+ * holder.
e687d6
+ */
e687d6
+
e687d6
+package com.sun.codemodel.ac;
e687d6
+
e687d6
+import java.util.Collection;
e687d6
+
e687d6
+/**
e687d6
+ * {@link ClassLoader} that masks a specified set of classes
e687d6
+ * from its parent class loader.
e687d6
+ *
e687d6
+ * 

e687d6
+ * This code is used to create an isolated environment.
e687d6
+ *
e687d6
+ * @author Kohsuke Kawaguchi
e687d6
+ */
e687d6
+public class MaskingClassLoader extends ClassLoader {
e687d6
+
e687d6
+    private final String[] masks;
e687d6
+
e687d6
+    public MaskingClassLoader(String... masks) {
e687d6
+        this.masks = masks;
e687d6
+    }
e687d6
+
e687d6
+    public MaskingClassLoader(Collection<String> masks) {
e687d6
+        this(masks.toArray(new String[masks.size()]));
e687d6
+    }
e687d6
+
e687d6
+    public MaskingClassLoader(ClassLoader parent, String... masks) {
e687d6
+        super(parent);
e687d6
+        this.masks = masks;
e687d6
+    }
e687d6
+
e687d6
+    public MaskingClassLoader(ClassLoader parent, Collection<String> masks) {
e687d6
+        this(parent, masks.toArray(new String[masks.size()]));
e687d6
+    }
e687d6
+
e687d6
+    @Override
e687d6
+    protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
e687d6
+        for (String mask : masks) {
e687d6
+            if(name.startsWith(mask))
e687d6
+                throw new ClassNotFoundException();
e687d6
+        }
e687d6
+
e687d6
+        return super.loadClass(name, resolve);
e687d6
+    }
e687d6
+}