6831313: update jaxws in OpenJDK7 to 2.1 plus bug fixes from OpenJDK 6

6672868: Package javax.xml.ws.wsaddressing not included in make/docs/CORE_PKGS.gmk

Reviewed-by: darcy
This commit is contained in:
Tim Bell 2009-04-20 15:14:39 -07:00
parent 38930ae468
commit 71315ac3a3
2692 changed files with 120166 additions and 63522 deletions

View File

@ -61,6 +61,28 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
%% This notice is provided with respect to littlecms, which may be included with this software:
Little cms
Copyright (C) 1998-2004 Marti Maria
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
%% This notice is provided with respect to zlib 1.1.3, which may be included with this software:
Acknowledgments:
@ -115,16 +137,6 @@ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQ
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
____________________________________
This formulation of W3C's notice and license became active on August 14 1998 so as to improve compatibility with GPL. This version ensures that W3C software licensing terms are no more restrictive than GPL and consequently W3C software may be distributed in GPL packages. See the older formulation for the policy prior to this date. Please see our Copyright FAQ for common questions about using materials from our site, including specific terms and conditions for packages like libwww, Amaya, and Jigsaw. Other questions about this notice can be directed to site-policy@w3.org.
 
%% This notice is provided with respect to jscheme.jar, which may be included with this software:
Software License Agreement
Copyright © 1998-2002 by Peter Norvig.
Permission is granted to anyone to use this software, in source or object code form, on any computer system, and to modify, compile, decompile, run, and redistribute it to anyone else, subject to the following restrictions:
1.The author makes no warranty of any kind, either expressed or implied, about the suitability of this software for any purpose.
2.The author accepts no liability of any kind for damages or other consequences of the use of this software, even if they arise from defects in the software.
3.The origin of this software must not be misrepresented, either by explicit claim or by omission.
4.Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. Altered versions may be distributed in packages under other licenses (such as the GNU license).
If you find this software useful, it would be nice if you let me (peter@norvig.com) know about it, and nicer still if you send me modifications that you are willing to share. However, you are not required to do so.
%% This notice is provided with respect to PC/SC Lite for Suse Linux v. 1.1.1, which may be included with this software:

41
jaxws/TRADEMARK Normal file
View File

@ -0,0 +1,41 @@
OpenJDK Trademark Notice
Version 1.1, 2008/3/10
OpenJDK (the "Name") is a trademark of Sun Microsystems, Inc. (the "Owner").
Owner permits any person obtaining a copy of this software (the "Software")
which is based on original software retrieved from one of the following
websites: http://download.java.net/openjdk, http://hg.openjdk.java.net/jdk6,
or http://openjdk.java.net (each a "Website", with the original software made
available by the Owner on a Website being known as the "Website Software") to
use the Name in package names and version strings of the Software subject to
the following conditions:
- The Software is a substantially complete implementation of the OpenJDK
development kit or runtime environment code made available by Owner on a
Website, and the vast majority of the Software code is identical to the
upstream Website Software;
- No permission is hereby granted to use the Name in any other manner,
unless such use constitutes "fair use."
- The Owner makes no warranties of any kind respecting the Name and all
representations and warranties, including any implied warranty of
merchantability, fitness for a particular purpose or non-infringement
are hereby disclaimed; and
- This notice and the following legend are included in all copies of the
Software or portions of it:
OpenJDK is a trademark or registered trademark of Sun Microsystems,
Inc. in the United States and other countries.
The Name may also be used in connection with descriptions of the Software that
constitute "fair use," such as "derived from the OpenJDK code base" or "based
on the OpenJDK source code."
Owner intends to revise this Notice as necessary in order to meet the needs of
the OpenJDK Community. Please send questions or comments about this Notice to
Sun Microsystems at openjdk-tm@sun.com. Revisions to this Notice will be
announced on the public mailing list announce@openjdk.java.net, to which you
may subscribe by visiting http://mail.openjdk.java.net. The latest version of
this Notice may be found at http://openjdk.java.net/legal.

View File

@ -1,5 +1,5 @@
#
# Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2007 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

View File

@ -78,6 +78,15 @@
<mkdir dir="${build.classes.dir}/META-INF/services"/>
<copy todir="${build.classes.dir}/META-INF/services"
file="${src.classes.dir}/com/sun/tools/etc/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory"/>
<copy todir="${build.classes.dir}/META-INF/services"
file="${src.classes.dir}/com/sun/tools/etc/META-INF/services/com.sun.tools.internal.xjc.Plugin"/>
<!-- copy jaxb sources files required for jaxb tool time -->
<mkdir dir="${build.classes.dir}/com/sun/tools/internal/xjc/runtime"/>
<copy todir="${build.classes.dir}/com/sun/tools/internal/xjc/runtime">
<fileset dir="${src.classes.dir}/com/sun/tools/internal/xjc/runtime"
includes="**/*.java"
excludes="**/*.package.html"/>
</copy>
</target>
<target name="-defs-pstrip">

View File

@ -24,13 +24,13 @@
#
# Properties for jprt
jprt.tools.default.release=jdk1.7.0
jprt.tools.default.release=openjdk6
# Specific platform list
jprt.build.platforms=\
solaris_sparc_5.10,\
solaris_sparcv9_5.10,\
solaris_i586_5.10,\
solaris_sparc_5.8,\
solaris_sparcv9_5.8,\
solaris_i586_5.8,\
solaris_x64_5.10,\
linux_i586,\
linux_x64,\
@ -41,10 +41,12 @@ windows_x64
jprt.build.flavors=product
# Explicitly designate what the 32bit match is for the 64bit build
jprt.solaris_sparcv9.build.platform.match32=solaris_sparc_5.10
jprt.solaris_sparcv9_5.10.build.platform.match32=solaris_sparc_5.10
jprt.solaris_x64.build.platform.match32=solaris_i586_5.10
jprt.solaris_x64_5.10.build.platform.match32=solaris_i586_5.10
jprt.solaris_sparcv9.build.platform.match32=solaris_sparc_5.8
jprt.solaris_sparcv9_5.8.build.platform.match32=solaris_sparc_5.8
jprt.solaris_sparcv9_5.10.build.platform.match32=solaris_sparc_5.8
jprt.solaris_x64.build.platform.match32=solaris_i586_5.8
jprt.solaris_x64_5.8.build.platform.match32=solaris_i586_5.8
jprt.solaris_x64_5.10.build.platform.match32=solaris_i586_5.8
# Standard list of jprt test targets for this workspace
jprt.test.targets=

View File

@ -182,7 +182,8 @@ public class MailcapFile {
*/
public String[] getNativeCommands(String mime_type) {
String[] cmds = null;
List v = (List)native_commands.get(mime_type.toLowerCase());
List v =
(List)native_commands.get(mime_type.toLowerCase(Locale.ENGLISH));
if (v != null) {
cmds = new String[v.size()];
cmds = (String[])v.toArray(cmds);
@ -301,7 +302,8 @@ public class MailcapFile {
reportParseError(MailcapTokenizer.STRING_TOKEN, currentToken,
tokenizer.getCurrentTokenValue());
}
String primaryType = tokenizer.getCurrentTokenValue().toLowerCase();
String primaryType =
tokenizer.getCurrentTokenValue().toLowerCase(Locale.ENGLISH);
String subType = "*";
// parse the '/' between primary and sub
@ -322,7 +324,8 @@ public class MailcapFile {
reportParseError(MailcapTokenizer.STRING_TOKEN,
currentToken, tokenizer.getCurrentTokenValue());
}
subType = tokenizer.getCurrentTokenValue().toLowerCase();
subType =
tokenizer.getCurrentTokenValue().toLowerCase(Locale.ENGLISH);
// get the next token to simplify the next step
currentToken = tokenizer.nextToken();
@ -386,8 +389,8 @@ public class MailcapFile {
reportParseError(MailcapTokenizer.STRING_TOKEN,
currentToken, tokenizer.getCurrentTokenValue());
}
String paramName =
tokenizer.getCurrentTokenValue().toLowerCase();
String paramName = tokenizer.getCurrentTokenValue().
toLowerCase(Locale.ENGLISH);
// parse the '=' which separates the name from the value
currentToken = tokenizer.nextToken();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**
* This helps enable whether the JDefinedClass is a Class or Interface or

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.io.IOException;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.lang.annotation.Annotation;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.lang.annotation.Annotation;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.Iterator;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -220,16 +220,14 @@ public final class JBlock implements JGenerable, JStatement {
* @return Newly generated JInvocation
*/
public JInvocation invoke(JExpression expr, JMethod method) {
return invoke(expr, method.name());
return insert(new JInvocation(expr, method));
}
/**
* Creates a static invocation statement.
*/
public JInvocation staticInvoke(JClass type, String method) {
JInvocation i = new JInvocation(type, method);
insert(i);
return i;
return insert(new JInvocation(type, method));
}
/**
@ -241,9 +239,7 @@ public final class JBlock implements JGenerable, JStatement {
* @return Newly generated JInvocation
*/
public JInvocation invoke(String method) {
JInvocation i = new JInvocation((JExpression)null, method);
insert(i);
return i;
return insert(new JInvocation((JExpression)null, method));
}
/**
@ -255,7 +251,7 @@ public final class JBlock implements JGenerable, JStatement {
* @return Newly generated JInvocation
*/
public JInvocation invoke(JMethod method) {
return invoke(method.name());
return insert(new JInvocation((JExpression)null, method));
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -321,7 +321,7 @@ public abstract class JClass extends JType
/** Generates a static method invocation. */
public final JInvocation staticInvoke(JMethod method) {
return staticInvoke(method.name());
return new JInvocation(this,method);
}
/** Generates a static method invocation. */

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.Iterator;
@ -146,7 +145,6 @@ public interface JClassContainer {
* newly created Annotation Type Declaration
* @exception JClassAlreadyExistsException
* When the specified class/interface was already created.
*/
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException;
@ -158,7 +156,6 @@ public interface JClassContainer {
* newly created Enum
* @exception JClassAlreadyExistsException
* When the specified class/interface was already created.
*/
public JDefinedClass _enum (String name) throws JClassAlreadyExistsException;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -446,13 +446,29 @@ public final class JCodeModel {
JClass clazz = ref(s.substring(start,idx));
return parseSuffix(clazz);
}
/**
* Parses additional left-associative suffixes, like type arguments
* and array specifiers.
*/
private JClass parseSuffix(JClass clazz) throws ClassNotFoundException {
if(idx==s.length())
return clazz; // hit EOL
char ch = s.charAt(idx);
if(ch=='<')
return parseArguments(clazz);
return parseSuffix(parseArguments(clazz));
if(ch=='[') {
if(s.charAt(idx+1)==']') {
idx+=2;
return parseSuffix(clazz.array());
}
throw new IllegalArgumentException("Expected ']' but found "+s.substring(idx+1));
}
return clazz;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.ArrayList;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -75,6 +75,13 @@ public class JConditional implements JStatement {
return _else;
}
/**
* Creates <tt>... else if(...) ...</tt> code.
*/
public JConditional _elseif(JExpression boolExp) {
return _else()._if(boolExp);
}
public void state(JFormatter f) {
if(test==JExpr.TRUE) {
_then.generateBody(f);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -251,6 +251,13 @@ public class JDefinedClass
if (superClass == null)
throw new NullPointerException();
for( JClass o=superClass.outer(); o!=null; o=o.outer() ){
if(this==o){
throw new IllegalArgumentException("Illegal class inheritance loop." +
" Outer class " + this.name + " may not subclass from inner class: " + o.name());
}
}
this.superClass = superClass;
return this;
}
@ -307,8 +314,9 @@ public class JDefinedClass
}
/**
* This method generates reference to the JEnumConstant in
* the class
* If the named enum already exists, the reference to it is returned.
* Otherwise this method generates a new enum reference with the given
* name and returns it.
*
* @param name
* The name of the constant.
@ -316,8 +324,11 @@ public class JDefinedClass
* The generated type-safe enum constant.
*/
public JEnumConstant enumConstant(String name){
JEnumConstant ec = new JEnumConstant(this, name);
enumConstantsByName.put(name, ec);
JEnumConstant ec = enumConstantsByName.get(name);
if (null == ec) {
ec = new JEnumConstant(this, name);
enumConstantsByName.put(name, ec);
}
return ec;
}
@ -417,7 +428,6 @@ public class JDefinedClass
* newly created Annotation Type Declaration
* @exception JClassAlreadyExistsException
* When the specified class/interface was already created.
*/
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException {
return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL);
@ -576,7 +586,6 @@ public class JDefinedClass
* null if not found.
*/
public JMethod getMethod(String name, JType[] argTypes) {
outer :
for (JMethod m : methods) {
if (!m.name().equals(name))
continue;
@ -740,8 +749,8 @@ public class JDefinedClass
f.nl().g(jdoc);
if (annotations != null){
for( int i=0; i<annotations.size(); i++ )
f.g(annotations.get(i)).nl();
for (JAnnotationUse annotation : annotations)
f.g(annotation).nl();
}
f.g(mods).p(classType.declarationToken).id(name).d(generifiable);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.Iterator;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.HashMap;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.ArrayList;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -57,11 +57,11 @@ public abstract class JExpr {
}
public static JInvocation invoke(JMethod method) {
return new JInvocation((JExpression)null,method.name());
return new JInvocation((JExpression)null,method);
}
public static JInvocation invoke(JExpression lhs, JMethod method) {
return new JInvocation(lhs, method.name());
return new JInvocation(lhs, method);
}
public static JInvocation invoke(JExpression lhs, String method) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**
@ -34,17 +33,17 @@ package com.sun.codemodel.internal;
*/
public final class JForEach implements JStatement {
private final JType type;
private final String var;
private JBlock body = null; // lazily created
private final JExpression collection;
private final JType type;
private final String var;
private JBlock body = null; // lazily created
private final JExpression collection;
private final JVar loopVar;
public JForEach(JType vartype, String variable, JExpression collection) {
public JForEach(JType vartype, String variable, JExpression collection) {
this.type = vartype;
this.var = variable;
this.collection = collection;
this.type = vartype;
this.var = variable;
this.collection = collection;
loopVar = new JVar(JMods.forVar(JMod.NONE), type, var, collection);
}
@ -52,24 +51,24 @@ public final class JForEach implements JStatement {
/**
* Returns a reference to the loop variable.
*/
public JVar var() {
return loopVar;
}
public JVar var() {
return loopVar;
}
public JBlock body() {
if (body == null)
body = new JBlock();
return body;
}
public JBlock body() {
if (body == null)
body = new JBlock();
return body;
}
public void state(JFormatter f) {
f.p("for (");
f.g(type).id(var).p(": ").g(collection);
f.p(')');
if (body != null)
f.g(body).nl();
else
f.p(';').nl();
}
public void state(JFormatter f) {
f.p("for (");
f.g(type).id(var).p(": ").g(collection);
f.p(')');
if (body != null)
f.g(body).nl();
else
f.p(';').nl();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.ArrayList;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -41,10 +41,15 @@ public final class JInvocation extends JExpressionImpl implements JStatement {
private JGenerable object;
/**
* Name of the method to be invoked
* Name of the method to be invoked.
* Either this field is set, or {@link #method}, or {@link #type} (in which case it's a
* constructor invocation.)
* This allows {@link JMethod#name(String) the name of the method to be changed later}.
*/
private String name;
private JMethod method;
private boolean isConstructor = false;
/**
@ -72,6 +77,10 @@ public final class JInvocation extends JExpressionImpl implements JStatement {
this( (JGenerable)object, name );
}
JInvocation(JExpression object, JMethod method) {
this( (JGenerable)object, method );
}
/**
* Invokes a static method on a class.
*/
@ -79,14 +88,22 @@ public final class JInvocation extends JExpressionImpl implements JStatement {
this( (JGenerable)type, name );
}
JInvocation(JClass type, JMethod method) {
this( (JGenerable)type, method );
}
private JInvocation(JGenerable object, String name) {
this.object = object;
if (name.indexOf('.') >= 0)
throw new IllegalArgumentException("JClass name contains '.': "
+ name);
throw new IllegalArgumentException("method name contains '.': " + name);
this.name = name;
}
private JInvocation(JGenerable object, JMethod method) {
this.object = object;
this.method =method;
}
/**
* Invokes a constructor of an object (i.e., creates
* a new object.)
@ -131,10 +148,15 @@ public final class JInvocation extends JExpressionImpl implements JStatement {
} else {
if (isConstructor)
f.p("new").g(type).p('(');
else if (object != null)
f.g(object).p('.').p(name).p('(');
else
f.id(name).p('(');
else {
String name = this.name;
if(name==null) name=this.method.name();
if (object != null)
f.g(object).p('.').p(name).p('(');
else
f.id(name).p('(');
}
}
f.g(args);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -51,6 +51,13 @@ public class JJavaName {
return true;
}
/**
* Checks if the given string is a valid fully qualified name.
*/
public static boolean isFullyQualifiedClassName(String s) {
return isJavaPackageName(s);
}
/**
* Checks if the given string is a valid Java package name.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -38,49 +38,49 @@ import com.sun.codemodel.internal.util.ClassNameComparator;
*/
public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotatable {
/**
* Modifiers for this method
*/
private JMods mods;
/**
* Modifiers for this method
*/
private JMods mods;
/**
* Return type for this method
*/
private JType type = null;
/**
* Return type for this method
*/
private JType type = null;
/**
* Name of this method
*/
private String name = null;
/**
* Name of this method
*/
private String name = null;
/**
* List of parameters for this method's declaration
*/
private final List<JVar> params = new ArrayList<JVar>();
/**
* List of parameters for this method's declaration
*/
private final List<JVar> params = new ArrayList<JVar>();
/**
* Set of exceptions that this method may throw.
/**
* Set of exceptions that this method may throw.
* A set instance lazily created.
*/
private Set<JClass> _throws;
*/
private Set<JClass> _throws;
/**
* JBlock of statements that makes up the body this method
*/
private JBlock body = null;
/**
* JBlock of statements that makes up the body this method
*/
private JBlock body = null;
private JDefinedClass outer;
private JDefinedClass outer;
/**
* javadoc comments for this JMethod
*/
private JDocComment jdoc = null;
/**
* javadoc comments for this JMethod
*/
private JDocComment jdoc = null;
/**
* Variable parameter for this method's varargs declaration
* introduced in J2SE 1.5
*/
private JVar varParam = null;
/**
* Variable parameter for this method's varargs declaration
* introduced in J2SE 1.5
*/
private JVar varParam = null;
/**
* Annotations on this variable. Lazily created.
@ -88,9 +88,9 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
private List<JAnnotationUse> annotations = null;
private boolean isConstructor() {
return type == null;
}
private boolean isConstructor() {
return type == null;
}
/** To set the default value for the
* annotation member
@ -98,40 +98,40 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
private JExpression defaultValue = null;
/**
* JMethod constructor
*
* @param mods
* Modifiers for this method's declaration
*
* @param type
* Return type for the method
*
* @param name
* Name of this method
*/
JMethod(JDefinedClass outer, int mods, JType type, String name) {
this.mods = JMods.forMethod(mods);
this.type = type;
this.name = name;
this.outer = outer;
}
/**
* JMethod constructor
*
* @param mods
* Modifiers for this method's declaration
*
* @param type
* Return type for the method
*
* @param name
* Name of this method
*/
JMethod(JDefinedClass outer, int mods, JType type, String name) {
this.mods = JMods.forMethod(mods);
this.type = type;
this.name = name;
this.outer = outer;
}
/**
* Constructor constructor
*
* @param mods
* Modifiers for this constructor's declaration
*
* @param _class
* JClass containing this constructor
*/
JMethod(int mods, JDefinedClass _class) {
this.mods = JMods.forMethod(mods);
this.type = null;
this.name = _class.name();
this.outer = _class;
}
/**
* Constructor constructor
*
* @param mods
* Modifiers for this constructor's declaration
*
* @param _class
* JClass containing this constructor
*/
JMethod(int mods, JDefinedClass _class) {
this.mods = JMods.forMethod(mods);
this.type = null;
this.name = _class.name();
this.outer = _class;
}
private Set<JClass> getThrows() {
if(_throws==null)
@ -139,56 +139,56 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
return _throws;
}
/**
* Add an exception to the list of exceptions that this
* method may throw.
*
* @param exception
* Name of an exception that this method may throw
*/
public JMethod _throws(JClass exception) {
/**
* Add an exception to the list of exceptions that this
* method may throw.
*
* @param exception
* Name of an exception that this method may throw
*/
public JMethod _throws(JClass exception) {
getThrows().add(exception);
return this;
}
return this;
}
public JMethod _throws(Class exception) {
return _throws(outer.owner().ref(exception));
}
public JMethod _throws(Class exception) {
return _throws(outer.owner().ref(exception));
}
/**
* Add the specified variable to the list of parameters
* for this method signature.
*
* @param type
* JType of the parameter being added
*
* @param name
* Name of the parameter being added
*
* @return New parameter variable
*/
public JVar param(int mods, JType type, String name) {
JVar v = new JVar(JMods.forVar(mods), type, name, null);
params.add(v);
return v;
}
/**
* Add the specified variable to the list of parameters
* for this method signature.
*
* @param type
* JType of the parameter being added
*
* @param name
* Name of the parameter being added
*
* @return New parameter variable
*/
public JVar param(int mods, JType type, String name) {
JVar v = new JVar(JMods.forVar(mods), type, name, null);
params.add(v);
return v;
}
public JVar param(JType type, String name) {
return param(JMod.NONE, type, name);
}
public JVar param(JType type, String name) {
return param(JMod.NONE, type, name);
}
public JVar param(int mods, Class type, String name) {
return param(mods, outer.owner()._ref(type), name);
}
public JVar param(int mods, Class type, String name) {
return param(mods, outer.owner()._ref(type), name);
}
public JVar param(Class type, String name) {
return param(outer.owner()._ref(type), name);
}
public JVar param(Class type, String name) {
return param(outer.owner()._ref(type), name);
}
/**
* @see #varParam(JType, String)
*/
public JVar varParam(Class type, String name) {
/**
* @see #varParam(JType, String)
*/
public JVar varParam(Class type, String name) {
return varParam(outer.owner()._ref(type),name);
}
@ -210,25 +210,25 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
* method signature.
*/
public JVar varParam(JType type, String name) {
if (!hasVarArgs()) {
if (!hasVarArgs()) {
varParam =
new JVar(
JMods.forVar(JMod.NONE),
type.array(),
name,
null);
return varParam;
} else {
throw new IllegalStateException(
"Cannot have two varargs in a method,\n"
+ "Check if varParam method of JMethod is"
+ " invoked more than once");
}
new JVar(
JMods.forVar(JMod.NONE),
type.array(),
name,
null);
return varParam;
} else {
throw new IllegalStateException(
"Cannot have two varargs in a method,\n"
+ "Check if varParam method of JMethod is"
+ " invoked more than once");
}
}
/**
* Adds an annotation to this variable.
* @param clazz
@ -256,92 +256,106 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
return TypedAnnotationWriter.create(clazz,this);
}
/**
* Check if there are any varargs declared
* for this method signature.
*/
public boolean hasVarArgs() {
return this.varParam!=null;
}
/**
* Check if there are any varargs declared
* for this method signature.
*/
public boolean hasVarArgs() {
return this.varParam!=null;
}
public String name() {
return name;
}
public String name() {
return name;
}
/**
* Returns the return type.
*/
public JType type() {
return type;
}
/**
* Changes the name of the method.
*/
public void name(String n) {
this.name = n;
}
/**
* Returns all the parameter types in an array.
* @return
* If there's no parameter, an empty array will be returned.
*/
public JType[] listParamTypes() {
JType[] r = new JType[params.size()];
for (int i = 0; i < r.length; i++)
r[i] = params.get(i).type();
return r;
}
/**
* Returns the return type.
*/
public JType type() {
return type;
}
/**
* Returns the varags parameter type.
* @return
* If there's no vararg parameter type, null will be returned.
*/
public JType listVarParamType() {
if (varParam != null)
return varParam.type();
else
return null;
}
/**
* Overrides the return type.
*/
public void type(JType t) {
this.type = t;
}
/**
* Returns all the parameters in an array.
* @return
* If there's no parameter, an empty array will be returned.
*/
public JVar[] listParams() {
return params.toArray(new JVar[params.size()]);
}
/**
* Returns all the parameter types in an array.
* @return
* If there's no parameter, an empty array will be returned.
*/
public JType[] listParamTypes() {
JType[] r = new JType[params.size()];
for (int i = 0; i < r.length; i++)
r[i] = params.get(i).type();
return r;
}
/**
* Returns the variable parameter
* @return
* If there's no parameter, null will be returned.
*/
public JVar listVarParam() {
return varParam;
}
/**
* Returns the varags parameter type.
* @return
* If there's no vararg parameter type, null will be returned.
*/
public JType listVarParamType() {
if (varParam != null)
return varParam.type();
else
return null;
}
/**
* Returns true if the method has the specified signature.
*/
public boolean hasSignature(JType[] argTypes) {
JVar[] p = listParams();
if (p.length != argTypes.length)
return false;
/**
* Returns all the parameters in an array.
* @return
* If there's no parameter, an empty array will be returned.
*/
public JVar[] listParams() {
return params.toArray(new JVar[params.size()]);
}
for (int i = 0; i < p.length; i++)
if (!p[i].type().equals(argTypes[i]))
return false;
/**
* Returns the variable parameter
* @return
* If there's no parameter, null will be returned.
*/
public JVar listVarParam() {
return varParam;
}
return true;
}
/**
* Returns true if the method has the specified signature.
*/
public boolean hasSignature(JType[] argTypes) {
JVar[] p = listParams();
if (p.length != argTypes.length)
return false;
/**
* Get the block that makes up body of this method
*
* @return Body of method
*/
public JBlock body() {
if (body == null)
body = new JBlock();
return body;
}
for (int i = 0; i < p.length; i++)
if (!p[i].type().equals(argTypes[i]))
return false;
return true;
}
/**
* Get the block that makes up body of this method
*
* @return Body of method
*/
public JBlock body() {
if (body == null)
body = new JBlock();
return body;
}
/**
* Specify the default value for this annotation member
@ -353,37 +367,37 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
this.defaultValue = value;
}
/**
* Creates, if necessary, and returns the class javadoc for this
* JDefinedClass
*
* @return JDocComment containing javadocs for this class
*/
public JDocComment javadoc() {
if (jdoc == null)
jdoc = new JDocComment(owner());
return jdoc;
}
/**
* Creates, if necessary, and returns the class javadoc for this
* JDefinedClass
*
* @return JDocComment containing javadocs for this class
*/
public JDocComment javadoc() {
if (jdoc == null)
jdoc = new JDocComment(owner());
return jdoc;
}
public void declare(JFormatter f) {
if (jdoc != null)
f.g(jdoc);
public void declare(JFormatter f) {
if (jdoc != null)
f.g(jdoc);
if (annotations != null){
for (JAnnotationUse a : annotations)
f.g(a).nl();
}
// declare the generics parameters
super.declare(f);
// declare the generics parameters
super.declare(f);
f.g(mods);
if (!isConstructor())
f.g(type);
f.id(name).p('(').i();
f.g(mods);
if (!isConstructor())
f.g(type);
f.id(name).p('(').i();
// when parameters are printed in new lines, we want them to be indented.
// there's a good chance no newlines happen, too, but just in case it does.
boolean first = true;
boolean first = true;
for (JVar var : params) {
if (!first)
f.p(',');
@ -392,33 +406,33 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
f.b(var);
first = false;
}
if (hasVarArgs()) {
if (!first)
f.p(',');
f.g(varParam.type().elementType());
f.p("... ");
f.id(varParam.name());
}
if (hasVarArgs()) {
if (!first)
f.p(',');
f.g(varParam.type().elementType());
f.p("... ");
f.id(varParam.name());
}
f.o().p(')');
if (_throws!=null && !_throws.isEmpty()) {
f.nl().i().p("throws").g(_throws).nl().o();
}
f.o().p(')');
if (_throws!=null && !_throws.isEmpty()) {
f.nl().i().p("throws").g(_throws).nl().o();
}
if (defaultValue != null) {
f.p("default ");
f.g(defaultValue);
}
if (body != null) {
f.s(body);
} else if (
!outer.isInterface() && !outer.isAnnotationTypeDeclaration() && !mods.isAbstract() && !mods.isNative()) {
// Print an empty body for non-native, non-abstract methods
f.s(new JBlock());
} else {
f.p(';').nl();
}
if (body != null) {
f.s(body);
} else if (
!outer.isInterface() && !outer.isAnnotationTypeDeclaration() && !mods.isAbstract() && !mods.isNative()) {
// Print an empty body for non-native, non-abstract methods
f.s(new JBlock());
} else {
f.p(';').nl();
}
}
/**
* @return
@ -433,10 +447,10 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
* @deprecated use {@link #mods()}
*/
public JMods getMods() {
return mods;
}
return mods;
}
protected JCodeModel owner() {
return outer.owner();
}
protected JCodeModel owner() {
return outer.owner();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -41,17 +41,17 @@ public class JMods implements JGenerable {
= JMod.FINAL;
private static int FIELD
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED
| JMod.STATIC | JMod.FINAL
| JMod.TRANSIENT | JMod.VOLATILE);
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED
| JMod.STATIC | JMod.FINAL
| JMod.TRANSIENT | JMod.VOLATILE);
private static int METHOD
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED | JMod.FINAL
| JMod.ABSTRACT | JMod.STATIC | JMod.NATIVE | JMod.SYNCHRONIZED);
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED | JMod.FINAL
| JMod.ABSTRACT | JMod.STATIC | JMod.NATIVE | JMod.SYNCHRONIZED);
private static int CLASS
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED
| JMod.STATIC | JMod.FINAL | JMod.ABSTRACT );
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED
| JMod.STATIC | JMod.FINAL | JMod.ABSTRACT );
private static int INTERFACE = JMod.PUBLIC;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.Iterator;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.Collections;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.ArrayList;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.Iterator;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.util.Iterator;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.lang.reflect.InvocationHandler;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,3 +1,27 @@
<!--
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.
-->
<HTML>
<BODY>
Various resource file formats (classes that implement <code>JResourceFile</code>).

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* <h1>Library for generating Java source code</h1>.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,6 +22,10 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,6 +22,10 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @(#)$Id: MS1252Encoder.java,v 1.2 2005/09/10 19:07:33 kohsuke Exp $
*/
package com.sun.codemodel.internal.util;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -23,6 +23,10 @@
* have any questions.
*/
/*
* @(#)SingleByteEncoder.java 1.14 03/01/23
*/
package com.sun.codemodel.internal.util;
import java.nio.ByteBuffer;
@ -47,109 +51,109 @@ abstract class SingleByteEncoder
private final Surrogate.Parser sgp = new Surrogate.Parser();
protected SingleByteEncoder(Charset cs,
short[] index1, String index2,
int mask1, int mask2, int shift)
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;
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;
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);
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;
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));
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);
// 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());
}
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;
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));
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);
// 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);
}
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);
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));
return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] +
(inputChar & mask2));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -33,6 +33,7 @@ import java.nio.charset.CoderResult;
* Utility class for dealing with surrogates.
*
* @author Mark Reinhold
* @version 1.11, 03/01/23
*/
class Surrogate {
@ -111,7 +112,7 @@ class Surrogate {
public Parser() { }
private int character; // UCS-4
private int character; // UCS-4
private CoderResult error = CoderResult.UNDERFLOW;
private boolean isPair;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* 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
@ -22,7 +22,6 @@
* 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;

Some files were not shown because too many files have changed in this diff Show More