w, JAnnotatable annotatable) {
- Class extends Annotation> a = findAnnotationType(w);
- return (W)new TypedAnnotationWriter(a,w,annotatable.annotate(a)).createProxy();
- }
-
- private static Class extends Annotation> findAnnotationType(Class clazz) {
- for( Type t : clazz.getGenericInterfaces()) {
- if(t instanceof ParameterizedType) {
- ParameterizedType p = (ParameterizedType) t;
- if(p.getRawType()==JAnnotationWriter.class)
- return (Class extends Annotation>)p.getActualTypeArguments()[0];
- }
- if(t instanceof Class) {
- // recurisve search
- Class extends Annotation> r = findAnnotationType((Class)t);
- if(r!=null) return r;
- }
- }
- return null;
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JBinaryFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JBinaryFile.java
deleted file mode 100644
index 61a22e8ffa7..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JBinaryFile.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.fmt;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import com.sun.codemodel.internal.JResourceFile;
-
-/**
- * Allows the application to use OutputStream to define data
- * that will be stored into a file.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public final class JBinaryFile extends JResourceFile {
-
- private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- public JBinaryFile( String name ) {
- super(name);
- }
-
- /**
- *
- * @return
- * Data written to the returned output stream will be written
- * to the file.
- */
- public OutputStream getDataStore() {
- return baos;
- }
-
- public void build(OutputStream os) throws IOException {
- os.write( baos.toByteArray() );
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JPropertyFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JPropertyFile.java
deleted file mode 100644
index 81e29f04f02..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JPropertyFile.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.fmt;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Properties;
-
-import com.sun.codemodel.internal.JResourceFile;
-
-/**
- * A property file.
- */
-public class JPropertyFile extends JResourceFile
-{
- public JPropertyFile( String name ) {
- super(name);
- }
-
- private final Properties data = new Properties();
-
- /**
- * Adds key/value pair into the property file.
- * If you call this method twice with the same key,
- * the old one is overriden by the new one.
- */
- public void add( String key, String value ) {
- data.put(key,value);
- }
-
- // TODO: method to iterate values in data?
- // TODO: should we rather expose Properties object directly via
- // public Properties body() { return data; } ?
-
- public void build( OutputStream out ) throws IOException {
- data.store(out,null);
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JSerializedObject.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JSerializedObject.java
deleted file mode 100644
index 12452641a09..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JSerializedObject.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.codemodel.internal.fmt;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-import com.sun.codemodel.internal.JResourceFile;
-
-
-/**
- * A simple class that takes an object and serializes it into a file
- * in the parent package with the given name.
- */
-public class JSerializedObject extends JResourceFile {
-
- private final Object obj;
-
- /**
- * @exception IOException
- * If the serialization fails, this exception is thrown
- */
- public JSerializedObject( String name, Object obj ) throws IOException {
- super(name);
- this.obj = obj;
- }
-
- /**
- * called by JPackage to serialize the object
- */
- protected void build( OutputStream os ) throws IOException {
- // serialize the obj into a ByteArrayOutputStream
- ObjectOutputStream oos = new ObjectOutputStream(os);
- oos.writeObject(obj);
- oos.close();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticFile.java
deleted file mode 100644
index 450aac31a43..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticFile.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.fmt;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import com.sun.codemodel.internal.JResourceFile;
-
-/**
- * Allows an application to copy a resource file to the output.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public final class JStaticFile extends JResourceFile {
-
- private final ClassLoader classLoader;
- private final String resourceName;
- private final boolean isResource;
-
- public JStaticFile(String _resourceName) {
- this(_resourceName,!_resourceName.endsWith(".java"));
- }
-
- public JStaticFile(String _resourceName,boolean isResource) {
- this( JStaticFile.class.getClassLoader(), _resourceName, isResource );
- }
-
- /**
- * @param isResource
- * false if this is a Java source file. True if this is other resource files.
- */
- public JStaticFile(ClassLoader _classLoader, String _resourceName, boolean isResource) {
- super(_resourceName.substring(_resourceName.lastIndexOf('/')+1));
- this.classLoader = _classLoader;
- this.resourceName = _resourceName;
- this.isResource = isResource;
- }
-
- protected boolean isResource() {
- return isResource;
- }
-
- protected void build(OutputStream os) throws IOException {
- DataInputStream dis = new DataInputStream(classLoader.getResourceAsStream(resourceName));
-
- byte[] buf = new byte[256];
- int sz;
- while( (sz=dis.read(buf))>0 )
- os.write(buf,0,sz);
-
- dis.close();
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticJavaFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticJavaFile.java
deleted file mode 100644
index 00d88e876ef..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticJavaFile.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.fmt;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.URL;
-import java.text.ParseException;
-import java.util.Iterator;
-import java.util.List;
-
-import com.sun.codemodel.internal.JClass;
-import com.sun.codemodel.internal.JPackage;
-import com.sun.codemodel.internal.JResourceFile;
-import com.sun.codemodel.internal.JTypeVar;
-
-/**
- * Statically generated Java soruce file.
- *
- *
- * This {@link JResourceFile} implementation will generate a Java source
- * file by copying the source code from a resource.
- *
- * While copying a resource, we look for a package declaration and
- * replace it with the target package name. This allows the static Java
- * source code to have an arbitrary package declaration.
- *
- * You can also use the getJClass method to obtain a {@link JClass}
- * object that represents the static file. This allows the client code
- * to refer to the class from other CodeModel generated code.
- *
- * Note that because we don't parse the static Java source code,
- * the returned {@link JClass} object doesn't respond to methods like
- * "isInterface" or "_extends",
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public final class JStaticJavaFile extends JResourceFile {
-
- private final JPackage pkg;
- private final String className;
- private final URL source;
- private final JStaticClass clazz;
- private final LineFilter filter;
-
- public JStaticJavaFile(JPackage _pkg, String className, String _resourceName) {
- this( _pkg, className,
- JStaticJavaFile.class.getClassLoader().getResource(_resourceName), null );
- }
-
- public JStaticJavaFile(JPackage _pkg, String _className, URL _source, LineFilter _filter ) {
- super(_className+".java");
- if(_source==null) throw new NullPointerException();
- this.pkg = _pkg;
- this.clazz = new JStaticClass();
- this.className = _className;
- this.source = _source;
- this.filter = _filter;
- }
-
- /**
- * Returns a class object that represents a statically generated code.
- */
- public final JClass getJClass() {
- return clazz;
- }
-
- protected boolean isResource() {
- return false;
- }
-
- protected void build(OutputStream os) throws IOException {
- InputStream is = source.openStream();
-
- BufferedReader r = new BufferedReader(new InputStreamReader(is));
- PrintWriter w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os)));
- LineFilter filter = createLineFilter();
- int lineNumber=1;
-
- try {
- String line;
- while((line=r.readLine())!=null) {
- line = filter.process(line);
- if(line!=null)
- w.println(line);
- lineNumber++;
- }
- } catch( ParseException e ) {
- throw new IOException("unable to process "+source+" line:"+lineNumber+"\n"+e.getMessage());
- }
-
- w.close();
- r.close();
- }
-
- /**
- * Creates a {@link LineFilter}.
- *
- * A derived class can override this method to process
- * the contents of the source file.
- */
- private LineFilter createLineFilter() {
- // this filter replaces the package declaration.
- LineFilter f = new LineFilter() {
- public String process(String line) {
- if(!line.startsWith("package ")) return line;
-
- // replace package decl
- if( pkg.isUnnamed() )
- return null;
- else
- return "package "+pkg.name()+";";
- }
- };
- if( filter!=null )
- return new ChainFilter(filter,f);
- else
- return f;
- }
-
- /**
- * Filter that alters the Java source code.
- *
- * By implementing this interface, derived classes
- * can modify the Java source file before it's written out.
- */
- public interface LineFilter {
- /**
- * @param line
- * a non-null valid String that corresponds to one line.
- * No '\n' included.
- * @return
- * null to strip the line off. Otherwise the returned
- * String will be written out. Do not add '\n' at the end
- * of this string.
- *
- * @exception ParseException
- * when for some reason there's an error in the line.
- */
- String process(String line) throws ParseException;
- }
-
- /**
- * A {@link LineFilter} that combines two {@link LineFilter}s.
- */
- public final static class ChainFilter implements LineFilter {
- private final LineFilter first,second;
- public ChainFilter( LineFilter first, LineFilter second ) {
- this.first=first;
- this.second=second;
- }
- public String process(String line) throws ParseException {
- line = first.process(line);
- if(line==null) return null;
- return second.process(line);
- }
- }
-
-
- private class JStaticClass extends JClass {
-
- private final JTypeVar[] typeParams;
-
- JStaticClass() {
- super(pkg.owner());
- // TODO: allow those to be specified
- typeParams = new JTypeVar[0];
- }
-
- public String name() {
- return className;
- }
-
- public String fullName() {
- if(pkg.isUnnamed())
- return className;
- else
- return pkg.name()+'.'+className;
- }
-
- public JPackage _package() {
- return pkg;
- }
-
- public JClass _extends() {
- throw new UnsupportedOperationException();
- }
-
- public Iterator _implements() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isInterface() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isAbstract() {
- throw new UnsupportedOperationException();
- }
-
- public JTypeVar[] typeParams() {
- return typeParams;
- }
-
- protected JClass substituteParams(JTypeVar[] variables, List bindings) {
- return this;
- }
- };
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JTextFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JTextFile.java
deleted file mode 100644
index dbc44daee95..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JTextFile.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.fmt;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-import com.sun.codemodel.internal.JResourceFile;
-
-
-/**
- * Simple text file.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class JTextFile extends JResourceFile
-{
- public JTextFile( String name ) {
- super(name);
- }
-
- private String contents = null;
-
- public void setContents( String _contents ) {
- this.contents = _contents;
- }
-
- public void build( OutputStream out ) throws IOException {
- Writer w = new OutputStreamWriter(out);
- w.write(contents);
- w.close();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/package-info.java b/jaxws/src/share/classes/com/sun/codemodel/internal/package-info.java
deleted file mode 100644
index 6e2fa832598..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/package-info.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/**
- * Library for generating Java source code
.
- *
- *
- * CodeModel is a library that allows you to generate Java source
- * code in a type-safe fashion.
- *
- *
- * With CodeModel, you build the java source code by first building AST,
- * then writing it out as text files that is Java source files.
- * The AST looks like this:
- *
- * {@DotDiagram
- digraph G {
- cls1 [label="JDefinedClass"];
- cls2 [label="JDefinedClass"];
- JCodeModel -> cls1 [label="generated class"];
- JCodeModel -> cls2 [label="generated class"];
-
- m1 [label="JMethod"];
- m2 [label="JMethod"];
-
- cls1 -> m1;
- cls1 -> m2;
- cls1 -> JField;
-
- m1 -> JVar [label="method parameter"];
- m1 -> JBlock [label="code"];
- }
- * }
- *
- *
- * You bulid this tree mostly from top-down. So, you first create
- * a new {@link JDefinedClass} from {@link JCodeModel}, then you
- * create a {@link JMethod} from {@link JDefinedClass}, and so on.
- *
- *
- * This design brings the following beneefits:
- *
- *
- * - source code can be written in random order
- *
- generated source code nicely imports other classes
- *
- generated source code is lexically always correct
- * (no unbalanced parenthesis, etc.)
- *
- code generation becomes relatively type-safe
- *
- *
- * The price you pay for that is
- * increased memory footprint and the generation speed.
- * See performance section for
- * more discussions about the performance and possible improvements.
- *
- *
- * Using CodeModel
- *
- * {@link com.sun.codemodel.internal.JCodeModel} is the entry point to
- * the library. See its javadoc for more details about how to use
- * CodeModel.
- *
- *
- *
- *
Performance
- *
- * Generally speaking, CodeModel is expected to be used in
- * an environment where the resource constraint is not severe.
- * Therefore, we haven't spent much effort in trying to make
- * this library lean and mean.
- *
- *
- * That said, we did some benchmark and performance analysis.
- * In case anyone is interested in making this library
- * better performance wise, here's the findings.
- *
- *
- * {@link List}s {@link Map}s, and other collections take up
- * a lot of space. Allocating those things lazily is generally
- * a good idea.
- *
- *
- * Compared to template-based code generator, the writing operation
- * is slow, as it needs to traverse each AST node. Consider
- * pre-encoding tokens (like 'public') to the target encoding,
- * and consider exploting the subtree equivalence.
- *
- * @ArchitectureDocument
- */
-package com.sun.codemodel.internal;
-
-import java.util.List;
-import java.util.Map;
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/ClassNameComparator.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/ClassNameComparator.java
deleted file mode 100644
index 46b4270ff89..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/ClassNameComparator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.util;
-
-import java.util.Comparator;
-import com.sun.codemodel.internal.JClass;
-
-/**
- * Comparator object that sorts {@link JClass}es in the order
- * of their names.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class ClassNameComparator implements Comparator {
- private ClassNameComparator() {}
-
- public int compare(JClass l, JClass r) {
- return l.fullName().compareTo(r.fullName());
- }
-
- public static final Comparator theInstance = new ClassNameComparator();
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/EncoderFactory.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/EncoderFactory.java
deleted file mode 100644
index 05555c623e7..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/EncoderFactory.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * @(#)$Id: EncoderFactory.java,v 1.3 2005/09/10 19:07:33 kohsuke Exp $
- */
-package com.sun.codemodel.internal.util;
-
-import java.lang.reflect.Constructor;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
-
-/**
- * Creates {@link CharsetEncoder} from a charset name.
- *
- * Fixes a MS1252 handling bug in JDK1.4.2.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class EncoderFactory {
- public static CharsetEncoder createEncoder( String encodin ) {
- Charset cs = Charset.forName(System.getProperty("file.encoding"));
- CharsetEncoder encoder = cs.newEncoder();
-
- if( cs.getClass().getName().equals("sun.nio.cs.MS1252") ) {
- try {
- // at least JDK1.4.2_01 has a bug in MS1252 encoder.
- // specifically, it returns true for any character.
- // return a correct encoder to workaround this problem
-
- // statically binding to MS1252Encoder will cause a Link error
- // (at least in IBM JDK1.4.1)
- Class ms1252encoder = Class.forName("com.sun.codemodel.internal.util.MS1252Encoder");
- Constructor c = ms1252encoder.getConstructor(new Class[]{
- Charset.class
- });
- return (CharsetEncoder)c.newInstance(new Object[]{cs});
- } catch( Throwable t ) {
- // if something funny happens, ignore it and fall back to
- // a broken MS1252 encoder. It's probably still better
- // than choking here.
- return encoder;
- }
- }
-
- return encoder;
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java
deleted file mode 100644
index 6db471edcf5..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.util;
-
-import java.io.FilterWriter;
-import java.io.IOException;
-import java.io.Writer;
-
-/**
- * {@link Writer} that escapes characters that are unsafe
- * as Javadoc comments.
- *
- * Such characters include '<' and '&'.
- *
- *
- * Note that this class doesn't escape other Unicode characters
- * that are typically unsafe. For example, 愛 (A kanji
- * that means "love") can be considered as unsafe because
- * javac with English Windows cannot accept this character in the
- * source code.
- *
- *
- * If the application needs to escape such characters as well, then
- * they are on their own.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class JavadocEscapeWriter extends FilterWriter {
-
- public JavadocEscapeWriter( Writer next ) {
- super(next);
- }
-
- public void write(int ch) throws IOException {
- if(ch=='<')
- out.write("<");
- else
- if(ch=='&')
- out.write("&");
- else
- out.write(ch);
- }
-
- public void write(char[] buf, int off, int len) throws IOException {
- for( int i=0; i
- * See
- * http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
- * for the normative definition.
- *
- * This code depends on Sun internal package, so we have to make sure
- * it won't be executed on other JDKs.
- */
-public final class MS1252Encoder extends SingleByteEncoder {
-
- public MS1252Encoder(Charset cs) {
- super(cs, index1, index2, 0xFF00, 0x00FF, 8);
- }
-
- private final static String index2 =
- "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
- "\b\t\n\u000B\f\r\u000E\u000F" +
- "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
- "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" +
- "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
- "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
- "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
- "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
- "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
- "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
- "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
- "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
- "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
- "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
- "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
- "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" +
- "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" +
- "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" +
- "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" +
- "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" +
- "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" +
- "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" +
- "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" +
- "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" +
- "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" +
- "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" +
- "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u008C\u009C\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u008A\u009A\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u009F\u0000\u0000\u0000\u0000\u008E\u009E\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0088\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0098\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0096\u0097\u0000" +
- "\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" +
- "\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" +
- "\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000";
-
- private final static short index1[] = {
- 0, 256, 461, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 698, 920, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- };
-
- public boolean canEncode(char c) {
- char test = index2.charAt( index1[(c&0xFF00)>>8] + (c&0xFF) );
- return test!=0;
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/SingleByteEncoder.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/SingleByteEncoder.java
deleted file mode 100644
index 71d4dfd82aa..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/SingleByteEncoder.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * @(#)SingleByteEncoder.java 1.14 03/01/23
- */
-
-package com.sun.codemodel.internal.util;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-
-import sun.nio.cs.Surrogate;
-
-
-abstract class SingleByteEncoder
- extends CharsetEncoder
-{
-
- private final short index1[];
- private final String index2;
- private final int mask1;
- private final int mask2;
- private final int shift;
-
- private final Surrogate.Parser sgp = new Surrogate.Parser();
-
- protected SingleByteEncoder(Charset cs,
- short[] index1, String index2,
- int mask1, int mask2, int shift)
- {
- super(cs, 1.0f, 1.0f);
- this.index1 = index1;
- this.index2 = index2;
- this.mask1 = mask1;
- this.mask2 = mask2;
- this.shift = shift;
- }
-
- public boolean canEncode(char c) {
- char testEncode;
- testEncode = index2.charAt(index1[(c & mask1) >> shift]
- + (c & mask2));
- if (testEncode == '\u0000')
- return false;
- else
- return true;
- }
-
- private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
- char[] sa = src.array();
- int sp = src.arrayOffset() + src.position();
- int sl = src.arrayOffset() + src.limit();
- sp = (sp <= sl ? sp : sl);
- byte[] da = dst.array();
- int dp = dst.arrayOffset() + dst.position();
- int dl = dst.arrayOffset() + dst.limit();
- dp = (dp <= dl ? dp : dl);
-
- try {
- while (sp < sl) {
- char c = sa[sp];
- if (Surrogate.is(c)) {
- if (sgp.parse(c, sa, sp, sl) < 0)
- return sgp.error();
- return sgp.unmappableResult();
- }
- if (c >= '\uFFFE')
- return CoderResult.unmappableForLength(1);
- if (dl - dp < 1)
- return CoderResult.OVERFLOW;
-
- char e = index2.charAt(index1[(c & mask1) >> shift]
- + (c & mask2));
-
- // If output byte is zero because input char is zero
- // then character is mappable, o.w. fail
- if (e == '\u0000' && c != '\u0000')
- return CoderResult.unmappableForLength(1);
-
- sp++;
- da[dp++] = (byte)e;
- }
- return CoderResult.UNDERFLOW;
- } finally {
- src.position(sp - src.arrayOffset());
- dst.position(dp - dst.arrayOffset());
- }
- }
-
- private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
- int mark = src.position();
- try {
- while (src.hasRemaining()) {
- char c = src.get();
- if (Surrogate.is(c)) {
- if (sgp.parse(c, src) < 0)
- return sgp.error();
- return sgp.unmappableResult();
- }
- if (c >= '\uFFFE')
- return CoderResult.unmappableForLength(1);
- if (!dst.hasRemaining())
- return CoderResult.OVERFLOW;
-
- char e = index2.charAt(index1[(c & mask1) >> shift]
- + (c & mask2));
-
- // If output byte is zero because input char is zero
- // then character is mappable, o.w. fail
- if (e == '\u0000' && c != '\u0000')
- return CoderResult.unmappableForLength(1);
-
- mark++;
- dst.put((byte)e);
- }
- return CoderResult.UNDERFLOW;
- } finally {
- src.position(mark);
- }
- }
-
- protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
- if (true && src.hasArray() && dst.hasArray())
- return encodeArrayLoop(src, dst);
- else
- return encodeBufferLoop(src, dst);
- }
-
- public byte encode(char inputChar) {
- return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] +
- (inputChar & mask2));
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/Surrogate.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/Surrogate.java
deleted file mode 100644
index ca97bc1d6fa..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/Surrogate.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.codemodel.internal.util;
-
-import java.nio.CharBuffer;
-import java.nio.charset.CoderResult;
-
-
-/**
- * Utility class for dealing with surrogates.
- *
- * @author Mark Reinhold
- * @version 1.11, 03/01/23
- */
-
-class Surrogate {
-
- private Surrogate() { }
-
- // UTF-16 surrogate-character ranges
- //
- public static final char MIN_HIGH = '\uD800';
- public static final char MAX_HIGH = '\uDBFF';
- public static final char MIN_LOW = '\uDC00';
- public static final char MAX_LOW = '\uDFFF';
- public static final char MIN = MIN_HIGH;
- public static final char MAX = MAX_LOW;
-
- // Range of UCS-4 values that need surrogates in UTF-16
- //
- public static final int UCS4_MIN = 0x10000;
- public static final int UCS4_MAX = (1 << 20) + UCS4_MIN - 1;
-
- /**
- * Tells whether or not the given UTF-16 value is a high surrogate.
- */
- public static boolean isHigh(int c) {
- return (MIN_HIGH <= c) && (c <= MAX_HIGH);
- }
-
- /**
- * Tells whether or not the given UTF-16 value is a low surrogate.
- */
- public static boolean isLow(int c) {
- return (MIN_LOW <= c) && (c <= MAX_LOW);
- }
-
- /**
- * Tells whether or not the given UTF-16 value is a surrogate character,
- */
- public static boolean is(int c) {
- return (MIN <= c) && (c <= MAX);
- }
-
- /**
- * Tells whether or not the given UCS-4 character must be represented as a
- * surrogate pair in UTF-16.
- */
- public static boolean neededFor(int uc) {
- return (uc >= UCS4_MIN) && (uc <= UCS4_MAX);
- }
-
- /**
- * Returns the high UTF-16 surrogate for the given UCS-4 character.
- */
- public static char high(int uc) {
- return (char)(0xd800 | (((uc - UCS4_MIN) >> 10) & 0x3ff));
- }
-
- /**
- * Returns the low UTF-16 surrogate for the given UCS-4 character.
- */
- public static char low(int uc) {
- return (char)(0xdc00 | ((uc - UCS4_MIN) & 0x3ff));
- }
-
- /**
- * Converts the given surrogate pair into a 32-bit UCS-4 character.
- */
- public static int toUCS4(char c, char d) {
- return (((c & 0x3ff) << 10) | (d & 0x3ff)) + 0x10000;
- }
-
- /**
- * Surrogate parsing support. Charset implementations may use instances of
- * this class to handle the details of parsing UTF-16 surrogate pairs.
- */
- public static class Parser {
-
- public Parser() { }
-
- private int character; // UCS-4
- private CoderResult error = CoderResult.UNDERFLOW;
- private boolean isPair;
-
- /**
- * Returns the UCS-4 character previously parsed.
- */
- public int character() {
- return character;
- }
-
- /**
- * Tells whether or not the previously-parsed UCS-4 character was
- * originally represented by a surrogate pair.
- */
- public boolean isPair() {
- return isPair;
- }
-
- /**
- * Returns the number of UTF-16 characters consumed by the previous
- * parse.
- */
- public int increment() {
- return isPair ? 2 : 1;
- }
-
- /**
- * If the previous parse operation detected an error, return the object
- * describing that error.
- */
- public CoderResult error() {
- return error;
- }
-
- /**
- * Returns an unmappable-input result object, with the appropriate
- * input length, for the previously-parsed character.
- */
- public CoderResult unmappableResult() {
- return CoderResult.unmappableForLength(isPair ? 2 : 1);
- }
-
- /**
- * Parses a UCS-4 character from the given source buffer, handling
- * surrogates.
- *
- * @param c The first character
- * @param in The source buffer, from which one more character
- * will be consumed if c is a high surrogate
- *
- * @return Either a parsed UCS-4 character, in which case the isPair()
- * and increment() methods will return meaningful values, or
- * -1, in which case error() will return a descriptive result
- * object
- */
- public int parse(char c, CharBuffer in) {
- if (isHigh(c)) {
- if (!in.hasRemaining()) {
- error = CoderResult.UNDERFLOW;
- return -1;
- }
- char d = in.get();
- if (isLow(d)) {
- character = toUCS4(c, d);
- isPair = true;
- error = null;
- return character;
- }
- error = CoderResult.malformedForLength(1);
- return -1;
- }
- if (isLow(c)) {
- error = CoderResult.malformedForLength(1);
- return -1;
- }
- character = c;
- isPair = false;
- error = null;
- return character;
- }
-
- /**
- * Parses a UCS-4 character from the given source buffer, handling
- * surrogates.
- *
- * @param c The first character
- * @param ia The input array, from which one more character
- * will be consumed if c is a high surrogate
- * @param ip The input index
- * @param il The input limit
- *
- * @return Either a parsed UCS-4 character, in which case the isPair()
- * and increment() methods will return meaningful values, or
- * -1, in which case error() will return a descriptive result
- * object
- */
- public int parse(char c, char[] ia, int ip, int il) {
- if (isHigh(c)) {
- if (il - ip < 2) {
- error = CoderResult.UNDERFLOW;
- return -1;
- }
- char d = ia[ip + 1];
- if (isLow(d)) {
- character = toUCS4(c, d);
- isPair = true;
- error = null;
- return character;
- }
- error = CoderResult.malformedForLength(1);
- return -1;
- }
- if (isLow(c)) {
- error = CoderResult.malformedForLength(1);
- return -1;
- }
- character = c;
- isPair = false;
- error = null;
- return character;
- }
-
- }
-
- /**
- * Surrogate generation support. Charset implementations may use instances
- * of this class to handle the details of generating UTF-16 surrogate
- * pairs.
- */
- public static class Generator {
-
- public Generator() { }
-
- private CoderResult error = CoderResult.OVERFLOW;
-
- /**
- * If the previous generation operation detected an error, return the
- * object describing that error.
- */
- public CoderResult error() {
- return error;
- }
-
- /**
- * Generates one or two UTF-16 characters to represent the given UCS-4
- * character.
- *
- * @param uc The UCS-4 character
- * @param len The number of input bytes from which the UCS-4 value
- * was constructed (used when creating result objects)
- * @param dst The destination buffer, to which one or two UTF-16
- * characters will be written
- *
- * @return Either a positive count of the number of UTF-16 characters
- * written to the destination buffer, or -1, in which case
- * error() will return a descriptive result object
- */
- public int generate(int uc, int len, CharBuffer dst) {
- if (uc <= 0xffff) {
- if (is(uc)) {
- error = CoderResult.malformedForLength(len);
- return -1;
- }
- if (dst.remaining() < 1) {
- error = CoderResult.OVERFLOW;
- return -1;
- }
- dst.put((char)uc);
- error = null;
- return 1;
- }
- if (uc < UCS4_MIN) {
- error = CoderResult.malformedForLength(len);
- return -1;
- }
- if (uc <= UCS4_MAX) {
- if (dst.remaining() < 2) {
- error = CoderResult.OVERFLOW;
- return -1;
- }
- dst.put(high(uc));
- dst.put(low(uc));
- error = null;
- return 2;
- }
- error = CoderResult.unmappableForLength(len);
- return -1;
- }
-
- /**
- * Generates one or two UTF-16 characters to represent the given UCS-4
- * character.
- *
- * @param uc The UCS-4 character
- * @param len The number of input bytes from which the UCS-4 value
- * was constructed (used when creating result objects)
- * @param da The destination array, to which one or two UTF-16
- * characters will be written
- * @param dp The destination position
- * @param dl The destination limit
- *
- * @return Either a positive count of the number of UTF-16 characters
- * written to the destination buffer, or -1, in which case
- * error() will return a descriptive result object
- */
- public int generate(int uc, int len, char[] da, int dp, int dl) {
- if (uc <= 0xffff) {
- if (is(uc)) {
- error = CoderResult.malformedForLength(len);
- return -1;
- }
- if (dl - dp < 1) {
- error = CoderResult.OVERFLOW;
- return -1;
- }
- da[dp] = (char)uc;
- error = null;
- return 1;
- }
- if (uc < UCS4_MIN) {
- error = CoderResult.malformedForLength(len);
- return -1;
- }
- if (uc <= UCS4_MAX) {
- if (dl - dp < 2) {
- error = CoderResult.OVERFLOW;
- return -1;
- }
- da[dp] = high(uc);
- da[dp + 1] = low(uc);
- error = null;
- return 2;
- }
- error = CoderResult.unmappableForLength(len);
- return -1;
- }
-
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/UnicodeEscapeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/UnicodeEscapeWriter.java
deleted file mode 100644
index ad09f15817a..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/UnicodeEscapeWriter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.util;
-
-import java.io.FilterWriter;
-import java.io.IOException;
-import java.io.Writer;
-
-/**
- * {@link Writer} that escapes non US-ASCII characters into
- * Java Unicode escape \\uXXXX.
- *
- * This process is necessary if the method names or field names
- * contain non US-ASCII characters.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class UnicodeEscapeWriter extends FilterWriter {
-
- public UnicodeEscapeWriter( Writer next ) {
- super(next);
- }
-
- public final void write(int ch) throws IOException {
- if(!requireEscaping(ch)) out.write(ch);
- else {
- // need to escape
- out.write("\\u");
- String s = Integer.toHexString(ch);
- for( int i=s.length(); i<4; i++ )
- out.write('0');
- out.write(s);
- }
- }
-
- /**
- * Can be overrided. Return true if the character
- * needs to be escaped.
- */
- protected boolean requireEscaping(int ch) {
- if(ch>=128) return true;
-
- // control characters
- if( ch<0x20 && " \t\r\n".indexOf(ch)==-1 ) return true;
-
- return false;
- }
-
- public final void write(char[] buf, int off, int len) throws IOException {
- for( int i=0; i readonlyFiles = new HashSet();
-
- public FileCodeWriter( File target ) throws IOException {
- this(target,false);
- }
-
- public FileCodeWriter( File target, boolean readOnly ) throws IOException {
- this.target = target;
- this.readOnly = readOnly;
- if(!target.exists() || !target.isDirectory())
- throw new IOException(target + ": non-existent directory");
- }
-
-
- public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
- return new FileOutputStream(getFile(pkg,fileName));
- }
-
- protected File getFile(JPackage pkg, String fileName ) throws IOException {
- File dir;
- if(pkg.isUnnamed())
- dir = target;
- else
- dir = new File(target, toDirName(pkg));
-
- if(!dir.exists()) dir.mkdirs();
-
- File fn = new File(dir,fileName);
-
- if (fn.exists()) {
- if (!fn.delete())
- throw new IOException(fn + ": Can't delete previous version");
- }
-
-
- if(readOnly) readonlyFiles.add(fn);
- return fn;
- }
-
- public void close() throws IOException {
- // mark files as read-onnly if necessary
- for (File f : readonlyFiles)
- f.setReadOnly();
- }
-
- /** Converts a package name to the directory name. */
- private static String toDirName( JPackage pkg ) {
- return pkg.name().replace('.',File.separatorChar);
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/FilterCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/FilterCodeWriter.java
deleted file mode 100644
index 198642abdcd..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/FilterCodeWriter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.codemodel.internal.writer;
-
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.Writer;
-
-import com.sun.codemodel.internal.CodeWriter;
-import com.sun.codemodel.internal.JPackage;
-
-/**
- * {@link CodeWriter} that delegates to another {@link CodeWriter}.
- *
- * @author Kohsuke Kawaguchi
- */
-public class FilterCodeWriter extends CodeWriter {
- protected CodeWriter core;
-
- public FilterCodeWriter(CodeWriter core) {
- this.core = core;
- }
-
- public OutputStream openBinary( JPackage pkg, String fileName ) throws IOException {
- return core.openBinary(pkg, fileName);
- }
-
- public Writer openSource( JPackage pkg, String fileName ) throws IOException {
- return core.openSource(pkg, fileName);
- }
-
- public void close() throws IOException {
- core.close();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ProgressCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ProgressCodeWriter.java
deleted file mode 100644
index 1bf8f845c75..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ProgressCodeWriter.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.writer;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.Writer;
-
-import com.sun.codemodel.internal.CodeWriter;
-import com.sun.codemodel.internal.JPackage;
-
-/**
- * Filter CodeWriter that writes a progress message to the specified
- * PrintStream.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class ProgressCodeWriter extends FilterCodeWriter {
- public ProgressCodeWriter( CodeWriter output, PrintStream progress ) {
- super(output);
- this.progress = progress;
- if(progress==null)
- throw new IllegalArgumentException();
- }
-
- private final PrintStream progress;
-
- public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
- report(pkg, fileName);
- return super.openBinary(pkg,fileName);
- }
-
- public Writer openSource(JPackage pkg, String fileName) throws IOException {
- report(pkg, fileName);
- return super.openSource(pkg,fileName);
- }
-
- private void report(JPackage pkg, String fileName) {
- if(pkg.isUnnamed()) progress.println(fileName);
- else
- progress.println(
- pkg.name().replace('.',File.separatorChar)
- +File.separatorChar+fileName);
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/PrologCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/PrologCodeWriter.java
deleted file mode 100644
index cbb5b203ba5..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/PrologCodeWriter.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.writer;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-
-import com.sun.codemodel.internal.CodeWriter;
-import com.sun.codemodel.internal.JPackage;
-
-/**
- * Writes all the source files under the specified file folder and
- * inserts a file prolog comment in each java source file.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class PrologCodeWriter extends FilterCodeWriter {
-
- /** prolog comment */
- private final String prolog;
-
- /**
- * @param core
- * This CodeWriter will be used to actually create a storage for files.
- * PrologCodeWriter simply decorates this underlying CodeWriter by
- * adding prolog comments.
- * @param prolog
- * Strings that will be added as comments.
- * This string may contain newlines to produce multi-line comments.
- * '//' will be inserted at the beginning of each line to make it
- * a valid Java comment, so the caller can just pass strings like
- * "abc\ndef"
- */
- public PrologCodeWriter( CodeWriter core, String prolog ) {
- super(core);
- this.prolog = prolog;
- }
-
-
- public Writer openSource(JPackage pkg, String fileName) throws IOException {
- Writer w = super.openSource(pkg,fileName);
-
- PrintWriter out = new PrintWriter(w);
-
- // write prolog if this is a java source file
- if( prolog != null ) {
- out.println( "//" );
-
- String s = prolog;
- int idx;
- while( (idx=s.indexOf('\n'))!=-1 ) {
- out.println("// "+ s.substring(0,idx) );
- s = s.substring(idx+1);
- }
- out.println("//");
- out.println();
- }
- out.flush(); // we can't close the stream for that would close the undelying stream.
-
- return w;
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/SingleStreamCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/SingleStreamCodeWriter.java
deleted file mode 100644
index 10740dfa422..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/SingleStreamCodeWriter.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.writer;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-import com.sun.codemodel.internal.CodeWriter;
-import com.sun.codemodel.internal.JPackage;
-
-/**
- * Output all source files into a single stream with a little
- * formatting header in front of each file.
- *
- * This is primarily for human consumption of the generated source
- * code, such as to debug/test CodeModel or to quickly inspect the result.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class SingleStreamCodeWriter extends CodeWriter {
-
- private final PrintStream out;
-
- /**
- * @param os
- * This stream will be closed at the end of the code generation.
- */
- public SingleStreamCodeWriter( OutputStream os ) {
- out = new PrintStream(os);
- }
-
- public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
- String pkgName = pkg.name();
- if(pkgName.length()!=0) pkgName += '.';
-
- out.println(
- "-----------------------------------" + pkgName+fileName +
- "-----------------------------------");
-
- return new FilterOutputStream(out) {
- public void close() {
- // don't let this stream close
- }
- };
- }
-
- public void close() throws IOException {
- out.close();
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ZipCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ZipCodeWriter.java
deleted file mode 100644
index 0d345993bf5..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ZipCodeWriter.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal.writer;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import com.sun.codemodel.internal.CodeWriter;
-import com.sun.codemodel.internal.JPackage;
-
-/**
- * Writes all the files into a zip file.
- *
- * @author
- * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
- */
-public class ZipCodeWriter extends CodeWriter {
- /**
- * @param target
- * Zip file will be written to this stream.
- */
- public ZipCodeWriter( OutputStream target ) {
- zip = new ZipOutputStream(target);
- // nullify the close method.
- filter = new FilterOutputStream(zip){
- public void close() {}
- };
- }
-
- private final ZipOutputStream zip;
-
- private final OutputStream filter;
-
- public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
- String name = fileName;
- if(!pkg.isUnnamed()) name = toDirName(pkg)+name;
-
- zip.putNextEntry(new ZipEntry(name));
- return filter;
- }
-
- /** Converts a package name to the directory name. */
- private static String toDirName( JPackage pkg ) {
- return pkg.name().replace('.','/')+'/';
- }
-
- public void close() throws IOException {
- zip.close();
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Builder.java b/jaxws/src/share/classes/com/sun/istack/internal/Builder.java
deleted file mode 100644
index a5b1a5af5f3..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/Builder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-/**
- *
- * @author Martin Grebac
- */
-public interface Builder {
- T build();
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/ByteArrayDataSource.java b/jaxws/src/share/classes/com/sun/istack/internal/ByteArrayDataSource.java
deleted file mode 100644
index b11eb1bb3c3..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/ByteArrayDataSource.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import javax.activation.DataSource;
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.io.OutputStream;
-
-/**
- * {@link DataSource} backed by a byte buffer.
- *
- * @author Kohsuke Kawaguchi
- */
-public final class ByteArrayDataSource implements DataSource {
-
- private final String contentType;
- private final byte[] buf;
- private final int len;
-
- public ByteArrayDataSource(byte[] buf, String contentType) {
- this(buf,buf.length,contentType);
- }
- public ByteArrayDataSource(byte[] buf, int length, String contentType) {
- this.buf = buf;
- this.len = length;
- this.contentType = contentType;
- }
-
- public String getContentType() {
- if(contentType==null)
- return "application/octet-stream";
- return contentType;
- }
-
- public InputStream getInputStream() {
- return new ByteArrayInputStream(buf,0,len);
- }
-
- public String getName() {
- return null;
- }
-
- public OutputStream getOutputStream() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/FinalArrayList.java b/jaxws/src/share/classes/com/sun/istack/internal/FinalArrayList.java
deleted file mode 100644
index 6cc67b466e4..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/FinalArrayList.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * {@link ArrayList} with the final keyword.
- *
- *
- * This gives HotSpot a better hint that all methods can be inlined.
- *
- * @author Kohsuke Kawaguchi
- */
-public final class FinalArrayList extends ArrayList {
- public FinalArrayList(int initialCapacity) {
- super(initialCapacity);
- }
-
- public FinalArrayList() {
- }
-
- public FinalArrayList(Collection extends T> ts) {
- super(ts);
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/FragmentContentHandler.java b/jaxws/src/share/classes/com/sun/istack/internal/FragmentContentHandler.java
deleted file mode 100644
index c9b77721c9a..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/FragmentContentHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import org.xml.sax.helpers.XMLFilterImpl;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.ContentHandler;
-
-/**
- * {@link XMLFilterImpl} that masks start/end document SAX events.
- * @author Kohsuke Kawaguchi
- */
-public class FragmentContentHandler extends XMLFilterImpl {
- public FragmentContentHandler() {
- }
-
- public FragmentContentHandler(XMLReader parent) {
- super(parent);
- }
-
- public FragmentContentHandler(ContentHandler handler) {
- super();
- setContentHandler(handler);
- }
-
- public void startDocument() throws SAXException {
- // noop
- }
-
- public void endDocument() throws SAXException {
- // noop
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Interned.java b/jaxws/src/share/classes/com/sun/istack/internal/Interned.java
deleted file mode 100644
index 26e6bff8648..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/Interned.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-
-/**
- * Designates that a field, return value, argument, or a variable is supposed
- * to be an {@link String#intern() interned} string.
- *
- *
- * In many places in the istack, we assume Strings to be interned for
- * the performance reason. Similarly, In many other places, we don't
- * make such an assumption for the performance reason (because intern
- * isn't free.)
- *
- *
- * Therefore, distinguishing which part is supposed to be interned and
- * which part is supposed to be not is important. This annotation
- * allows us to capture that in the code.
- *
- * @author Kohsuke Kawaguchi
- */
-@Documented
-@Retention(RetentionPolicy.CLASS)
-@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE})
-public @interface Interned {
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/NotNull.java b/jaxws/src/share/classes/com/sun/istack/internal/NotNull.java
deleted file mode 100644
index f31eb46f248..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/NotNull.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-
-/**
- * Designates that a field, return value, argument, or a variable is guaranteed to be non-null.
- *
- * @author Kohsuke Kawaguchi
- */
-@Documented
-@Retention(RetentionPolicy.CLASS)
-@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE})
-public @interface NotNull {
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Nullable.java b/jaxws/src/share/classes/com/sun/istack/internal/Nullable.java
deleted file mode 100644
index 269d2498193..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/Nullable.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-
-/**
- * Designates that a field, return value, argument, or a variable may be null.
- *
- * @author Kohsuke Kawaguchi
- */
-@Documented
-@Retention(RetentionPolicy.CLASS)
-@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE})
-public @interface Nullable {
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Pool.java b/jaxws/src/share/classes/com/sun/istack/internal/Pool.java
deleted file mode 100644
index 589f79a0c69..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/Pool.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.lang.ref.WeakReference;
-
-/**
- * Pool of reusable objects that are indistinguishable from each other,
- * such as JAXB marshallers.
- *
- * @author Kohsuke Kawaguchi
- */
-public interface Pool {
-
- /**
- * Gets a new object from the pool.
- *
- *
- * If no object is available in the pool, this method creates a new one.
- */
- @NotNull T take();
-
- /**
- * Returns an object back to the pool.
- */
- void recycle(@NotNull T t);
-
- /**
- * Default implementation that uses {@link ConcurrentLinkedQueue}
- * as the data store.
- *
- *
Note for Implementors
- *
- * Don't rely on the fact that this class extends from {@link ConcurrentLinkedQueue}.
- */
- public abstract class Impl implements Pool {
-
- private volatile WeakReference> queue;
-
- /**
- * Gets a new object from the pool.
- *
- *
- * If no object is available in the pool, this method creates a new one.
- *
- * @return
- * always non-null.
- */
- public final @NotNull T take() {
- T t = getQueue().poll();
- if(t==null) {
- return create();
- }
- return t;
- }
-
- /**
- * Returns an object back to the pool.
- */
- public final void recycle(T t) {
- getQueue().offer(t);
- }
-
- private ConcurrentLinkedQueue getQueue() {
- WeakReference> q = queue;
- if (q != null) {
- ConcurrentLinkedQueue d = q.get();
- if (d != null) {
- return d;
- }
- }
- // overwrite the queue
- ConcurrentLinkedQueue d = new ConcurrentLinkedQueue();
- queue = new WeakReference>(d);
-
- return d;
- }
-
- /**
- * Creates a new instance of object.
- *
- *
- * This method is used when someone wants to
- * {@link #take() take} an object from an empty pool.
- *
- *
- * Also note that multiple threads may call this method
- * concurrently.
- */
- protected abstract @NotNull T create();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/SAXException2.java b/jaxws/src/share/classes/com/sun/istack/internal/SAXException2.java
deleted file mode 100644
index 558d8ce57c5..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/SAXException2.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import org.xml.sax.SAXException;
-
-/**
- * {@link SAXException} that handles exception chaining correctly.
- *
- * @author Kohsuke Kawaguchi
- * @since 2.0 FCS
- */
-public class SAXException2 extends SAXException {
- public SAXException2(String message) {
- super(message);
- }
-
- public SAXException2(Exception e) {
- super(e);
- }
-
- public SAXException2(String message, Exception e) {
- super(message, e);
- }
-
- public Throwable getCause() {
- return getException();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/SAXParseException2.java b/jaxws/src/share/classes/com/sun/istack/internal/SAXParseException2.java
deleted file mode 100644
index 0c6095f0a5a..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/SAXParseException2.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import org.xml.sax.SAXParseException;
-import org.xml.sax.Locator;
-
-/**
- * {@link SAXParseException} that handles exception chaining correctly.
- *
- * @author Kohsuke Kawaguchi
- * @since 2.0 FCS
- */
-public class SAXParseException2 extends SAXParseException {
- public SAXParseException2(String message, Locator locator) {
- super(message, locator);
- }
-
- public SAXParseException2(String message, Locator locator, Exception e) {
- super(message, locator, e);
- }
-
- public SAXParseException2(String message, String publicId, String systemId, int lineNumber, int columnNumber) {
- super(message, publicId, systemId, lineNumber, columnNumber);
- }
-
- public SAXParseException2(String message, String publicId, String systemId, int lineNumber, int columnNumber, Exception e) {
- super(message, publicId, systemId, lineNumber, columnNumber, e);
- }
-
- public Throwable getCause() {
- return getException();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamException2.java b/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamException2.java
deleted file mode 100644
index c88f6aea2c4..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamException2.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.Location;
-
-/**
- * {@link XMLStreamException} that properly handles exception chaining.
- *
- * @author Kohsuke Kawaguchi
- */
-public class XMLStreamException2 extends XMLStreamException {
- public XMLStreamException2(String msg) {
- super(msg);
- }
-
- public XMLStreamException2(Throwable th) {
- super(th);
- }
-
- public XMLStreamException2(String msg, Throwable th) {
- super(msg, th);
- }
-
- public XMLStreamException2(String msg, Location location) {
- super(msg, location);
- }
-
- public XMLStreamException2(String msg, Location location, Throwable th) {
- super(msg, location, th);
- }
-
- /**
- * {@link XMLStreamException} doesn't return the correct cause.
- */
- public Throwable getCause() {
- return getNestedException();
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java b/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java
deleted file mode 100644
index ae960953b6b..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.AttributesImpl;
-
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.namespace.QName;
-
-/**
- * This is a simple utility class that adapts StAX events from an
- * {@link XMLStreamReader} to SAX events on a
- * {@link ContentHandler}, bridging between the two
- * parser technologies.
- *
- * @author Ryan.Shoemaker@Sun.COM
- * @version 1.0
- */
-public class XMLStreamReaderToContentHandler {
-
- // StAX event source
- private final XMLStreamReader staxStreamReader;
-
- // SAX event sink
- private final ContentHandler saxHandler;
-
- // if true, when the conversion is completed, leave the cursor to the last
- // event that was fired (such as end element)
- private final boolean eagerQuit;
-
- /**
- * If true, not start/endDocument event.
- */
- private final boolean fragment;
-
- // array of the even length of the form { prefix0, uri0, prefix1, uri1, ... }
- private final String[] inscopeNamespaces;
-
- /**
- * @see #XMLStreamReaderToContentHandler(XMLStreamReader, ContentHandler, boolean, boolean, String[])
- */
- public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore, boolean eagerQuit, boolean fragment) {
- this(staxCore, saxCore, eagerQuit, fragment, new String[0]);
- }
-
- /**
- * Construct a new StAX to SAX adapter that will convert a StAX event
- * stream into a SAX event stream.
- *
- * @param staxCore
- * StAX event source
- * @param saxCore
- * SAXevent sink
- * @param eagerQuit
- * @param fragment
- * @param inscopeNamespaces
- * array of the even length of the form { prefix0, uri0, prefix1, uri1, ... }
- */
- public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore,
- boolean eagerQuit, boolean fragment, String[] inscopeNamespaces) {
- this.staxStreamReader = staxCore;
- this.saxHandler = saxCore;
- this.eagerQuit = eagerQuit;
- this.fragment = fragment;
- this.inscopeNamespaces = inscopeNamespaces;
- assert inscopeNamespaces.length%2 == 0;
- }
-
-
- /*
- * @see StAXReaderToContentHandler#bridge()
- */
- public void bridge() throws XMLStreamException {
-
- try {
- // remembers the nest level of elements to know when we are done.
- int depth=0;
-
- // if the parser is at the start tag, proceed to the first element
- int event = staxStreamReader.getEventType();
- if(event == XMLStreamConstants.START_DOCUMENT) {
- // nextTag doesn't correctly handle DTDs
- while( !staxStreamReader.isStartElement() )
- event = staxStreamReader.next();
- }
-
-
- if( event!=XMLStreamConstants.START_ELEMENT)
- throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event);
-
- handleStartDocument();
-
- for(int i=0; i < inscopeNamespaces.length; i+=2) {
- saxHandler.startPrefixMapping(inscopeNamespaces[i], inscopeNamespaces[i+1]);
- }
-
- OUTER:
- do {
- // These are all of the events listed in the javadoc for
- // XMLEvent.
- // The spec only really describes 11 of them.
- switch (event) {
- case XMLStreamConstants.START_ELEMENT :
- depth++;
- handleStartElement();
- break;
- case XMLStreamConstants.END_ELEMENT :
- handleEndElement();
- depth--;
- if(depth==0 && eagerQuit)
- break OUTER;
- break;
- case XMLStreamConstants.CHARACTERS :
- handleCharacters();
- break;
- case XMLStreamConstants.ENTITY_REFERENCE :
- handleEntityReference();
- break;
- case XMLStreamConstants.PROCESSING_INSTRUCTION :
- handlePI();
- break;
- case XMLStreamConstants.COMMENT :
- handleComment();
- break;
- case XMLStreamConstants.DTD :
- handleDTD();
- break;
- case XMLStreamConstants.ATTRIBUTE :
- handleAttribute();
- break;
- case XMLStreamConstants.NAMESPACE :
- handleNamespace();
- break;
- case XMLStreamConstants.CDATA :
- handleCDATA();
- break;
- case XMLStreamConstants.ENTITY_DECLARATION :
- handleEntityDecl();
- break;
- case XMLStreamConstants.NOTATION_DECLARATION :
- handleNotationDecl();
- break;
- case XMLStreamConstants.SPACE :
- handleSpace();
- break;
- default :
- throw new InternalError("processing event: " + event);
- }
-
- event=staxStreamReader.next();
- } while (depth!=0);
-
- for(int i=0; i < inscopeNamespaces.length; i+=2) {
- saxHandler.endPrefixMapping(inscopeNamespaces[i]);
- }
-
- handleEndDocument();
- } catch (SAXException e) {
- throw new XMLStreamException2(e);
- }
- }
-
- private void handleEndDocument() throws SAXException {
- if(fragment)
- return;
-
- saxHandler.endDocument();
- }
-
- private void handleStartDocument() throws SAXException {
- if(fragment)
- return;
-
- saxHandler.setDocumentLocator(new Locator() {
- public int getColumnNumber() {
- return staxStreamReader.getLocation().getColumnNumber();
- }
- public int getLineNumber() {
- return staxStreamReader.getLocation().getLineNumber();
- }
- public String getPublicId() {
- return staxStreamReader.getLocation().getPublicId();
- }
- public String getSystemId() {
- return staxStreamReader.getLocation().getSystemId();
- }
- });
- saxHandler.startDocument();
- }
-
- private void handlePI() throws XMLStreamException {
- try {
- saxHandler.processingInstruction(
- staxStreamReader.getPITarget(),
- staxStreamReader.getPIData());
- } catch (SAXException e) {
- throw new XMLStreamException2(e);
- }
- }
-
- private void handleCharacters() throws XMLStreamException {
- try {
- saxHandler.characters(
- staxStreamReader.getTextCharacters(),
- staxStreamReader.getTextStart(),
- staxStreamReader.getTextLength() );
- } catch (SAXException e) {
- throw new XMLStreamException2(e);
- }
- }
-
- private void handleEndElement() throws XMLStreamException {
- QName qName = staxStreamReader.getName();
-
- try {
- String pfix = qName.getPrefix();
- String rawname = (pfix == null || pfix.length() == 0)
- ? qName.getLocalPart()
- : pfix + ':' + qName.getLocalPart();
- // fire endElement
- saxHandler.endElement(
- qName.getNamespaceURI(),
- qName.getLocalPart(),
- rawname);
-
- // end namespace bindings
- int nsCount = staxStreamReader.getNamespaceCount();
- for (int i = nsCount - 1; i >= 0; i--) {
- String prefix = staxStreamReader.getNamespacePrefix(i);
- if (prefix == null) { // true for default namespace
- prefix = "";
- }
- saxHandler.endPrefixMapping(prefix);
- }
- } catch (SAXException e) {
- throw new XMLStreamException2(e);
- }
- }
-
- private void handleStartElement() throws XMLStreamException {
-
- try {
- // start namespace bindings
- int nsCount = staxStreamReader.getNamespaceCount();
- for (int i = 0; i < nsCount; i++) {
- saxHandler.startPrefixMapping(
- fixNull(staxStreamReader.getNamespacePrefix(i)),
- fixNull(staxStreamReader.getNamespaceURI(i)));
- }
-
- // fire startElement
- QName qName = staxStreamReader.getName();
- String prefix = qName.getPrefix();
- String rawname;
- if(prefix==null || prefix.length()==0)
- rawname = qName.getLocalPart();
- else
- rawname = prefix + ':' + qName.getLocalPart();
- Attributes attrs = getAttributes();
- saxHandler.startElement(
- qName.getNamespaceURI(),
- qName.getLocalPart(),
- rawname,
- attrs);
- } catch (SAXException e) {
- throw new XMLStreamException2(e);
- }
- }
-
- private static String fixNull(String s) {
- if(s==null) return "";
- else return s;
- }
-
- /**
- * Get the attributes associated with the given START_ELEMENT or ATTRIBUTE
- * StAXevent.
- *
- * @return the StAX attributes converted to an org.xml.sax.Attributes
- */
- private Attributes getAttributes() {
- AttributesImpl attrs = new AttributesImpl();
-
- int eventType = staxStreamReader.getEventType();
- if (eventType != XMLStreamConstants.ATTRIBUTE
- && eventType != XMLStreamConstants.START_ELEMENT) {
- throw new InternalError(
- "getAttributes() attempting to process: " + eventType);
- }
-
- // in SAX, namespace declarations are not part of attributes by default.
- // (there's a property to control that, but as far as we are concerned
- // we don't use it.) So don't add xmlns:* to attributes.
-
- // gather non-namespace attrs
- for (int i = 0; i < staxStreamReader.getAttributeCount(); i++) {
- String uri = staxStreamReader.getAttributeNamespace(i);
- if(uri==null) uri="";
- String localName = staxStreamReader.getAttributeLocalName(i);
- String prefix = staxStreamReader.getAttributePrefix(i);
- String qName;
- if(prefix==null || prefix.length()==0)
- qName = localName;
- else
- qName = prefix + ':' + localName;
- String type = staxStreamReader.getAttributeType(i);
- String value = staxStreamReader.getAttributeValue(i);
-
- attrs.addAttribute(uri, localName, qName, type, value);
- }
-
- return attrs;
- }
-
- private void handleNamespace() {
- // no-op ???
- // namespace events don't normally occur outside of a startElement
- // or endElement
- }
-
- private void handleAttribute() {
- // no-op ???
- // attribute events don't normally occur outside of a startElement
- // or endElement
- }
-
- private void handleDTD() {
- // no-op ???
- // it seems like we need to pass this info along, but how?
- }
-
- private void handleComment() {
- // no-op ???
- }
-
- private void handleEntityReference() {
- // no-op ???
- }
-
- private void handleSpace() {
- // no-op ???
- // this event is listed in the javadoc, but not in the spec.
- }
-
- private void handleNotationDecl() {
- // no-op ???
- // this event is listed in the javadoc, but not in the spec.
- }
-
- private void handleEntityDecl() {
- // no-op ???
- // this event is listed in the javadoc, but not in the spec.
- }
-
- private void handleCDATA() {
- // no-op ???
- // this event is listed in the javadoc, but not in the spec.
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizable.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizable.java
deleted file mode 100644
index 82dbde89c17..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizable.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.istack.internal.localization;
-
-/**
- * Localizable message.
- *
- * @author WS Development Team
- */
-public interface Localizable {
- /**
- * Gets the key in the resource bundle.
- *
- * @return
- * if this method returns {@link #NOT_LOCALIZABLE},
- * that means the message is not localizable, and
- * the first item of {@link #getArguments()} array
- * holds a String.
- */
- public String getKey();
-
- /**
- * Returns the arguments for message formatting.
- *
- * @return
- * can be an array of length 0 but never be null.
- */
- public Object[] getArguments();
- public String getResourceBundleName();
-
-
- /**
- * Special constant that represents a message that
- * is not localizable.
- *
- *
- * Use of "new" is to create an unique instance.
- */
- public static final String NOT_LOCALIZABLE = new String("\u0000");
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java
deleted file mode 100644
index 4438e131c1e..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.istack.internal.localization;
-
-/**
- * @author WS Development Team
- */
-public final class LocalizableMessage implements Localizable {
-
- private final String _bundlename;
- private final String _key;
- private final Object[] _args;
-
- public LocalizableMessage(String bundlename, String key, Object... args) {
- _bundlename = bundlename;
- _key = key;
- if(args==null)
- args = new Object[0];
- _args = args;
- }
-
- public String getKey() {
- return _key;
- }
-
- public Object[] getArguments() {
- return _args;
- }
-
- public String getResourceBundleName() {
- return _bundlename;
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java
deleted file mode 100644
index 066d8b1df36..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.istack.internal.localization;
-
-/**
- * @author WS Development Team
- */
-public class LocalizableMessageFactory {
-
- private final String _bundlename;
-
- public LocalizableMessageFactory(String bundlename) {
- _bundlename = bundlename;
- }
-
- public Localizable getMessage(String key, Object... args) {
- return new LocalizableMessage(_bundlename, key, args);
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizer.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizer.java
deleted file mode 100644
index 7aa7064d40c..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.istack.internal.localization;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Localizes the {@link Localizable} into a message
- * by using a configured {@link Locale}.
- *
- * @author WS Development Team
- */
-public class Localizer {
-
- private final Locale _locale;
- private final HashMap _resourceBundles;
-
- public Localizer() {
- this(Locale.getDefault());
- }
-
- public Localizer(Locale l) {
- _locale = l;
- _resourceBundles = new HashMap();
- }
-
- public Locale getLocale() {
- return _locale;
- }
-
- public String localize(Localizable l) {
- String key = l.getKey();
- if (key == Localizable.NOT_LOCALIZABLE) {
- // this message is not localizable
- return (String) l.getArguments()[0];
- }
- String bundlename = l.getResourceBundleName();
-
- try {
- ResourceBundle bundle =
- (ResourceBundle) _resourceBundles.get(bundlename);
-
- if (bundle == null) {
- try {
- bundle = ResourceBundle.getBundle(bundlename, _locale);
- } catch (MissingResourceException e) {
- // work around a bug in the com.sun.enterprise.deployment.WebBundleArchivist:
- // all files with an extension different from .class (hence all the .properties files)
- // get copied to the top level directory instead of being in the package where they
- // are defined
- // so, since we can't find the bundle under its proper name, we look for it under
- // the top-level package
-
- int i = bundlename.lastIndexOf('.');
- if (i != -1) {
- String alternateBundleName =
- bundlename.substring(i + 1);
- try {
- bundle =
- ResourceBundle.getBundle(
- alternateBundleName,
- _locale);
- } catch (MissingResourceException e2) {
- // give up
- return getDefaultMessage(l);
- }
- }
- }
-
- _resourceBundles.put(bundlename, bundle);
- }
-
- if (bundle == null) {
- return getDefaultMessage(l);
- }
-
- if (key == null)
- key = "undefined";
-
- String msg;
- try {
- msg = bundle.getString(key);
- } catch (MissingResourceException e) {
- // notice that this may throw a MissingResourceException of its own (caught below)
- msg = bundle.getString("undefined");
- }
-
- // localize all arguments to the given localizable object
- Object[] args = l.getArguments();
- for (int i = 0; i < args.length; ++i) {
- if (args[i] instanceof Localizable)
- args[i] = localize((Localizable) args[i]);
- }
-
- String message = MessageFormat.format(msg, args);
- return message;
-
- } catch (MissingResourceException e) {
- return getDefaultMessage(l);
- }
-
- }
-
- private String getDefaultMessage(Localizable l) {
- String key = l.getKey();
- Object[] args = l.getArguments();
- StringBuilder sb = new StringBuilder();
- sb.append("[failed to localize] ");
- sb.append(key);
- if (args != null) {
- sb.append('(');
- for (int i = 0; i < args.length; ++i) {
- if (i != 0)
- sb.append(", ");
- sb.append(String.valueOf(args[i]));
- }
- sb.append(')');
- }
- return sb.toString();
- }
-
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/package-info.java b/jaxws/src/share/classes/com/sun/istack/internal/package-info.java
deleted file mode 100644
index 60a915df58d..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-/**
- * istack-commons runtime utilities.
- */
-package com.sun.istack.internal;
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/APTTypeVisitor.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/APTTypeVisitor.java
deleted file mode 100644
index 2678f1437b3..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/tools/APTTypeVisitor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal.tools;
-
-import com.sun.mirror.type.TypeMirror;
-import com.sun.mirror.type.ArrayType;
-import com.sun.mirror.type.ClassType;
-import com.sun.mirror.type.InterfaceType;
-import com.sun.mirror.type.TypeVariable;
-import com.sun.mirror.type.VoidType;
-import com.sun.mirror.type.WildcardType;
-import com.sun.mirror.type.PrimitiveType;
-
-/**
- * Visitor that works on APT {@link TypeMirror} and computes a value.
- *
- *
- * This visitor takes a parameter 'P' so that visitor code can be made stateless.
- *
- * @author Kohsuke Kawaguchi
- */
-public abstract class APTTypeVisitor {
- public final T apply(TypeMirror type, P param) {
- if( type instanceof ArrayType)
- return onArrayType((ArrayType)type,param);
- if( type instanceof PrimitiveType)
- return onPrimitiveType((PrimitiveType)type,param);
- if (type instanceof ClassType )
- return onClassType((ClassType)type,param);
- if (type instanceof InterfaceType )
- return onInterfaceType((InterfaceType)type,param);
- if (type instanceof TypeVariable )
- return onTypeVariable((TypeVariable)type,param);
- if (type instanceof VoidType )
- return onVoidType((VoidType)type,param);
- if(type instanceof WildcardType)
- return onWildcard((WildcardType) type,param);
- assert false;
- throw new IllegalArgumentException();
- }
-
- protected abstract T onPrimitiveType(PrimitiveType type, P param);
- protected abstract T onArrayType(ArrayType type, P param);
- protected abstract T onClassType(ClassType type, P param);
- protected abstract T onInterfaceType(InterfaceType type, P param);
- protected abstract T onTypeVariable(TypeVariable type, P param);
- protected abstract T onVoidType(VoidType type, P param);
- protected abstract T onWildcard(WildcardType type, P param);
-
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/MaskingClassLoader.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/MaskingClassLoader.java
deleted file mode 100644
index 8159a7e677b..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/tools/MaskingClassLoader.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal.tools;
-
-import java.util.Collection;
-
-/**
- * {@link ClassLoader} that masks a specified set of classes
- * from its parent class loader.
- *
- *
- * This code is used to create an isolated environment.
- *
- * @author Kohsuke Kawaguchi
- */
-public class MaskingClassLoader extends ClassLoader {
-
- private final String[] masks;
-
- public MaskingClassLoader(String... masks) {
- this.masks = masks;
- }
-
- public MaskingClassLoader(Collection masks) {
- this(masks.toArray(new String[masks.size()]));
- }
-
- public MaskingClassLoader(ClassLoader parent, String... masks) {
- super(parent);
- this.masks = masks;
- }
-
- public MaskingClassLoader(ClassLoader parent, Collection masks) {
- this(parent, masks.toArray(new String[masks.size()]));
- }
-
- @Override
- protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- for (String mask : masks) {
- if(name.startsWith(mask))
- throw new ClassNotFoundException();
- }
-
- return super.loadClass(name, resolve);
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/ParallelWorldClassLoader.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/ParallelWorldClassLoader.java
deleted file mode 100644
index 013a0aa12ad..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/tools/ParallelWorldClassLoader.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.istack.internal.tools;
-
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Enumeration;
-
-/**
- * Load classes/resources from a side folder, so that
- * classes of the same package can live in a single jar file.
- *
- *
- * For example, with the following jar file:
- *
- * /
- * +- foo
- * +- X.class
- * +- bar
- * +- X.class
- *
- *
- * {@link ParallelWorldClassLoader}("foo/") would load X.class from
- * /foo/X.class (note that X is defined in the root package, not
- * foo.X.
- *
- *
- * This can be combined with {@link MaskingClassLoader} to mask classes which are loaded by the parent
- * class loader so that the child class loader
- * classes living in different folders are loaded
- * before the parent class loader loads classes living the jar file publicly
- * visible
- * For example, with the following jar file:
- *
- * /
- * +- foo
- * +- X.class
- * +- bar
- * +-foo
- * +- X.class
- *
- *
- * {@link ParallelWorldClassLoader}(MaskingClassLoader.class.getClassLoader()) would load foo.X.class from
- * /bar/foo.X.class not the foo.X.class in the publicly visible place in the jar file, thus
- * masking the parent classLoader from loading the class from foo.X.class
- * (note that X is defined in the package foo, not
- * bar.foo.X.
- *
- * @author Kohsuke Kawaguchi
- */
-public class ParallelWorldClassLoader extends ClassLoader {
-
- /**
- * Strings like "prefix/", "abc/", or "" to indicate
- * classes should be loaded normally.
- */
- private final String prefix;
-
- public ParallelWorldClassLoader(ClassLoader parent,String prefix) {
- super(parent);
- this.prefix = prefix;
- }
-
- protected Class findClass(String name) throws ClassNotFoundException {
- StringBuffer sb = new StringBuffer(name.length()+prefix.length()+6);
- sb.append(prefix).append(name.replace('.','/')).append(".class");
-
- InputStream is = getParent().getResourceAsStream(sb.toString());
- if (is==null)
- throw new ClassNotFoundException(name);
-
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buf = new byte[1024];
- int len;
- while((len=is.read(buf))>=0)
- baos.write(buf,0,len);
-
- buf = baos.toByteArray();
- int packIndex = name.lastIndexOf('.');
- if (packIndex != -1) {
- String pkgname = name.substring(0, packIndex);
- // Check if package already loaded.
- Package pkg = getPackage(pkgname);
- if (pkg == null) {
- definePackage(pkgname, null, null, null, null, null, null, null);
- }
- }
- return defineClass(name,buf,0,buf.length);
- } catch (IOException e) {
- throw new ClassNotFoundException(name,e);
- }
- }
-
- protected URL findResource(String name) {
- return getParent().getResource(prefix+name);
- }
-
- protected Enumeration findResources(String name) throws IOException {
- return getParent().getResources( prefix+name);
- }
-
- /**
- * Given the URL inside jar, returns the URL to the jar itself.
- */
- public static URL toJarUrl(URL res) throws ClassNotFoundException, MalformedURLException {
- String url = res.toExternalForm();
- if(!url.startsWith("jar:"))
- throw new ClassNotFoundException("Loaded outside a jar "+url);
- url = url.substring(4); // cut off jar:
- url = url.substring(0,url.lastIndexOf('!')); // cut off everything after '!'
- return new URL(url);
- }
-}
diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/package-info.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/package-info.java
deleted file mode 100644
index 3ce8c80627f..00000000000
--- a/jaxws/src/share/classes/com/sun/istack/internal/tools/package-info.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-/**
- * istack-commons tool time utilities.
- *
- *