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

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

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