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