This commit is contained in:
J. Duke 2017-07-05 20:47:18 +02:00
commit 21ae9718b3
221 changed files with 6685 additions and 2663 deletions

View File

@ -321,3 +321,4 @@ c706ef5ea5da00078dc5e4334660315f7d99c15b jdk9-b71
d82072b699b880a1f647a5e2d7c0f86cec958941 jdk9-b76
7972dc8f2a47f0c4cd8f02fa5662af41f028aa14 jdk9-b77
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79

View File

@ -321,3 +321,4 @@ f9f3706bd24c42c07cb260fe05730a749b8e52f4 jdk9-b72
d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
8bb2441c0fec8b28f7bf11a0ca3ec1642e7ef457 jdk9-b77
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79

View File

@ -481,3 +481,4 @@ fff6b54e9770ac4c12c2fb4cab5aa7672affa4bd jdk9-b74
0bc8d1656d6f2b1fdfe803c1305a108bb9939f35 jdk9-b76
e66c3813789debfc06f206afde1bf7a84cb08451 jdk9-b77
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79

View File

@ -321,3 +321,4 @@ eadcb2b55cd1daf77625813aad0f6f3967b1528a jdk9-b74
36801a89a04201b59874ec776ffe85d6253c9ab5 jdk9-b76
be357705874c4ba1a69c38fb211e5e31e35bf9cb jdk9-b77
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79

View File

@ -1,15 +1,15 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Copyright 2001-2004 The Apache Software Foundation.
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: MultiDOM.java,v 1.5 2005/09/28 13:48:36 pvedula Exp $
*/
package com.sun.org.apache.xalan.internal.xsltc.dom;
@ -35,6 +32,7 @@ import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
import com.sun.org.apache.xml.internal.dtm.DTMManager;
import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase;
import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIterNodeList;
import com.sun.org.apache.xml.internal.utils.SuballocatedIntVector;
import org.w3c.dom.Node;
@ -569,7 +567,7 @@ public final class MultiDOM implements DOM {
public NodeList makeNodeList(DTMAxisIterator iter) {
int index = iter.next();
if (index == DTM.NULL) {
return null;
return new DTMAxisIterNodeList(null, null);
}
iter.reset();
return _adapters[getDTMId(index)].makeNodeList(iter);

View File

@ -321,3 +321,4 @@ f376824d4940f45719d91838f3f6249f873440db jdk9-b72
4526c0da8fb362eebd7e88f4d44e86858cf9b80b jdk9-b76
7fd081100f48828431e7c1bff65c906ee759069b jdk9-b77
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79

View File

@ -31,7 +31,7 @@ include LauncherCommon.gmk
# into another dir and copy selectively so debuginfo for java.dll isn't
# overwritten.
$(eval $(call SetupLauncher,java, \
-DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
-DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
$(JAVA_VERSION_INFO_RESOURCE), $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs,true))
@ -44,7 +44,7 @@ TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX)
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupLauncher,javaw, \
-DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
-DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
$(JAVA_VERSION_INFO_RESOURCE),,true))
endif

View File

@ -330,6 +330,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
-export:JLI_CmdToArgs \
-export:JLI_GetStdArgc \
-export:JLI_GetStdArgs \
-export:JLI_List_new \
-export:JLI_List_add \
-export:JLI_StringDup \
-export:JLI_MemFree \
-export:JLI_InitArgProcessing \
-export:JLI_PreprocessArg \
-export:JLI_GetAppArgIndex \
advapi32.lib \
comctl32.lib \
user32.lib, \

View File

@ -36,6 +36,13 @@ SUNWprivate_1.1 {
JLI_ReportExceptionDescription;
JLI_GetStdArgs;
JLI_GetStdArgc;
JLI_List_new;
JLI_List_add;
JLI_StringDup;
JLI_MemFree;
JLI_InitArgProcessing;
JLI_PreprocessArg;
JLI_GetAppArgIndex;
local:
*;

View File

@ -72,8 +72,9 @@ public class NervousText extends Applet implements Runnable, MouseListener {
public void init() {
banner = getParameter("text");
if (banner == null) {
banner = "HotJava";
banner = "Java Development Kit ";
}
banner += System.getProperty("java.version", "");
int bannerLength = banner.length();
StringBuilder bc = new StringBuilder(bannerLength);

View File

@ -1,7 +1,7 @@
<title>Nervous Text 1.1</title>
<hr>
<applet code="NervousText.class" width=534 height=50>
<param name=text value="Java SE Development Kit (JDK) 7.0">
<param name=text value="Java Development Kit (JDK) ">
</applet>
<hr>
<a href="NervousText.java">The source.</a>

View File

@ -9356,7 +9356,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* <td>{@code FORM FEED}</td></tr>
* <tr><td>{@code '\r'}</td> <td>{@code U+000D}</td>
* <td>{@code CARRIAGE RETURN}</td></tr>
* <tr><td>{@code '&nbsp;'}</td> <td>{@code U+0020}</td>
* <tr><td>{@code ' '}</td> <td>{@code U+0020}</td>
* <td>{@code SPACE}</td></tr>
* </table>
*

View File

@ -93,7 +93,7 @@ import java.util.Objects;
/** Return the simple name of this member.
* For a type, it is the same as {@link Class#getSimpleName}.
* For a method or field, it is the simple name of the member.
* For a constructor, it is always {@code "&lt;init&gt;"}.
* For a constructor, it is always {@code "<init>"}.
*/
public String getName() {
if (name == null) {
@ -727,7 +727,7 @@ import java.util.Objects;
}
/** Create a method or constructor name from the given components:
* Declaring class, name, type, reference kind.
* It will be a constructor if and only if the name is {@code "&lt;init&gt;"}.
* It will be a constructor if and only if the name is {@code "<init>"}.
* The declaring class may be supplied as null if this is to be a bare name and type.
* The last argument is optional, a boolean which requests REF_invokeSpecial.
* The resulting name will in an unresolved state.

View File

@ -155,7 +155,7 @@ interface MethodHandleInfo {
/**
* Returns the name of the cracked method handle's underlying member.
* This is {@code "&lt;init&gt;"} if the underlying member was a constructor,
* This is {@code "<init>"} if the underlying member was a constructor,
* else it is a simple method name or field name.
* @return the simple name of the underlying member
*/

View File

@ -51,7 +51,7 @@ import java.lang.annotation.*;
* If the field is an array type, then both the field value and
* all the components of the field value (if the field value is non-null)
* are indicated to be stable.
* If the field type is an array type with rank {@code N &gt; 1},
* If the field type is an array type with rank {@code N > 1},
* then each component of the field value (if the field value is non-null),
* is regarded as a stable array of rank {@code N-1}.
* <p>

View File

@ -55,20 +55,20 @@ package java.lang.invoke;
* At that point {@code guardWithTest} may ignore {@code T} and return {@code F}.
* <p>
* Here is an example of a switch point in action:
* <blockquote><pre>{@code
MethodHandle MH_strcat = MethodHandles.lookup()
.findVirtual(String.class, "concat", MethodType.methodType(String.class, String.class));
SwitchPoint spt = new SwitchPoint();
assert(!spt.hasBeenInvalidated());
// the following steps may be repeated to re-use the same switch point:
MethodHandle worker1 = MH_strcat;
MethodHandle worker2 = MethodHandles.permuteArguments(MH_strcat, MH_strcat.type(), 1, 0);
MethodHandle worker = spt.guardWithTest(worker1, worker2);
assertEquals("method", (String) worker.invokeExact("met", "hod"));
SwitchPoint.invalidateAll(new SwitchPoint[]{ spt });
assert(spt.hasBeenInvalidated());
assertEquals("hodmet", (String) worker.invokeExact("met", "hod"));
* }</pre></blockquote>
* <pre>{@code
* MethodHandle MH_strcat = MethodHandles.lookup()
* .findVirtual(String.class, "concat", MethodType.methodType(String.class, String.class));
* SwitchPoint spt = new SwitchPoint();
* assert(!spt.hasBeenInvalidated());
* // the following steps may be repeated to re-use the same switch point:
* MethodHandle worker1 = MH_strcat;
* MethodHandle worker2 = MethodHandles.permuteArguments(MH_strcat, MH_strcat.type(), 1, 0);
* MethodHandle worker = spt.guardWithTest(worker1, worker2);
* assertEquals("method", (String) worker.invokeExact("met", "hod"));
* SwitchPoint.invalidateAll(new SwitchPoint[]{ spt });
* assert(spt.hasBeenInvalidated());
* assertEquals("hodmet", (String) worker.invokeExact("met", "hod"));
* }</pre>
* <p style="font-size:smaller;">
* <em>Discussion:</em>
* Switch points are useful without subclassing. They may also be subclassed.
@ -82,31 +82,31 @@ assertEquals("hodmet", (String) worker.invokeExact("met", "hod"));
* <em>Implementation Note:</em>
* A switch point behaves as if implemented on top of {@link MutableCallSite},
* approximately as follows:
* <blockquote><pre>{@code
public class SwitchPoint {
private static final MethodHandle
K_true = MethodHandles.constant(boolean.class, true),
K_false = MethodHandles.constant(boolean.class, false);
private final MutableCallSite mcs;
private final MethodHandle mcsInvoker;
public SwitchPoint() {
this.mcs = new MutableCallSite(K_true);
this.mcsInvoker = mcs.dynamicInvoker();
}
public MethodHandle guardWithTest(
MethodHandle target, MethodHandle fallback) {
// Note: mcsInvoker is of type ()boolean.
// Target and fallback may take any arguments, but must have the same type.
return MethodHandles.guardWithTest(this.mcsInvoker, target, fallback);
}
public static void invalidateAll(SwitchPoint[] spts) {
List&lt;MutableCallSite&gt; mcss = new ArrayList&lt;&gt;();
for (SwitchPoint spt : spts) mcss.add(spt.mcs);
for (MutableCallSite mcs : mcss) mcs.setTarget(K_false);
MutableCallSite.syncAll(mcss.toArray(new MutableCallSite[0]));
}
}
* }</pre></blockquote>
* <pre>{@code
* public class SwitchPoint {
* private static final MethodHandle
* K_true = MethodHandles.constant(boolean.class, true),
* K_false = MethodHandles.constant(boolean.class, false);
* private final MutableCallSite mcs;
* private final MethodHandle mcsInvoker;
* public SwitchPoint() {
* this.mcs = new MutableCallSite(K_true);
* this.mcsInvoker = mcs.dynamicInvoker();
* }
* public MethodHandle guardWithTest(
* MethodHandle target, MethodHandle fallback) {
* // Note: mcsInvoker is of type ()boolean.
* // Target and fallback may take any arguments, but must have the same type.
* return MethodHandles.guardWithTest(this.mcsInvoker, target, fallback);
* }
* public static void invalidateAll(SwitchPoint[] spts) {
* List<MutableCallSite> mcss = new ArrayList<>();
* for (SwitchPoint spt : spts) mcss.add(spt.mcs);
* for (MutableCallSite mcs : mcss) mcs.setTarget(K_false);
* MutableCallSite.syncAll(mcss.toArray(new MutableCallSite[0]));
* }
* }
* }</pre>
* @author Remi Forax, JSR 292 EG
*/
public class SwitchPoint {

View File

@ -160,6 +160,21 @@ public final class Method extends Executable {
return res;
}
/**
* Make a copy of a leaf method.
*/
Method leafCopy() {
if (this.root == null)
throw new IllegalArgumentException("Can only leafCopy a non-root Method");
Method res = new Method(clazz, name, parameterTypes, returnType,
exceptionTypes, modifiers, slot, signature,
annotations, parameterAnnotations, annotationDefault);
res.root = root;
res.methodAccessor = methodAccessor;
return res;
}
/**
* Used by Excecutable for annotation sharing.
*/

View File

@ -139,6 +139,9 @@ class ReflectAccess implements sun.reflect.LangReflectAccess {
public Method copyMethod(Method arg) {
return arg.copy();
}
public Method leafCopyMethod(Method arg) {
return arg.leafCopy();
}
public Field copyField(Field arg) {
return arg.copy();

View File

@ -715,7 +715,7 @@ public interface ChronoLocalDate
* only compares the underlying date and not the chronology.
* This allows dates in different calendar systems to be compared based
* on the time-line position.
* This is equivalent to using {@code date1.toEpochDay() &gt; date2.toEpochDay()}.
* This is equivalent to using {@code date1.toEpochDay() > date2.toEpochDay()}.
* <p>
* This default implementation performs the comparison based on the epoch-day.
*
@ -733,7 +733,7 @@ public interface ChronoLocalDate
* only compares the underlying date and not the chronology.
* This allows dates in different calendar systems to be compared based
* on the time-line position.
* This is equivalent to using {@code date1.toEpochDay() &lt; date2.toEpochDay()}.
* This is equivalent to using {@code date1.toEpochDay() < date2.toEpochDay()}.
* <p>
* This default implementation performs the comparison based on the epoch-day.
*

File diff suppressed because it is too large Load Diff

View File

@ -40,24 +40,24 @@ import sun.security.jca.GetInstance.Instance;
* exchange) protocol.
* <p>
* The keys involved in establishing a shared secret are created by one of the
* key generators (<code>KeyPairGenerator</code> or
* <code>KeyGenerator</code>), a <code>KeyFactory</code>, or as a result from
* key generators ({@code KeyPairGenerator} or
* {@code KeyGenerator}), a {@code KeyFactory}, or as a result from
* an intermediate phase of the key agreement protocol.
*
* <p> For each of the correspondents in the key exchange, <code>doPhase</code>
* <p> For each of the correspondents in the key exchange, {@code doPhase}
* needs to be called. For example, if this key exchange is with one other
* party, <code>doPhase</code> needs to be called once, with the
* <code>lastPhase</code> flag set to <code>true</code>.
* party, {@code doPhase} needs to be called once, with the
* {@code lastPhase} flag set to {@code true}.
* If this key exchange is
* with two other parties, <code>doPhase</code> needs to be called twice,
* the first time setting the <code>lastPhase</code> flag to
* <code>false</code>, and the second time setting it to <code>true</code>.
* with two other parties, {@code doPhase} needs to be called twice,
* the first time setting the {@code lastPhase} flag to
* {@code false}, and the second time setting it to {@code true}.
* There may be any number of parties involved in a key exchange.
*
* <p> Every implementation of the Java platform is required to support the
* following standard <code>KeyAgreement</code> algorithm:
* following standard {@code KeyAgreement} algorithm:
* <ul>
* <li><tt>DiffieHellman</tt></li>
* <li>{@code DiffieHellman}</li>
* </ul>
* This algorithm is described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement">
@ -125,20 +125,20 @@ public class KeyAgreement {
}
/**
* Returns the algorithm name of this <code>KeyAgreement</code> object.
* Returns the algorithm name of this {@code KeyAgreement} object.
*
* <p>This is the same name that was specified in one of the
* <code>getInstance</code> calls that created this
* <code>KeyAgreement</code> object.
* {@code getInstance} calls that created this
* {@code KeyAgreement} object.
*
* @return the algorithm name of this <code>KeyAgreement</code> object.
* @return the algorithm name of this {@code KeyAgreement} object.
*/
public final String getAlgorithm() {
return this.algorithm;
}
/**
* Returns a <code>KeyAgreement</code> object that implements the
* Returns a {@code KeyAgreement} object that implements the
* specified key agreement algorithm.
*
* <p> This method traverses the list of registered security Providers,
@ -157,7 +157,7 @@ public class KeyAgreement {
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @return the new <code>KeyAgreement</code> object.
* @return the new {@code KeyAgreement} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
@ -186,7 +186,7 @@ public class KeyAgreement {
}
/**
* Returns a <code>KeyAgreement</code> object that implements the
* Returns a {@code KeyAgreement} object that implements the
* specified key agreement algorithm.
*
* <p> A new KeyAgreement object encapsulating the
@ -206,7 +206,7 @@ public class KeyAgreement {
*
* @param provider the name of the provider.
*
* @return the new <code>KeyAgreement</code> object.
* @return the new {@code KeyAgreement} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
@ -218,7 +218,7 @@ public class KeyAgreement {
* @exception NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null or empty.
*
* @see java.security.Provider
@ -233,7 +233,7 @@ public class KeyAgreement {
}
/**
* Returns a <code>KeyAgreement</code> object that implements the
* Returns a {@code KeyAgreement} object that implements the
* specified key agreement algorithm.
*
* <p> A new KeyAgreement object encapsulating the
@ -250,7 +250,7 @@ public class KeyAgreement {
*
* @param provider the provider.
*
* @return the new <code>KeyAgreement</code> object.
* @return the new {@code KeyAgreement} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
@ -259,7 +259,7 @@ public class KeyAgreement {
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null.
*
* @see java.security.Provider
@ -408,9 +408,9 @@ public class KeyAgreement {
}
/**
* Returns the provider of this <code>KeyAgreement</code> object.
* Returns the provider of this {@code KeyAgreement} object.
*
* @return the provider of this <code>KeyAgreement</code> object
* @return the provider of this {@code KeyAgreement} object
*/
public final Provider getProvider() {
chooseFirstProvider();
@ -447,10 +447,10 @@ public class KeyAgreement {
* parameters required for this key agreement.
*
* <p> If the key agreement algorithm requires random bytes, it gets them
* from the given source of randomness, <code>random</code>.
* from the given source of randomness, {@code random}.
* However, if the underlying
* algorithm implementation does not require any random bytes,
* <code>random</code> is ignored.
* {@code random} is ignored.
*
* @param key the party's private information. For example, in the case
* of the Diffie-Hellman key agreement, this would be the party's own
@ -570,9 +570,9 @@ public class KeyAgreement {
/**
* Generates the shared secret and returns it in a new buffer.
*
* <p>This method resets this <code>KeyAgreement</code> object, so that it
* <p>This method resets this {@code KeyAgreement} object, so that it
* can be reused for further key agreements. Unless this key agreement is
* reinitialized with one of the <code>init</code> methods, the same
* reinitialized with one of the {@code init} methods, the same
* private information and algorithm parameters will be used for
* subsequent key agreements.
*
@ -588,23 +588,23 @@ public class KeyAgreement {
/**
* Generates the shared secret, and places it into the buffer
* <code>sharedSecret</code>, beginning at <code>offset</code> inclusive.
* {@code sharedSecret}, beginning at {@code offset} inclusive.
*
* <p>If the <code>sharedSecret</code> buffer is too small to hold the
* result, a <code>ShortBufferException</code> is thrown.
* <p>If the {@code sharedSecret} buffer is too small to hold the
* result, a {@code ShortBufferException} is thrown.
* In this case, this call should be repeated with a larger output buffer.
*
* <p>This method resets this <code>KeyAgreement</code> object, so that it
* <p>This method resets this {@code KeyAgreement} object, so that it
* can be reused for further key agreements. Unless this key agreement is
* reinitialized with one of the <code>init</code> methods, the same
* reinitialized with one of the {@code init} methods, the same
* private information and algorithm parameters will be used for
* subsequent key agreements.
*
* @param sharedSecret the buffer for the shared secret
* @param offset the offset in <code>sharedSecret</code> where the
* @param offset the offset in {@code sharedSecret} where the
* shared secret will be stored
*
* @return the number of bytes placed into <code>sharedSecret</code>
* @return the number of bytes placed into {@code sharedSecret}
*
* @exception IllegalStateException if this key agreement has not been
* completed yet
@ -619,12 +619,12 @@ public class KeyAgreement {
}
/**
* Creates the shared secret and returns it as a <code>SecretKey</code>
* Creates the shared secret and returns it as a {@code SecretKey}
* object of the specified algorithm.
*
* <p>This method resets this <code>KeyAgreement</code> object, so that it
* <p>This method resets this {@code KeyAgreement} object, so that it
* can be reused for further key agreements. Unless this key agreement is
* reinitialized with one of the <code>init</code> methods, the same
* reinitialized with one of the {@code init} methods, the same
* private information and algorithm parameters will be used for
* subsequent key agreements.
*

View File

@ -38,7 +38,7 @@ import sun.security.util.Debug;
/**
* This class provides the functionality of a secret (symmetric) key generator.
*
* <p>Key generators are constructed using one of the <code>getInstance</code>
* <p>Key generators are constructed using one of the {@code getInstance}
* class methods of this class.
*
* <p>KeyGenerator objects are reusable, i.e., after a key has been
@ -57,14 +57,14 @@ import sun.security.util.Debug;
* {@link #init(int, java.security.SecureRandom) init}
* method in this KeyGenerator class that takes these two universally
* shared types of arguments. There is also one that takes just a
* <code>keysize</code> argument, and uses the SecureRandom implementation
* {@code keysize} argument, and uses the SecureRandom implementation
* of the highest-priority installed provider as the source of randomness
* (or a system-provided source of randomness if none of the installed
* providers supply a SecureRandom implementation), and one that takes just a
* source of randomness.
*
* <p>Since no other parameters are specified when you call the above
* algorithm-independent <code>init</code> methods, it is up to the
* algorithm-independent {@code init} methods, it is up to the
* provider what to do about the algorithm-specific parameters (if any) to be
* associated with each of the keys.
*
@ -72,8 +72,8 @@ import sun.security.util.Debug;
* <p>For situations where a set of algorithm-specific parameters already
* exists, there are two
* {@link #init(java.security.spec.AlgorithmParameterSpec) init}
* methods that have an <code>AlgorithmParameterSpec</code>
* argument. One also has a <code>SecureRandom</code> argument, while the
* methods that have an {@code AlgorithmParameterSpec}
* argument. One also has a {@code SecureRandom} argument, while the
* other uses the SecureRandom implementation
* of the highest-priority installed provider as the source of randomness
* (or a system-provided source of randomness if none of the installed
@ -81,18 +81,18 @@ import sun.security.util.Debug;
* </ul>
*
* <p>In case the client does not explicitly initialize the KeyGenerator
* (via a call to an <code>init</code> method), each provider must
* (via a call to an {@code init} method), each provider must
* supply (and document) a default initialization.
*
* <p> Every implementation of the Java platform is required to support the
* following standard <code>KeyGenerator</code> algorithms with the keysizes in
* following standard {@code KeyGenerator} algorithms with the keysizes in
* parentheses:
* <ul>
* <li><tt>AES</tt> (128)</li>
* <li><tt>DES</tt> (56)</li>
* <li><tt>DESede</tt> (168)</li>
* <li><tt>HmacSHA1</tt></li>
* <li><tt>HmacSHA256</tt></li>
* <li>{@code AES} (128)</li>
* <li>{@code DES} (56)</li>
* <li>{@code DESede} (168)</li>
* <li>{@code HmacSHA1}</li>
* <li>{@code HmacSHA256}</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyGenerator">
@ -177,20 +177,20 @@ public class KeyGenerator {
}
/**
* Returns the algorithm name of this <code>KeyGenerator</code> object.
* Returns the algorithm name of this {@code KeyGenerator} object.
*
* <p>This is the same name that was specified in one of the
* <code>getInstance</code> calls that created this
* <code>KeyGenerator</code> object.
* {@code getInstance} calls that created this
* {@code KeyGenerator} object.
*
* @return the algorithm name of this <code>KeyGenerator</code> object.
* @return the algorithm name of this {@code KeyGenerator} object.
*/
public final String getAlgorithm() {
return this.algorithm;
}
/**
* Returns a <code>KeyGenerator</code> object that generates secret keys
* Returns a {@code KeyGenerator} object that generates secret keys
* for the specified algorithm.
*
* <p> This method traverses the list of registered security Providers,
@ -208,7 +208,7 @@ public class KeyGenerator {
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @return the new <code>KeyGenerator</code> object.
* @return the new {@code KeyGenerator} object.
*
* @exception NullPointerException if the specified algorithm is null.
*
@ -224,7 +224,7 @@ public class KeyGenerator {
}
/**
* Returns a <code>KeyGenerator</code> object that generates secret keys
* Returns a {@code KeyGenerator} object that generates secret keys
* for the specified algorithm.
*
* <p> A new KeyGenerator object encapsulating the
@ -243,7 +243,7 @@ public class KeyGenerator {
*
* @param provider the name of the provider.
*
* @return the new <code>KeyGenerator</code> object.
* @return the new {@code KeyGenerator} object.
*
* @exception NullPointerException if the specified algorithm is null.
*
@ -254,7 +254,7 @@ public class KeyGenerator {
* @exception NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null or empty.
*
* @see java.security.Provider
@ -269,7 +269,7 @@ public class KeyGenerator {
}
/**
* Returns a <code>KeyGenerator</code> object that generates secret keys
* Returns a {@code KeyGenerator} object that generates secret keys
* for the specified algorithm.
*
* <p> A new KeyGenerator object encapsulating the
@ -285,7 +285,7 @@ public class KeyGenerator {
*
* @param provider the provider.
*
* @return the new <code>KeyGenerator</code> object.
* @return the new {@code KeyGenerator} object.
*
* @exception NullPointerException if the specified algorithm is null.
*
@ -293,7 +293,7 @@ public class KeyGenerator {
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null.
*
* @see java.security.Provider
@ -307,9 +307,9 @@ public class KeyGenerator {
}
/**
* Returns the provider of this <code>KeyGenerator</code> object.
* Returns the provider of this {@code KeyGenerator} object.
*
* @return the provider of this <code>KeyGenerator</code> object
* @return the provider of this {@code KeyGenerator} object
*/
public final Provider getProvider() {
synchronized (lock) {
@ -437,7 +437,7 @@ public class KeyGenerator {
* @param params the key generation parameters
* @param random the source of randomness for this key generator
*
* @exception InvalidAlgorithmParameterException if <code>params</code> is
* @exception InvalidAlgorithmParameterException if {@code params} is
* inappropriate for this key generator
*/
public final void init(AlgorithmParameterSpec params, SecureRandom random)

View File

@ -54,11 +54,11 @@ import sun.security.jca.GetInstance.Instance;
* specified in RFC 2104.
*
* <p> Every implementation of the Java platform is required to support
* the following standard <code>Mac</code> algorithms:
* the following standard {@code Mac} algorithms:
* <ul>
* <li><tt>HmacMD5</tt></li>
* <li><tt>HmacSHA1</tt></li>
* <li><tt>HmacSHA256</tt></li>
* <li>{@code HmacMD5}</li>
* <li>{@code HmacSHA1}</li>
* <li>{@code HmacSHA256}</li>
* </ul>
* These algorithms are described in the
* <a href="{@docRoot}/../technotes/guides/security/StandardNames.html#Mac">
@ -127,20 +127,20 @@ public class Mac implements Cloneable {
}
/**
* Returns the algorithm name of this <code>Mac</code> object.
* Returns the algorithm name of this {@code Mac} object.
*
* <p>This is the same name that was specified in one of the
* <code>getInstance</code> calls that created this
* <code>Mac</code> object.
* {@code getInstance} calls that created this
* {@code Mac} object.
*
* @return the algorithm name of this <code>Mac</code> object.
* @return the algorithm name of this {@code Mac} object.
*/
public final String getAlgorithm() {
return this.algorithm;
}
/**
* Returns a <code>Mac</code> object that implements the
* Returns a {@code Mac} object that implements the
* specified MAC algorithm.
*
* <p> This method traverses the list of registered security Providers,
@ -158,7 +158,7 @@ public class Mac implements Cloneable {
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @return the new <code>Mac</code> object.
* @return the new {@code Mac} object.
*
* @exception NoSuchAlgorithmException if no Provider supports a
* MacSpi implementation for the
@ -183,7 +183,7 @@ public class Mac implements Cloneable {
}
/**
* Returns a <code>Mac</code> object that implements the
* Returns a {@code Mac} object that implements the
* specified MAC algorithm.
*
* <p> A new Mac object encapsulating the
@ -202,7 +202,7 @@ public class Mac implements Cloneable {
*
* @param provider the name of the provider.
*
* @return the new <code>Mac</code> object.
* @return the new {@code Mac} object.
*
* @exception NoSuchAlgorithmException if a MacSpi
* implementation for the specified algorithm is not
@ -211,7 +211,7 @@ public class Mac implements Cloneable {
* @exception NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null or empty.
*
* @see java.security.Provider
@ -224,7 +224,7 @@ public class Mac implements Cloneable {
}
/**
* Returns a <code>Mac</code> object that implements the
* Returns a {@code Mac} object that implements the
* specified MAC algorithm.
*
* <p> A new Mac object encapsulating the
@ -240,13 +240,13 @@ public class Mac implements Cloneable {
*
* @param provider the provider.
*
* @return the new <code>Mac</code> object.
* @return the new {@code Mac} object.
*
* @exception NoSuchAlgorithmException if a MacSpi
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null.
*
* @see java.security.Provider
@ -380,9 +380,9 @@ public class Mac implements Cloneable {
}
/**
* Returns the provider of this <code>Mac</code> object.
* Returns the provider of this {@code Mac} object.
*
* @return the provider of this <code>Mac</code> object.
* @return the provider of this {@code Mac} object.
*/
public final Provider getProvider() {
chooseFirstProvider();
@ -400,7 +400,7 @@ public class Mac implements Cloneable {
}
/**
* Initializes this <code>Mac</code> object with the given key.
* Initializes this {@code Mac} object with the given key.
*
* @param key the key.
*
@ -426,7 +426,7 @@ public class Mac implements Cloneable {
}
/**
* Initializes this <code>Mac</code> object with the given key and
* Initializes this {@code Mac} object with the given key and
* algorithm parameters.
*
* @param key the key.
@ -457,7 +457,7 @@ public class Mac implements Cloneable {
*
* @param input the input byte to be processed.
*
* @exception IllegalStateException if this <code>Mac</code> has not been
* @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void update(byte input) throws IllegalStateException {
@ -473,7 +473,7 @@ public class Mac implements Cloneable {
*
* @param input the array of bytes to be processed.
*
* @exception IllegalStateException if this <code>Mac</code> has not been
* @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void update(byte[] input) throws IllegalStateException {
@ -487,14 +487,14 @@ public class Mac implements Cloneable {
}
/**
* Processes the first <code>len</code> bytes in <code>input</code>,
* starting at <code>offset</code> inclusive.
* Processes the first {@code len} bytes in {@code input},
* starting at {@code offset} inclusive.
*
* @param input the input buffer.
* @param offset the offset in <code>input</code> where the input starts.
* @param offset the offset in {@code input} where the input starts.
* @param len the number of bytes to process.
*
* @exception IllegalStateException if this <code>Mac</code> has not been
* @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void update(byte[] input, int offset, int len)
@ -512,14 +512,14 @@ public class Mac implements Cloneable {
}
/**
* Processes <code>input.remaining()</code> bytes in the ByteBuffer
* <code>input</code>, starting at <code>input.position()</code>.
* Processes {@code input.remaining()} bytes in the ByteBuffer
* {@code input}, starting at {@code input.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
* @param input the ByteBuffer
*
* @exception IllegalStateException if this <code>Mac</code> has not been
* @exception IllegalStateException if this {@code Mac} has not been
* initialized.
* @since 1.5
*/
@ -537,20 +537,20 @@ public class Mac implements Cloneable {
/**
* Finishes the MAC operation.
*
* <p>A call to this method resets this <code>Mac</code> object to the
* <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
* <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
* the same key, if desired, via new calls to <code>update</code> and
* <code>doFinal</code>.
* (In order to reuse this <code>Mac</code> object with a different key,
* it must be reinitialized via a call to <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* the same key, if desired, via new calls to {@code update} and
* {@code doFinal}.
* (In order to reuse this {@code Mac} object with a different key,
* it must be reinitialized via a call to {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
*
* @return the MAC result.
*
* @exception IllegalStateException if this <code>Mac</code> has not been
* @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final byte[] doFinal() throws IllegalStateException {
@ -566,27 +566,27 @@ public class Mac implements Cloneable {
/**
* Finishes the MAC operation.
*
* <p>A call to this method resets this <code>Mac</code> object to the
* <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
* <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
* the same key, if desired, via new calls to <code>update</code> and
* <code>doFinal</code>.
* (In order to reuse this <code>Mac</code> object with a different key,
* it must be reinitialized via a call to <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* the same key, if desired, via new calls to {@code update} and
* {@code doFinal}.
* (In order to reuse this {@code Mac} object with a different key,
* it must be reinitialized via a call to {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
*
* <p>The MAC result is stored in <code>output</code>, starting at
* <code>outOffset</code> inclusive.
* <p>The MAC result is stored in {@code output}, starting at
* {@code outOffset} inclusive.
*
* @param output the buffer where the MAC result is stored
* @param outOffset the offset in <code>output</code> where the MAC is
* @param outOffset the offset in {@code output} where the MAC is
* stored
*
* @exception ShortBufferException if the given output buffer is too small
* to hold the result
* @exception IllegalStateException if this <code>Mac</code> has not been
* @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final void doFinal(byte[] output, int outOffset)
@ -609,21 +609,21 @@ public class Mac implements Cloneable {
/**
* Processes the given array of bytes and finishes the MAC operation.
*
* <p>A call to this method resets this <code>Mac</code> object to the
* <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
* <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
* the same key, if desired, via new calls to <code>update</code> and
* <code>doFinal</code>.
* (In order to reuse this <code>Mac</code> object with a different key,
* it must be reinitialized via a call to <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* the same key, if desired, via new calls to {@code update} and
* {@code doFinal}.
* (In order to reuse this {@code Mac} object with a different key,
* it must be reinitialized via a call to {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
*
* @param input data in bytes
* @return the MAC result.
*
* @exception IllegalStateException if this <code>Mac</code> has not been
* @exception IllegalStateException if this {@code Mac} has not been
* initialized.
*/
public final byte[] doFinal(byte[] input) throws IllegalStateException
@ -637,18 +637,18 @@ public class Mac implements Cloneable {
}
/**
* Resets this <code>Mac</code> object.
* Resets this {@code Mac} object.
*
* <p>A call to this method resets this <code>Mac</code> object to the
* <p>A call to this method resets this {@code Mac} object to the
* state it was in when previously initialized via a call to
* <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
* That is, the object is reset and available to generate another MAC from
* the same key, if desired, via new calls to <code>update</code> and
* <code>doFinal</code>.
* (In order to reuse this <code>Mac</code> object with a different key,
* it must be reinitialized via a call to <code>init(Key)</code> or
* <code>init(Key, AlgorithmParameterSpec)</code>.
* the same key, if desired, via new calls to {@code update} and
* {@code doFinal}.
* (In order to reuse this {@code Mac} object with a different key,
* it must be reinitialized via a call to {@code init(Key)} or
* {@code init(Key, AlgorithmParameterSpec)}.
*/
public final void reset() {
chooseFirstProvider();
@ -661,7 +661,7 @@ public class Mac implements Cloneable {
* @return a clone if the provider implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called on a
* delegate that does not support <code>Cloneable</code>.
* delegate that does not support {@code Cloneable}.
*/
public final Object clone() throws CloneNotSupportedException {
chooseFirstProvider();

View File

@ -38,7 +38,7 @@ import sun.security.jca.GetInstance.Instance;
* This class represents a factory for secret keys.
*
* <P> Key factories are used to convert <I>keys</I> (opaque
* cryptographic keys of type <code>Key</code>) into <I>key specifications</I>
* cryptographic keys of type {@code Key}) into <I>key specifications</I>
* (transparent representations of the underlying key material), and vice
* versa.
* Secret key factories operate only on secret (symmetric) keys.
@ -53,16 +53,16 @@ import sun.security.jca.GetInstance.Instance;
* {@link #getKeySpec(javax.crypto.SecretKey, java.lang.Class) getKeySpec}
* methods.
* For example, the DES secret-key factory supplied by the "SunJCE" provider
* supports <code>DESKeySpec</code> as a transparent representation of DES
* supports {@code DESKeySpec} as a transparent representation of DES
* keys, and that provider's secret-key factory for Triple DES keys supports
* <code>DESedeKeySpec</code> as a transparent representation of Triple DES
* {@code DESedeKeySpec} as a transparent representation of Triple DES
* keys.
*
* <p> Every implementation of the Java platform is required to support the
* following standard <code>SecretKeyFactory</code> algorithms:
* following standard {@code SecretKeyFactory} algorithms:
* <ul>
* <li><tt>DES</tt></li>
* <li><tt>DESede</tt></li>
* <li>{@code DES}</li>
* <li>{@code DESede}</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#SecretKeyFactory">
@ -125,7 +125,7 @@ public class SecretKeyFactory {
}
/**
* Returns a <code>SecretKeyFactory</code> object that converts
* Returns a {@code SecretKeyFactory} object that converts
* secret keys of the specified algorithm.
*
* <p> This method traverses the list of registered security Providers,
@ -144,7 +144,7 @@ public class SecretKeyFactory {
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @return the new <code>SecretKeyFactory</code> object.
* @return the new {@code SecretKeyFactory} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
@ -161,7 +161,7 @@ public class SecretKeyFactory {
}
/**
* Returns a <code>SecretKeyFactory</code> object that converts
* Returns a {@code SecretKeyFactory} object that converts
* secret keys of the specified algorithm.
*
* <p> A new SecretKeyFactory object encapsulating the
@ -181,7 +181,7 @@ public class SecretKeyFactory {
*
* @param provider the name of the provider.
*
* @return the new <code>SecretKeyFactory</code> object.
* @return the new {@code SecretKeyFactory} object.
*
* @exception NoSuchAlgorithmException if a SecretKeyFactorySpi
* implementation for the specified algorithm is not
@ -193,7 +193,7 @@ public class SecretKeyFactory {
* @throws NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null or empty.
*
* @see java.security.Provider
@ -208,7 +208,7 @@ public class SecretKeyFactory {
}
/**
* Returns a <code>SecretKeyFactory</code> object that converts
* Returns a {@code SecretKeyFactory} object that converts
* secret keys of the specified algorithm.
*
* <p> A new SecretKeyFactory object encapsulating the
@ -225,7 +225,7 @@ public class SecretKeyFactory {
*
* @param provider the provider.
*
* @return the new <code>SecretKeyFactory</code> object.
* @return the new {@code SecretKeyFactory} object.
*
* @exception NullPointerException if the specified algorithm
* is null.
@ -234,7 +234,7 @@ public class SecretKeyFactory {
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
* @exception IllegalArgumentException if the <code>provider</code>
* @exception IllegalArgumentException if the {@code provider}
* is null.
*
* @see java.security.Provider
@ -248,9 +248,9 @@ public class SecretKeyFactory {
}
/**
* Returns the provider of this <code>SecretKeyFactory</code> object.
* Returns the provider of this {@code SecretKeyFactory} object.
*
* @return the provider of this <code>SecretKeyFactory</code> object
* @return the provider of this {@code SecretKeyFactory} object
*/
public final Provider getProvider() {
synchronized (lock) {
@ -261,13 +261,13 @@ public class SecretKeyFactory {
}
/**
* Returns the algorithm name of this <code>SecretKeyFactory</code> object.
* Returns the algorithm name of this {@code SecretKeyFactory} object.
*
* <p>This is the same name that was specified in one of the
* <code>getInstance</code> calls that created this
* <code>SecretKeyFactory</code> object.
* {@code getInstance} calls that created this
* {@code SecretKeyFactory} object.
*
* @return the algorithm name of this <code>SecretKeyFactory</code>
* @return the algorithm name of this {@code SecretKeyFactory}
* object.
*/
public final String getAlgorithm() {
@ -314,7 +314,7 @@ public class SecretKeyFactory {
}
/**
* Generates a <code>SecretKey</code> object from the provided key
* Generates a {@code SecretKey} object from the provided key
* specification (key material).
*
* @param keySpec the specification (key material) of the secret key
@ -361,9 +361,9 @@ public class SecretKeyFactory {
*
* @exception InvalidKeySpecException if the requested key specification is
* inappropriate for the given key (e.g., the algorithms associated with
* <code>key</code> and <code>keySpec</code> do not match, or
* <code>key</code> references a key on a cryptographic hardware device
* whereas <code>keySpec</code> is the specification of a software-based
* {@code key} and {@code keySpec} do not match, or
* {@code key} references a key on a cryptographic hardware device
* whereas {@code keySpec} is the specification of a software-based
* key), or the given key cannot be dealt with
* (e.g., the given key has an algorithm or format not supported by this
* secret-key factory).

View File

@ -35,7 +35,7 @@ import java.security.spec.AlgorithmParameterSpec;
* <p> The parameters consist of an effective key size and optionally
* an 8-byte initialization vector (IV) (only in feedback mode).
*
* <p> This class can be used to initialize a <code>Cipher</code> object that
* <p> This class can be used to initialize a {@code Cipher} object that
* implements the <i>RC2</i> algorithm.
*
* @author Jan Luehe
@ -62,12 +62,12 @@ public class RC2ParameterSpec implements AlgorithmParameterSpec {
* (in bits) and an 8-byte IV.
*
* <p> The bytes that constitute the IV are those between
* <code>iv[0]</code> and <code>iv[7]</code> inclusive.
* {@code iv[0]} and {@code iv[7]} inclusive.
*
* @param effectiveKeyBits the effective key size in bits.
* @param iv the buffer with the 8-byte IV. The first 8 bytes of
* the buffer are copied to protect against subsequent modification.
* @exception IllegalArgumentException if <code>iv</code> is null.
* @exception IllegalArgumentException if {@code iv} is null.
*/
public RC2ParameterSpec(int effectiveKeyBits, byte[] iv) {
this(effectiveKeyBits, iv, 0);
@ -77,18 +77,18 @@ public class RC2ParameterSpec implements AlgorithmParameterSpec {
* Constructs a parameter set for RC2 from the given effective key size
* (in bits) and IV.
*
* <p> The IV is taken from <code>iv</code>, starting at
* <code>offset</code> inclusive.
* <p> The IV is taken from {@code iv}, starting at
* {@code offset} inclusive.
* The bytes that constitute the IV are those between
* <code>iv[offset]</code> and <code>iv[offset+7]</code> inclusive.
* {@code iv[offset]} and {@code iv[offset+7]} inclusive.
*
* @param effectiveKeyBits the effective key size in bits.
* @param iv the buffer with the IV. The first 8 bytes
* of the buffer beginning at <code>offset</code> inclusive
* of the buffer beginning at {@code offset} inclusive
* are copied to protect against subsequent modification.
* @param offset the offset in <code>iv</code> where the 8-byte IV
* @param offset the offset in {@code iv} where the 8-byte IV
* starts.
* @exception IllegalArgumentException if <code>iv</code> is null.
* @exception IllegalArgumentException if {@code iv} is null.
*/
public RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset) {
this.effectiveKeyBits = effectiveKeyBits;
@ -124,12 +124,12 @@ public class RC2ParameterSpec implements AlgorithmParameterSpec {
* Tests for equality between the specified object and this
* object. Two RC2ParameterSpec objects are considered equal if their
* effective key sizes and IVs are equal.
* (Two IV references are considered equal if both are <tt>null</tt>.)
* (Two IV references are considered equal if both are {@code null}.)
*
* @param obj the object to test for equality with this object.
*
* @return true if the objects are considered equal, false if
* <code>obj</code> is null or otherwise.
* {@code obj} is null or otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {

View File

@ -35,7 +35,7 @@ import java.security.spec.AlgorithmParameterSpec;
* <p> The parameters consist of a version number, a rounds count, a word
* size, and optionally an initialization vector (IV) (only in feedback mode).
*
* <p> This class can be used to initialize a <code>Cipher</code> object that
* <p> This class can be used to initialize a {@code Cipher} object that
* implements the <i>RC5</i> algorithm as supplied by
* <a href="http://www.rsa.com">RSA Security LLC</a>,
* or any parties authorized by RSA Security.
@ -71,16 +71,16 @@ public class RC5ParameterSpec implements AlgorithmParameterSpec {
*
* <p> Note that the size of the IV (block size) must be twice the word
* size. The bytes that constitute the IV are those between
* <code>iv[0]</code> and <code>iv[2*(wordSize/8)-1]</code> inclusive.
* {@code iv[0]} and {@code iv[2*(wordSize/8)-1]} inclusive.
*
* @param version the version.
* @param rounds the number of rounds.
* @param wordSize the word size in bits.
* @param iv the buffer with the IV. The first <code>2*(wordSize/8)
* </code> bytes of the buffer are copied to protect against subsequent
* @param iv the buffer with the IV. The first {@code 2*(wordSize/8)}
* bytes of the buffer are copied to protect against subsequent
* modification.
* @exception IllegalArgumentException if <code>iv</code> is
* <code>null</code> or {@code (iv.length < 2 * (wordSize / 8))}
* @exception IllegalArgumentException if {@code iv} is
* {@code null} or {@code (iv.length < 2 * (wordSize / 8))}
*/
public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv) {
this(version, rounds, wordSize, iv, 0);
@ -90,23 +90,23 @@ public class RC5ParameterSpec implements AlgorithmParameterSpec {
* Constructs a parameter set for RC5 from the given version, number of
* rounds, word size (in bits), and IV.
*
* <p> The IV is taken from <code>iv</code>, starting at
* <code>offset</code> inclusive.
* <p> The IV is taken from {@code iv}, starting at
* {@code offset} inclusive.
* Note that the size of the IV (block size), starting at
* <code>offset</code> inclusive, must be twice the word size.
* {@code offset} inclusive, must be twice the word size.
* The bytes that constitute the IV are those between
* <code>iv[offset]</code> and <code>iv[offset+2*(wordSize/8)-1]</code>
* {@code iv[offset]} and {@code iv[offset+2*(wordSize/8)-1]}
* inclusive.
*
* @param version the version.
* @param rounds the number of rounds.
* @param wordSize the word size in bits.
* @param iv the buffer with the IV. The first <code>2*(wordSize/8)
* </code> bytes of the buffer beginning at <code>offset</code>
* @param iv the buffer with the IV. The first {@code 2*(wordSize/8)}
* bytes of the buffer beginning at {@code offset}
* inclusive are copied to protect against subsequent modification.
* @param offset the offset in <code>iv</code> where the IV starts.
* @exception IllegalArgumentException if <code>iv</code> is
* <code>null</code> or
* @param offset the offset in {@code iv} where the IV starts.
* @exception IllegalArgumentException if {@code iv} is
* {@code null} or
* {@code (iv.length - offset < 2 * (wordSize / 8))}
*/
public RC5ParameterSpec(int version, int rounds, int wordSize,
@ -164,12 +164,12 @@ public class RC5ParameterSpec implements AlgorithmParameterSpec {
* Tests for equality between the specified object and this
* object. Two RC5ParameterSpec objects are considered equal if their
* version numbers, number of rounds, word sizes, and IVs are equal.
* (Two IV references are considered equal if both are <tt>null</tt>.)
* (Two IV references are considered equal if both are {@code null}.)
*
* @param obj the object to test for equality with this object.
*
* @return true if the objects are considered equal, false if
* <code>obj</code> is null or otherwise.
* {@code obj} is null or otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {

View File

@ -295,7 +295,7 @@ public class BytecodeName {
* (The safe name might possibly be mangled to hide further dangerous characters.)
* For example, the qualified class name {@code java/lang/String}
* will be parsed into the array {@code {"java", '/', "lang", '/', "String"}}.
* The name {@code &lt;init&gt;} will be parsed into { '&lt;', "init", '&gt;'}}
* The name {@code <init>} will be parsed into {@code {'<', "init", '>'}}.
* The name {@code foo/bar$:baz} will be parsed into
* {@code {"foo", '/', "bar", '$', ':', "baz"}}.
* The name {@code ::\=:foo:\=bar\!baz} will be parsed into

View File

@ -24,8 +24,8 @@
#
# Translators please note do not translate the options themselves
java.launcher.opt.header = Usage: {0} [-options] class [args...]\n\
\ (to execute a class)\n or {0} [-options] -jar jarfile [args...]\n\
java.launcher.opt.header = Usage: {0} [options] class [args...]\n\
\ (to execute a class)\n or {0} [options] -jar jarfile [args...]\n\
\ (to execute a jar file)\n\
where options include:\n
@ -68,6 +68,8 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
\ load Java programming language agent, see java.lang.instrument\n\
\ -splash:<imagepath>\n\
\ show splash screen with specified image\n\
\ @<filepath> read options from the specified file\n\
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
# Translators please note do not translate the options themselves
@ -102,7 +104,8 @@ java.launcher.X.usage=\
\ -XshowSettings:properties\n\
\ show all property settings and continue\n\
\ -XshowSettings:locale\n\
\ show all locale related settings and continue\n\n\
\ show all locale related settings and continue\n\
\ -Xdisable-@files disable further argument file expansion\n\n\
The -X options are non-standard and subject to change without notice.\n
# Translators please note do not translate the options themselves

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. 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
@ -44,6 +44,7 @@ public class IPAddressUtil {
long tmpValue = 0;
int currByte = 0;
boolean newOctet = true;
int len = src.length();
if (len == 0 || len > 15) {
@ -77,11 +78,12 @@ public class IPAddressUtil {
for (int i = 0; i < len; i++) {
char c = src.charAt(i);
if (c == '.') {
if (tmpValue < 0 || tmpValue > 0xff || currByte == 3) {
if (newOctet || tmpValue < 0 || tmpValue > 0xff || currByte == 3) {
return null;
}
res[currByte++] = (byte) (tmpValue & 0xff);
tmpValue = 0;
newOctet = true;
} else {
int digit = Character.digit(c, 10);
if (digit < 0) {
@ -89,9 +91,10 @@ public class IPAddressUtil {
}
tmpValue *= 10;
tmpValue += digit;
newOctet = false;
}
}
if (tmpValue < 0 || tmpValue >= (1L << ((4 - currByte) * 8))) {
if (newOctet || tmpValue < 0 || tmpValue >= (1L << ((4 - currByte) * 8))) {
return null;
}
switch (currByte) {

View File

@ -104,6 +104,9 @@ public interface LangReflectAccess {
/** Makes a "child" copy of a Method */
public Method copyMethod(Method arg);
/** Makes a copy of this non-root a Method */
public Method leafCopyMethod(Method arg);
/** Makes a "child" copy of a Field */
public Field copyField(Field arg);

View File

@ -302,6 +302,14 @@ public class ReflectionFactory {
return langReflectAccess().copyMethod(arg);
}
/** Makes a copy of the passed method. The returned method is NOT
* a "child" but a "sibling" of the Method in arg. Should only be
* used on non-root methods. */
public Method leafCopyMethod(Method arg) {
return langReflectAccess().leafCopyMethod(arg);
}
/** Makes a copy of the passed field. The returned field is a
"child" of the passed one; see the comments in Field.java for
details. */

View File

@ -27,14 +27,17 @@ package sun.reflect.annotation;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import sun.misc.JavaLangAccess;
import sun.reflect.LangReflectAccess;
import sun.reflect.ReflectionFactory;
public final class AnnotationSupport {
private static final JavaLangAccess LANG_ACCESS = sun.misc.SharedSecrets.getJavaLangAccess();
@ -62,7 +65,7 @@ public final class AnnotationSupport {
public static <A extends Annotation> A[] getDirectlyAndIndirectlyPresent(
Map<Class<? extends Annotation>, Annotation> annotations,
Class<A> annoClass) {
List<A> result = new ArrayList<A>();
List<A> result = new ArrayList<>();
@SuppressWarnings("unchecked")
A direct = (A) annotations.get(annoClass);
@ -188,27 +191,68 @@ public final class AnnotationSupport {
AnnotationType annoType = AnnotationType.getInstance(containerClass);
if (annoType == null)
throw invalidContainerException(container, null);
Method m = annoType.members().get("value");
if (m == null)
throw invalidContainerException(container, null);
m.setAccessible(true);
if (Proxy.isProxyClass(container.getClass())) {
// Invoke by invocation handler
InvocationHandler handler = Proxy.getInvocationHandler(container);
// This will erase to (Annotation[]) but we do a runtime cast on the
// return-value in the method that call this method.
@SuppressWarnings("unchecked")
A[] values = (A[]) m.invoke(container);
try {
// This will erase to (Annotation[]) but we do a runtime cast on the
// return-value in the method that call this method.
@SuppressWarnings("unchecked")
A[] values = (A[]) handler.invoke(container, m, null);
return values;
} catch (Throwable t) { // from InvocationHandler::invoke
throw invalidContainerException(container, t);
}
} else {
// In theory there might be instances of Annotations that are not
// implemented using Proxies. Try to invoke the "value" element with
// reflection.
return values;
// Declaring class should be an annotation type
Class<?> iface = m.getDeclaringClass();
if (!iface.isAnnotation())
throw new UnsupportedOperationException("Unsupported container annotation type.");
// Method must be public
if (!Modifier.isPublic(m.getModifiers()))
throw new UnsupportedOperationException("Unsupported value member.");
// Interface might not be public though
final Method toInvoke;
if (!Modifier.isPublic(iface.getModifiers())) {
if (System.getSecurityManager() != null) {
toInvoke = AccessController.doPrivileged(new PrivilegedAction<Method>() {
@Override
public Method run() {
Method res = ReflectionFactory.getReflectionFactory().leafCopyMethod(m);
res.setAccessible(true);
return res;
}
});
} else {
toInvoke = ReflectionFactory.getReflectionFactory().leafCopyMethod(m);
toInvoke.setAccessible(true);
}
} else {
toInvoke = m;
}
// This will erase to (Annotation[]) but we do a runtime cast on the
// return-value in the method that call this method.
@SuppressWarnings("unchecked")
A[] values = (A[]) toInvoke.invoke(container);
return values;
}
} catch (IllegalAccessException | // couldn't loosen security
IllegalArgumentException | // parameters doesn't match
InvocationTargetException | // the value method threw an exception
ClassCastException e) {
throw invalidContainerException(container, e);
}
}

View File

@ -46,9 +46,9 @@ import sun.security.x509.X500Name;
/**
* PKCS7 as defined in RSA Laboratories PKCS7 Technical Note. Profile
* Supports only <tt>SignedData</tt> ContentInfo
* Supports only {@code SignedData} ContentInfo
* type, where to the type of data signed is plain Data.
* For signedData, <tt>crls</tt>, <tt>attributes</tt> and
* For signedData, {@code crls}, {@code attributes} and
* PKCS#6 Extended Certificates are not supported.
*
* @author Benjamin Renaud

View File

@ -180,7 +180,7 @@ public class SignerInfo implements DerEncoder {
/**
* DER encode this object onto an output stream.
* Implements the <code>DerEncoder</code> interface.
* Implements the {@code DerEncoder} interface.
*
* @param out
* the output stream on which to write the DER encoding.
@ -454,7 +454,7 @@ public class SignerInfo implements DerEncoder {
* Extracts a timestamp from a PKCS7 SignerInfo.
*
* Examines the signer's unsigned attributes for a
* <tt>signatureTimestampToken</tt> attribute. If present,
* {@code signatureTimestampToken} attribute. If present,
* then it is parsed to extract the date and time at which the
* timestamp was generated.
*

View File

@ -98,7 +98,7 @@ public class PKCS10Attributes implements DerEncoder {
/**
* Encode the attributes in DER form to the stream.
* Implements the <code>DerEncoder</code> interface.
* Implements the {@code DerEncoder} interface.
*
* @param out the OutputStream to marshal the contents to.
* @exception IOException on encoding errors.
@ -157,8 +157,8 @@ public class PKCS10Attributes implements DerEncoder {
/**
* Compares this PKCS10Attributes for equality with the specified
* object. If the <code>other</code> object is an
* <code>instanceof</code> <code>PKCS10Attributes</code>, then
* object. If the {@code other} object is an
* {@code instanceof PKCS10Attributes}, then
* all the entries are compared with the entries from this.
*
* @param other the object to test for equality with this PKCS10Attributes.
@ -205,10 +205,10 @@ public class PKCS10Attributes implements DerEncoder {
}
/**
* Returns a string representation of this <tt>PKCS10Attributes</tt> object
* Returns a string representation of this {@code PKCS10Attributes} object
* in the form of a set of entries, enclosed in braces and separated
* by the ASCII characters "<tt>,&nbsp;</tt>" (comma and space).
* <p>Overrides the <tt>toString</tt> method of <tt>Object</tt>.
* by the ASCII characters "<code>,&nbsp;</code>" (comma and space).
* <p>Overrides the {@code toString} method of {@code Object}.
*
* @return a string representation of this PKCS10Attributes.
*/

View File

@ -238,8 +238,8 @@ public class CRLExtensions {
/**
* Compares this CRLExtensions for equality with the specified
* object. If the <code>other</code> object is an
* <code>instanceof</code> <code>CRLExtensions</code>, then
* object. If the {@code other} object is an
* {@code instanceof} {@code CRLExtensions}, then
* all the entries are compared with the entries from this.
*
* @param other the object to test for equality with this CRLExtensions.
@ -286,10 +286,10 @@ public class CRLExtensions {
}
/**
* Returns a string representation of this <tt>CRLExtensions</tt> object
* Returns a string representation of this {@code CRLExtensions} object
* in the form of a set of entries, enclosed in braces and separated
* by the ASCII characters "<tt>,&nbsp;</tt>" (comma and space).
* <p>Overrides to <tt>toString</tt> method of <tt>Object</tt>.
* by the ASCII characters "<code>,&nbsp;</code>" (comma and space).
* <p>Overrides to {@code toString} method of {@code Object}.
*
* @return a string representation of this CRLExtensions.
*/

View File

@ -289,8 +289,8 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
/**
* Compares this CertificateExtensions for equality with the specified
* object. If the <code>other</code> object is an
* <code>instanceof</code> <code>CertificateExtensions</code>, then
* object. If the {@code other} object is an
* {@code instanceof} {@code CertificateExtensions}, then
* all the entries are compared with the entries from this.
*
* @param other the object to test for equality with this
@ -339,10 +339,10 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
}
/**
* Returns a string representation of this <tt>CertificateExtensions</tt>
* Returns a string representation of this {@code CertificateExtensions}
* object in the form of a set of entries, enclosed in braces and separated
* by the ASCII characters "<tt>,&nbsp;</tt>" (comma and space).
* <p>Overrides to <tt>toString</tt> method of <tt>Object</tt>.
* by the ASCII characters "<code>,&nbsp;</code>" (comma and space).
* <p>Overrides to {@code toString} method of {@code Object}.
*
* @return a string representation of this CertificateExtensions.
*/

View File

@ -246,6 +246,10 @@ package.access=sun.,\
jdk.nashorn.tools.,\
jdk.tools.jimage.,\
com.sun.activation.registries.,\
com.sun.java.accessibility.util.internal.,\
#ifdef windows
com.sun.java.accessibility.internal.,\
#endif
#ifdef macosx
apple.,\
#endif
@ -297,6 +301,10 @@ package.definition=sun.,\
jdk.nashorn.tools.,\
jdk.tools.jimage.,\
com.sun.activation.registries.,\
com.sun.java.accessibility.util.internal.,\
#ifdef windows
com.sun.java.accessibility.internal.,\
#endif
#ifdef macosx
apple.,\
#endif

View File

@ -89,4 +89,9 @@ static const jint const_ergo_class = ALWAYS_SERVER_CLASS;
static const jint const_ergo_class = DEFAULT_POLICY;
#endif /* NEVER_ACT_AS_SERVER_CLASS_MACHINE */
#ifdef ENABLE_ARG_FILES
static const jboolean const_disable_argfile = JNI_FALSE;
#else
static const jboolean const_disable_argfile = JNI_TRUE;
#endif
#endif /*_DEFINES_H */

View File

@ -31,6 +31,7 @@
*/
#include "defines.h"
#include "jli_util.h"
#ifdef _MSC_VER
#if _MSC_VER > 1400 && _MSC_VER < 1600
@ -96,6 +97,9 @@ main(int argc, char **argv)
char** margv;
const jboolean const_javaw = JNI_FALSE;
#endif /* JAVAW */
JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile);
#ifdef _WIN32
{
int i = 0;
@ -119,8 +123,30 @@ main(int argc, char **argv)
margv[i] = NULL;
}
#else /* *NIXES */
margc = argc;
margv = argv;
{
// accommodate the NULL at the end
JLI_List args = JLI_List_new(argc + 1);
int i = 0;
for (i = 0; i < argc; i++) {
JLI_List argsInFile = JLI_PreprocessArg(argv[i]);
if (NULL == argsInFile) {
JLI_List_add(args, JLI_StringDup(argv[i]));
} else {
int cnt, idx;
cnt = argsInFile->size;
for (idx = 0; idx < cnt; idx++) {
JLI_List_add(args, argsInFile->elements[idx]);
}
// Shallow free, we reuse the string to avoid copy
JLI_MemFree(argsInFile->elements);
JLI_MemFree(argsInFile);
}
}
margc = args->size;
// add the NULL pointer at argv[argc]
JLI_List_add(args, NULL);
margv = args->elements;
}
#endif /* WIN32 */
return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs,

View File

@ -0,0 +1,532 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <stdio.h>
#include <assert.h>
#include <sys/stat.h>
#ifdef DEBUG_ARGFILE
#ifndef NO_JNI
#define NO_JNI
#endif
#define JLI_ReportMessage(p1, p2) printf((p1), (p2))
#else
#include "java.h"
#endif
#include "jli_util.h"
#include "emessages.h"
#define MAX_ARGF_SIZE 0x7fffffffL
static char* clone_substring(const char *begin, size_t len) {
char *rv = (char *) JLI_MemAlloc(len + 1);
memcpy(rv, begin, len);
rv[len] = '\0';
return rv;
}
enum STATE {
FIND_NEXT,
IN_COMMENT,
IN_QUOTE,
IN_ESCAPE,
SKIP_LEAD_WS,
IN_TOKEN
};
typedef struct {
enum STATE state;
const char* cptr;
const char* eob;
char quote_char;
JLI_List parts;
} __ctx_args;
#define NOT_FOUND -1
static int firstAppArgIndex = NOT_FOUND;
static jboolean expectingNoDashArg = JNI_FALSE;
static size_t argsCount = 0;
static jboolean stopExpansion = JNI_FALSE;
void JLI_InitArgProcessing(jboolean isJava, jboolean disableArgFile) {
// No expansion for relaunch
if (argsCount != 0) {
stopExpansion = JNI_TRUE;
argsCount = 0;
} else {
stopExpansion = disableArgFile;
}
expectingNoDashArg = JNI_FALSE;
// for tools, this value remains 0 all the time.
firstAppArgIndex = isJava ? NOT_FOUND : 0;
}
int JLI_GetAppArgIndex() {
// Will be 0 for tools
return firstAppArgIndex;
}
static void checkArg(const char *arg) {
size_t idx = 0;
argsCount++;
if (argsCount == 1) {
// ignore first argument, the application name
return;
}
// All arguments arrive here must be a launcher argument,
// ie. by now, all argfile expansions must have been performed.
if (*arg++ == '-') {
expectingNoDashArg = JNI_FALSE;
if (JLI_StrCmp(arg, "cp") == 0 ||
JLI_StrCmp(arg, "classpath") == 0) {
expectingNoDashArg = JNI_TRUE;
} else if (JLI_StrCmp(arg, "jar") == 0) {
// This is tricky, we do expect NoDashArg
// But that is considered main class to stop expansion
expectingNoDashArg = JNI_FALSE;
// We can not just update the idx here because if -jar @file
// still need expansion of @file to get the argument for -jar
} else if (JLI_StrCmp(arg, "Xdisable-@files") == 0) {
stopExpansion = JNI_TRUE;
}
} else {
if (!expectingNoDashArg) {
// this is main class, argsCount is index to next arg
idx = argsCount;
}
expectingNoDashArg = JNI_FALSE;
}
// only update on java mode and not yet found main class
if (firstAppArgIndex == -1 && idx != 0) {
firstAppArgIndex = (int) idx;
}
}
/*
[\n\r] +------------+ +------------+ [\n\r]
+---------+ IN_COMMENT +<------+ | IN_ESCAPE +---------+
| +------------+ | +------------+ |
| [#] ^ |[#] ^ | |
| +----------+ | [\\]| |[^\n\r] |
v | | | v |
+------------+ [^ \t\n\r\f] +------------+['"]> +------------+ |
| FIND_NEXT +-------------->+ IN_TOKEN +-----------+ IN_QUOTE + |
+------------+ +------------+ <[quote]+------------+ |
| ^ | | ^ ^ |
| | [ \t\n\r\f]| [\n\r]| | |[^ \t\n\r\f]v
| +--------------------------+-----------------------+ | +--------------+
| ['"] | | SKIP_LEAD_WS |
+---------------------------------------------------------+ +--------------+
*/
static char* nextToken(__ctx_args *pctx) {
const char* nextc = pctx->cptr;
const char* const eob = pctx->eob;
const char* anchor = nextc;
char *token;
for (; nextc < eob; nextc++) {
register char ch = *nextc;
// Skip white space characters
if (pctx->state == FIND_NEXT || pctx->state == SKIP_LEAD_WS) {
while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f') {
nextc++;
if (nextc >= eob) {
return NULL;
}
ch = *nextc;
}
pctx->state = (pctx->state == FIND_NEXT) ? IN_TOKEN : IN_QUOTE;
anchor = nextc;
// Deal with escape sequences
} else if (pctx->state == IN_ESCAPE) {
// concatenation directive
if (ch == '\n' || ch == '\r') {
pctx->state = SKIP_LEAD_WS;
} else {
// escaped character
char* escaped = (char*) JLI_MemAlloc(2 * sizeof(char));
escaped[1] = '\0';
switch (ch) {
case 'n':
escaped[0] = '\n';
break;
case 'r':
escaped[0] = '\r';
break;
case 't':
escaped[0] = '\t';
break;
case 'f':
escaped[0] = '\f';
break;
default:
escaped[0] = ch;
break;
}
JLI_List_add(pctx->parts, escaped);
pctx->state = IN_QUOTE;
}
// anchor to next character
anchor = nextc + 1;
continue;
// ignore comment to EOL
} else if (pctx->state == IN_COMMENT) {
while (ch != '\n' && ch != '\r') {
nextc++;
if (nextc > eob) {
return NULL;
}
ch = *nextc;
}
pctx->state = FIND_NEXT;
continue;
}
assert(pctx->state != IN_ESCAPE);
assert(pctx->state != FIND_NEXT);
assert(pctx->state != SKIP_LEAD_WS);
assert(pctx->state != IN_COMMENT);
switch(ch) {
case ' ':
case '\t':
case '\f':
if (pctx->state == IN_QUOTE) {
continue;
}
// fall through
case '\n':
case '\r':
if (pctx->parts->size == 0) {
token = clone_substring(anchor, nextc - anchor);
} else {
JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
token = JLI_List_combine(pctx->parts);
JLI_List_free(pctx->parts);
pctx->parts = JLI_List_new(4);
}
pctx->cptr = nextc + 1;
pctx->state = FIND_NEXT;
return token;
case '#':
if (pctx->state == IN_QUOTE) {
continue;
}
pctx->state = IN_COMMENT;
break;
case '\\':
if (pctx->state != IN_QUOTE) {
continue;
}
JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
pctx->state = IN_ESCAPE;
break;
case '\'':
case '"':
if (pctx->state == IN_QUOTE && pctx->quote_char != ch) {
// not matching quote
continue;
}
// partial before quote
if (anchor != nextc) {
JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
}
// anchor after quote character
anchor = nextc + 1;
if (pctx->state == IN_TOKEN) {
pctx->quote_char = ch;
pctx->state = IN_QUOTE;
} else {
pctx->state = IN_TOKEN;
}
break;
default:
break;
}
}
assert(nextc == eob);
if (anchor != nextc) {
// not yet return until end of stream, we have part of a token.
JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
}
return NULL;
}
static JLI_List readArgFile(FILE *file) {
char buf[4096];
JLI_List rv;
__ctx_args ctx;
size_t size;
char *token;
ctx.state = FIND_NEXT;
ctx.parts = JLI_List_new(4);
/* arbitrarily pick 8, seems to be a reasonable number of arguments */
rv = JLI_List_new(8);
while (!feof(file)) {
size = fread(buf, sizeof(char), sizeof(buf), file);
if (ferror(file)) {
JLI_List_free(rv);
return NULL;
}
/* nextc is next character to read from the buffer
* eob is the end of input
* token is the copied token value, NULL if no a complete token
*/
ctx.cptr = buf;
ctx.eob = buf + size;
token = nextToken(&ctx);
while (token != NULL) {
checkArg(token);
JLI_List_add(rv, token);
token = nextToken(&ctx);
}
}
// remaining partial token
if (ctx.state == IN_TOKEN || ctx.state == IN_QUOTE) {
if (ctx.parts->size != 0) {
JLI_List_add(rv, JLI_List_combine(ctx.parts));
}
}
JLI_List_free(ctx.parts);
return rv;
}
/*
* if the arg represent a file, that is, prefix with a single '@',
* return a list of arguments from the file.
* otherwise, return NULL.
*/
static JLI_List expandArgFile(const char *arg) {
FILE *fptr;
struct stat st;
JLI_List rv;
/* failed to access the file */
if (stat(arg, &st) != 0) {
JLI_ReportMessage(CFG_ERROR6, arg);
exit(1);
}
if (st.st_size > MAX_ARGF_SIZE) {
JLI_ReportMessage(CFG_ERROR10, MAX_ARGF_SIZE);
exit(1);
}
fptr = fopen(arg, "r");
/* arg file cannot be openned */
if (fptr == NULL) {
JLI_ReportMessage(CFG_ERROR6, arg);
exit(1);
}
rv = readArgFile(fptr);
fclose(fptr);
/* error occurred reading the file */
if (rv == NULL) {
JLI_ReportMessage(DLL_ERROR4, arg);
exit(1);
}
return rv;
}
JLI_List JLI_PreprocessArg(const char *arg)
{
JLI_List rv;
if (firstAppArgIndex > 0) {
// In user application arg, no more work.
return NULL;
}
if (stopExpansion) {
// still looking for user application arg
checkArg(arg);
return NULL;
}
if (arg[0] != '@') {
checkArg(arg);
return NULL;
}
if (arg[1] == '\0') {
// @ by itself is an argument
checkArg(arg);
return NULL;
}
arg++;
if (arg[0] == '@') {
// escaped @argument
rv = JLI_List_new(1);
checkArg(arg);
JLI_List_add(rv, JLI_StringDup(arg));
} else {
rv = expandArgFile(arg);
}
return rv;
}
#ifdef DEBUG_ARGFILE
/*
* Stand-alone sanity test, build with following command line
* $ CC -DDEBUG_ARGFILE -DNO_JNI -g args.c jli_util.c
*/
void fail(char *expected, char *actual, size_t idx) {
printf("FAILED: Token[%lu] expected to be <%s>, got <%s>\n", idx, expected, actual);
exit(1);
}
void test_case(char *case_data, char **tokens, size_t cnt_tokens) {
size_t actual_cnt;
char *token;
__ctx_args ctx;
actual_cnt = 0;
ctx.state = FIND_NEXT;
ctx.parts = JLI_List_new(4);
ctx.cptr = case_data;
ctx.eob = case_data + strlen(case_data);
printf("Test case: <%s>, expected %lu tokens.\n", case_data, cnt_tokens);
for (token = nextToken(&ctx); token != NULL; token = nextToken(&ctx)) {
// should not have more tokens than expected
if (actual_cnt >= cnt_tokens) {
printf("FAILED: Extra token detected: <%s>\n", token);
exit(2);
}
if (JLI_StrCmp(token, tokens[actual_cnt]) != 0) {
fail(tokens[actual_cnt], token, actual_cnt);
}
actual_cnt++;
}
char* last = NULL;
if (ctx.parts->size != 0) {
last = JLI_List_combine(ctx.parts);
}
JLI_List_free(ctx.parts);
if (actual_cnt >= cnt_tokens) {
// same number of tokens, should have nothing left to parse
if (last != NULL) {
if (*last != '#') {
printf("Leftover detected: %s", last);
exit(2);
}
}
} else {
if (JLI_StrCmp(last, tokens[actual_cnt]) != 0) {
fail(tokens[actual_cnt], last, actual_cnt);
}
actual_cnt++;
}
if (actual_cnt != cnt_tokens) {
printf("FAILED: Number of tokens not match, expected %lu, got %lu\n",
cnt_tokens, actual_cnt);
exit(3);
}
printf("PASS\n");
}
#define DO_CASE(name) \
test_case(name[0], name + 1, sizeof(name)/sizeof(char*) - 1)
int main(int argc, char** argv) {
size_t i, j;
char* case1[] = { "-version -cp \"c:\\\\java libs\\\\one.jar\" \n",
"-version", "-cp", "c:\\java libs\\one.jar" };
DO_CASE(case1);
// note the open quote at the end
char* case2[] = { "com.foo.Panda \"Furious 5\"\fand\t'Shi Fu' \"escape\tprison",
"com.foo.Panda", "Furious 5", "and", "Shi Fu", "escape\tprison"};
DO_CASE(case2);
char* escaped_chars[] = { "escaped chars testing \"\\a\\b\\c\\f\\n\\r\\t\\v\\9\\6\\23\\82\\28\\377\\477\\278\\287\"",
"escaped", "chars", "testing", "abc\f\n\r\tv96238228377477278287"};
DO_CASE(escaped_chars);
char* mixed_quote[] = { "\"mix 'single quote' in double\" 'mix \"double quote\" in single' partial\"quote me\"this",
"mix 'single quote' in double", "mix \"double quote\" in single", "partialquote methis"};
DO_CASE(mixed_quote);
char* comments[] = { "line one #comment\n'line #2' #rest are comment\r\n#comment on line 3\nline 4 #comment to eof",
"line", "one", "line #2", "line", "4"};
DO_CASE(comments);
char* open_quote[] = { "This is an \"open quote \n across line\n\t, note for WS.",
"This", "is", "an", "open quote ", "across", "line", ",", "note", "for", "WS." };
DO_CASE(open_quote);
char* escape_in_open_quote[] = { "Try \"this \\\\\\\\ escape\\n double quote \\\" in open quote",
"Try", "this \\\\ escape\n double quote \" in open quote" };
DO_CASE(escape_in_open_quote);
char* quote[] = { "'-Dmy.quote.single'='Property in single quote. Here a double quote\" Add some slashes \\\\/'",
"-Dmy.quote.single=Property in single quote. Here a double quote\" Add some slashes \\/" };
DO_CASE(quote);
char* multi[] = { "\"Open quote to \n new \"line \\\n\r third\\\n\r\\\tand\ffourth\"",
"Open quote to ", "new", "line third\tand\ffourth" };
DO_CASE(multi);
char* escape_quote[] = { "c:\\\"partial quote\"\\lib",
"c:\\partial quote\\lib" };
DO_CASE(escape_quote);
if (argc > 1) {
for (i = 0; i < argc; i++) {
JLI_List tokens = JLI_PreprocessArg(argv[i]);
if (NULL != tokens) {
for (j = 0; j < tokens->size; j++) {
printf("Token[%lu]: <%s>\n", (unsigned long) j, tokens->elements[j]);
}
}
}
}
}
#endif // DEBUG_ARGFILE

View File

@ -71,6 +71,7 @@
#define CFG_ERROR7 "Error: no known VMs. (check for corrupt jvm.cfg file)"
#define CFG_ERROR8 "Error: missing `%s' JVM at `%s'.\nPlease install or use the JRE or JDK that contains these missing components."
#define CFG_ERROR9 "Error: could not determine JVM type."
#define CFG_ERROR10 "Error: Argument file size should not be larger than %lu."
#define JRE_ERROR1 "Error: Could not find Java SE Runtime Environment."
#define JRE_ERROR2 "Error: This Java instance does not support a %d-bit JVM.\nPlease install the desired version."

View File

@ -1963,6 +1963,7 @@ DumpState()
{
if (!JLI_IsTraceLauncher()) return ;
printf("Launcher state:\n");
printf("\tFirst application arg index: %d\n", JLI_GetAppArgIndex());
printf("\tdebug:%s\n", (JLI_IsTraceLauncher() == JNI_TRUE) ? "on" : "off");
printf("\tjavargs:%s\n", (_is_java_args == JNI_TRUE) ? "on" : "off");
printf("\tprogram name:%s\n", GetProgramName());

View File

@ -25,8 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <jni.h>
#include <stdarg.h>
#include "jli_util.h"
/*
@ -97,6 +96,7 @@ JLI_TraceLauncher(const char* fmt, ...)
va_start(vl, fmt);
vprintf(fmt,vl);
va_end(vl);
fflush(stdout);
}
void
@ -119,3 +119,122 @@ JLI_StrCCmp(const char *s1, const char* s2)
{
return JLI_StrNCmp(s1, s2, JLI_StrLen(s2));
}
JLI_List
JLI_List_new(size_t capacity)
{
JLI_List l = (JLI_List) JLI_MemAlloc(sizeof(struct JLI_List_));
l->capacity = capacity;
l->elements = (char **) JLI_MemAlloc(capacity * sizeof(l->elements[0]));
l->size = 0;
return l;
}
void
JLI_List_free(JLI_List sl)
{
if (sl) {
if (sl->elements) {
size_t i;
for (i = 0; i < sl->size; i++)
JLI_MemFree(sl->elements[i]);
JLI_MemFree(sl->elements);
}
JLI_MemFree(sl);
}
}
void
JLI_List_ensureCapacity(JLI_List sl, size_t capacity)
{
if (sl->capacity < capacity) {
while (sl->capacity < capacity)
sl->capacity *= 2;
sl->elements = JLI_MemRealloc(sl->elements,
sl->capacity * sizeof(sl->elements[0]));
}
}
void
JLI_List_add(JLI_List sl, char *str)
{
JLI_List_ensureCapacity(sl, sl->size+1);
sl->elements[sl->size++] = str;
}
void
JLI_List_addSubstring(JLI_List sl, const char *beg, size_t len)
{
char *str = (char *) JLI_MemAlloc(len+1);
memcpy(str, beg, len);
str[len] = '\0';
JLI_List_ensureCapacity(sl, sl->size+1);
sl->elements[sl->size++] = str;
}
char *
JLI_List_combine(JLI_List sl)
{
size_t i;
size_t size;
char *str;
char *p;
for (i = 0, size = 1; i < sl->size; i++)
size += JLI_StrLen(sl->elements[i]);
str = JLI_MemAlloc(size);
for (i = 0, p = str; i < sl->size; i++) {
size_t len = JLI_StrLen(sl->elements[i]);
memcpy(p, sl->elements[i], len);
p += len;
}
*p = '\0';
return str;
}
char *
JLI_List_join(JLI_List sl, char sep)
{
size_t i;
size_t size;
char *str;
char *p;
for (i = 0, size = 1; i < sl->size; i++)
size += JLI_StrLen(sl->elements[i]) + 1;
str = JLI_MemAlloc(size);
for (i = 0, p = str; i < sl->size; i++) {
size_t len = JLI_StrLen(sl->elements[i]);
if (i > 0) *p++ = sep;
memcpy(p, sl->elements[i], len);
p += len;
}
*p = '\0';
return str;
}
JLI_List
JLI_List_split(const char *str, char sep)
{
const char *p, *q;
size_t len = JLI_StrLen(str);
int count;
JLI_List sl;
for (count = 1, p = str; p < str + len; p++)
count += (*p == sep);
sl = JLI_List_new(count);
for (p = str;;) {
for (q = p; q <= str + len; q++) {
if (*q == sep || *q == '\0') {
JLI_List_addSubstring(sl, p, q - p);
if (*q == '\0')
return sl;
p = q + 1;
}
}
}
}

View File

@ -29,7 +29,15 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <jni.h>
#ifndef NO_JNI
#include <jni.h>
#else
#define jboolean int
#define JNI_TRUE 1
#define JNI_FALSE 0
#endif
#define JLDEBUG_ENV_ENTRY "_JAVA_LAUNCHER_DEBUG"
void *JLI_MemAlloc(size_t size);
@ -45,6 +53,7 @@ typedef struct {
StdArg *JLI_GetStdArgs();
int JLI_GetStdArgc();
int JLI_GetAppArgIndex();
#define JLI_StrLen(p1) strlen((p1))
#define JLI_StrChr(p1, p2) strchr((p1), (p2))
@ -102,4 +111,29 @@ void JLI_TraceLauncher(const char* fmt, ...);
void JLI_SetTraceLauncher();
jboolean JLI_IsTraceLauncher();
/*
* JLI_List - a dynamic list of char*
*/
struct JLI_List_
{
char **elements;
size_t size;
size_t capacity;
};
typedef struct JLI_List_ *JLI_List;
JLI_List JLI_List_new(size_t capacity);
void JLI_List_free(JLI_List l);
void JLI_List_ensureCapacity(JLI_List l, size_t capacity);
/* e must be JLI_MemFree-able */
void JLI_List_add(JLI_List l, char *e);
/* a copy is made out of beg */
void JLI_List_addSubstring(JLI_List l, const char *beg, size_t len);
char *JLI_List_combine(JLI_List sl);
char *JLI_List_join(JLI_List l, char sep);
JLI_List JLI_List_split(const char *str, char sep);
void JLI_InitArgProcessing(jboolean isJava, jboolean disableArgFile);
JLI_List JLI_PreprocessArg(const char *arg);
#endif /* _JLI_UTIL_H */

View File

@ -218,116 +218,6 @@ equal(const char *s1, const char *s2)
return JLI_StrCmp(s1, s2) == 0;
}
/*
* FileList ADT - a dynamic list of C filenames
*/
struct FileList_
{
char **files;
int size;
int capacity;
};
typedef struct FileList_ *FileList;
static FileList
FileList_new(int capacity)
{
FileList fl = NEW_(FileList);
fl->capacity = capacity;
fl->files = (char **) JLI_MemAlloc(capacity * sizeof(fl->files[0]));
fl->size = 0;
return fl;
}
static void
FileList_free(FileList fl)
{
if (fl) {
if (fl->files) {
int i;
for (i = 0; i < fl->size; i++)
JLI_MemFree(fl->files[i]);
JLI_MemFree(fl->files);
}
JLI_MemFree(fl);
}
}
static void
FileList_ensureCapacity(FileList fl, int capacity)
{
if (fl->capacity < capacity) {
while (fl->capacity < capacity)
fl->capacity *= 2;
fl->files = JLI_MemRealloc(fl->files,
fl->capacity * sizeof(fl->files[0]));
}
}
static void
FileList_add(FileList fl, char *file)
{
FileList_ensureCapacity(fl, fl->size+1);
fl->files[fl->size++] = file;
}
static void
FileList_addSubstring(FileList fl, const char *beg, size_t len)
{
char *filename = (char *) JLI_MemAlloc(len+1);
memcpy(filename, beg, len);
filename[len] = '\0';
FileList_ensureCapacity(fl, fl->size+1);
fl->files[fl->size++] = filename;
}
static char *
FileList_join(FileList fl, char sep)
{
int i;
int size;
char *path;
char *p;
for (i = 0, size = 1; i < fl->size; i++)
size += (int)JLI_StrLen(fl->files[i]) + 1;
path = JLI_MemAlloc(size);
for (i = 0, p = path; i < fl->size; i++) {
int len = (int)JLI_StrLen(fl->files[i]);
if (i > 0) *p++ = sep;
memcpy(p, fl->files[i], len);
p += len;
}
*p = '\0';
return path;
}
static FileList
FileList_split(const char *path, char sep)
{
const char *p, *q;
size_t len = JLI_StrLen(path);
int count;
FileList fl;
for (count = 1, p = path; p < path + len; p++)
count += (*p == sep);
fl = FileList_new(count);
for (p = path;;) {
for (q = p; q <= path + len; q++) {
if (*q == sep || *q == '\0') {
FileList_addSubstring(fl, p, q - p);
if (*q == '\0')
return fl;
p = q + 1;
}
}
}
}
static int
isJarFileName(const char *filename)
{
@ -352,22 +242,22 @@ wildcardConcat(const char *wildcard, const char *basename)
return filename;
}
static FileList
static JLI_List
wildcardFileList(const char *wildcard)
{
const char *basename;
FileList fl = FileList_new(16);
JLI_List fl = JLI_List_new(16);
WildcardIterator it = WildcardIterator_for(wildcard);
if (it == NULL)
{
FileList_free(fl);
JLI_List_free(fl);
return NULL;
}
while ((basename = WildcardIterator_next(it)) != NULL)
if (isJarFileName(basename))
FileList_add(fl, wildcardConcat(wildcard, basename));
JLI_List_add(fl, wildcardConcat(wildcard, basename));
WildcardIterator_close(it);
return fl;
}
@ -383,25 +273,25 @@ isWildcard(const char *filename)
}
static void
FileList_expandWildcards(FileList fl)
FileList_expandWildcards(JLI_List fl)
{
int i, j;
size_t i, j;
for (i = 0; i < fl->size; i++) {
if (isWildcard(fl->files[i])) {
FileList expanded = wildcardFileList(fl->files[i]);
if (isWildcard(fl->elements[i])) {
JLI_List expanded = wildcardFileList(fl->elements[i]);
if (expanded != NULL && expanded->size > 0) {
JLI_MemFree(fl->files[i]);
FileList_ensureCapacity(fl, fl->size + expanded->size);
JLI_MemFree(fl->elements[i]);
JLI_List_ensureCapacity(fl, fl->size + expanded->size);
for (j = fl->size - 1; j >= i+1; j--)
fl->files[j+expanded->size-1] = fl->files[j];
fl->elements[j+expanded->size-1] = fl->elements[j];
for (j = 0; j < expanded->size; j++)
fl->files[i+j] = expanded->files[j];
fl->elements[i+j] = expanded->elements[j];
i += expanded->size - 1;
fl->size += expanded->size - 1;
/* fl expropriates expanded's elements. */
expanded->size = 0;
}
FileList_free(expanded);
JLI_List_free(expanded);
}
}
}
@ -410,14 +300,14 @@ const char *
JLI_WildcardExpandClasspath(const char *classpath)
{
char *expanded;
FileList fl;
JLI_List fl;
if (JLI_StrChr(classpath, '*') == NULL)
return classpath;
fl = FileList_split(classpath, PATH_SEPARATOR);
fl = JLI_List_split(classpath, PATH_SEPARATOR);
FileList_expandWildcards(fl);
expanded = FileList_join(fl, PATH_SEPARATOR);
FileList_free(fl);
expanded = JLI_List_join(fl, PATH_SEPARATOR);
JLI_List_free(fl);
if (getenv(JLDEBUG_ENV_ENTRY) != 0)
printf("Expanded wildcards:\n"
" before: \"%s\"\n"
@ -428,13 +318,13 @@ JLI_WildcardExpandClasspath(const char *classpath)
#ifdef DEBUG_WILDCARD
static void
FileList_print(FileList fl)
FileList_print(JLI_List fl)
{
int i;
size_t i;
putchar('[');
for (i = 0; i < fl->size; i++) {
if (i > 0) printf(", ");
printf("\"%s\"",fl->files[i]);
printf("\"%s\"",fl->elements[i]);
}
putchar(']');
}

View File

@ -685,6 +685,9 @@ findJavaTZ_md(const char *java_home_dir)
#ifdef __solaris__
if (tz != NULL && strcmp(tz, "localtime") == 0) {
tz = getSolarisDefaultZoneID();
if (freetz != NULL) {
free((void *) freetz);
}
freetz = tz;
}
#endif

View File

@ -198,18 +198,37 @@ void JLI_CmdToArgs(char* cmdline) {
StdArg* argv = NULL;
jboolean wildcard = JNI_FALSE;
char* src = cmdline;
JLI_List argsInFile;
// allocate arg buffer with sufficient space to receive the largest arg
char* arg = JLI_StringDup(cmdline);
do {
src = next_arg(src, arg, &wildcard);
// resize to accommodate another Arg
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = wildcard;
argsInFile = JLI_PreprocessArg(arg);
if (argsInFile != NULL) {
size_t cnt, i;
// resize to accommodate another Arg
cnt = argsInFile->size;
argv = (StdArg*) JLI_MemRealloc(argv, (nargs + cnt) * sizeof(StdArg));
for (i = 0; i < cnt; i++) {
argv[nargs].arg = argsInFile->elements[i];
// wildcard is not supported in argfile
argv[nargs].has_wildcard = JNI_FALSE;
nargs++;
}
// Shallow free, we reuse the string to avoid copy
JLI_MemFree(argsInFile->elements);
JLI_MemFree(argsInFile);
} else {
// resize to accommodate another Arg
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = wildcard;
*arg = '\0';
nargs++;
}
*arg = '\0';
nargs++;
} while (src != NULL);
JLI_MemFree(arg);

View File

@ -31,6 +31,8 @@
#include <malloc.h>
#include <sys/types.h>
#include <process.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#include "java_net_InetAddress.h"
#include "java_net_Inet4AddressImpl.h"
@ -281,114 +283,47 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
* Returns true is an ECHO_REPLY is received, otherwise, false.
*/
static jboolean
ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
struct sockaddr_in* netif, jint ttl) {
jint size;
jint n, len, hlen1, icmplen;
char sendbuf[1500];
char recvbuf[1500];
struct icmp *icmp;
struct ip *ip;
WSAEVENT hEvent;
struct sockaddr sa_recv;
jint tmout2;
u_short pid, seq;
int read_rv = 0;
ping4(JNIEnv *env, unsigned long ipaddr, jint timeout) {
/* Initialize the sequence number to a suitable random number and
shift right one place to allow sufficient room for increamenting. */
seq = ((unsigned short)rand()) >> 1;
// See https://msdn.microsoft.com/en-us/library/aa366050%28VS.85%29.aspx
/* icmp_id is a 16 bit data type, therefore down cast the pid */
pid = (u_short) _getpid();
size = 60*1024;
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const char *) &size, sizeof(size));
/**
* A TTL was specified, let's set the socket option.
*/
if (ttl > 0) {
setsockopt(fd, IPPROTO_IP, IP_TTL, (const char *) &ttl, sizeof(ttl));
HANDLE hIcmpFile;
DWORD dwRetVal = 0;
char SendData[32] = {0};
LPVOID ReplyBuffer = NULL;
DWORD ReplySize = 0;
hIcmpFile = IcmpCreateFile();
if (hIcmpFile == INVALID_HANDLE_VALUE) {
NET_ThrowNew(env, WSAGetLastError(), "Unable to open handle");
return JNI_FALSE;
}
/**
* A network interface was specified, let's bind to it.
*/
if (netif != NULL) {
if (bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in)) < 0) {
NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket");
closesocket(fd);
ReplySize = sizeof(ICMP_ECHO_REPLY) + sizeof(SendData);
ReplyBuffer = (VOID*) malloc(ReplySize);
if (ReplyBuffer == NULL) {
IcmpCloseHandle(hIcmpFile);
NET_ThrowNew(env, WSAGetLastError(), "Unable to allocate memory");
return JNI_FALSE;
}
}
/**
* Let's make the socket non blocking
*/
hEvent = WSACreateEvent();
WSAEventSelect(fd, hEvent, FD_READ|FD_CONNECT|FD_CLOSE);
dwRetVal = IcmpSendEcho(hIcmpFile, // HANDLE IcmpHandle,
ipaddr, // IPAddr DestinationAddress,
SendData, // LPVOID RequestData,
sizeof(SendData), // WORD RequestSize,
NULL, // PIP_OPTION_INFORMATION RequestOptions,
ReplyBuffer,// LPVOID ReplyBuffer,
ReplySize, // DWORD ReplySize,
timeout); // DWORD Timeout
/**
* send 1 ICMP REQUEST every second until either we get a valid reply
* or the timeout expired.
*/
do {
/**
* construct the ICMP header
*/
memset(sendbuf, 0, 1500);
icmp = (struct icmp *) sendbuf;
icmp->icmp_type = ICMP_ECHO;
icmp->icmp_code = 0;
icmp->icmp_id = htons(pid);
icmp->icmp_seq = htons(seq);
/**
* checksum has to be set to zero before we can calculate the
* real checksum!
*/
icmp->icmp_cksum = 0;
icmp->icmp_cksum = in_cksum((u_short *)icmp, 64);
/**
* Ping!
*/
n = sendto(fd, sendbuf, 64, 0, (struct sockaddr *)him,
sizeof(struct sockaddr));
if (n < 0 && WSAGetLastError() != WSAEWOULDBLOCK) {
NET_ThrowNew(env, WSAGetLastError(), "Can't send ICMP packet");
closesocket(fd);
WSACloseEvent(hEvent);
free(ReplyBuffer);
IcmpCloseHandle(hIcmpFile);
if (dwRetVal != 0) {
return JNI_TRUE;
} else {
return JNI_FALSE;
}
/*
* wait for 1 second at most
*/
tmout2 = timeout > 1000 ? 1000 : timeout;
do {
tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2);
if (tmout2 >= 0) {
len = sizeof(sa_recv);
n = recvfrom(fd, recvbuf, sizeof(recvbuf), 0, &sa_recv, &len);
ip = (struct ip*) recvbuf;
hlen1 = (ip->ip_hl) << 2;
icmp = (struct icmp *) (recvbuf + hlen1);
icmplen = n - hlen1;
/**
* Is that a proper ICMP reply?
*/
if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY &&
(ntohs(icmp->icmp_seq) == seq) && (ntohs(icmp->icmp_id) == pid)) {
closesocket(fd);
WSACloseEvent(hEvent);
return JNI_TRUE;
}
}
} while (tmout2 > 0);
timeout -= 1000;
seq++;
} while (timeout > 0);
closesocket(fd);
WSACloseEvent(hEvent);
return JNI_FALSE;
}
}
/*
@ -404,13 +339,7 @@ Java_java_net_Inet4AddressImpl_isReachable0(JNIEnv *env, jobject this,
jint ttl) {
jint addr;
jbyte caddr[4];
jint fd;
struct sockaddr_in him;
struct sockaddr_in* netif = NULL;
struct sockaddr_in inf;
int len = 0;
WSAEVENT hEvent;
int connect_rv = -1;
int sz;
/**
@ -428,135 +357,6 @@ Java_java_net_Inet4AddressImpl_isReachable0(JNIEnv *env, jobject this,
addr |= ((caddr[2] <<8) & 0xff00);
addr |= (caddr[3] & 0xff);
addr = htonl(addr);
/**
* Socket address
*/
him.sin_addr.s_addr = addr;
him.sin_family = AF_INET;
len = sizeof(him);
/**
* If a network interface was specified, let's convert its address
* as well.
*/
if (!(IS_NULL(ifArray))) {
memset((char *) caddr, 0, sizeof(caddr));
(*env)->GetByteArrayRegion(env, ifArray, 0, 4, caddr);
addr = ((caddr[0]<<24) & 0xff000000);
addr |= ((caddr[1] <<16) & 0xff0000);
addr |= ((caddr[2] <<8) & 0xff00);
addr |= (caddr[3] & 0xff);
addr = htonl(addr);
inf.sin_addr.s_addr = addr;
inf.sin_family = AF_INET;
inf.sin_port = 0;
netif = &inf;
}
#if 0
/*
* Windows implementation of ICMP & RAW sockets is too unreliable for now.
* Therefore it's best not to try it at all and rely only on TCP
* We may revisit and enable this code in the future.
*/
/*
* Let's try to create a RAW socket to send ICMP packets
* This usually requires "root" privileges, so it's likely to fail.
*/
fd = NET_Socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
if (fd != -1) {
/*
* It didn't fail, so we can use ICMP_ECHO requests.
*/
return ping4(env, fd, &him, timeout, netif, ttl);
}
#endif
/*
* Can't create a raw socket, so let's try a TCP socket
*/
fd = NET_Socket(AF_INET, SOCK_STREAM, 0);
if (fd == SOCKET_ERROR) {
/* note: if you run out of fds, you may not be able to load
* the exception class, and get a NoClassDefFoundError
* instead.
*/
NET_ThrowNew(env, WSAGetLastError(), "Can't create socket");
return JNI_FALSE;
}
if (ttl > 0) {
setsockopt(fd, IPPROTO_IP, IP_TTL, (const char *)&ttl, sizeof(ttl));
}
/*
* A network interface was specified, so let's bind to it.
*/
if (netif != NULL) {
if (bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in)) < 0) {
NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket");
closesocket(fd);
return JNI_FALSE;
}
}
/*
* Make the socket non blocking so we can use select/poll.
*/
hEvent = WSACreateEvent();
WSAEventSelect(fd, hEvent, FD_READ|FD_CONNECT|FD_CLOSE);
/* no need to use NET_Connect as non-blocking */
him.sin_port = htons(7); /* Echo */
connect_rv = connect(fd, (struct sockaddr *)&him, len);
/**
* connection established or refused immediately, either way it means
* we were able to reach the host!
*/
if (connect_rv == 0 || WSAGetLastError() == WSAECONNREFUSED) {
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_TRUE;
} else {
int optlen;
switch (WSAGetLastError()) {
case WSAEHOSTUNREACH: /* Host Unreachable */
case WSAENETUNREACH: /* Network Unreachable */
case WSAENETDOWN: /* Network is down */
case WSAEPFNOSUPPORT: /* Protocol Family unsupported */
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_FALSE;
}
if (WSAGetLastError() != WSAEWOULDBLOCK) {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
"connect failed");
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_FALSE;
}
timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
/* has connection been established */
if (timeout >= 0) {
optlen = sizeof(connect_rv);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
&optlen) <0) {
connect_rv = WSAGetLastError();
}
if (connect_rv == 0 || connect_rv == WSAECONNREFUSED) {
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_TRUE;
}
}
}
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_FALSE;
return ping4(env, addr, timeout);
}

View File

@ -31,6 +31,8 @@
#include <malloc.h>
#include <sys/types.h>
#include <process.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#include "java_net_InetAddress.h"
#include "java_net_Inet4AddressImpl.h"
@ -332,139 +334,61 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
* Returns true is an ECHO_REPLY is received, otherwise, false.
*/
static jboolean
ping6(JNIEnv *env, jint fd, struct SOCKADDR_IN6* him, jint timeout,
struct SOCKADDR_IN6* netif, jint ttl) {
jint size;
jint n, len, i;
char sendbuf[1500];
char auxbuf[1500];
unsigned char recvbuf[1500];
struct icmp6_hdr *icmp6;
struct SOCKADDR_IN6 sa_recv;
unsigned short pid, seq;
int read_rv = 0;
WSAEVENT hEvent;
struct ip6_pseudo_hdr *pseudo_ip6;
int timestamp;
int tmout2;
ping6(JNIEnv *env,
struct sockaddr_in6* src,
struct sockaddr_in6* dest,
jint timeout)
{
HANDLE hIcmpFile;
DWORD dwRetVal = 0;
char SendData[32] = {0};
LPVOID ReplyBuffer = NULL;
DWORD ReplySize = 0;
IP_OPTION_INFORMATION ipInfo = {255, 0, 0, 0, NULL};
struct sockaddr_in6 sa6Source;
/* Initialize the sequence number to a suitable random number and
shift right one place to allow sufficient room for increamenting. */
seq = ((unsigned short)rand()) >> 1;
/* icmp_id is a 16 bit data type, therefore down cast the pid */
pid = (unsigned short) _getpid();
size = 60*1024;
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const char *)&size, sizeof(size));
/**
* A TTL was specified, let's set the socket option.
*/
if (ttl > 0) {
setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (const char *) &ttl, sizeof(ttl));
hIcmpFile = Icmp6CreateFile();
if (hIcmpFile == INVALID_HANDLE_VALUE) {
NET_ThrowNew(env, WSAGetLastError(), "Unable to open handle");
return JNI_FALSE;
}
/**
* A network interface was specified, let's bind to it.
*/
if (netif != NULL) {
if (NET_Bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in6)) < 0){
NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket to interface");
closesocket(fd);
ReplySize = sizeof(ICMPV6_ECHO_REPLY) + sizeof(SendData);
ReplyBuffer = (VOID*) malloc(ReplySize);
if (ReplyBuffer == NULL) {
IcmpCloseHandle(hIcmpFile);
NET_ThrowNew(env, WSAGetLastError(), "Unable to allocate memory");
return JNI_FALSE;
}
}
/*
* Make the socket non blocking
*/
hEvent = WSACreateEvent();
WSAEventSelect(fd, hEvent, FD_READ|FD_CONNECT|FD_CLOSE);
//define local source information
sa6Source.sin6_addr = in6addr_any;
sa6Source.sin6_family = AF_INET6;
sa6Source.sin6_flowinfo = 0;
sa6Source.sin6_port = 0;
/**
* send 1 ICMP REQUEST every second until either we get a valid reply
* or the timeout expired.
*/
do {
/* let's tag the ECHO packet with our pid so we can identify it */
timestamp = GetCurrentTime();
memset(sendbuf, 0, 1500);
icmp6 = (struct icmp6_hdr *) sendbuf;
icmp6->icmp6_type = ICMP6_ECHO_REQUEST;
icmp6->icmp6_code = 0;
icmp6->icmp6_id = htons(pid);
icmp6->icmp6_seq = htons(seq);
icmp6->icmp6_cksum = 0;
memcpy((icmp6 + 1), &timestamp, sizeof(int));
if (netif != NULL) {
memset(auxbuf, 0, 1500);
pseudo_ip6 = (struct ip6_pseudo_hdr*) auxbuf;
memcpy(&pseudo_ip6->ip6_src, &netif->sin6_addr, sizeof(struct in6_addr));
memcpy(&pseudo_ip6->ip6_dst, &him->sin6_addr, sizeof(struct in6_addr));
pseudo_ip6->ip6_plen= htonl( 64 );
pseudo_ip6->ip6_nxt = htonl( IPPROTO_ICMPV6 );
memcpy(auxbuf + sizeof(struct ip6_pseudo_hdr), icmp6, 64);
/**
* We shouldn't have to do that as computing the checksum is supposed
* to be done by the IPv6 stack. Unfortunately windows, here too, is
* uterly broken, or non compliant, so let's do it.
* Problem is to compute the checksum I need to know the source address
* which happens only if I know the interface to be used...
*/
icmp6->icmp6_cksum = in_cksum((u_short *)pseudo_ip6, sizeof(struct ip6_pseudo_hdr) + 64);
}
dwRetVal = Icmp6SendEcho2(hIcmpFile, // HANDLE IcmpHandle,
NULL, // HANDLE Event,
NULL, // PIO_APC_ROUTINE ApcRoutine,
NULL, // PVOID ApcContext,
&sa6Source, // struct sockaddr_in6 *SourceAddress,
dest, // struct sockaddr_in6 *DestinationAddress,
SendData, // LPVOID RequestData,
sizeof(SendData), // WORD RequestSize,
&ipInfo, // PIP_OPTION_INFORMATION RequestOptions,
ReplyBuffer, // LPVOID ReplyBuffer,
ReplySize, // DWORD ReplySize,
timeout); // DWORD Timeout
/**
* Ping!
*/
n = sendto(fd, sendbuf, 64, 0, (struct sockaddr*) him, sizeof(struct sockaddr_in6));
if (n < 0 && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEADDRNOTAVAIL)) {
// Happens when using a "tunnel interface" for instance.
// Or trying to send a packet on a different scope.
closesocket(fd);
WSACloseEvent(hEvent);
free(ReplyBuffer);
IcmpCloseHandle(hIcmpFile);
if (dwRetVal != 0) {
return JNI_TRUE;
} else {
return JNI_FALSE;
}
if (n < 0 && WSAGetLastError() != WSAEWOULDBLOCK) {
NET_ThrowNew(env, WSAGetLastError(), "Can't send ICMP packet");
closesocket(fd);
WSACloseEvent(hEvent);
return JNI_FALSE;
}
tmout2 = timeout > 1000 ? 1000 : timeout;
do {
tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2);
if (tmout2 >= 0) {
len = sizeof(sa_recv);
memset(recvbuf, 0, 1500);
/**
* For some unknown reason, besides plain stupidity, windows
* truncates the first 4 bytes of the icmpv6 header some we can't
* check for the ICMP_ECHOREPLY value.
* we'll check the other values, though
*/
n = recvfrom(fd, recvbuf + 4, sizeof(recvbuf) - 4, 0, (struct sockaddr*) &sa_recv, &len);
icmp6 = (struct icmp6_hdr *) (recvbuf);
memcpy(&i, (icmp6 + 1), sizeof(int));
/**
* Is that the reply we were expecting?
*/
if (n >= 8 && ntohs(icmp6->icmp6_seq) == seq &&
ntohs(icmp6->icmp6_id) == pid && i == timestamp) {
closesocket(fd);
WSACloseEvent(hEvent);
return JNI_TRUE;
}
}
} while (tmout2 > 0);
timeout -= 1000;
seq++;
} while (timeout > 0);
closesocket(fd);
WSACloseEvent(hEvent);
return JNI_FALSE;
}
}
#endif /* AF_INET6 */
@ -482,11 +406,10 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
jint ttl, jint if_scope) {
#ifdef AF_INET6
jbyte caddr[16];
jint fd, sz;
jint sz;
struct sockaddr_in6 him6;
struct sockaddr_in6* netif = NULL;
struct sockaddr_in6 inf6;
WSAEVENT hEvent;
int len = 0;
int connect_rv = -1;
@ -518,6 +441,7 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
him6.sin6_scope_id = scope;
}
len = sizeof(struct sockaddr_in6);
/**
* A network interface was specified, let's convert the address
*/
@ -532,122 +456,8 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
netif = &inf6;
}
#if 0
/*
* Windows implementation of ICMP & RAW sockets is too unreliable for now.
* Therefore it's best not to try it at all and rely only on TCP
* We may revisit and enable this code in the future.
*/
return ping6(env, netif, &him6, timeout);
/*
* Right now, windows doesn't generate the ICMP checksum automatically
* so we have to compute it, but we can do it only if we know which
* interface will be used. Therefore, don't try to use ICMP if no
* interface was specified.
* When ICMPv6 support improves in windows, we may change this.
*/
if (!(IS_NULL(ifArray))) {
/*
* If we can create a RAW socket, then when can use the ICMP ECHO_REQUEST
* otherwise we'll try a tcp socket to the Echo port (7).
* Note that this is empiric, and not connecting could mean it's blocked
* or the echo servioe has been disabled.
*/
fd = NET_Socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
if (fd != -1) { /* Good to go, let's do a ping */
return ping6(env, fd, &him6, timeout, netif, ttl);
}
}
#endif
/* No good, let's fall back on TCP */
fd = NET_Socket(AF_INET6, SOCK_STREAM, 0);
if (fd == SOCKET_ERROR) {
/* note: if you run out of fds, you may not be able to load
* the exception class, and get a NoClassDefFoundError
* instead.
*/
NET_ThrowNew(env, errno, "Can't create socket");
return JNI_FALSE;
}
/**
* A TTL was specified, let's set the socket option.
*/
if (ttl > 0) {
setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (const char *)&ttl, sizeof(ttl));
}
/**
* A network interface was specified, let's bind to it.
*/
if (netif != NULL) {
if (NET_Bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in6)) < 0) {
NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket to interface");
closesocket(fd);
return JNI_FALSE;
}
}
/**
* Make the socket non blocking.
*/
hEvent = WSACreateEvent();
WSAEventSelect(fd, hEvent, FD_READ|FD_CONNECT|FD_CLOSE);
/* no need to use NET_Connect as non-blocking */
him6.sin6_port = htons((short) 7); /* Echo port */
connect_rv = connect(fd, (struct sockaddr *)&him6, len);
/**
* connection established or refused immediately, either way it means
* we were able to reach the host!
*/
if (connect_rv == 0 || WSAGetLastError() == WSAECONNREFUSED) {
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_TRUE;
} else {
int optlen;
switch (WSAGetLastError()) {
case WSAEHOSTUNREACH: /* Host Unreachable */
case WSAENETUNREACH: /* Network Unreachable */
case WSAENETDOWN: /* Network is down */
case WSAEPFNOSUPPORT: /* Protocol Family unsupported */
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_FALSE;
}
if (WSAGetLastError() != WSAEWOULDBLOCK) {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
"connect failed");
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_FALSE;
}
timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout);
if (timeout >= 0) {
/* has connection been established? */
optlen = sizeof(connect_rv);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv,
&optlen) <0) {
connect_rv = WSAGetLastError();
}
if (connect_rv == 0 || connect_rv == WSAECONNREFUSED) {
WSACloseEvent(hEvent);
closesocket(fd);
return JNI_TRUE;
}
}
}
WSACloseEvent(hEvent);
closesocket(fd);
#endif /* AF_INET6 */
return JNI_FALSE;
}

View File

@ -746,7 +746,7 @@ public class LWWindowPeer
*/
@Override
public void notifyMouseEvent(int id, long when, int button,
int x, int y, int screenX, int screenY,
int x, int y, int absX, int absY,
int modifiers, int clickCount, boolean popupTrigger,
byte[] bdata)
{
@ -763,7 +763,7 @@ public class LWWindowPeer
this);
Component target = lastMouseEventPeer.getTarget();
postMouseExitedEvent(target, when, modifiers, lp,
screenX, screenY, clickCount, popupTrigger, button);
absX, absY, clickCount, popupTrigger, button);
}
// Sometimes we may get MOUSE_EXITED after lastCommonMouseEventPeer is switched
@ -781,7 +781,7 @@ public class LWWindowPeer
Point lp = targetPeer.windowToLocal(x, y, this);
Component target = targetPeer.getTarget();
postMouseEnteredEvent(target, when, modifiers, lp,
screenX, screenY, clickCount, popupTrigger, button);
absX, absY, clickCount, popupTrigger, button);
}
lastCommonMouseEventPeer = targetPeer;
lastMouseEventPeer = targetPeer;
@ -798,12 +798,12 @@ public class LWWindowPeer
// implemented in CPlatformEmbeddedFrame class
if (topmostWindowPeer == this || topmostWindowPeer == null) {
generateMouseEnterExitEventsForComponents(when, button, x, y,
screenX, screenY, modifiers, clickCount, popupTrigger,
absX, absY, modifiers, clickCount, popupTrigger,
targetPeer);
} else {
LWComponentPeer<?, ?> topmostTargetPeer = topmostWindowPeer.findPeerAt(r.x + x, r.y + y);
topmostWindowPeer.generateMouseEnterExitEventsForComponents(when, button, x, y,
screenX, screenY, modifiers, clickCount, popupTrigger,
absX, absY, modifiers, clickCount, popupTrigger,
topmostTargetPeer);
}
@ -874,7 +874,7 @@ public class LWWindowPeer
if (targetPeer.isEnabled()) {
MouseEvent event = new MouseEvent(targetPeer.getTarget(), id,
when, modifiers, lp.x, lp.y,
screenX, screenY, clickCount,
absX, absY, clickCount,
popupTrigger, button);
postEvent(event);
}
@ -885,7 +885,7 @@ public class LWWindowPeer
postEvent(new MouseEvent(targetPeer.getTarget(),
MouseEvent.MOUSE_CLICKED,
when, modifiers,
lp.x, lp.y, screenX, screenY,
lp.x, lp.y, absX, absY,
clickCount, popupTrigger, button));
}
mouseClickButtons &= ~eventButtonMask;
@ -948,10 +948,10 @@ public class LWWindowPeer
}
@Override
public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
int scrollType, int scrollAmount,
int wheelRotation, double preciseWheelRotation,
byte[] bdata)
public void notifyMouseWheelEvent(long when, int x, int y, int absX,
int absY, int modifiers, int scrollType,
int scrollAmount, int wheelRotation,
double preciseWheelRotation, byte[] bdata)
{
// TODO: could we just use the last mouse event target here?
Rectangle r = getBounds();
@ -963,12 +963,11 @@ public class LWWindowPeer
Point lp = targetPeer.windowToLocal(x, y, this);
// TODO: fill "bdata" member of AWTEvent
// TODO: screenX/screenY
postEvent(new MouseWheelEvent(targetPeer.getTarget(),
MouseEvent.MOUSE_WHEEL,
when, modifiers,
lp.x, lp.y,
0, 0, /* screenX, Y */
absX, absY, /* absX, absY */
0 /* clickCount */, false /* popupTrigger */,
scrollType, scrollAmount,
wheelRotation, preciseWheelRotation));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. 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
@ -49,14 +49,14 @@ public interface PlatformEventNotifier {
* point of the client area is (insets.top, insets.left).
*/
void notifyMouseEvent(int id, long when, int button,
int x, int y, int screenX, int screenY,
int x, int y, int absX, int absY,
int modifiers, int clickCount, boolean popupTrigger,
byte[] bdata);
void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
int scrollType, int scrollAmount,
int wheelRotation, double preciseWheelRotation,
byte[] bdata);
void notifyMouseWheelEvent(long when, int x, int y, final int absX,
final int absY, int modifiers, int scrollType,
int scrollAmount, int wheelRotation,
double preciseWheelRotation, byte[] bdata);
/*
* Called by the delegate when a key is pressed.
*/

View File

@ -26,8 +26,6 @@
package sun.lwawt.macosx;
import java.awt.*;
import java.awt.image.*;
import sun.awt.image.ImageRepresentation;
import java.io.*;
import java.net.URL;
@ -35,6 +33,7 @@ import java.nio.charset.Charset;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.*;
import java.util.regex.*;
import java.awt.datatransfer.*;
import sun.awt.datatransfer.*;
@ -123,26 +122,52 @@ public class CDataTransferer extends DataTransferer {
@Override
public Object translateBytes(byte[] bytes, DataFlavor flavor,
long format, Transferable transferable) throws IOException {
long format, Transferable transferable) throws IOException {
if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
{
String charset = Charset.defaultCharset().name();
if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
try {
charset = new String((byte[])transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
} catch (UnsupportedFlavorException cannotHappen) {
}
if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass())) {
String charset = Charset.defaultCharset().name();
if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
try {
charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
} catch (UnsupportedFlavorException cannotHappen) {
}
return new URL(new String(bytes, charset));
}
String xml = new String(bytes, charset);
// macosx pasteboard returns a property list that consists of one URL
// let's extract it.
return new URL(extractURL(xml));
}
if (format == CF_STRING) {
bytes = Normalizer.normalize(new String(bytes, "UTF8"), Form.NFC).getBytes("UTF8");
}
if (format == CF_STRING) {
bytes = Normalizer.normalize(new String(bytes, "UTF8"), Form.NFC).getBytes("UTF8");
}
return super.translateBytes(bytes, flavor, format, transferable);
return super.translateBytes(bytes, flavor, format, transferable);
}
/**
* Macosx pasteboard returns xml document that contains one URL, for exmple:
* <pre>
* {@code
* <?xml version=\"1.0\" encoding=\"UTF-8\"?>
* <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
* <plist version=\"1.0\">
* <array>
* <string>file:///path_to_file</string>
* <string></string>
* </array>
* </plist>
* }
* </pre>
*/
private String extractURL(String xml) {
Pattern urlExtractorPattern = Pattern.compile("<string>(.*)</string>");
Matcher matcher = urlExtractorPattern.matcher(xml);
if (matcher.find()) {
return matcher.group(1);
} else {
return null;
}
}
@Override

View File

@ -75,8 +75,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
int x = (int)pluginX;
int y = (int)pluginY;
Point locationOnScreen = getLocationOnScreen();
int screenX = locationOnScreen.x + x;
int screenY = locationOnScreen.y + y;
int absX = locationOnScreen.x + x;
int absY = locationOnScreen.y + y;
if (eventType == CocoaConstants.NPCocoaEventMouseEntered) {
CCursorManager.nativeSetAllowsCursorSetInBackground(true);
@ -85,15 +85,19 @@ public class CEmbeddedFrame extends EmbeddedFrame {
}
responder.handleMouseEvent(eventType, modifierFlags, buttonNumber,
clickCount, x, y, screenX, screenY);
clickCount, x, y, absX, absY);
}
public void handleScrollEvent(double pluginX, double pluginY, int modifierFlags,
double deltaX, double deltaY, double deltaZ) {
int x = (int)pluginX;
int y = (int)pluginY;
Point locationOnScreen = getLocationOnScreen();
int absX = locationOnScreen.x + x;
int absY = locationOnScreen.y + y;
responder.handleScrollEvent(x, y, modifierFlags, deltaX, deltaY);
responder.handleScrollEvent(x, y, absX, absY, modifierFlags, deltaX,
deltaY);
}
public void handleKeyEvent(int eventType, int modifierFlags, String characters,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@ -54,8 +54,7 @@ final class CPlatformResponder {
* Handles mouse events.
*/
void handleMouseEvent(int eventType, int modifierFlags, int buttonNumber,
int clickCount, int x, int y, int absoluteX,
int absoluteY) {
int clickCount, int x, int y, int absX, int absY) {
final SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
if ((buttonNumber > 2 && !tk.areExtraMouseButtonsEnabled())
|| buttonNumber > tk.getNumberOfButtons() - 1) {
@ -81,14 +80,15 @@ final class CPlatformResponder {
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
x, y, absX, absY, jmodifiers, jclickCount,
jpopupTrigger, null);
}
/**
* Handles scroll events.
*/
void handleScrollEvent(final int x, final int y, final int modifierFlags,
void handleScrollEvent(final int x, final int y, final int absX,
final int absY, final int modifierFlags,
final double deltaX, final double deltaY) {
final int buttonNumber = CocoaConstants.kCGMouseButtonCenter;
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
@ -97,18 +97,19 @@ final class CPlatformResponder {
// Vertical scroll.
if (!isShift && deltaY != 0.0) {
dispatchScrollEvent(x, y, jmodifiers, deltaY);
dispatchScrollEvent(x, y, absX, absY, jmodifiers, deltaY);
}
// Horizontal scroll or shirt+vertical scroll.
final double delta = isShift && deltaY != 0.0 ? deltaY : deltaX;
if (delta != 0.0) {
jmodifiers |= InputEvent.SHIFT_DOWN_MASK;
dispatchScrollEvent(x, y, jmodifiers, delta);
dispatchScrollEvent(x, y, absX, absY, jmodifiers, delta);
}
}
private void dispatchScrollEvent(final int x, final int y,
final int modifiers, final double delta) {
private void dispatchScrollEvent(final int x, final int y, final int absX,
final int absY, final int modifiers,
final double delta) {
final long when = System.currentTimeMillis();
final int scrollType = MouseWheelEvent.WHEEL_UNIT_SCROLL;
final int scrollAmount = 1;
@ -118,8 +119,9 @@ final class CPlatformResponder {
wheelRotation = signum;
}
// invert the wheelRotation for the peer
eventNotifier.notifyMouseWheelEvent(when, x, y, modifiers, scrollType,
scrollAmount, -wheelRotation, -delta, null);
eventNotifier.notifyMouseWheelEvent(when, x, y, absX, absY, modifiers,
scrollType, scrollAmount,
-wheelRotation, -delta, null);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@ -186,16 +186,19 @@ public class CPlatformView extends CFRetainedResource {
}
private void deliverMouseEvent(NSEvent event) {
private void deliverMouseEvent(final NSEvent event) {
int x = event.getX();
int y = getBounds().height - event.getY();
int absX = event.getAbsX();
int absY = event.getAbsY();
if (event.getType() == CocoaConstants.NSScrollWheel) {
responder.handleScrollEvent(x, y, event.getModifierFlags(),
responder.handleScrollEvent(x, y, absX, absY, event.getModifierFlags(),
event.getScrollDeltaX(), event.getScrollDeltaY());
} else {
responder.handleMouseEvent(event.getType(), event.getModifierFlags(), event.getButtonNumber(),
event.getClickCount(), x, y, event.getAbsX(), event.getAbsY());
event.getClickCount(), x, y,
absX, absY);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. 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
@ -173,7 +173,7 @@ public final class CWarningWindow extends CPlatformWindow
@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
int screenX, int screenY, int modifiers,
int absX, int absY, int modifiers,
int clickCount, boolean popupTrigger,
byte[] bdata) {
LWWindowPeer peer = ownerPeer.get();
@ -239,9 +239,10 @@ public final class CWarningWindow extends CPlatformWindow
}
@Override
public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
int scrollType, int scrollAmount,
int wheelRotation, double preciseWheelRotation,
public void notifyMouseWheelEvent(long when, int x, int y, int absX,
int absY, int modifiers, int scrollType,
int scrollAmount, int wheelRotation,
double preciseWheelRotation,
byte[] bdata) {
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@ -71,7 +71,7 @@ static long eventCount;
return eventCount;
}
+ (void) eventCountPlusPlus{
+ (void) eventCountPlusPlus{
eventCount++;
}
@ -167,7 +167,7 @@ static void setUpAWTAppKit(BOOL installObservers)
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
setBusy(YES);
});
CFRunLoopObserverRef notBusyObserver = CFRunLoopObserverCreateWithHandler(
NULL, // CFAllocator
kCFRunLoopBeforeWaiting, // CFOptionFlags
@ -176,14 +176,14 @@ static void setUpAWTAppKit(BOOL installObservers)
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
setBusy(NO);
});
CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
CFRelease(busyObserver);
CFRelease(notBusyObserver);
setBusy(YES);
}
@ -344,19 +344,19 @@ static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
// We're either embedded, or showing a splash screen
if (isEmbedded) {
AWT_STARTUP_LOG(@"running embedded");
// We don't track if the runloop is busy, so set it free to let AWT finish when it needs
setBusy(NO);
} else {
AWT_STARTUP_LOG(@"running after showing a splash screen");
}
// Signal so that JNI_OnLoad can proceed.
if (!wasOnMainThread) [AWTStarter appKitIsRunning:nil];
// Proceed to exit this call as there is no reason to run the NSApplication event loop.
}
[pool drain];
}
@ -370,24 +370,34 @@ static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue
(JNIEnv *env, jobject self, jlong timeout)
{
int currentEventNum = [AWTToolkit getEventCount];
long currentEventNum = [AWTToolkit getEventCount];
NSApplication* sharedApp = [NSApplication sharedApplication];
if ([sharedApp isKindOfClass:[NSApplicationAWT class]]) {
NSApplicationAWT* theApp = (NSApplicationAWT*)sharedApp;
[theApp postDummyEvent];
[theApp waitForDummyEvent:timeout];
// We use two different API to post events to the application,
// - [NSApplication postEvent]
// - CGEventPost(), see CRobot.m
// It was found that if we post an event via CGEventPost in robot and
// immediately after this we will post the second event via
// [NSApp postEvent] then sometimes the second event will be handled
// first. The opposite isn't proved, but we use both here to be safer.
[theApp postDummyEvent:false];
[theApp waitForDummyEvent:timeout / 2.0];
[theApp postDummyEvent:true];
[theApp waitForDummyEvent:timeout / 2.0];
} else {
// could happen if we are embedded inside SWT application,
// in this case just spin a single empty block through
// in this case just spin a single empty block through
// the event loop to give it a chance to process pending events
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){}];
}
if (([AWTToolkit getEventCount] - currentEventNum) != 0) {
return JNI_TRUE;
}
return JNI_FALSE;
}
@ -516,7 +526,7 @@ JNF_COCOA_ENTER(env);
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.010]];
if (processEvents) {
//We do not spin a runloop here as date is nil, so does not matter which mode to use
// Processing all events excluding NSApplicationDefined which need to be processed
// Processing all events excluding NSApplicationDefined which need to be processed
// on the main loop only (those events are intended for disposing resources)
NSEvent *event;
if ((event = [NSApp nextEventMatchingMask:(NSAnyEventMask & ~NSApplicationDefined)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@ -36,9 +36,9 @@
- (void) finishLaunching;
- (void) registerWithProcessManager;
- (void) setDockIconWithEnv:(JNIEnv *)env;
- (void) postDummyEvent;
- (void) postDummyEvent:(bool) useCocoa;
- (void) postRunnableEvent:(void (^)())block;
- (void) waitForDummyEvent:(long long) timeout;
- (void) waitForDummyEvent:(double) timeout;
+ (void) runAWTLoopWithApp:(NSApplication*)app;

View File

@ -349,6 +349,7 @@ AWT_ASSERT_APPKIT_THREAD;
&& [event subtype] == NativeSyncQueueEvent) {
[seenDummyEventLock lockWhenCondition:NO];
[seenDummyEventLock unlockWithCondition:YES];
} else if ([event type] == NSApplicationDefined && [event subtype] == ExecuteBlockEvent) {
void (^block)() = (void (^)()) [event data1];
block();
@ -387,9 +388,7 @@ AWT_ASSERT_APPKIT_THREAD;
[pool drain];
}
- (void)postDummyEvent {
- (void)postDummyEvent:(bool)useCocoa {
seenDummyEventLock = [[NSConditionLock alloc] initWithCondition:NO];
dummyEventTimestamp = [NSProcessInfo processInfo].systemUptime;
@ -403,19 +402,28 @@ AWT_ASSERT_APPKIT_THREAD;
subtype: NativeSyncQueueEvent
data1: 0
data2: 0];
[NSApp postEvent: event atStart: NO];
if (useCocoa) {
[NSApp postEvent:event atStart:NO];
} else {
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
CGEventPostToPSN(&psn, [event CGEvent]);
}
[pool drain];
}
- (void)waitForDummyEvent:(long long) timeout {
- (void)waitForDummyEvent:(double)timeout {
bool unlock = true;
if (timeout >= 0) {
double sec = ((double) timeout)/1000;
[seenDummyEventLock lockWhenCondition:YES
double sec = timeout / 1000;
unlock = [seenDummyEventLock lockWhenCondition:YES
beforeDate:[NSDate dateWithTimeIntervalSinceNow:sec]];
} else {
[seenDummyEventLock lockWhenCondition:YES];
}
[seenDummyEventLock unlock];
if (unlock) {
[seenDummyEventLock unlock];
}
[seenDummyEventLock release];
seenDummyEventLock = nil;

View File

@ -55,8 +55,8 @@ public interface AppletContext {
AudioClip getAudioClip(URL url);
/**
* Returns an <code>Image</code> object that can then be painted on
* the screen. The <code>url</code> argument that is
* Returns an {@code Image} object that can then be painted on
* the screen. The {@code url} argument that is
* passed as an argument must specify an absolute URL.
* <p>
* This method always returns immediately, whether or not the image
@ -73,10 +73,10 @@ public interface AppletContext {
/**
* Finds and returns the applet in the document represented by this
* applet context with the given name. The name can be set in the
* HTML tag by setting the <code>name</code> attribute.
* HTML tag by setting the {@code name} attribute.
*
* @param name an applet name.
* @return the applet with the given name, or <code>null</code> if
* @return the applet with the given name, or {@code null} if
* not found.
*/
Applet getApplet(String name);
@ -92,7 +92,7 @@ public interface AppletContext {
/**
* Requests that the browser or applet viewer show the Web page
* indicated by the <code>url</code> argument. The browser or
* indicated by the {@code url} argument. The browser or
* applet viewer determines which window or frame to display the
* Web page. This method may be ignored by applet contexts that
* are not browsers.
@ -103,22 +103,22 @@ public interface AppletContext {
/**
* Requests that the browser or applet viewer show the Web page
* indicated by the <code>url</code> argument. The
* <code>target</code> argument indicates in which HTML frame the
* indicated by the {@code url} argument. The
* {@code target} argument indicates in which HTML frame the
* document is to be displayed.
* The target argument is interpreted as follows:
*
* <center><table border="3" summary="Target arguments and their descriptions">
* <tr><th>Target Argument</th><th>Description</th></tr>
* <tr><td><code>"_self"</code> <td>Show in the window and frame that
* <tr><td>{@code "_self"} <td>Show in the window and frame that
* contain the applet.</tr>
* <tr><td><code>"_parent"</code><td>Show in the applet's parent frame. If
* <tr><td>{@code "_parent"}<td>Show in the applet's parent frame. If
* the applet's frame has no parent frame,
* acts the same as "_self".</tr>
* <tr><td><code>"_top"</code> <td>Show in the top-level frame of the applet's
* <tr><td>{@code "_top"} <td>Show in the top-level frame of the applet's
* window. If the applet's frame is the
* top-level frame, acts the same as "_self".</tr>
* <tr><td><code>"_blank"</code> <td>Show in a new, unnamed
* <tr><td>{@code "_blank"} <td>Show in a new, unnamed
* top-level window.</tr>
* <tr><td><i>name</i><td>Show in the frame or window named <i>name</i>. If
* a target named <i>name</i> does not already exist, a
@ -126,10 +126,10 @@ public interface AppletContext {
* and the document is shown there.</tr>
* </table> </center>
* <p>
* An applet viewer or browser is free to ignore <code>showDocument</code>.
* An applet viewer or browser is free to ignore {@code showDocument}.
*
* @param url an absolute URL giving the location of the document.
* @param target a <code>String</code> indicating where to display
* @param target a {@code String} indicating where to display
* the page.
*/
public void showDocument(URL url, String target);
@ -155,7 +155,7 @@ public interface AppletContext {
*
* @param key key with which the specified value is to be associated.
* @param stream stream to be associated with the specified key. If this
* parameter is <code>null</code>, the specified key is removed
* parameter is {@code null}, the specified key is removed
* in this applet context.
* @throws IOException if the stream size exceeds a certain
* size limit. Size limit is decided by the implementor of this
@ -166,7 +166,7 @@ public interface AppletContext {
/**
* Returns the stream to which specified key is associated within this
* applet context. Returns <tt>null</tt> if the applet context contains
* applet context. Returns {@code null} if the applet context contains
* no stream for this key.
* <p>
* For security reasons, mapping of streams and keys exists for each

View File

@ -28,7 +28,7 @@ import java.net.URL;
/**
* When an applet is first created, an applet stub is attached to it
* using the applet's <code>setStub</code> method. This stub
* using the applet's {@code setStub} method. This stub
* serves as the interface between the applet and the browser
* environment or applet viewer environment in which the application
* is running.
@ -40,11 +40,11 @@ import java.net.URL;
public interface AppletStub {
/**
* Determines if the applet is active. An applet is active just
* before its <code>start</code> method is called. It becomes
* inactive just before its <code>stop</code> method is called.
* before its {@code start} method is called. It becomes
* inactive just before its {@code stop} method is called.
*
* @return <code>true</code> if the applet is active;
* <code>false</code> otherwise.
* @return {@code true} if the applet is active;
* {@code false} otherwise.
*/
boolean isActive();
@ -85,12 +85,12 @@ public interface AppletStub {
* &lt;/applet&gt;
* </pre></blockquote>
* <p>
* then a call to <code>getParameter("Color")</code> returns the
* value <code>"blue"</code>.
* then a call to {@code getParameter("Color")} returns the
* value {@code "blue"}.
*
* @param name a parameter name.
* @return the value of the named parameter,
* or <tt>null</tt> if not set.
* or {@code null} if not set.
*/
String getParameter(String name);

View File

@ -30,14 +30,14 @@ import java.beans.ConstructorProperties;
import java.lang.annotation.Native;
/**
* The <code>BasicStroke</code> class defines a basic set of rendering
* The {@code BasicStroke} class defines a basic set of rendering
* attributes for the outlines of graphics primitives, which are rendered
* with a {@link Graphics2D} object that has its Stroke attribute set to
* this <code>BasicStroke</code>.
* The rendering attributes defined by <code>BasicStroke</code> describe
* this {@code BasicStroke}.
* The rendering attributes defined by {@code BasicStroke} describe
* the shape of the mark made by a pen drawn along the outline of a
* {@link Shape} and the decorations applied at the ends and joins of
* path segments of the <code>Shape</code>.
* path segments of the {@code Shape}.
* These rendering attributes include:
* <dl>
* <dt><i>width</i>
@ -73,32 +73,32 @@ import java.lang.annotation.Native;
* </dl>
* All attributes that specify measurements and distances controlling
* the shape of the returned outline are measured in the same
* coordinate system as the original unstroked <code>Shape</code>
* argument. When a <code>Graphics2D</code> object uses a
* <code>Stroke</code> object to redefine a path during the execution
* of one of its <code>draw</code> methods, the geometry is supplied
* in its original form before the <code>Graphics2D</code> transform
* coordinate system as the original unstroked {@code Shape}
* argument. When a {@code Graphics2D} object uses a
* {@code Stroke} object to redefine a path during the execution
* of one of its {@code draw} methods, the geometry is supplied
* in its original form before the {@code Graphics2D} transform
* attribute is applied. Therefore, attributes such as the pen width
* are interpreted in the user space coordinate system of the
* <code>Graphics2D</code> object and are subject to the scaling and
* {@code Graphics2D} object and are subject to the scaling and
* shearing effects of the user-space-to-device-space transform in that
* particular <code>Graphics2D</code>.
* particular {@code Graphics2D}.
* For example, the width of a rendered shape's outline is determined
* not only by the width attribute of this <code>BasicStroke</code>,
* not only by the width attribute of this {@code BasicStroke},
* but also by the transform attribute of the
* <code>Graphics2D</code> object. Consider this code:
* <blockquote><tt>
* {@code Graphics2D} object. Consider this code:
* <blockquote><pre>{@code
* // sets the Graphics2D object's Transform attribute
* g2d.scale(10, 10);
* // sets the Graphics2D object's Stroke attribute
* g2d.setStroke(new BasicStroke(1.5f));
* </tt></blockquote>
* }</pre></blockquote>
* Assuming there are no other scaling transforms added to the
* <code>Graphics2D</code> object, the resulting line
* {@code Graphics2D} object, the resulting line
* will be approximately 15 pixels wide.
* As the example code demonstrates, a floating-point line
* offers better precision, especially when large transforms are
* used with a <code>Graphics2D</code> object.
* used with a {@code Graphics2D} object.
* When a line is diagonal, the exact width depends on how the
* rendering pipeline chooses which pixels to fill as it traces the
* theoretical widened outline. The choice of which pixels to turn
@ -107,7 +107,7 @@ import java.lang.annotation.Native;
* partially-covered pixels.
* <p>
* For more information on the user space coordinate system and the
* rendering process, see the <code>Graphics2D</code> class comments.
* rendering process, see the {@code Graphics2D} class comments.
* @see Graphics2D
* @author Jim Graham
*/
@ -161,30 +161,30 @@ public class BasicStroke implements Stroke {
float dash_phase;
/**
* Constructs a new <code>BasicStroke</code> with the specified
* Constructs a new {@code BasicStroke} with the specified
* attributes.
* @param width the width of this <code>BasicStroke</code>. The
* @param width the width of this {@code BasicStroke}. The
* width must be greater than or equal to 0.0f. If width is
* set to 0.0f, the stroke is rendered as the thinnest
* possible line for the target device and the antialias
* hint setting.
* @param cap the decoration of the ends of a <code>BasicStroke</code>
* @param cap the decoration of the ends of a {@code BasicStroke}
* @param join the decoration applied where path segments meet
* @param miterlimit the limit to trim the miter join. The miterlimit
* must be greater than or equal to 1.0f.
* @param dash the array representing the dashing pattern
* @param dash_phase the offset to start the dashing pattern
* @throws IllegalArgumentException if <code>width</code> is negative
* @throws IllegalArgumentException if <code>cap</code> is not either
* @throws IllegalArgumentException if {@code width} is negative
* @throws IllegalArgumentException if {@code cap} is not either
* CAP_BUTT, CAP_ROUND or CAP_SQUARE
* @throws IllegalArgumentException if <code>miterlimit</code> is less
* than 1 and <code>join</code> is JOIN_MITER
* @throws IllegalArgumentException if <code>join</code> is not
* @throws IllegalArgumentException if {@code miterlimit} is less
* than 1 and {@code join} is JOIN_MITER
* @throws IllegalArgumentException if {@code join} is not
* either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
* @throws IllegalArgumentException if <code>dash_phase</code>
* is negative and <code>dash</code> is not <code>null</code>
* @throws IllegalArgumentException if {@code dash_phase}
* is negative and {@code dash} is not {@code null}
* @throws IllegalArgumentException if the length of
* <code>dash</code> is zero
* {@code dash} is zero
* @throws IllegalArgumentException if dash lengths are all zero.
*/
@ConstructorProperties({ "lineWidth", "endCap", "lineJoin", "miterLimit", "dashArray", "dashPhase" })
@ -231,18 +231,18 @@ public class BasicStroke implements Stroke {
}
/**
* Constructs a solid <code>BasicStroke</code> with the specified
* Constructs a solid {@code BasicStroke} with the specified
* attributes.
* @param width the width of the <code>BasicStroke</code>
* @param cap the decoration of the ends of a <code>BasicStroke</code>
* @param width the width of the {@code BasicStroke}
* @param cap the decoration of the ends of a {@code BasicStroke}
* @param join the decoration applied where path segments meet
* @param miterlimit the limit to trim the miter join
* @throws IllegalArgumentException if <code>width</code> is negative
* @throws IllegalArgumentException if <code>cap</code> is not either
* @throws IllegalArgumentException if {@code width} is negative
* @throws IllegalArgumentException if {@code cap} is not either
* CAP_BUTT, CAP_ROUND or CAP_SQUARE
* @throws IllegalArgumentException if <code>miterlimit</code> is less
* than 1 and <code>join</code> is JOIN_MITER
* @throws IllegalArgumentException if <code>join</code> is not
* @throws IllegalArgumentException if {@code miterlimit} is less
* than 1 and {@code join} is JOIN_MITER
* @throws IllegalArgumentException if {@code join} is not
* either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
*/
public BasicStroke(float width, int cap, int join, float miterlimit) {
@ -250,17 +250,17 @@ public class BasicStroke implements Stroke {
}
/**
* Constructs a solid <code>BasicStroke</code> with the specified
* attributes. The <code>miterlimit</code> parameter is
* Constructs a solid {@code BasicStroke} with the specified
* attributes. The {@code miterlimit} parameter is
* unnecessary in cases where the default is allowable or the
* line joins are not specified as JOIN_MITER.
* @param width the width of the <code>BasicStroke</code>
* @param cap the decoration of the ends of a <code>BasicStroke</code>
* @param width the width of the {@code BasicStroke}
* @param cap the decoration of the ends of a {@code BasicStroke}
* @param join the decoration applied where path segments meet
* @throws IllegalArgumentException if <code>width</code> is negative
* @throws IllegalArgumentException if <code>cap</code> is not either
* @throws IllegalArgumentException if {@code width} is negative
* @throws IllegalArgumentException if {@code cap} is not either
* CAP_BUTT, CAP_ROUND or CAP_SQUARE
* @throws IllegalArgumentException if <code>join</code> is not
* @throws IllegalArgumentException if {@code join} is not
* either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
*/
public BasicStroke(float width, int cap, int join) {
@ -268,18 +268,18 @@ public class BasicStroke implements Stroke {
}
/**
* Constructs a solid <code>BasicStroke</code> with the specified
* Constructs a solid {@code BasicStroke} with the specified
* line width and with default values for the cap and join
* styles.
* @param width the width of the <code>BasicStroke</code>
* @throws IllegalArgumentException if <code>width</code> is negative
* @param width the width of the {@code BasicStroke}
* @throws IllegalArgumentException if {@code width} is negative
*/
public BasicStroke(float width) {
this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f);
}
/**
* Constructs a new <code>BasicStroke</code> with defaults for all
* Constructs a new {@code BasicStroke} with defaults for all
* attributes.
* The default attributes are a solid line of width 1.0, CAP_SQUARE,
* JOIN_MITER, a miter limit of 10.0.
@ -290,10 +290,10 @@ public class BasicStroke implements Stroke {
/**
* Returns a <code>Shape</code> whose interior defines the
* stroked outline of a specified <code>Shape</code>.
* @param s the <code>Shape</code> boundary be stroked
* @return the <code>Shape</code> of the stroked outline.
* Returns a {@code Shape} whose interior defines the
* stroked outline of a specified {@code Shape}.
* @param s the {@code Shape} boundary be stroked
* @return the {@code Shape} of the stroked outline.
*/
public Shape createStrokedShape(Shape s) {
sun.java2d.pipe.RenderingEngine re =
@ -305,9 +305,9 @@ public class BasicStroke implements Stroke {
/**
* Returns the line width. Line width is represented in user space,
* which is the default-coordinate space used by Java 2D. See the
* <code>Graphics2D</code> class comments for more information on
* {@code Graphics2D} class comments for more information on
* the user space coordinate system.
* @return the line width of this <code>BasicStroke</code>.
* @return the line width of this {@code BasicStroke}.
* @see Graphics2D
*/
public float getLineWidth() {
@ -316,8 +316,8 @@ public class BasicStroke implements Stroke {
/**
* Returns the end cap style.
* @return the end cap style of this <code>BasicStroke</code> as one
* of the static <code>int</code> values that define possible end cap
* @return the end cap style of this {@code BasicStroke} as one
* of the static {@code int} values that define possible end cap
* styles.
*/
public int getEndCap() {
@ -326,8 +326,8 @@ public class BasicStroke implements Stroke {
/**
* Returns the line join style.
* @return the line join style of the <code>BasicStroke</code> as one
* of the static <code>int</code> values that define possible line
* @return the line join style of the {@code BasicStroke} as one
* of the static {@code int} values that define possible line
* join styles.
*/
public int getLineJoin() {
@ -336,7 +336,7 @@ public class BasicStroke implements Stroke {
/**
* Returns the limit of miter joins.
* @return the limit of miter joins of the <code>BasicStroke</code>.
* @return the limit of miter joins of the {@code BasicStroke}.
*/
public float getMiterLimit() {
return miterlimit;
@ -346,7 +346,7 @@ public class BasicStroke implements Stroke {
* Returns the array representing the lengths of the dash segments.
* Alternate entries in the array represent the user space lengths
* of the opaque and transparent segments of the dashes.
* As the pen moves along the outline of the <code>Shape</code>
* As the pen moves along the outline of the {@code Shape}
* to be stroked, the user space
* distance that the pen travels is accumulated. The distance
* value is used to index into the dash array.
@ -368,7 +368,7 @@ public class BasicStroke implements Stroke {
* represents an offset into the dashing pattern. In other words, the dash
* phase defines the point in the dashing pattern that will correspond to
* the beginning of the stroke.
* @return the dash phase as a <code>float</code> value.
* @return the dash phase as a {@code float} value.
*/
public float getDashPhase() {
return dash_phase;
@ -397,15 +397,15 @@ public class BasicStroke implements Stroke {
* stroking operation as the given argument.
*/
/**
* Tests if a specified object is equal to this <code>BasicStroke</code>
* by first testing if it is a <code>BasicStroke</code> and then comparing
* Tests if a specified object is equal to this {@code BasicStroke}
* by first testing if it is a {@code BasicStroke} and then comparing
* its width, join, cap, miter limit, dash, and dash phase attributes with
* those of this <code>BasicStroke</code>.
* those of this {@code BasicStroke}.
* @param obj the specified object to compare to this
* <code>BasicStroke</code>
* @return <code>true</code> if the width, join, cap, miter limit, dash, and
* {@code BasicStroke}
* @return {@code true} if the width, join, cap, miter limit, dash, and
* dash phase are the same for both objects;
* <code>false</code> otherwise.
* {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (!(obj instanceof BasicStroke)) {

View File

@ -25,10 +25,10 @@
package java.awt;
/**
* The <code>CheckboxGroup</code> class is used to group together
* a set of <code>Checkbox</code> buttons.
* The {@code CheckboxGroup} class is used to group together
* a set of {@code Checkbox} buttons.
* <p>
* Exactly one check box button in a <code>CheckboxGroup</code> can
* Exactly one check box button in a {@code CheckboxGroup} can
* be in the "on" state at any given time. Pushing any
* button sets its state to "on" and forces any other button that
* is in the "on" state into the "off" state.
@ -69,7 +69,7 @@ public class CheckboxGroup implements java.io.Serializable {
private static final long serialVersionUID = 3729780091441768983L;
/**
* Creates a new instance of <code>CheckboxGroup</code>.
* Creates a new instance of {@code CheckboxGroup}.
*/
public CheckboxGroup() {
}
@ -78,10 +78,10 @@ public class CheckboxGroup implements java.io.Serializable {
* Gets the current choice from this check box group.
* The current choice is the check box in this
* group that is currently in the "on" state,
* or <code>null</code> if all check boxes in the
* or {@code null} if all check boxes in the
* group are off.
* @return the check box that is currently in the
* "on" state, or <code>null</code>.
* "on" state, or {@code null}.
* @see java.awt.Checkbox
* @see java.awt.CheckboxGroup#setSelectedCheckbox
* @since 1.1
@ -96,7 +96,7 @@ public class CheckboxGroup implements java.io.Serializable {
*
* @return the selected checkbox
* @deprecated As of JDK version 1.1,
* replaced by <code>getSelectedCheckbox()</code>.
* replaced by {@code getSelectedCheckbox()}.
*/
@Deprecated
public Checkbox getCurrent() {
@ -109,11 +109,11 @@ public class CheckboxGroup implements java.io.Serializable {
* This method sets the state of that check box to "on" and
* sets all other check boxes in the group to be off.
* <p>
* If the check box argument is <tt>null</tt>, all check boxes
* If the check box argument is {@code null}, all check boxes
* in this check box group are deselected. If the check box argument
* belongs to a different check box group, this method does
* nothing.
* @param box the <code>Checkbox</code> to set as the
* @param box the {@code Checkbox} to set as the
* current selection.
* @see java.awt.Checkbox
* @see java.awt.CheckboxGroup#getSelectedCheckbox
@ -130,7 +130,7 @@ public class CheckboxGroup implements java.io.Serializable {
* @param box the {@code Checkbox} to set as the
* current selection.
* @deprecated As of JDK version 1.1,
* replaced by <code>setSelectedCheckbox(Checkbox)</code>.
* replaced by {@code setSelectedCheckbox(Checkbox)}.
*/
@Deprecated
public synchronized void setCurrent(Checkbox box) {

View File

@ -26,7 +26,7 @@
package java.awt;
/**
* The <code>GridLayout</code> class is a layout manager that
* The {@code GridLayout} class is a layout manager that
* lays out a container's components in a rectangular grid.
* The container is divided into equal-sized rectangles,
* and one component is placed in each rectangle.
@ -50,9 +50,9 @@ package java.awt;
* }
* </pre></blockquote><hr>
* <p>
* If the container's <code>ComponentOrientation</code> property is horizontal
* If the container's {@code ComponentOrientation} property is horizontal
* and left-to-right, the above example produces the output shown in Figure 1.
* If the container's <code>ComponentOrientation</code> property is horizontal
* If the container's {@code ComponentOrientation} property is horizontal
* and right-to-left, the example produces the output shown in Figure 2.
*
* <table style="float:center" WIDTH=600 summary="layout">
@ -77,7 +77,7 @@ package java.awt;
* <p>
* When both the number of rows and the number of columns have
* been set to non-zero values, either by a constructor or
* by the <tt>setRows</tt> and <tt>setColumns</tt> methods, the number of
* by the {@code setRows} and {@code setColumns} methods, the number of
* columns specified is ignored. Instead, the number of
* columns is determined from the specified number of rows
* and the total number of components in the layout. So, for
@ -154,7 +154,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* Creates a grid layout with the specified number of rows and
* columns. All components in the layout are given equal size.
* <p>
* One, but not both, of <code>rows</code> and <code>cols</code> can
* One, but not both, of {@code rows} and {@code cols} can
* be zero, which means that any number of objects can be placed in a
* row or in a column.
* @param rows the rows, with the value zero meaning
@ -175,11 +175,11 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* of the columns. Vertical gaps are placed between each of
* the rows.
* <p>
* One, but not both, of <code>rows</code> and <code>cols</code> can
* One, but not both, of {@code rows} and {@code cols} can
* be zero, which means that any number of objects can be placed in a
* row or in a column.
* <p>
* All <code>GridLayout</code> constructors defer to this one.
* All {@code GridLayout} constructors defer to this one.
* @param rows the rows, with the value zero meaning
* any number of rows
* @param cols the columns, with the value zero meaning
@ -187,7 +187,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* @param hgap the horizontal gap
* @param vgap the vertical gap
* @exception IllegalArgumentException if the value of both
* <code>rows</code> and <code>cols</code> is
* {@code rows} and {@code cols} is
* set to zero
*/
public GridLayout(int rows, int cols, int hgap, int vgap) {
@ -213,7 +213,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* Sets the number of rows in this layout to the specified value.
* @param rows the number of rows in this layout
* @exception IllegalArgumentException if the value of both
* <code>rows</code> and <code>cols</code> is set to zero
* {@code rows} and {@code cols} is set to zero
* @since 1.1
*/
public void setRows(int rows) {
@ -236,12 +236,12 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* Sets the number of columns in this layout to the specified value.
* Setting the number of columns has no affect on the layout
* if the number of rows specified by a constructor or by
* the <tt>setRows</tt> method is non-zero. In that case, the number
* the {@code setRows} method is non-zero. In that case, the number
* of columns displayed in the layout is determined by the total
* number of components and the number of rows specified.
* @param cols the number of columns in this layout
* @exception IllegalArgumentException if the value of both
* <code>rows</code> and <code>cols</code> is set to zero
* {@code rows} and {@code cols} is set to zero
* @since 1.1
*/
public void setColumns(int cols) {
@ -405,7 +405,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* <p>
* This method reshapes the components in the specified target
* container in order to satisfy the constraints of the
* <code>GridLayout</code> object.
* {@code GridLayout} object.
* <p>
* The grid layout manager determines the size of individual
* components by dividing the free space in the container into

View File

@ -53,6 +53,7 @@ import sun.awt.AWTAccessor;
import sun.awt.AWTPermissions;
import sun.awt.AppContext;
import sun.awt.CausedFocusEvent;
import sun.awt.DebugSettings;
import sun.awt.SunToolkit;
import sun.awt.util.IdentityArrayList;
import sun.java2d.pipe.Region;
@ -2159,11 +2160,13 @@ public class Window extends Container implements Accessible {
* @param e the keyboard event
*/
void preProcessKeyEvent(KeyEvent e) {
// Dump the list of child windows to System.out.
if (e.isActionKey() && e.getKeyCode() == KeyEvent.VK_F1 &&
e.isControlDown() && e.isShiftDown() &&
e.getID() == KeyEvent.KEY_PRESSED) {
list(System.out, 0);
// Dump the list of child windows to System.out if debug is enabled.
if (DebugSettings.getInstance().getBoolean("on", false)) {
if (e.isActionKey() && e.getKeyCode() == KeyEvent.VK_F1 &&
e.isControlDown() && e.isShiftDown() &&
e.getID() == KeyEvent.KEY_PRESSED) {
list(System.out, 0);
}
}
}

View File

@ -43,11 +43,11 @@ import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.DropTargetContextAccessor;
/**
* A <code>DropTargetContext</code> is created
* A {@code DropTargetContext} is created
* whenever the logical cursor associated
* with a Drag and Drop operation coincides with the visible geometry of
* a <code>Component</code> associated with a <code>DropTarget</code>.
* The <code>DropTargetContext</code> provides
* a {@code Component} associated with a {@code DropTarget}.
* The {@code DropTargetContext} provides
* the mechanism for a potential receiver
* of a drop operation to both provide the end user with the appropriate
* drag under feedback, but also to effect the subsequent data transfer
@ -74,8 +74,8 @@ public class DropTargetContext implements Serializable {
});
}
/**
* Construct a <code>DropTargetContext</code>
* given a specified <code>DropTarget</code>.
* Construct a {@code DropTargetContext}
* given a specified {@code DropTarget}.
*
* @param dt the DropTarget to associate with
*/
@ -87,17 +87,17 @@ public class DropTargetContext implements Serializable {
}
/**
* This method returns the <code>DropTarget</code> associated with this
* <code>DropTargetContext</code>.
* This method returns the {@code DropTarget} associated with this
* {@code DropTargetContext}.
*
* @return the <code>DropTarget</code> associated with this <code>DropTargetContext</code>
* @return the {@code DropTarget} associated with this {@code DropTargetContext}
*/
public DropTarget getDropTarget() { return dropTarget; }
/**
* This method returns the <code>Component</code> associated with
* this <code>DropTargetContext</code>.
* This method returns the {@code Component} associated with
* this {@code DropTargetContext}.
*
* @return the Component associated with this Context
*/
@ -105,7 +105,7 @@ public class DropTargetContext implements Serializable {
public Component getComponent() { return dropTarget.getComponent(); }
/**
* Called when disassociated with the <code>DropTargetContextPeer</code>.
* Called when disassociated with the {@code DropTargetContextPeer}.
*/
void reset() {
dropTargetContextPeer = null;
@ -114,9 +114,9 @@ public class DropTargetContext implements Serializable {
/**
* This method sets the current actions acceptable to
* this <code>DropTarget</code>.
* this {@code DropTarget}.
*
* @param actions an <code>int</code> representing the supported action(s)
* @param actions an {@code int} representing the supported action(s)
*/
protected void setTargetActions(int actions) {
@ -132,10 +132,10 @@ public class DropTargetContext implements Serializable {
}
/**
* This method returns an <code>int</code> representing the
* current actions this <code>DropTarget</code> will accept.
* This method returns an {@code int} representing the
* current actions this {@code DropTarget} will accept.
*
* @return the current actions acceptable to this <code>DropTarget</code>
* @return the current actions acceptable to this {@code DropTarget}
*/
protected int getTargetActions() {
@ -215,11 +215,11 @@ public class DropTargetContext implements Serializable {
/**
* get the available DataFlavors of the
* <code>Transferable</code> operand of this operation.
* {@code Transferable} operand of this operation.
*
* @return a <code>DataFlavor[]</code> containing the
* supported <code>DataFlavor</code>s of the
* <code>Transferable</code> operand.
* @return a {@code DataFlavor[]} containing the
* supported {@code DataFlavor}s of the
* {@code Transferable} operand.
*/
protected DataFlavor[] getCurrentDataFlavors() {
@ -229,11 +229,11 @@ public class DropTargetContext implements Serializable {
/**
* This method returns a the currently available DataFlavors
* of the <code>Transferable</code> operand
* as a <code>java.util.List</code>.
* of the {@code Transferable} operand
* as a {@code java.util.List}.
*
* @return the currently available
* DataFlavors as a <code>java.util.List</code>
* DataFlavors as a {@code java.util.List}
*/
protected List<DataFlavor> getCurrentDataFlavorsAsList() {
@ -241,13 +241,13 @@ public class DropTargetContext implements Serializable {
}
/**
* This method returns a <code>boolean</code>
* indicating if the given <code>DataFlavor</code> is
* supported by this <code>DropTargetContext</code>.
* This method returns a {@code boolean}
* indicating if the given {@code DataFlavor} is
* supported by this {@code DropTargetContext}.
*
* @param df the <code>DataFlavor</code>
* @param df the {@code DataFlavor}
*
* @return if the <code>DataFlavor</code> specified is supported
* @return if the {@code DataFlavor} specified is supported
*/
protected boolean isDataFlavorSupported(DataFlavor df) {
@ -259,7 +259,7 @@ public class DropTargetContext implements Serializable {
*
* @throws InvalidDnDOperationException if a drag is not outstanding/extant
*
* @return the <code>Transferable</code>
* @return the {@code Transferable}
*/
protected Transferable getTransferable() throws InvalidDnDOperationException {
@ -282,7 +282,7 @@ public class DropTargetContext implements Serializable {
}
/**
* Get the <code>DropTargetContextPeer</code>
* Get the {@code DropTargetContextPeer}
*
* @return the platform peer
*/
@ -301,10 +301,10 @@ public class DropTargetContext implements Serializable {
* Creates a TransferableProxy to proxy for the specified
* Transferable.
*
* @param t the <tt>Transferable</tt> to be proxied
* @param local <tt>true</tt> if <tt>t</tt> represents
* @param t the {@code Transferable} to be proxied
* @param local {@code true} if {@code t} represents
* the result of a local drag-n-drop operation.
* @return the new <tt>TransferableProxy</tt> instance.
* @return the new {@code TransferableProxy} instance.
*/
protected Transferable createTransferableProxy(Transferable t, boolean local) {
return new TransferableProxy(t, local);
@ -314,9 +314,9 @@ public class DropTargetContext implements Serializable {
/**
* <code>TransferableProxy</code> is a helper inner class that implements
* <code>Transferable</code> interface and serves as a proxy for another
* <code>Transferable</code> object which represents data transfer for
* {@code TransferableProxy} is a helper inner class that implements
* {@code Transferable} interface and serves as a proxy for another
* {@code Transferable} object which represents data transfer for
* a particular drag-n-drop operation.
* <p>
* The proxy forwards all requests to the encapsulated transferable
@ -327,14 +327,14 @@ public class DropTargetContext implements Serializable {
protected class TransferableProxy implements Transferable {
/**
* Constructs a <code>TransferableProxy</code> given
* a specified <code>Transferable</code> object representing
* Constructs a {@code TransferableProxy} given
* a specified {@code Transferable} object representing
* data transfer for a particular drag-n-drop operation and
* a <code>boolean</code> which indicates whether the
* a {@code boolean} which indicates whether the
* drag-n-drop operation is local (within the same JVM).
*
* @param t the <code>Transferable</code> object
* @param local <code>true</code>, if <code>t</code> represents
* @param t the {@code Transferable} object
* @param local {@code true}, if {@code t} represents
* the result of local drag-n-drop operation
*/
TransferableProxy(Transferable t, boolean local) {
@ -358,8 +358,8 @@ public class DropTargetContext implements Serializable {
* Returns whether or not the specified data flavor is supported by
* the encapsulated transferable.
* @param flavor the requested flavor for the data
* @return <code>true</code> if the data flavor is supported,
* <code>false</code> otherwise
* @return {@code true} if the data flavor is supported,
* {@code false} otherwise
*/
public boolean isDataFlavorSupported(DataFlavor flavor) {
return proxy.isDataFlavorSupported(flavor);
@ -397,13 +397,13 @@ public class DropTargetContext implements Serializable {
// public constructor.
/**
* The encapsulated <code>Transferable</code> object.
* The encapsulated {@code Transferable} object.
*/
protected Transferable transferable;
/**
* A <code>boolean</code> indicating if the encapsulated
* <code>Transferable</code> object represents the result
* A {@code boolean} indicating if the encapsulated
* {@code Transferable} object represents the result
* of local drag-n-drop operation (within the same JVM).
*/
protected boolean isLocal;

View File

@ -31,16 +31,16 @@ import java.awt.ActiveEvent;
import java.awt.AWTEvent;
/**
* An event which executes the <code>run()</code> method on a <code>Runnable
* </code> when dispatched by the AWT event dispatcher thread. This class can
* be used as a reference implementation of <code>ActiveEvent</code> rather
* than declaring a new class and defining <code>dispatch()</code>.<p>
* An event which executes the {@code run()} method on a {@code Runnable
* } when dispatched by the AWT event dispatcher thread. This class can
* be used as a reference implementation of {@code ActiveEvent} rather
* than declaring a new class and defining {@code dispatch()}.<p>
*
* Instances of this class are placed on the <code>EventQueue</code> by calls
* to <code>invokeLater</code> and <code>invokeAndWait</code>. Client code
* can use this fact to write replacement functions for <code>invokeLater
* </code> and <code>invokeAndWait</code> without writing special-case code
* in any <code>AWTEventListener</code> objects.
* Instances of this class are placed on the {@code EventQueue} by calls
* to {@code invokeLater} and {@code invokeAndWait}. Client code
* can use this fact to write replacement functions for {@code invokeLater
* } and {@code invokeAndWait} without writing special-case code
* in any {@code AWTEventListener} objects.
* <p>
* An unspecified behavior will be caused if the {@code id} parameter
* of any particular {@code InvocationEvent} instance is not
@ -106,7 +106,7 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
private final Runnable listener;
/**
* Indicates whether the <code>run()</code> method of the <code>runnable</code>
* Indicates whether the {@code run()} method of the {@code runnable}
* was executed or not.
*
* @see #isDispatched
@ -149,20 +149,21 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
private static final long serialVersionUID = 436056344909459450L;
/**
* Constructs an <code>InvocationEvent</code> with the specified
* source which will execute the runnable's <code>run</code>
* Constructs an {@code InvocationEvent} with the specified
* source which will execute the runnable's {@code run}
* method when dispatched.
* <p>This is a convenience constructor. An invocation of the form
* <tt>InvocationEvent(source, runnable)</tt>
* {@code InvocationEvent(source, runnable)}
* behaves in exactly the same way as the invocation of
* <tt>{@link #InvocationEvent(Object, Runnable, Object, boolean) InvocationEvent}(source, runnable, null, false)</tt>.
* <p> This method throws an <code>IllegalArgumentException</code>
* if <code>source</code> is <code>null</code>.
* {@link #InvocationEvent(Object, Runnable, Object, boolean)
* InvocationEvent(source, runnable, null, false)}.
* <p> This method throws an {@code IllegalArgumentException}
* if {@code source} is {@code null}.
*
* @param source The <code>Object</code> that originated the event
* @param runnable The <code>Runnable</code> whose <code>run</code>
* @param source The {@code Object} that originated the event
* @param runnable The {@code Runnable} whose {@code run}
* method will be executed
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
*
* @see #getSource()
* @see #InvocationEvent(Object, Runnable, Object, boolean)
@ -172,35 +173,36 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
* Constructs an <code>InvocationEvent</code> with the specified
* source which will execute the runnable's <code>run</code>
* method when dispatched. If notifier is non-<code>null</code>,
* <code>notifyAll()</code> will be called on it
* immediately after <code>run</code> has returned or thrown an exception.
* <p>An invocation of the form <tt>InvocationEvent(source,
* runnable, notifier, catchThrowables)</tt>
* Constructs an {@code InvocationEvent} with the specified
* source which will execute the runnable's {@code run}
* method when dispatched. If notifier is non-{@code null},
* {@code notifyAll()} will be called on it
* immediately after {@code run} has returned or thrown an exception.
* <p>An invocation of the form
* {@code InvocationEvent(source, runnable, notifier, catchThrowables)}
* behaves in exactly the same way as the invocation of
* <tt>{@link #InvocationEvent(Object, int, Runnable, Object, boolean) InvocationEvent}(source, InvocationEvent.INVOCATION_DEFAULT, runnable, notifier, catchThrowables)</tt>.
* <p>This method throws an <code>IllegalArgumentException</code>
* if <code>source</code> is <code>null</code>.
* {@link #InvocationEvent(Object, int, Runnable, Object, boolean)
* InvocationEvent(source, InvocationEvent.INVOCATION_DEFAULT, runnable, notifier, catchThrowables)}.
* <p>This method throws an {@code IllegalArgumentException}
* if {@code source} is {@code null}.
*
* @param source The <code>Object</code> that originated
* @param source The {@code Object} that originated
* the event
* @param runnable The <code>Runnable</code> whose
* <code>run</code> method will be
* @param runnable The {@code Runnable} whose
* {@code run} method will be
* executed
* @param notifier The {@code Object} whose <code>notifyAll</code>
* @param notifier The {@code Object} whose {@code notifyAll}
* method will be called after
* <code>Runnable.run</code> has returned or
* {@code Runnable.run} has returned or
* thrown an exception or after the event was
* disposed
* @param catchThrowables Specifies whether <code>dispatch</code>
* @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing
* the <code>Runnable</code>'s <code>run</code>
* the {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
*
* @see #getSource()
* @see #InvocationEvent(Object, int, Runnable, Object, boolean)
@ -211,31 +213,31 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
* Constructs an <code>InvocationEvent</code> with the specified
* source which will execute the runnable's <code>run</code>
* method when dispatched. If listener is non-<code>null</code>,
* <code>listener.run()</code> will be called immediately after
* <code>run</code> has returned, thrown an exception or the event
* Constructs an {@code InvocationEvent} with the specified
* source which will execute the runnable's {@code run}
* method when dispatched. If listener is non-{@code null},
* {@code listener.run()} will be called immediately after
* {@code run} has returned, thrown an exception or the event
* was disposed.
* <p>This method throws an <code>IllegalArgumentException</code>
* if <code>source</code> is <code>null</code>.
* <p>This method throws an {@code IllegalArgumentException}
* if {@code source} is {@code null}.
*
* @param source The <code>Object</code> that originated
* @param source The {@code Object} that originated
* the event
* @param runnable The <code>Runnable</code> whose
* <code>run</code> method will be
* @param runnable The {@code Runnable} whose
* {@code run} method will be
* executed
* @param listener The <code>Runnable</code>Runnable whose
* <code>run()</code> method will be called
* @param listener The {@code Runnable}Runnable whose
* {@code run()} method will be called
* after the {@code InvocationEvent}
* was dispatched or disposed
* @param catchThrowables Specifies whether <code>dispatch</code>
* @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing
* the <code>Runnable</code>'s <code>run</code>
* the {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
*/
public InvocationEvent(Object source, Runnable runnable, Runnable listener,
boolean catchThrowables) {
@ -243,34 +245,34 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
* Constructs an <code>InvocationEvent</code> with the specified
* source and ID which will execute the runnable's <code>run</code>
* method when dispatched. If notifier is non-<code>null</code>,
* <code>notifyAll</code> will be called on it immediately after
* <code>run</code> has returned or thrown an exception.
* Constructs an {@code InvocationEvent} with the specified
* source and ID which will execute the runnable's {@code run}
* method when dispatched. If notifier is non-{@code null},
* {@code notifyAll} will be called on it immediately after
* {@code run} has returned or thrown an exception.
* <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
* {@code IllegalArgumentException} if {@code source}
* is {@code null}.
*
* @param source The <code>Object</code> that originated
* @param source The {@code Object} that originated
* the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link InvocationEvent}
* @param runnable The <code>Runnable</code> whose
* <code>run</code> method will be executed
* @param notifier The <code>Object</code> whose <code>notifyAll</code>
* @param runnable The {@code Runnable} whose
* {@code run} method will be executed
* @param notifier The {@code Object} whose {@code notifyAll}
* method will be called after
* <code>Runnable.run</code> has returned or
* {@code Runnable.run} has returned or
* thrown an exception or after the event was
* disposed
* @param catchThrowables Specifies whether <code>dispatch</code>
* @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing the
* <code>Runnable</code>'s <code>run</code>
* {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
*/
@ -289,8 +291,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
this.when = System.currentTimeMillis();
}
/**
* Executes the Runnable's <code>run()</code> method and notifies the
* notifier (if any) when <code>run()</code> has returned or thrown an exception.
* Executes the Runnable's {@code run()} method and notifies the
* notifier (if any) when {@code run()} has returned or thrown an exception.
*
* @see #isDispatched
*/
@ -316,8 +318,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
* Returns any Exception caught while executing the Runnable's <code>run()
* </code> method.
* Returns any Exception caught while executing
* the Runnable's {@code run()} method.
*
* @return A reference to the Exception if one was thrown; null if no
* Exception was thrown or if this InvocationEvent does not
@ -328,8 +330,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
* Returns any Throwable caught while executing the Runnable's <code>run()
* </code> method.
* Returns any Throwable caught while executing
* the Runnable's {@code run()} method.
*
* @return A reference to the Throwable if one was thrown; null if no
* Throwable was thrown or if this InvocationEvent does not

View File

@ -78,26 +78,26 @@ import sun.awt.SunToolkit;
* </ul>
* </ul>
* <P>
* A <code>MouseEvent</code> object is passed to every
* <code>MouseListener</code>
* or <code>MouseAdapter</code> object which is registered to receive
* A {@code MouseEvent} object is passed to every
* {@code MouseListener}
* or {@code MouseAdapter} object which is registered to receive
* the "interesting" mouse events using the component's
* <code>addMouseListener</code> method.
* (<code>MouseAdapter</code> objects implement the
* <code>MouseListener</code> interface.) Each such listener object
* gets a <code>MouseEvent</code> containing the mouse event.
* {@code addMouseListener} method.
* ({@code MouseAdapter} objects implement the
* {@code MouseListener} interface.) Each such listener object
* gets a {@code MouseEvent} containing the mouse event.
* <P>
* A <code>MouseEvent</code> object is also passed to every
* <code>MouseMotionListener</code> or
* <code>MouseMotionAdapter</code> object which is registered to receive
* A {@code MouseEvent} object is also passed to every
* {@code MouseMotionListener} or
* {@code MouseMotionAdapter} object which is registered to receive
* mouse motion events using the component's
* <code>addMouseMotionListener</code>
* method. (<code>MouseMotionAdapter</code> objects implement the
* <code>MouseMotionListener</code> interface.) Each such listener object
* gets a <code>MouseEvent</code> containing the mouse motion event.
* {@code addMouseMotionListener}
* method. ({@code MouseMotionAdapter} objects implement the
* {@code MouseMotionListener} interface.) Each such listener object
* gets a {@code MouseEvent} containing the mouse motion event.
* <P>
* When a mouse button is clicked, events are generated and sent to the
* registered <code>MouseListener</code>s.
* registered {@code MouseListener}s.
* The state of modal keys can be retrieved using {@link InputEvent#getModifiers}
* and {@link InputEvent#getModifiersEx}.
* The button mask returned by {@link InputEvent#getModifiers} reflects
@ -111,31 +111,31 @@ import sun.awt.SunToolkit;
* <P>
* For example, if the first mouse button is pressed, events are sent in the
* following order:
* <PRE>
* <b >id </b > <b >modifiers </b > <b >button </b >
* <code>MOUSE_PRESSED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
* <code>MOUSE_RELEASED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
* <code>MOUSE_CLICKED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
* </PRE>
* <pre><b>
* id modifiers button</b>{@code
* MOUSE_PRESSED: BUTTON1_MASK BUTTON1
* MOUSE_RELEASED: BUTTON1_MASK BUTTON1
* MOUSE_CLICKED: BUTTON1_MASK BUTTON1
* }</pre>
* When multiple mouse buttons are pressed, each press, release, and click
* results in a separate event.
* <P>
* For example, if the user presses <b>button 1</b> followed by
* <b>button 2</b>, and then releases them in the same order,
* the following sequence of events is generated:
* <PRE>
* <b >id </b > <b >modifiers </b > <b >button </b >
* <code>MOUSE_PRESSED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
* <code>MOUSE_PRESSED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code>
* <code>MOUSE_RELEASED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
* <code>MOUSE_CLICKED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
* <code>MOUSE_RELEASED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code>
* <code>MOUSE_CLICKED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code>
* </PRE>
* <pre><b>
* id modifiers button</b>{@code
* MOUSE_PRESSED: BUTTON1_MASK BUTTON1
* MOUSE_PRESSED: BUTTON2_MASK BUTTON2
* MOUSE_RELEASED: BUTTON1_MASK BUTTON1
* MOUSE_CLICKED: BUTTON1_MASK BUTTON1
* MOUSE_RELEASED: BUTTON2_MASK BUTTON2
* MOUSE_CLICKED: BUTTON2_MASK BUTTON2
* }</pre>
* If <b>button 2</b> is released first, the
* <code>MOUSE_RELEASED</code>/<code>MOUSE_CLICKED</code> pair
* for <code>BUTTON2_MASK</code> arrives first,
* followed by the pair for <code>BUTTON1_MASK</code>.
* {@code MOUSE_RELEASED}/{@code MOUSE_CLICKED} pair
* for {@code BUTTON2_MASK} arrives first,
* followed by the pair for {@code BUTTON1_MASK}.
* <p>
* Some extra mouse buttons are added to extend the standard set of buttons
* represented by the following constants:{@code BUTTON1}, {@code BUTTON2}, and {@code BUTTON3}.
@ -154,20 +154,20 @@ import sun.awt.SunToolkit;
* Drag&amp;Drop operation.
*
* In a multi-screen environment mouse drag events are delivered to the
* <code>Component</code> even if the mouse position is outside the bounds of the
* <code>GraphicsConfiguration</code> associated with that
* <code>Component</code>. However, the reported position for mouse drag events
* {@code Component} even if the mouse position is outside the bounds of the
* {@code GraphicsConfiguration} associated with that
* {@code Component}. However, the reported position for mouse drag events
* in this case may differ from the actual mouse position:
* <ul>
* <li>In a multi-screen environment without a virtual device:
* <br>
* The reported coordinates for mouse drag events are clipped to fit within the
* bounds of the <code>GraphicsConfiguration</code> associated with
* the <code>Component</code>.
* bounds of the {@code GraphicsConfiguration} associated with
* the {@code Component}.
* <li>In a multi-screen environment with a virtual device:
* <br>
* The reported coordinates for mouse drag events are clipped to fit within the
* bounds of the virtual device associated with the <code>Component</code>.
* bounds of the virtual device associated with the {@code Component}.
* </ul>
* <p>
* An unspecified behavior will be caused if the {@code id} parameter
@ -200,51 +200,51 @@ public class MouseEvent extends InputEvent {
public static final int MOUSE_LAST = 507;
/**
* The "mouse clicked" event. This <code>MouseEvent</code>
* The "mouse clicked" event. This {@code MouseEvent}
* occurs when a mouse button is pressed and released.
*/
public static final int MOUSE_CLICKED = MOUSE_FIRST;
/**
* The "mouse pressed" event. This <code>MouseEvent</code>
* The "mouse pressed" event. This {@code MouseEvent}
* occurs when a mouse button is pushed down.
*/
public static final int MOUSE_PRESSED = 1 + MOUSE_FIRST; //Event.MOUSE_DOWN
/**
* The "mouse released" event. This <code>MouseEvent</code>
* The "mouse released" event. This {@code MouseEvent}
* occurs when a mouse button is let up.
*/
public static final int MOUSE_RELEASED = 2 + MOUSE_FIRST; //Event.MOUSE_UP
/**
* The "mouse moved" event. This <code>MouseEvent</code>
* The "mouse moved" event. This {@code MouseEvent}
* occurs when the mouse position changes.
*/
public static final int MOUSE_MOVED = 3 + MOUSE_FIRST; //Event.MOUSE_MOVE
/**
* The "mouse entered" event. This <code>MouseEvent</code>
* The "mouse entered" event. This {@code MouseEvent}
* occurs when the mouse cursor enters the unobscured part of component's
* geometry.
*/
public static final int MOUSE_ENTERED = 4 + MOUSE_FIRST; //Event.MOUSE_ENTER
/**
* The "mouse exited" event. This <code>MouseEvent</code>
* The "mouse exited" event. This {@code MouseEvent}
* occurs when the mouse cursor exits the unobscured part of component's
* geometry.
*/
public static final int MOUSE_EXITED = 5 + MOUSE_FIRST; //Event.MOUSE_EXIT
/**
* The "mouse dragged" event. This <code>MouseEvent</code>
* The "mouse dragged" event. This {@code MouseEvent}
* occurs when the mouse position changes while a mouse button is pressed.
*/
public static final int MOUSE_DRAGGED = 6 + MOUSE_FIRST; //Event.MOUSE_DRAG
/**
* The "mouse wheel" event. This is the only <code>MouseWheelEvent</code>.
* The "mouse wheel" event. This is the only {@code MouseWheelEvent}.
* It occurs when a mouse equipped with a wheel has its wheel rotated.
* @since 1.4
*/
@ -320,10 +320,10 @@ public class MouseEvent extends InputEvent {
* Indicates the number of quick consecutive clicks of
* a mouse button.
* clickCount will be valid for only three mouse events :<BR>
* <code>MOUSE_CLICKED</code>,
* <code>MOUSE_PRESSED</code> and
* <code>MOUSE_RELEASED</code>.
* For the above, the <code>clickCount</code> will be at least 1.
* {@code MOUSE_CLICKED},
* {@code MOUSE_PRESSED} and
* {@code MOUSE_RELEASED}.
* For the above, the {@code clickCount} will be at least 1.
* For all other events the count will be 0.
*
* @serial
@ -365,8 +365,8 @@ public class MouseEvent extends InputEvent {
/**
* A property used to indicate whether a Popup Menu
* should appear with a certain gestures.
* If <code>popupTrigger</code> = <code>false</code>,
* no popup menu should appear. If it is <code>true</code>
* If {@code popupTrigger} = {@code false},
* no popup menu should appear. If it is {@code true}
* then a popup menu should appear.
*
* @serial
@ -415,7 +415,7 @@ public class MouseEvent extends InputEvent {
* Otherwise, these coordinates are relative to the coordinate system
* associated with the Component's GraphicsConfiguration.
*
* @return a <code>Point</code> object containing the absolute x
* @return a {@code Point} object containing the absolute x
* and y coordinates.
*
* @see java.awt.GraphicsConfiguration
@ -460,7 +460,7 @@ public class MouseEvent extends InputEvent {
}
/**
* Constructs a <code>MouseEvent</code> object with the
* Constructs a {@code MouseEvent} object with the
* specified source component,
* type, time, modifiers, coordinates, click count, popupTrigger flag,
* and button number.
@ -469,19 +469,19 @@ public class MouseEvent extends InputEvent {
* as by using more than one of the old _MASKs, or modifier/button
* values which don't match) results in unspecified behavior.
* An invocation of the form
* <tt>MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button)</tt>
* {@code MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button)}
* behaves in exactly the same way as the invocation
* <tt> {@link #MouseEvent(Component, int, long, int, int, int,
* int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers,
* x, y, xAbs, yAbs, clickCount, popupTrigger, button)</tt>
* {@link #MouseEvent(Component, int, long, int, int, int,
* int, int, int, boolean, int) MouseEvent(source, id, when, modifiers,
* x, y, xAbs, yAbs, clickCount, popupTrigger, button)}
* where xAbs and yAbs defines as source's location on screen plus
* relative coordinates x and y.
* xAbs and yAbs are set to zero if the source is not showing.
* This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
* {@code IllegalArgumentException} if {@code source}
* is {@code null}.
*
* @param source The <code>Component</code> that originated the event
* @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
@ -527,16 +527,16 @@ public class MouseEvent extends InputEvent {
* if the mouse has more than three buttons.
* </ul>
* @throws IllegalArgumentException if {@code button} is less then zero
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
* @throws IllegalArgumentException if an invalid <code>button</code>
* @throws IllegalArgumentException if an invalid {@code button}
* value is passed in
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
@ -565,22 +565,22 @@ public class MouseEvent extends InputEvent {
}
/**
* Constructs a <code>MouseEvent</code> object with the
* Constructs a {@code MouseEvent} object with the
* specified source component,
* type, modifiers, coordinates, click count, and popupTrigger flag.
* An invocation of the form
* <tt>MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)</tt>
* {@code MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)}
* behaves in exactly the same way as the invocation
* <tt> {@link #MouseEvent(Component, int, long, int, int, int,
* int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers,
* x, y, xAbs, yAbs, clickCount, popupTrigger, MouseEvent.NOBUTTON)</tt>
* {@link #MouseEvent(Component, int, long, int, int, int,
* int, int, int, boolean, int) MouseEvent(source, id, when, modifiers,
* x, y, xAbs, yAbs, clickCount, popupTrigger, MouseEvent.NOBUTTON)}
* where xAbs and yAbs defines as source's location on screen plus
* relative coordinates x and y.
* xAbs and yAbs are set to zero if the source is not showing.
* This method throws an <code>IllegalArgumentException</code>
* if <code>source</code> is <code>null</code>.
* This method throws an {@code IllegalArgumentException}
* if {@code source} is {@code null}.
*
* @param source The <code>Component</code> that originated the event
* @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
@ -605,7 +605,7 @@ public class MouseEvent extends InputEvent {
* is not recommended
* @param popupTrigger A boolean that equals {@code true} if this event
* is a trigger for a popup menu
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
@ -637,7 +637,7 @@ public class MouseEvent extends InputEvent {
}
/**
* Constructs a <code>MouseEvent</code> object with the
* Constructs a {@code MouseEvent} object with the
* specified source component,
* type, time, modifiers, coordinates, absolute coordinates, click count, popupTrigger flag,
* and button number.
@ -649,10 +649,10 @@ public class MouseEvent extends InputEvent {
* passed to the constructor, the mouse event instance is still
* created and no exception is thrown.
* This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
* {@code IllegalArgumentException} if {@code source}
* is {@code null}.
*
* @param source The <code>Component</code> that originated the event
* @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
@ -702,16 +702,16 @@ public class MouseEvent extends InputEvent {
* if the mouse has more than three buttons.
* </ul>
* @throws IllegalArgumentException if {@code button} is less then zero
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
* @throws IllegalArgumentException if an invalid <code>button</code>
* @throws IllegalArgumentException if an invalid {@code button}
* value is passed in
* @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
@ -803,7 +803,7 @@ public class MouseEvent extends InputEvent {
/**
* Returns the x,y position of the event relative to the source component.
*
* @return a <code>Point</code> object containing the x and y coordinates
* @return a {@code Point} object containing the x and y coordinates
* relative to the source component
*
*/
@ -819,7 +819,7 @@ public class MouseEvent extends InputEvent {
/**
* Translates the event's coordinates to a new position
* by adding specified <code>x</code> (horizontal) and <code>y</code>
* by adding specified {@code x} (horizontal) and {@code y}
* (vertical) offsets.
*
* @param x the horizontal x value to add to the current x
@ -901,9 +901,9 @@ public class MouseEvent extends InputEvent {
* Returns whether or not this mouse event is the popup menu
* trigger event for the platform.
* <p><b>Note</b>: Popup menus are triggered differently
* on different systems. Therefore, <code>isPopupTrigger</code>
* should be checked in both <code>mousePressed</code>
* and <code>mouseReleased</code>
* on different systems. Therefore, {@code isPopupTrigger}
* should be checked in both {@code mousePressed}
* and {@code mouseReleased}
* for proper cross-platform functionality.
*
* @return boolean, true if this event is the popup menu trigger
@ -914,16 +914,16 @@ public class MouseEvent extends InputEvent {
}
/**
* Returns a <code>String</code> instance describing the modifier keys and
* Returns a {@code String} instance describing the modifier keys and
* mouse buttons that were down during the event, such as "Shift",
* or "Ctrl+Shift". These strings can be localized by changing
* the <code>awt.properties</code> file.
* the {@code awt.properties} file.
* <p>
* Note that the <code>InputEvent.ALT_MASK</code> and
* <code>InputEvent.BUTTON2_MASK</code> have equal values,
* Note that the {@code InputEvent.ALT_MASK} and
* {@code InputEvent.BUTTON2_MASK} have equal values,
* so the "Alt" string is returned for both modifiers. Likewise,
* the <code>InputEvent.META_MASK</code> and
* <code>InputEvent.BUTTON3_MASK</code> have equal values,
* the {@code InputEvent.META_MASK} and
* {@code InputEvent.BUTTON3_MASK} have equal values,
* so the "Meta" string is returned for both modifiers.
* <p>
* Note that passing negative parameter is incorrect,

View File

@ -99,7 +99,7 @@ public class PixelGrabber implements ImageConsumer {
* The pixels are stored into the array in the default RGB ColorModel.
* The RGB data for pixel (i, j) where (i, j) is inside the rectangle
* (x, y, w, h) is stored in the array at
* <tt>pix[(j - y) * scansize + (i - x) + off]</tt>.
* {@code pix[(j - y) * scansize + (i - x) + off]}.
* @see ColorModel#getRGBdefault
* @param img the image to retrieve pixels from
* @param x the x coordinate of the upper left corner of the rectangle
@ -127,8 +127,8 @@ public class PixelGrabber implements ImageConsumer {
* The pixels are stored into the array in the default RGB ColorModel.
* The RGB data for pixel (i, j) where (i, j) is inside the rectangle
* (x, y, w, h) is stored in the array at
* <tt>pix[(j - y) * scansize + (i - x) + off]</tt>.
* @param ip the <code>ImageProducer</code> that produces the
* {@code pix[(j - y) * scansize + (i - x) + off]}.
* @param ip the {@code ImageProducer} that produces the
* image from which to retrieve pixels
* @param x the x coordinate of the upper left corner of the rectangle
* of pixels to retrieve from the image, relative to the default
@ -231,13 +231,13 @@ public class PixelGrabber implements ImageConsumer {
* wait for all of the pixels in the rectangle of interest to be
* delivered or until the specified timeout has elapsed. This method
* behaves in the following ways, depending on the value of
* <code>ms</code>:
* {@code ms}:
* <ul>
* <li> If {@code ms == 0}, waits until all pixels are delivered
* <li> If {@code ms > 0}, waits until all pixels are delivered
* as timeout expires.
* <li> If {@code ms < 0}, returns <code>true</code> if all pixels
* are grabbed, <code>false</code> otherwise and does not wait.
* <li> If {@code ms < 0}, returns {@code true} if all pixels
* are grabbed, {@code false} otherwise and does not wait.
* </ul>
* @param ms the number of milliseconds to wait for the image pixels
* to arrive before timing out
@ -420,7 +420,7 @@ public class PixelGrabber implements ImageConsumer {
* this class to retrieve pixels from an image should avoid calling
* this method directly since that operation could result in problems
* with retrieving the requested pixels.
* @param model the specified <code>ColorModel</code>
* @param model the specified {@code ColorModel}
* @see #getColorModel
*/
public void setColorModel(ColorModel model) {
@ -461,7 +461,7 @@ public class PixelGrabber implements ImageConsumer {
* of the area of pixels to be set
* @param srcW the width of the area of pixels
* @param srcH the height of the area of pixels
* @param model the specified <code>ColorModel</code>
* @param model the specified {@code ColorModel}
* @param pixels the array of pixels
* @param srcOff the offset into the pixels array
* @param srcScan the distance from one row of pixels to the next
@ -548,7 +548,7 @@ public class PixelGrabber implements ImageConsumer {
* of the area of pixels to be set
* @param srcW the width of the area of pixels
* @param srcH the height of the area of pixels
* @param model the specified <code>ColorModel</code>
* @param model the specified {@code ColorModel}
* @param pixels the array of pixels
* @param srcOff the offset into the pixels array
* @param srcScan the distance from one row of pixels to the next
@ -658,7 +658,7 @@ public class PixelGrabber implements ImageConsumer {
* Returns the status of the pixels. The ImageObserver flags
* representing the available pixel information are returned.
* This method and {@link #getStatus() getStatus} have the
* same implementation, but <code>getStatus</code> is the
* same implementation, but {@code getStatus} is the
* preferred method because it conforms to the convention of
* naming information-retrieval methods with the form
* "getXXX".

View File

@ -326,16 +326,16 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
ColorModel srcCM = src.getColorModel();
ColorModel dstCM;
int numBands = srcCM.getNumColorComponents();
int numSrcColorComp = srcCM.getNumColorComponents();
int scaleConst = length;
if (srcCM instanceof IndexColorModel) {
throw new
IllegalArgumentException("Rescaling cannot be "+
"performed on an indexed image");
}
if (length != 1 && length != numBands &&
length != srcCM.getNumComponents())
if (scaleConst != 1 && scaleConst != numSrcColorComp &&
scaleConst != srcCM.getNumComponents())
{
throw new IllegalArgumentException("Number of scaling constants "+
"does not equal the number of"+
@ -346,13 +346,14 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
boolean needToConvert = false;
// Include alpha
if (length > numBands && srcCM.hasAlpha()) {
length = numBands+1;
if (scaleConst > numSrcColorComp && srcCM.hasAlpha()) {
scaleConst = numSrcColorComp+1;
}
int width = src.getWidth();
int height = src.getHeight();
BufferedImage origDst = dst;
if (dst == null) {
dst = createCompatibleDestImage(src, null);
dstCM = srcCM;
@ -380,7 +381,19 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
}
BufferedImage origDst = dst;
boolean scaleAlpha = true;
//
// The number of sets of scaling constants may be one,
// in which case the same constants are applied to all color
// (but NOT alpha) components. Otherwise, the number of sets
// of scaling constants may equal the number of Source color
// components, in which case NO rescaling of the alpha component
// (if present) is performed.
//
if (numSrcColorComp == scaleConst || scaleConst == 1) {
scaleAlpha = false;
}
//
// Try to use a native BI rescale operation first
@ -392,12 +405,13 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
WritableRaster srcRaster = src.getRaster();
WritableRaster dstRaster = dst.getRaster();
if (srcCM.hasAlpha()) {
if (numBands-1 == length || length == 1) {
if (!scaleAlpha) {
if (srcCM.hasAlpha()) {
// Do not rescale Alpha component
int minx = srcRaster.getMinX();
int miny = srcRaster.getMinY();
int[] bands = new int[numBands-1];
for (int i=0; i < numBands-1; i++) {
int[] bands = new int[numSrcColorComp];
for (int i=0; i < numSrcColorComp; i++) {
bands[i] = i;
}
srcRaster =
@ -407,14 +421,11 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
minx, miny,
bands);
}
}
if (dstCM.hasAlpha()) {
int dstNumBands = dstRaster.getNumBands();
if (dstNumBands-1 == length || length == 1) {
if (dstCM.hasAlpha()) {
int minx = dstRaster.getMinX();
int miny = dstRaster.getMinY();
int[] bands = new int[numBands-1];
for (int i=0; i < numBands-1; i++) {
int[] bands = new int[numSrcColorComp];
for (int i=0; i < numSrcColorComp; i++) {
bands[i] = i;
}
dstRaster =
@ -429,17 +440,42 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
//
// Call the raster filter method
//
filter(srcRaster, dstRaster);
filterRasterImpl(srcRaster, dstRaster, scaleConst);
//
// here copy the unscaled src alpha to destination alpha channel
//
if (!scaleAlpha) {
Raster srcAlphaRaster = null;
WritableRaster dstAlphaRaster = null;
if (srcCM.hasAlpha()) {
srcAlphaRaster = src.getAlphaRaster();
}
if (dstCM.hasAlpha()) {
dstAlphaRaster = dst.getAlphaRaster();
if (srcAlphaRaster != null) {
dstAlphaRaster.setRect(srcAlphaRaster);
} else {
int alpha = 0xff << 24;
for (int cy=0; cy < dst.getHeight(); cy++) {
for (int cx=0; cx < dst.getWidth(); cx++) {
int color = dst.getRGB(cx, cy);
dst.setRGB(cx, cy, color | alpha);
}
}
}
}
}
}
if (needToConvert) {
// ColorModels are not the same
ColorConvertOp ccop = new ColorConvertOp(hints);
ccop.filter(dst, origDst);
dst = ccop.filter(dst, origDst);
}
return origDst;
return dst;
}
/**
@ -461,6 +497,10 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
* stated in the class comments.
*/
public final WritableRaster filter (Raster src, WritableRaster dst) {
return filterRasterImpl(src, dst, length);
}
private WritableRaster filterRasterImpl(Raster src, WritableRaster dst, int scaleConst) {
int numBands = src.getNumBands();
int width = src.getWidth();
int height = src.getHeight();
@ -484,15 +524,15 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
+ " does not equal number of bands in dest "
+ dst.getNumBands());
}
// Make sure that the arrays match
// Make sure that the low/high/constant arrays match
if (length != 1 && length != src.getNumBands()) {
if (scaleConst != 1 && scaleConst != src.getNumBands()) {
throw new IllegalArgumentException("Number of scaling constants "+
"does not equal the number of"+
" of bands in the src raster");
}
//
// Try for a native raster rescale first
//
@ -523,7 +563,7 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
//
// Fall back to the slow code
//
if (length > 1) {
if (scaleConst > 1) {
step = 1;
}

View File

@ -54,16 +54,16 @@ public class EventSetDescriptor extends FeatureDescriptor {
private boolean inDefaultEventSet = true;
/**
* Creates an <TT>EventSetDescriptor</TT> assuming that you are
* Creates an {@code EventSetDescriptor} assuming that you are
* following the most simple standard design pattern where a named
* event &quot;fred&quot; is (1) delivered as a call on the single method of
* event "fred" is (1) delivered as a call on the single method of
* interface FredListener, (2) has a single argument of type FredEvent,
* and (3) where the FredListener may be registered with a call on an
* addFredListener method of the source component and removed with a
* call on a removeFredListener method.
*
* @param sourceClass The class firing the event.
* @param eventSetName The programmatic name of the event. E.g. &quot;fred&quot;.
* @param eventSetName The programmatic name of the event. E.g. "fred".
* Note that this should normally start with a lower-case character.
* @param listenerType The target interface that events
* will get delivered to.
@ -100,7 +100,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
* Creates an <TT>EventSetDescriptor</TT> from scratch using
* Creates an {@code EventSetDescriptor} from scratch using
* string names.
*
* @param sourceClass The class firing the event.
@ -199,8 +199,8 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
* Creates an <TT>EventSetDescriptor</TT> from scratch using
* <TT>java.lang.reflect.Method</TT> and <TT>java.lang.Class</TT> objects.
* Creates an {@code EventSetDescriptor} from scratch using
* {@code java.lang.reflect.Method} and {@code java.lang.Class} objects.
*
* @param eventSetName The programmatic name of the event set.
* @param listenerType The Class for the listener interface.
@ -267,8 +267,8 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
* Creates an <TT>EventSetDescriptor</TT> from scratch using
* <TT>java.lang.reflect.MethodDescriptor</TT> and <TT>java.lang.Class</TT>
* Creates an {@code EventSetDescriptor} from scratch using
* {@code java.lang.reflect.MethodDescriptor} and {@code java.lang.Class}
* objects.
*
* @param eventSetName The programmatic name of the event set.
@ -299,7 +299,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
* Gets the <TT>Class</TT> object for the target interface.
* Gets the {@code Class} object for the target interface.
*
* @return The Class object for the target interface that will
* get invoked when the event is fired.
@ -317,7 +317,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
/**
* Gets the methods of the target listener interface.
*
* @return An array of <TT>Method</TT> objects for the target methods
* @return An array of {@code Method} objects for the target methods
* within the target listener interface that will get called when
* events are fired.
*/
@ -355,9 +355,9 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
* Gets the <code>MethodDescriptor</code>s of the target listener interface.
* Gets the {@code MethodDescriptor}s of the target listener interface.
*
* @return An array of <code>MethodDescriptor</code> objects for the target methods
* @return An array of {@code MethodDescriptor} objects for the target methods
* within the target listener interface that will get called when
* events are fired.
*/
@ -442,30 +442,30 @@ public class EventSetDescriptor extends FeatureDescriptor {
* Normally event sources are multicast. However there are some
* exceptions that are strictly unicast.
*
* @return <TT>true</TT> if the event set is unicast.
* Defaults to <TT>false</TT>.
* @return {@code true} if the event set is unicast.
* Defaults to {@code false}.
*/
public boolean isUnicast() {
return unicast;
}
/**
* Marks an event set as being in the &quot;default&quot; set (or not).
* By default this is <TT>true</TT>.
* Marks an event set as being in the "default" set (or not).
* By default this is {@code true}.
*
* @param inDefaultEventSet <code>true</code> if the event set is in
* the &quot;default&quot; set,
* <code>false</code> if not
* @param inDefaultEventSet {@code true} if the event set is in
* the "default" set,
* {@code false} if not
*/
public void setInDefaultEventSet(boolean inDefaultEventSet) {
this.inDefaultEventSet = inDefaultEventSet;
}
/**
* Reports if an event set is in the &quot;default&quot; set.
* Reports if an event set is in the "default" set.
*
* @return <TT>true</TT> if the event set is in
* the &quot;default&quot; set. Defaults to <TT>true</TT>.
* @return {@code true} if the event set is in
* the "default" set. Defaults to {@code true}.
*/
public boolean isInDefaultEventSet() {
return inDefaultEventSet;

View File

@ -27,8 +27,7 @@ package java.beans;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.ImageProducer;
import java.net.URL;
import java.io.InputStream;
/**
* This is a support class to make it easier for people to provide
@ -122,14 +121,8 @@ public class SimpleBeanInfo implements BeanInfo {
* @return an image object. May be null if the load failed.
*/
public Image loadImage(final String resourceName) {
try {
final URL url = getClass().getResource(resourceName);
if (url != null) {
final ImageProducer ip = (ImageProducer) url.getContent();
if (ip != null) {
return Toolkit.getDefaultToolkit().createImage(ip);
}
}
try (InputStream in = getClass().getResourceAsStream(resourceName)) {
return Toolkit.getDefaultToolkit().createImage(in.readAllBytes());
} catch (final Exception ignored) {
}
return null;

View File

@ -91,9 +91,9 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
}
/**
* Sets the <code>BeanContext</code> for
* this <code>BeanContextChildSupport</code>.
* @param bc the new value to be assigned to the <code>BeanContext</code>
* Sets the {@code BeanContext} for
* this {@code BeanContextChildSupport}.
* @param bc the new value to be assigned to the {@code BeanContext}
* property
* @throws PropertyVetoException if the change is rejected
*/
@ -137,10 +137,10 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
}
/**
* Gets the nesting <code>BeanContext</code>
* for this <code>BeanContextChildSupport</code>.
* @return the nesting <code>BeanContext</code> for
* this <code>BeanContextChildSupport</code>.
* Gets the nesting {@code BeanContext}
* for this {@code BeanContextChildSupport}.
* @return the nesting {@code BeanContext} for
* this {@code BeanContextChildSupport}.
*/
public synchronized BeanContext getBeanContext() { return beanContext; }
@ -149,11 +149,11 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
* If <code>name</code> or <code>pcl</code> is null, no exception is thrown
* If {@code name} or {@code pcl} is null, no exception is thrown
* and no action is taken.
*
* @param name The name of the property to listen on
* @param pcl The <code>PropertyChangeListener</code> to be added
* @param pcl The {@code PropertyChangeListener} to be added
*/
public void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
pcSupport.addPropertyChangeListener(name, pcl);
@ -161,12 +161,12 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
/**
* Remove a PropertyChangeListener for a specific property.
* If <code>pcl</code> was added more than once to the same event
* If {@code pcl} was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
* If <code>name</code> is null, no exception is thrown
* If {@code name} is null, no exception is thrown
* and no action is taken.
* If <code>pcl</code> is null, or was never added for the specified
* If {@code pcl} is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param name The name of the property that was listened on
@ -181,28 +181,28 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
* If <code>name</code> or <code>vcl</code> is null, no exception is thrown
* If {@code name} or {@code vcl} is null, no exception is thrown
* and no action is taken.
*
* @param name The name of the property to listen on
* @param vcl The <code>VetoableChangeListener</code> to be added
* @param vcl The {@code VetoableChangeListener} to be added
*/
public void addVetoableChangeListener(String name, VetoableChangeListener vcl) {
vcSupport.addVetoableChangeListener(name, vcl);
}
/**
* Removes a <code>VetoableChangeListener</code>.
* If <code>pcl</code> was added more than once to the same event
* Removes a {@code VetoableChangeListener}.
* If {@code pcl} was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
* If <code>name</code> is null, no exception is thrown
* If {@code name} is null, no exception is thrown
* and no action is taken.
* If <code>vcl</code> is null, or was never added for the specified
* If {@code vcl} is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param name The name of the property that was listened on
* @param vcl The <code>VetoableChangeListener</code> to be removed
* @param vcl The {@code VetoableChangeListener} to be removed
*/
public void removeVetoableChangeListener(String name, VetoableChangeListener vcl) {
vcSupport.removeVetoableChangeListener(name, vcl);
@ -213,7 +213,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
*
* Subclasses may override this method in order to implement their own
* behaviors.
* @param bcsre The <code>BeanContextServiceRevokedEvent</code> fired as a
* @param bcsre The {@code BeanContextServiceRevokedEvent} fired as a
* result of a service being revoked
*/
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { }
@ -230,10 +230,10 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) { }
/**
* Gets the <tt>BeanContextChild</tt> associated with this
* <tt>BeanContextChildSupport</tt>.
* Gets the {@code BeanContextChild} associated with this
* {@code BeanContextChildSupport}.
*
* @return the <tt>BeanContextChild</tt> peer of this class
* @return the {@code BeanContextChild} peer of this class
*/
public BeanContextChild getBeanContextChildPeer() { return beanContextChildPeer; }
@ -283,7 +283,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
* PropertyVetoException.
* @param newValue the new value that has been requested for
* the BeanContext property
* @return <code>true</code> if the change operation is to be vetoed
* @return {@code true} if the change operation is to be vetoed
*/
public boolean validatePendingSetBeanContext(BeanContext newValue) {
return true;
@ -345,20 +345,20 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
*/
/**
* The <code>BeanContext</code> in which
* this <code>BeanContextChild</code> is nested.
* The {@code BeanContext} in which
* this {@code BeanContextChild} is nested.
*/
public BeanContextChild beanContextChildPeer;
/**
* The <tt>PropertyChangeSupport</tt> associated with this
* <tt>BeanContextChildSupport</tt>.
* The {@code PropertyChangeSupport} associated with this
* {@code BeanContextChildSupport}.
*/
protected PropertyChangeSupport pcSupport;
/**
* The <tt>VetoableChangeSupport</tt> associated with this
* <tt>BeanContextChildSupport</tt>.
* The {@code VetoableChangeSupport} associated with this
* {@code BeanContextChildSupport}.
*/
protected VetoableChangeSupport vcSupport;
@ -369,7 +369,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
/**
* A flag indicating that there has been
* at least one <code>PropertyChangeVetoException</code>
* at least one {@code PropertyChangeVetoException}
* thrown for the attempted setBeanContext operation.
*/
protected transient boolean rejectedSetBCOnce;

View File

@ -134,10 +134,10 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
* Gets the <tt>BeanContextServices</tt> associated with this
* <tt>BeanContextServicesSupport</tt>.
* Gets the {@code BeanContextServices} associated with this
* {@code BeanContextServicesSupport}.
*
* @return the instance of <tt>BeanContext</tt>
* @return the instance of {@code BeanContext}
* this object is providing the implementation for.
*/
public BeanContextServices getBeanContextServicesPeer() {
@ -1001,7 +1001,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
* Gets the <tt>BeanContextServicesListener</tt> (if any) of the specified
* Gets the {@code BeanContextServicesListener} (if any) of the specified
* child.
*
* @param child the specified child
@ -1084,7 +1084,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
* Fires a <tt>BeanContextServiceEvent</tt> notifying of a new service.
* Fires a {@code BeanContextServiceEvent} notifying of a new service.
* @param serviceClass the service class
*/
protected final void fireServiceAdded(Class<?> serviceClass) {
@ -1094,10 +1094,10 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
* Fires a <tt>BeanContextServiceAvailableEvent</tt> indicating that a new
* Fires a {@code BeanContextServiceAvailableEvent} indicating that a new
* service has become available.
*
* @param bcssae the <tt>BeanContextServiceAvailableEvent</tt>
* @param bcssae the {@code BeanContextServiceAvailableEvent}
*/
protected final void fireServiceAdded(BeanContextServiceAvailableEvent bcssae) {
Object[] copy;
@ -1110,9 +1110,9 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
* Fires a <tt>BeanContextServiceEvent</tt> notifying of a service being revoked.
* Fires a {@code BeanContextServiceEvent} notifying of a service being revoked.
*
* @param bcsre the <tt>BeanContextServiceRevokedEvent</tt>
* @param bcsre the {@code BeanContextServiceRevokedEvent}
*/
protected final void fireServiceRevoked(BeanContextServiceRevokedEvent bcsre) {
Object[] copy;
@ -1125,7 +1125,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
* Fires a <tt>BeanContextServiceRevokedEvent</tt>
* Fires a {@code BeanContextServiceRevokedEvent}
* indicating that a particular service is
* no longer available.
* @param serviceClass the service class
@ -1235,25 +1235,25 @@ public class BeanContextServicesSupport extends BeanContextSupport
*/
/**
* all accesses to the <code> protected transient HashMap services </code>
* all accesses to the {@code protected transient HashMap services}
* field should be synchronized on that object
*/
protected transient HashMap<Object, BCSSServiceProvider> services;
/**
* The number of instances of a serializable <tt>BeanContextServceProvider</tt>.
* The number of instances of a serializable {@code BeanContextServceProvider}.
*/
protected transient int serializable = 0;
/**
* Delegate for the <tt>BeanContextServiceProvider</tt>.
* Delegate for the {@code BeanContextServiceProvider}.
*/
protected transient BCSSProxyServiceProvider proxy;
/**
* List of <tt>BeanContextServicesListener</tt> objects.
* List of {@code BeanContextServicesListener} objects.
*/
protected transient ArrayList<BeanContextServicesListener> bcsListeners;
}

View File

@ -85,16 +85,16 @@ public class BeanContextSupport extends BeanContextChildSupport
* Construct a BeanContextSupport instance
*
*
* @param peer The peer <tt>BeanContext</tt> we are
* @param peer The peer {@code BeanContext} we are
* supplying an implementation for,
* or <tt>null</tt>
* or {@code null}
* if this object is its own peer
* @param lcle The current Locale for this BeanContext. If
* <tt>lcle</tt> is <tt>null</tt>, the default locale
* is assigned to the <tt>BeanContext</tt> instance.
* {@code lcle} is {@code null}, the default locale
* is assigned to the {@code BeanContext} instance.
* @param dTime The initial state,
* <tt>true</tt> if in design mode,
* <tt>false</tt> if runtime.
* {@code true} if in design mode,
* {@code false} if runtime.
* @param visible The initial visibility.
* @see java.util.Locale#getDefault()
* @see java.util.Locale#setDefault(java.util.Locale)
@ -112,15 +112,15 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Create an instance using the specified Locale and design mode.
*
* @param peer The peer <tt>BeanContext</tt> we
* @param peer The peer {@code BeanContext} we
* are supplying an implementation for,
* or <tt>null</tt> if this object is its own peer
* @param lcle The current Locale for this <tt>BeanContext</tt>. If
* <tt>lcle</tt> is <tt>null</tt>, the default locale
* is assigned to the <tt>BeanContext</tt> instance.
* @param dtime The initial state, <tt>true</tt>
* or {@code null} if this object is its own peer
* @param lcle The current Locale for this {@code BeanContext}. If
* {@code lcle} is {@code null}, the default locale
* is assigned to the {@code BeanContext} instance.
* @param dtime The initial state, {@code true}
* if in design mode,
* <tt>false</tt> if runtime.
* {@code false} if runtime.
* @see java.util.Locale#getDefault()
* @see java.util.Locale#setDefault(java.util.Locale)
*/
@ -133,13 +133,13 @@ public class BeanContextSupport extends BeanContextChildSupport
*
* @param peer The peer BeanContext we are
* supplying an implementation for,
* or <tt>null</tt> if this object
* or {@code null} if this object
* is its own peer
* @param lcle The current Locale for this
* <tt>BeanContext</tt>. If
* <tt>lcle</tt> is <tt>null</tt>,
* {@code BeanContext}. If
* {@code lcle} is {@code null},
* the default locale
* is assigned to the <tt>BeanContext</tt>
* is assigned to the {@code BeanContext}
* instance.
* @see java.util.Locale#getDefault()
* @see java.util.Locale#setDefault(java.util.Locale)
@ -151,9 +151,9 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Create an instance using with a default locale
*
* @param peer The peer <tt>BeanContext</tt> we are
* @param peer The peer {@code BeanContext} we are
* supplying an implementation for,
* or <tt>null</tt> if this object
* or {@code null} if this object
* is its own peer
*/
public BeanContextSupport(BeanContext peer) {
@ -169,7 +169,7 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
* Gets the instance of <tt>BeanContext</tt> that
* Gets the instance of {@code BeanContext} that
* this object is providing the implementation for.
* @return the BeanContext instance
*/
@ -180,7 +180,7 @@ public class BeanContextSupport extends BeanContextChildSupport
* The instantiateChild method is a convenience hook
* in BeanContext to simplify
* the task of instantiating a Bean, nested,
* into a <tt>BeanContext</tt>.
* into a {@code BeanContext}.
* </p>
* <p>
* The semantics of the beanName parameter are defined by java.beans.Beans.instantiate.
@ -213,8 +213,8 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Reports whether or not this
* <tt>BeanContext</tt> is empty.
* A <tt>BeanContext</tt> is considered
* {@code BeanContext} is empty.
* A {@code BeanContext} is considered
* empty when it contains zero
* nested children.
* @return if there are not children
@ -227,7 +227,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Determines whether or not the specified object
* is currently a child of this <tt>BeanContext</tt>.
* is currently a child of this {@code BeanContext}.
* @param o the Object in question
* @return if this object is a child
*/
@ -239,7 +239,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Determines whether or not the specified object
* is currently a child of this <tt>BeanContext</tt>.
* is currently a child of this {@code BeanContext}.
* @param o the Object in question
* @return if this object is a child
*/
@ -250,9 +250,9 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
* Gets all JavaBean or <tt>BeanContext</tt> instances
* currently nested in this <tt>BeanContext</tt>.
* @return an <tt>Iterator</tt> of the nested children
* Gets all JavaBean or {@code BeanContext} instances
* currently nested in this {@code BeanContext}.
* @return an {@code Iterator} of the nested children
*/
public Iterator<Object> iterator() {
synchronized(children) {
@ -261,7 +261,7 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
* Gets all JavaBean or <tt>BeanContext</tt>
* Gets all JavaBean or {@code BeanContext}
* instances currently nested in this BeanContext.
*/
public Object[] toArray() {
@ -272,7 +272,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Gets an array containing all children of
* this <tt>BeanContext</tt> that match
* this {@code BeanContext} that match
* the types contained in arry.
* @param arry The array of object
* types that are of interest.
@ -362,7 +362,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/************************************************************************/
/**
* Adds/nests a child within this <tt>BeanContext</tt>.
* Adds/nests a child within this {@code BeanContext}.
* <p>
* Invoked as a side effect of java.beans.Beans.instantiate().
* If the child object is not valid for adding then this method
@ -371,7 +371,7 @@ public class BeanContextSupport extends BeanContextChildSupport
*
*
* @param targetChild The child objects to nest
* within this <tt>BeanContext</tt>
* within this {@code BeanContext}
* @return true if the child was added successfully.
* @see #validatePendingAdd
*/
@ -485,12 +485,12 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* internal remove used when removal caused by
* unexpected <tt>setBeanContext</tt> or
* by <tt>remove()</tt> invocation.
* unexpected {@code setBeanContext} or
* by {@code remove()} invocation.
* @param targetChild the JavaBean, BeanContext, or Object to be removed
* @param callChildSetBC used to indicate that
* the child should be notified that it is no
* longer nested in this <tt>BeanContext</tt>.
* longer nested in this {@code BeanContext}.
* @return whether or not was present before being removed
*/
protected boolean remove(Object targetChild, boolean callChildSetBC) {
@ -558,13 +558,13 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Tests to see if all objects in the
* specified <tt>Collection</tt> are children of
* this <tt>BeanContext</tt>.
* @param c the specified <tt>Collection</tt>
* specified {@code Collection} are children of
* this {@code BeanContext}.
* @param c the specified {@code Collection}
*
* @return <tt>true</tt> if all objects
* @return {@code true} if all objects
* in the collection are children of
* this <tt>BeanContext</tt>, false if not.
* this {@code BeanContext}, false if not.
*/
@SuppressWarnings("rawtypes")
public boolean containsAll(Collection c) {
@ -698,7 +698,7 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
* Sets the new design time value for this <tt>BeanContext</tt>.
* Sets the new design time value for this {@code BeanContext}.
* @param dTime the new designTime value
*/
public synchronized void setDesignTime(boolean dTime) {
@ -713,15 +713,15 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Reports whether or not this object is in
* currently in design time mode.
* @return <tt>true</tt> if in design time mode,
* <tt>false</tt> if not
* @return {@code true} if in design time mode,
* {@code false} if not
*/
public synchronized boolean isDesignTime() { return designTime; }
/**
* Sets the locale of this BeanContext.
* @param newLocale the new locale. This method call will have
* no effect if newLocale is <CODE>null</CODE>.
* no effect if newLocale is {@code null}.
* @throws PropertyVetoException if the new value is rejected
*/
public synchronized void setLocale(Locale newLocale) throws PropertyVetoException {
@ -738,9 +738,9 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
* Gets the locale for this <tt>BeanContext</tt>.
* Gets the locale for this {@code BeanContext}.
*
* @return the current Locale of the <tt>BeanContext</tt>
* @return the current Locale of the {@code BeanContext}
*/
public synchronized Locale getLocale() { return locale; }
@ -754,7 +754,7 @@ public class BeanContextSupport extends BeanContextChildSupport
* to determine if they are either Containers, Components, or if they implement
* Visibility and return needsGui() == true.
* </p>
* @return <tt>true</tt> if the implementor needs a GUI
* @return {@code true} if the implementor needs a GUI
*/
public synchronized boolean needsGui() {
BeanContext bc = getBeanContextPeer();
@ -823,7 +823,7 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
* Used to determine if the <tt>BeanContext</tt>
* Used to determine if the {@code BeanContext}
* child is avoiding using its GUI.
* @return is this instance avoiding using its GUI?
* @see Visibility
@ -833,16 +833,16 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
* Is this <tt>BeanContext</tt> in the
* Is this {@code BeanContext} in the
* process of being serialized?
* @return if this <tt>BeanContext</tt> is
* @return if this {@code BeanContext} is
* currently being serialized
*/
public boolean isSerializing() { return serializing; }
/**
* Returns an iterator of all children
* of this <tt>BeanContext</tt>.
* of this {@code BeanContext}.
* @return an iterator for all the current BCSChild values
*/
protected Iterator<BCSChild> bcsChildren() { synchronized(children) { return children.values().iterator(); } }
@ -895,9 +895,9 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Used by writeObject to serialize a Collection.
* @param oos the <tt>ObjectOutputStream</tt>
* @param oos the {@code ObjectOutputStream}
* to use during serialization
* @param coll the <tt>Collection</tt> to serialize
* @param coll the {@code Collection} to serialize
* @throws IOException if serialization failed
*/
protected final void serialize(ObjectOutputStream oos, Collection<?> coll) throws IOException {
@ -943,8 +943,8 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Used to serialize all children of
* this <tt>BeanContext</tt>.
* @param oos the <tt>ObjectOutputStream</tt>
* this {@code BeanContext}.
* @param oos the {@code ObjectOutputStream}
* to use during serialization
* @throws IOException if serialization failed
*/
@ -1375,7 +1375,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* all accesses to the <code> protected HashMap children </code> field
* all accesses to the {@code protected HashMap children} field
* shall be synchronized on that object.
*/
protected transient HashMap<Object, BCSChild> children;
@ -1383,7 +1383,7 @@ public class BeanContextSupport extends BeanContextChildSupport
private int serializable = 0; // children serializable
/**
* all accesses to the <code> protected ArrayList bcmListeners </code> field
* all accesses to the {@code protected ArrayList bcmListeners} field
* shall be synchronized on that object.
*/
protected transient ArrayList<BeanContextMembershipListener> bcmListeners;
@ -1396,14 +1396,14 @@ public class BeanContextSupport extends BeanContextChildSupport
protected Locale locale;
/**
* A <tt>boolean</tt> indicating if this
* A {@code boolean} indicating if this
* instance may now render a GUI.
*/
protected boolean okToUseGui;
/**
* A <tt>boolean</tt> indicating whether or not
* A {@code boolean} indicating whether or not
* this object is currently in design time mode.
*/
protected boolean designTime;

View File

@ -43,7 +43,7 @@ below.
<A NAME="Accessible"></A><A HREF="Accessible.html">Interface Accessible</A></H3>
<A HREF="Accessible.html">Interface Accessible</A> is the main interface
of the Java Accessibility API. All components that support the Java Accessibility
API must implement this interface. It contains a single method, <TT>getAccessibleContext</TT>,
API must implement this interface. It contains a single method, <code>getAccessibleContext</code>,
that returns an instance of the class <A HREF="#AccessibleContext">AccessibleContext</A>.
Sun thinks that implementing this interface is the absolute minimum requirement
of every object that is part of the user interface of a Java application,
@ -53,7 +53,7 @@ if that program is to be compatible with assistive technologies.
AccessibleContext</A></H3>
<A HREF="AccessibleContext.html">AccessibleContext</A> represents the minimum
information all accessible objects return and is obtained by calling the
<TT>getAccessibleContext</TT> method on an object that implements the <A HREF="#Accessible">Accessible</A>
<code>getAccessibleContext</code> method on an object that implements the <A HREF="#Accessible">Accessible</A>
interface. This information includes the accessible name, description,
<A HREF="#AccessibleRole">role</A>, and <A HREF="#AccessibleState">state</A>
of the object, as well as information about the parent and children of
@ -69,7 +69,7 @@ an object that implements one or more of the following interfaces:
perform one or more actions. This interface provides the standard mechanism
for an assistive technology to determine what those actions are and tell
the object to perform those actions. Any object that can be manipulated
should return an object that implements this interface when the <TT>getAccessibleAction</TT>
should return an object that implements this interface when the <code>getAccessibleAction</code>
method is called on an AccessibleContext.</LI>
<LI>
@ -77,7 +77,7 @@ method is called on an AccessibleContext.</LI>
has a graphical representation. This interface provides the standard mechanism
for an assistive technology to determine and set the graphical representation
of the object. Any object that is rendered on the screen should return
an object that implements this interface when the <TT>getAccessibleComponent</TT>
an object that implements this interface when the <code>getAccessibleComponent</code>
method is called on an AccessibleContext.</LI>
<LI>
@ -86,7 +86,7 @@ allows its children to be selected. This interface provides the standard
mechanism for an assistive technology to determine the currently selected
children as well as modify the selection set. Any object that has children
that can be selected should return an object that implements this interface
when the <TT>getAccessibleSelection</TT> method is called on an AccessibleContext.</LI>
when the <code>getAccessibleSelection</code> method is called on an AccessibleContext.</LI>
<LI>
<B><A HREF="#AccessibleText">AccessibleText</A></B> - the object presents
@ -94,7 +94,7 @@ editable textual information on the display. This interface provides the
standard mechanism for an assistive technology to access that text via
its content, attributes, and spatial location. Any object that contains
editable text should return an object that implements this interface when
the <TT>getAccessibleText</TT> method is called on an AccessibleContext.</LI>
the <code>getAccessibleText</code> method is called on an AccessibleContext.</LI>
<LI>
<B><A HREF="#AccessibleHypertext">AccessibleHypertext</A></B> - the object
@ -102,25 +102,25 @@ presents hypertext information on the display. This interface provides
the standard mechanism for an assistive technology to access that hypertext
via its content, attributes, and spatial location. Any object that contains
hypertext should return an object that implements this interface when the
<TT>getAccessibleText</TT> method is called on an AccessibleContext.</LI>
<code>getAccessibleText</code> method is called on an AccessibleContext.</LI>
<LI>
<B><A HREF="#AccessibleValue">AccessibleValue</A></B> - the object supports
a numerical value. This interface provides the standard mechanism for an
assistive technology to determine and set the current value of the object,
as well as the minimum and maximum values. Any object that supports a numerical
value should return an object that implements this interface when the <TT>getAccessibleValue</TT>
value should return an object that implements this interface when the <code>getAccessibleValue</code>
method is called on an AccessibleContext.</LI>
</UL>
<H3>
<A NAME="AccessibleRole"></A><A HREF="AccessibleRole.html">Class AccessibleRole</A></H3>
This class encapsulates the Accessible object's role in the user interface
and is obtained by calling the <TT>getAccessibleRole</TT> method on an
and is obtained by calling the <code>getAccessibleRole</code> method on an
<A HREF="#AccessibleContext">AccessibleContext</A>. Accessible roles include
"Check box", "Menu Item", "Panel", etc. These roles are identified by the
constants in this class such as <TT>AccessibleRole.CHECK_BOX, AccessibleRole.MENU_ITEM,</TT>
and <TT>AccessibleRole.PANEL</TT>. The constants in this class present
constants in this class such as <code>AccessibleRole.CHECK_BOX, AccessibleRole.MENU_ITEM,</code>
and <code>AccessibleRole.PANEL</code>. The constants in this class present
a strongly typed enumeration of common object roles. A public constructor
for this class has been purposely omitted and applications should use one
of the constants from this class. Although this class pre-defines a large
@ -131,10 +131,10 @@ roles can be added in the future without needing to modify the base class.
<A NAME="AccessibleState"></A><A HREF="AccessibleState.html">Class AccessibleState</A></H3>
This class encapsulates a particular state of the Accessible object. Accessible
states include things like "Armed", "Busy", "Checked", "Focused", etc.
These roles are identified by the constants in this class such as <TT>AccessibleState.ARMED,
AccessibleState.BUSY, AccessibleState.CHECKED,</TT> and <TT>AccessibleState.FOCUSED</TT>.
These roles are identified by the constants in this class such as <code>AccessibleState.ARMED,
AccessibleState.BUSY, AccessibleState.CHECKED,</code> and <code>AccessibleState.FOCUSED</code>.
The sum of all the states of an Accessible object is called the <A HREF="#AccessibleStateSet">AccessibleStateSet</A>,
and can be obtained by calling the <TT>getAccessibleStateSet</TT> method
and can be obtained by calling the <code>getAccessibleStateSet</code> method
on an <A HREF="#AccessibleContext">AccessibleContext</A>.
<P>The constants in this class present a strongly typed enumeration of
@ -148,7 +148,7 @@ needing to modify the base class.
<A NAME="AccessibleStateSet"></A><A HREF="AccessibleStateSet.html">Class
AccessibleStateSet</A></H3>
This class encapsulates a collection of states of the Accessible object
and is obtained by calling the <TT>getAccessibleStateSet</TT> method on
and is obtained by calling the <code>getAccessibleStateSet</code> method on
an <A HREF="#AccessibleContext">AccessibleContext</A>. Since an object
might have multiple states (e.g. it might be both "Checked" and "Focused"),
this class is needed to encapsulate a collection of these states. Methods
@ -173,7 +173,7 @@ Any object that can be manipulated should support this interface.
<P>Applications can determine if an object supports the AccessibleAction
interface by first obtaining its <A HREF="#AccessibleContext">AccessibleContext</A>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <TT>getAccessibleAction</TT>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <code>getAccessibleAction</code>
method of <A HREF="#AccessibleContext">AccessibleContext</A>. If the return
value is not null, the object supports this interface.
<H3>
@ -186,7 +186,7 @@ determine and set the graphical representation of an object.
<P>Applications can determine if an object supports the AccessibleComponent
interface by first obtaining its <A HREF="#AccessibleContext">AccessibleContext</A>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <TT>getAccessibleComponent</TT>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <code>getAccessibleComponent</code>
method of <A HREF="#AccessibleContext">AccessibleContext</A>. If the return
value is not null, the object supports this interface.
<H3>
@ -200,7 +200,7 @@ the AccessibleSelection interface.
<P>Applications can determine if an object supports the AccessibleSelection
interface by first obtaining its <A HREF="#AccessibleContext">AccessibleContext</A>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <TT>getAccessibleSelection</TT>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <code>getAccessibleSelection</code>
method of <A HREF="#AccessibleContext">AccessibleContext</A>. If the return
value is not null, the object supports this interface.
<H3>
@ -222,7 +222,7 @@ the text caret.
<P>Applications can determine if an object supports the AccessibleText
interface by first obtaining its <A HREF="#AccessibleContext">AccessibleContext</A>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <TT>getAccessibleText</TT>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <code>getAccessibleText</code>
method of <A HREF="#AccessibleContext">AccessibleContext</A>. If the return
value is not null, the object supports this interface.
<H3><A NAME="AccessibleHypertext"></A>
@ -256,7 +256,7 @@ maximum values.
<P>Applications can determine if an object supports the AccessibleValue
interface by first obtaining its <A HREF="#AccessibleContext">AccessibleContext</A>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <TT>getAccessibleValue</TT>
(see <A HREF="#Accessible">Accessible</A>) and then calling the <code>getAccessibleValue</code>
method of <A HREF="#AccessibleContext">AccessibleContext</A>. If the return
value is not null, the object supports this interface.

View File

@ -40,7 +40,7 @@ import javax.imageio.spi.ServiceRegistry;
* @see javax.imageio.spi.ImageWriterSpi
* @see javax.imageio.spi.ImageTranscoderSpi
* @see javax.imageio.spi.ImageInputStreamSpi
*
* @see javax.imageio.spi.ImageOutputStreamSpi
*/
public abstract class IIOServiceProvider implements RegisterableService {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. 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
@ -47,18 +47,33 @@ import java.util.ServiceLoader;
* <p> Service providers are stored in one or more <i>categories</i>,
* each of which is defined by a class of interface (described by a
* <code>Class</code> object) that all of its members must implement.
* The set of categories may be changed dynamically.
*
* <p>The set of categories supported is limited
* to the following standard Image I/O service types:
*
* <ul>
* <li>{@link ImageInputStreamSpi}
* <li>{@link ImageOutputStreamSpi}
* <li>{@link ImageReaderSpi}
* <li>{@link ImageTranscoderSpi}
* <li>{@link ImageWriterSpi}
* </ul>
*
* <p>An attempt to load a provider that is not a subtype of one of the
* above types will result in {@code IllegalArgumentException}. For
* a general mechanism to load service providers, see
* {@link java.util.ServiceLoader ServiceLoader}.
*
* <p> Only a single instance of a given leaf class (that is, the
* actual class returned by <code>getClass()</code>, as opposed to any
* inherited classes or interfaces) may be registered. That is,
* suppose that the
* <code>com.mycompany.mypkg.GreenServiceProvider</code> class
* implements the <code>com.mycompany.mypkg.MyService</code>
* interface. If a <code>GreenServiceProvider</code> instance is
* <code>com.mycompany.mypkg.GreenImageReaderProvider</code> class
* is a subclass of <code>javax.imageio.spi.ImageReaderSpi</code>.
* If a <code>GreenImageReaderProvider</code> instance is
* registered, it will be stored in the category defined by the
* <code>MyService</code> class. If a new instance of
* <code>GreenServiceProvider</code> is registered, it will replace
* <code>ImageReaderSpi</code> class. If a new instance of
* <code>GreenImageReaderProvider</code> is registered, it will replace
* the previous instance. In practice, service provider objects are
* usually singletons so this behavior is appropriate.
*
@ -68,15 +83,15 @@ import java.util.ServiceLoader;
* for each service provider interface that has one or more
* implementation classes present in the JAR file. For example, if
* the JAR file contained a class named
* <code>com.mycompany.mypkg.MyServiceImpl</code> which implements the
* <code>javax.someapi.SomeService</code> interface, the JAR file
* <code>com.mycompany.mypkg.GreenImageReaderProvider</code> which implements the
* <code>javax.imageio.spi.ImageReaderSpi</code> interface, the JAR file
* would contain a file named: <pre>
* META-INF/services/javax.someapi.SomeService </pre>
* META-INF/services/javax.imageio.spi.ImageReaderSpi</pre>
*
* containing the line:
*
* <pre>
* com.mycompany.mypkg.MyService
* com.mycompany.mypkg.GreenImageReaderProvider
* </pre>
*
* <p> The service provider classes should be to be lightweight and
@ -94,7 +109,7 @@ import java.util.ServiceLoader;
* JAR File Specification</a>.
*
* @see RegisterableService
*
* @see java.util.ServiceLoader
*/
public class ServiceRegistry {
@ -104,13 +119,15 @@ public class ServiceRegistry {
/**
* Constructs a <code>ServiceRegistry</code> instance with a
* set of categories taken from the <code>categories</code>
* argument.
* argument. The categories must all be members of the set
* of service types listed in the class specification.
*
* @param categories an <code>Iterator</code> containing
* <code>Class</code> objects to be used to define categories.
*
* @exception IllegalArgumentException if
* <code>categories</code> is <code>null</code>.
* <code>categories</code> is <code>null</code>, or if
* one of the categories is not an allowed service type.
*/
public ServiceRegistry(Iterator<Class<?>> categories) {
if (categories == null) {
@ -118,6 +135,7 @@ public class ServiceRegistry {
}
while (categories.hasNext()) {
Class<?> category = categories.next();
checkClassAllowed(category);
SubRegistry reg = new SubRegistry(this, category);
categoryMap.put(category, reg);
}
@ -127,6 +145,10 @@ public class ServiceRegistry {
* Searches for implementations of a particular service class
* using the given class loader.
*
* <p>The service class must be one of the service types listed
* in the class specification. If it is not, {@code IllegalArgumentException}
* will be thrown.
*
* <p> This method transforms the name of the given service class
* into a provider-configuration filename as described in the
* class comment and then uses the <code>getResources</code>
@ -157,7 +179,8 @@ public class ServiceRegistry {
* cannot be found and instantiated.
*
* @exception IllegalArgumentException if
* <code>providerClass</code> is <code>null</code>.
* <code>providerClass</code> is <code>null</code>, or if it is
* not one of the allowed service types.
*/
public static <T> Iterator<T> lookupProviders(Class<T> providerClass,
ClassLoader loader)
@ -165,6 +188,7 @@ public class ServiceRegistry {
if (providerClass == null) {
throw new IllegalArgumentException("providerClass == null!");
}
checkClassAllowed(providerClass);
return ServiceLoader.load(providerClass, loader).iterator();
}
@ -178,6 +202,10 @@ public class ServiceRegistry {
* return Service.providers(service, cl);
* </pre>
*
* <p>The service class must be one of the service types listed
* in the class specification. If it is not, {@code IllegalArgumentException}
* will be thrown.
*
* @param providerClass a <code>Class</code>object indicating the
* class or interface of the service providers being detected.
*
@ -190,12 +218,14 @@ public class ServiceRegistry {
* cannot be found and instantiated.
*
* @exception IllegalArgumentException if
* <code>providerClass</code> is <code>null</code>.
* <code>providerClass</code> is <code>null</code>, or if it is
* not one of the allowed service types.
*/
public static <T> Iterator<T> lookupProviders(Class<T> providerClass) {
if (providerClass == null) {
throw new IllegalArgumentException("providerClass == null!");
}
checkClassAllowed(providerClass);
return ServiceLoader.load(providerClass).iterator();
}
@ -681,6 +711,28 @@ public class ServiceRegistry {
deregisterAll();
super.finalize();
}
/**
* Checks whether the provided class is one of the allowed
* ImageIO service provider classes. If it is, returns normally.
* If it is not, throws IllegalArgumentException.
*
* @param clazz
* @throws IllegalArgumentException if clazz is null or is not one of the allowed set
*/
private static void checkClassAllowed(Class<?> clazz) {
if (clazz == null) {
throw new IllegalArgumentException("class must not be null");
}
if ( clazz != ImageInputStreamSpi.class
&& clazz != ImageOutputStreamSpi.class
&& clazz != ImageReaderSpi.class
&& clazz != ImageTranscoderSpi.class
&& clazz != ImageWriterSpi.class) {
throw new IllegalArgumentException(clazz.getName() + " is not an ImageIO SPI class");
}
}
}

View File

@ -39,8 +39,8 @@ registry.
The <code>javax.imageio.spi</code> package contains service
provider interfaces for reading, writing, and transcoding images, and
obtaining input and output streams, as well as a run-time registry
that discovers installed service provider instances and allows new
obtaining image input and output streams, as well as a run-time registry
that discovers installed instances of Image I/O service providers and allows new
instances to be registered dynamically.
@since 1.4

View File

@ -111,7 +111,7 @@ public interface AttributeSet {
/**
* Returns the attribute value which this attribute set contains in the
* given attribute category. Returns <tt>null</tt> if this attribute set
* given attribute category. Returns {@code null} if this attribute set
* does not contain any attribute value in the given attribute category.
*
* @param category Attribute category whose associated attribute value
@ -121,14 +121,14 @@ public interface AttributeSet {
* Attribute}.
*
* @return The attribute value in the given attribute category contained
* in this attribute set, or <tt>null</tt> if this attribute set
* in this attribute set, or {@code null} if this attribute set
* does not contain any attribute value in the given attribute
* category.
*
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>category</CODE> is null.
* (unchecked exception) Thrown if the {@code category} is null.
* @throws ClassCastException
* (unchecked exception) Thrown if the <CODE>category</CODE> is not a
* (unchecked exception) Thrown if the {@code category} is not a
* {@link java.lang.Class Class} that implements interface {@link
* Attribute Attribute}.
*/
@ -141,74 +141,74 @@ public interface AttributeSet {
*
* @param attribute Attribute value to be added to this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call, i.e., the given attribute value was not already a member
* of this attribute set.
*
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if the {@code attribute} is null.
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not support
* the <CODE>add()</CODE> operation.
* the {@code add()} operation.
*/
public boolean add(Attribute attribute);
/**
* Removes any attribute for this category from this attribute set if
* present. If <CODE>category</CODE> is null, then
* <CODE>remove()</CODE> does nothing and returns <tt>false</tt>.
* present. If {@code category} is null, then
* {@code remove()} does nothing and returns {@code false}.
*
* @param category Attribute category to be removed from this
* attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call, i.e., the given attribute value had been a member of this
* attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not support
* the <CODE>remove()</CODE> operation.
* the {@code remove()} operation.
*/
public boolean remove(Class<?> category);
/**
* Removes the specified attribute from this attribute set if
* present. If <CODE>attribute</CODE> is null, then
* <CODE>remove()</CODE> does nothing and returns <tt>false</tt>.
* present. If {@code attribute} is null, then
* {@code remove()} does nothing and returns {@code false}.
*
* @param attribute Attribute value to be removed from this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call, i.e., the given attribute value had been a member of this
* attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not support
* the <CODE>remove()</CODE> operation.
* the {@code remove()} operation.
*/
public boolean remove(Attribute attribute);
/**
* Returns <tt>true</tt> if this attribute set contains an
* Returns {@code true} if this attribute set contains an
* attribute for the specified category.
*
* @param category whose presence in this attribute set is
* to be tested.
*
* @return <tt>true</tt> if this attribute set contains an attribute
* @return {@code true} if this attribute set contains an attribute
* value for the specified category.
*/
public boolean containsKey(Class<?> category);
/**
* Returns <tt>true</tt> if this attribute set contains the given
* Returns {@code true} if this attribute set contains the given
* attribute value.
*
* @param attribute Attribute value whose presence in this
* attribute set is to be tested.
*
* @return <tt>true</tt> if this attribute set contains the given
* @return {@code true} if this attribute set contains the given
* attribute value.
*/
public boolean containsValue(Attribute attribute);
@ -219,11 +219,11 @@ public interface AttributeSet {
* {@link #add(Attribute) add(Attribute)}
* operation had been applied to this attribute set successively with each
* element from the specified set.
* The behavior of the <CODE>addAll(AttributeSet)</CODE>
* The behavior of the {@code addAll(AttributeSet)}
* operation is unspecified if the specified set is modified while
* the operation is in progress.
* <P>
* If the <CODE>addAll(AttributeSet)</CODE> operation throws an exception,
* If the {@code addAll(AttributeSet)} operation throws an exception,
* the effect on this attribute set's state is implementation dependent;
* elements from the specified set before the point of the exception may
* or may not have been added to this attribute set.
@ -231,12 +231,12 @@ public interface AttributeSet {
* @param attributes whose elements are to be added to this attribute
* set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call.
*
* @throws UnmodifiableSetException
* (Unchecked exception) Thrown if this attribute set does not support
* the <tt>addAll(AttributeSet)</tt> method.
* the {@code addAll(AttributeSet)} method.
* @throws NullPointerException
* (Unchecked exception) Thrown if some element in the specified
* set is null.
@ -247,8 +247,8 @@ public interface AttributeSet {
/**
* Returns the number of attributes in this attribute set. If this
* attribute set contains more than <tt>Integer.MAX_VALUE</tt> elements,
* returns <tt>Integer.MAX_VALUE</tt>.
* attribute set contains more than {@code Integer.MAX_VALUE} elements,
* returns {@code Integer.MAX_VALUE}.
*
* @return The number of attributes in this attribute set.
*/
@ -267,7 +267,7 @@ public interface AttributeSet {
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not support
* the <CODE>clear()</CODE> operation.
* the {@code clear()} operation.
*/
public void clear();
@ -280,15 +280,15 @@ public interface AttributeSet {
/**
* Compares the specified object with this attribute set for equality.
* Returns <tt>true</tt> if the given object is also an attribute set and
* Returns {@code true} if the given object is also an attribute set and
* the two attribute sets contain the same attribute category-attribute
* value mappings. This ensures that the
* <tt>equals()</tt> method works properly across different
* {@code equals()} method works properly across different
* implementations of the AttributeSet interface.
*
* @param object to be compared for equality with this attribute set.
*
* @return <tt>true</tt> if the specified object is equal to this
* @return {@code true} if the specified object is equal to this
* attribute set.
*/
public boolean equals(Object object);
@ -297,9 +297,9 @@ public interface AttributeSet {
* Returns the hash code value for this attribute set. The hash code of an
* attribute set is defined to be the sum of the hash codes of each entry
* in the AttributeSet.
* This ensures that <tt>t1.equals(t2)</tt> implies that
* <tt>t1.hashCode()==t2.hashCode()</tt> for any two attribute sets
* <tt>t1</tt> and <tt>t2</tt>, as required by the general contract of
* This ensures that {@code t1.equals(t2)} implies that
* {@code t1.hashCode()==t2.hashCode()} for any two attribute sets
* {@code t1} and {@code t2}, as required by the general contract of
* {@link java.lang.Object#hashCode() Object.hashCode()}.
*
* @return The hash code value for this attribute set.

View File

@ -54,19 +54,19 @@ public interface DocAttributeSet extends AttributeSet {
*
* @param attribute Attribute value to be added to this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call, i.e., the given attribute value was not already a
* member of this attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not
* support the <CODE>add()</CODE> operation.
* support the {@code add()} operation.
* @throws ClassCastException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is
* (unchecked exception) Thrown if the {@code attribute} is
* not an instance of interface
* {@link DocAttribute DocAttribute}.
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if the {@code attribute} is null.
*/
public boolean add(Attribute attribute);
@ -77,13 +77,13 @@ public interface DocAttributeSet extends AttributeSet {
* operation had been applied to this attribute set successively with
* each element from the specified set. If none of the categories in the
* specified set are the same as any categories in this attribute set,
* the <tt>addAll()</tt> operation effectively modifies this attribute
* the {@code addAll()} operation effectively modifies this attribute
* set so that its value is the <i>union</i> of the two sets.
* <P>
* The behavior of the <CODE>addAll()</CODE> operation is unspecified if
* The behavior of the {@code addAll()} operation is unspecified if
* the specified set is modified while the operation is in progress.
* <P>
* If the <CODE>addAll()</CODE> operation throws an exception, the effect
* If the {@code addAll()} operation throws an exception, the effect
* on this attribute set's state is implementation dependent; elements
* from the specified set before the point of the exception may or
* may not have been added to this attribute set.
@ -91,12 +91,12 @@ public interface DocAttributeSet extends AttributeSet {
* @param attributes whose elements are to be added to this attribute
* set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call.
*
* @throws UnmodifiableSetException
* (Unchecked exception) Thrown if this attribute set does not
* support the <tt>addAll()</tt> method.
* support the {@code addAll()} method.
* @throws ClassCastException
* (Unchecked exception) Thrown if some element in the specified
* set is not an instance of interface {@link DocAttribute

View File

@ -32,7 +32,7 @@ import java.io.Serializable;
import java.util.HashMap;
/**
* Class HashAttributeSet provides an <code>AttributeSet</code>
* Class HashAttributeSet provides an {@code AttributeSet}
* implementation with characteristics of a hash map.
*
* @author Alan Kaminsky
@ -104,7 +104,7 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* @param attribute Attribute value to add to the set.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if {@code attribute} is null.
*/
public HashAttributeSet(Attribute attribute) {
this (attribute, Attribute.class);
@ -114,7 +114,7 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* Construct a new attribute set,
* initially populated with the values from the
* given array. The new attribute set is populated by
* adding the elements of <CODE>attributes</CODE> array to the set in
* adding the elements of {@code attributes} array to the set in
* sequence, starting at index 0. Thus, later array elements may replace
* earlier array elements if the array contains duplicate attribute
* values or attribute categories.
@ -124,7 +124,7 @@ public class HashAttributeSet implements AttributeSet, Serializable {
*
* @exception NullPointerException
* (unchecked exception) Thrown if any element of
* <CODE>attributes</CODE> is null.
* {@code attributes} is null.
*/
public HashAttributeSet(Attribute[] attributes) {
this (attributes, Attribute.class);
@ -171,11 +171,11 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* subinterface thereof.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if {@code attribute} is null.
* @exception NullPointerException if interfaceName is null.
* @exception ClassCastException
* (unchecked exception) Thrown if <CODE>attribute</CODE> is not an
* instance of <CODE>interfaceName</CODE>.
* (unchecked exception) Thrown if {@code attribute} is not an
* instance of {@code interfaceName}.
*/
protected HashAttributeSet(Attribute attribute, Class<?> interfaceName) {
if (interfaceName == null) {
@ -189,7 +189,7 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* Construct a new attribute set, where the members of the attribute
* set are restricted to the given interface.
* The new attribute set is populated
* by adding the elements of <CODE>attributes</CODE> array to the set in
* by adding the elements of {@code attributes} array to the set in
* sequence, starting at index 0. Thus, later array elements may replace
* earlier array elements if the array contains duplicate attribute
* values or attribute categories.
@ -203,12 +203,12 @@ public class HashAttributeSet implements AttributeSet, Serializable {
*
* @exception NullPointerException
* (unchecked exception) Thrown if any element of
* <CODE>attributes</CODE> is null.
* {@code attributes} is null.
* @exception NullPointerException if interfaceName is null.
* @exception ClassCastException
* (unchecked exception) Thrown if any element of
* <CODE>attributes</CODE> is not an instance of
* <CODE>interfaceName</CODE>.
* {@code attributes} is not an instance of
* {@code interfaceName}.
*/
protected HashAttributeSet(Attribute[] attributes, Class<?> interfaceName) {
if (interfaceName == null) {
@ -235,8 +235,8 @@ public class HashAttributeSet implements AttributeSet, Serializable {
*
* @exception ClassCastException
* (unchecked exception) Thrown if any element of
* <CODE>attributes</CODE> is not an instance of
* <CODE>interfaceName</CODE>.
* {@code attributes} is not an instance of
* {@code interfaceName}.
*/
protected HashAttributeSet(AttributeSet attributes, Class<?> interfaceName) {
myInterface = interfaceName;
@ -251,7 +251,7 @@ public class HashAttributeSet implements AttributeSet, Serializable {
/**
* Returns the attribute value which this attribute set contains in the
* given attribute category. Returns <tt>null</tt> if this attribute set
* given attribute category. Returns {@code null} if this attribute set
* does not contain any attribute value in the given attribute category.
*
* @param category Attribute category whose associated attribute value
@ -261,14 +261,14 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* Attribute}.
*
* @return The attribute value in the given attribute category contained
* in this attribute set, or <tt>null</tt> if this attribute set
* in this attribute set, or {@code null} if this attribute set
* does not contain any attribute value in the given attribute
* category.
*
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>category</CODE> is null.
* (unchecked exception) Thrown if the {@code category} is null.
* @throws ClassCastException
* (unchecked exception) Thrown if the <CODE>category</CODE> is not a
* (unchecked exception) Thrown if the {@code category} is not a
* {@link java.lang.Class Class} that implements interface {@link
* Attribute Attribute}.
*/
@ -285,15 +285,15 @@ public class HashAttributeSet implements AttributeSet, Serializable {
*
* @param attribute Attribute value to be added to this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call, i.e., the given attribute value was not already a
* member of this attribute set.
*
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if the {@code attribute} is null.
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not support
* the <CODE>add()</CODE> operation.
* the {@code add()} operation.
*/
public boolean add(Attribute attribute) {
Object oldAttribute =
@ -305,19 +305,19 @@ public class HashAttributeSet implements AttributeSet, Serializable {
/**
* Removes any attribute for this category from this attribute set if
* present. If <CODE>category</CODE> is null, then
* <CODE>remove()</CODE> does nothing and returns <tt>false</tt>.
* present. If {@code category} is null, then
* {@code remove()} does nothing and returns {@code false}.
*
* @param category Attribute category to be removed from this
* attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call, i.e., the given attribute category had been a member of
* this attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not
* support the <CODE>remove()</CODE> operation.
* support the {@code remove()} operation.
*/
public boolean remove(Class<?> category) {
return
@ -329,18 +329,18 @@ public class HashAttributeSet implements AttributeSet, Serializable {
/**
* Removes the specified attribute from this attribute set if
* present. If <CODE>attribute</CODE> is null, then
* <CODE>remove()</CODE> does nothing and returns <tt>false</tt>.
* present. If {@code attribute} is null, then
* {@code remove()} does nothing and returns {@code false}.
*
* @param attribute Attribute value to be removed from this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call, i.e., the given attribute value had been a member of
* this attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not
* support the <CODE>remove()</CODE> operation.
* support the {@code remove()} operation.
*/
public boolean remove(Attribute attribute) {
return
@ -349,13 +349,13 @@ public class HashAttributeSet implements AttributeSet, Serializable {
}
/**
* Returns <tt>true</tt> if this attribute set contains an
* Returns {@code true} if this attribute set contains an
* attribute for the specified category.
*
* @param category whose presence in this attribute set is
* to be tested.
*
* @return <tt>true</tt> if this attribute set contains an attribute
* @return {@code true} if this attribute set contains an attribute
* value for the specified category.
*/
public boolean containsKey(Class<?> category) {
@ -367,13 +367,13 @@ public class HashAttributeSet implements AttributeSet, Serializable {
}
/**
* Returns <tt>true</tt> if this attribute set contains the given
* Returns {@code true} if this attribute set contains the given
* attribute.
*
* @param attribute value whose presence in this attribute set is
* to be tested.
*
* @return <tt>true</tt> if this attribute set contains the given
* @return {@code true} if this attribute set contains the given
* attribute value.
*/
public boolean containsValue(Attribute attribute) {
@ -389,11 +389,11 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* {@link #add(Attribute) add(Attribute)}
* operation had been applied to this attribute set successively with
* each element from the specified set.
* The behavior of the <CODE>addAll(AttributeSet)</CODE>
* The behavior of the {@code addAll(AttributeSet)}
* operation is unspecified if the specified set is modified while
* the operation is in progress.
* <P>
* If the <CODE>addAll(AttributeSet)</CODE> operation throws an exception,
* If the {@code addAll(AttributeSet)} operation throws an exception,
* the effect on this attribute set's state is implementation dependent;
* elements from the specified set before the point of the exception may
* or may not have been added to this attribute set.
@ -401,12 +401,12 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* @param attributes whose elements are to be added to this attribute
* set.
*
* @return <tt>true</tt> if this attribute set changed as a result of the
* @return {@code true} if this attribute set changed as a result of the
* call.
*
* @throws UnmodifiableSetException
* (Unchecked exception) Thrown if this attribute set does not
* support the <tt>addAll(AttributeSet)</tt> method.
* support the {@code addAll(AttributeSet)} method.
* @throws NullPointerException
* (Unchecked exception) Thrown if some element in the specified
* set is null, or the set is null.
@ -429,8 +429,8 @@ public class HashAttributeSet implements AttributeSet, Serializable {
/**
* Returns the number of attributes in this attribute set. If this
* attribute set contains more than <tt>Integer.MAX_VALUE</tt> elements,
* returns <tt>Integer.MAX_VALUE</tt>.
* attribute set contains more than {@code Integer.MAX_VALUE} elements,
* returns {@code Integer.MAX_VALUE}.
*
* @return The number of attributes in this attribute set.
*/
@ -455,7 +455,7 @@ public class HashAttributeSet implements AttributeSet, Serializable {
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not support
* the <CODE>clear()</CODE> operation.
* the {@code clear()} operation.
*/
public void clear() {
attrMap.clear();
@ -472,15 +472,15 @@ public class HashAttributeSet implements AttributeSet, Serializable {
/**
* Compares the specified object with this attribute set for equality.
* Returns <tt>true</tt> if the given object is also an attribute set and
* Returns {@code true} if the given object is also an attribute set and
* the two attribute sets contain the same attribute category-attribute
* value mappings. This ensures that the
* <tt>equals()</tt> method works properly across different
* {@code equals()} method works properly across different
* implementations of the AttributeSet interface.
*
* @param object to be compared for equality with this attribute set.
*
* @return <tt>true</tt> if the specified object is equal to this
* @return {@code true} if the specified object is equal to this
* attribute set.
*/
@ -507,9 +507,9 @@ public class HashAttributeSet implements AttributeSet, Serializable {
* Returns the hash code value for this attribute set.
* The hash code of an attribute set is defined to be the sum
* of the hash codes of each entry in the AttributeSet.
* This ensures that <tt>t1.equals(t2)</tt> implies that
* <tt>t1.hashCode()==t2.hashCode()</tt> for any two attribute sets
* <tt>t1</tt> and <tt>t2</tt>, as required by the general contract of
* This ensures that {@code t1.equals(t2)} implies that
* {@code t1.hashCode()==t2.hashCode()} for any two attribute sets
* {@code t1} and {@code t2}, as required by the general contract of
* {@link java.lang.Object#hashCode() Object.hashCode()}.
*
* @return The hash code value for this attribute set.

View File

@ -52,19 +52,19 @@ public interface PrintJobAttributeSet extends AttributeSet {
*
* @param attribute Attribute value to be added to this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call, i.e., the given attribute value was not already a
* member of this attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not
* support the <CODE>add()</CODE> operation.
* support the {@code add()} operation.
* @throws ClassCastException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is
* (unchecked exception) Thrown if the {@code attribute} is
* not an instance of interface
* {@link PrintJobAttribute PrintJobAttribute}.
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if the {@code attribute} is null.
*/
public boolean add(Attribute attribute);
@ -75,13 +75,13 @@ public interface PrintJobAttributeSet extends AttributeSet {
* operation had been applied to this attribute set successively with
* each element from the specified set. If none of the categories in the
* specified set are the same as any categories in this attribute set,
* the <tt>addAll()</tt> operation effectively modifies this attribute
* the {@code addAll()} operation effectively modifies this attribute
* set so that its value is the <i>union</i> of the two sets.
* <P>
* The behavior of the <CODE>addAll()</CODE> operation is unspecified if
* The behavior of the {@code addAll()} operation is unspecified if
* the specified set is modified while the operation is in progress.
* <P>
* If the <CODE>addAll()</CODE> operation throws an exception, the effect
* If the {@code addAll()} operation throws an exception, the effect
* on this attribute set's state is implementation dependent; elements
* from the specified set before the point of the exception may or
* may not have been added to this attribute set.
@ -89,12 +89,12 @@ public interface PrintJobAttributeSet extends AttributeSet {
* @param attributes whose elements are to be added to this attribute
* set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call.
*
* @throws UnmodifiableSetException
* (Unchecked exception) Thrown if this attribute set does not
* support the <tt>addAll()</tt> method.
* support the {@code addAll()} method.
* @throws ClassCastException
* (Unchecked exception) Thrown if some element in the specified
* set is not an instance of interface {@link PrintJobAttribute

View File

@ -53,19 +53,19 @@ public interface PrintRequestAttributeSet extends AttributeSet {
*
* @param attribute Attribute value to be added to this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call, i.e., the given attribute value was not already a
* member of this attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not
* support the <CODE>add()</CODE> operation.
* support the {@code add()} operation.
* @throws ClassCastException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is
* (unchecked exception) Thrown if the {@code attribute} is
* not an instance of interface
* {@link PrintRequestAttribute PrintRequestAttribute}.
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if the {@code attribute} is null.
*/
public boolean add(Attribute attribute);
@ -76,13 +76,13 @@ public interface PrintRequestAttributeSet extends AttributeSet {
* operation had been applied to this attribute set successively with
* each element from the specified set. If none of the categories in the
* specified set are the same as any categories in this attribute set,
* the <tt>addAll()</tt> operation effectively modifies this attribute
* the {@code addAll()} operation effectively modifies this attribute
* set so that its value is the <i>union</i> of the two sets.
* <P>
* The behavior of the <CODE>addAll()</CODE> operation is unspecified if
* The behavior of the {@code addAll()} operation is unspecified if
* the specified set is modified while the operation is in progress.
* <P>
* If the <CODE>addAll()</CODE> operation throws an exception, the effect
* If the {@code addAll()} operation throws an exception, the effect
* on this attribute set's state is implementation dependent; elements
* from the specified set before the point of the exception may or
* may not have been added to this attribute set.
@ -90,12 +90,12 @@ public interface PrintRequestAttributeSet extends AttributeSet {
* @param attributes whose elements are to be added to this attribute
* set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call.
*
* @throws UnmodifiableSetException
* (Unchecked exception) Thrown if this attribute set does not
* support the <tt>addAll()</tt> method.
* support the {@code addAll()} method.
* @throws ClassCastException
* (Unchecked exception) Thrown if some element in the specified
* set is not an instance of interface {@link PrintRequestAttribute

View File

@ -57,19 +57,19 @@ public interface PrintServiceAttributeSet extends AttributeSet {
*
* @param attribute Attribute value to be added to this attribute set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call, i.e., the given attribute value was not already a
* member of this attribute set.
*
* @throws UnmodifiableSetException
* (unchecked exception) Thrown if this attribute set does not
* support the <CODE>add()</CODE> operation.
* support the {@code add()} operation.
* @throws ClassCastException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is
* (unchecked exception) Thrown if the {@code attribute} is
* not an instance of interface
* {@link PrintServiceAttribute PrintServiceAttribute}.
* @throws NullPointerException
* (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
* (unchecked exception) Thrown if the {@code attribute} is null.
*/
public boolean add(Attribute attribute);
@ -80,13 +80,13 @@ public interface PrintServiceAttributeSet extends AttributeSet {
* operation had been applied to this attribute set successively with
* each element from the specified set. If none of the categories in the
* specified set are the same as any categories in this attribute set,
* the <tt>addAll()</tt> operation effectively modifies this attribute
* the {@code addAll()} operation effectively modifies this attribute
* set so that its value is the <i>union</i> of the two sets.
* <P>
* The behavior of the <CODE>addAll()</CODE> operation is unspecified if
* The behavior of the {@code addAll()} operation is unspecified if
* the specified set is modified while the operation is in progress.
* <P>
* If the <CODE>addAll()</CODE> operation throws an exception, the effect
* If the {@code addAll()} operation throws an exception, the effect
* on this attribute set's state is implementation dependent; elements
* from the specified set before the point of the exception may or
* may not have been added to this attribute set.
@ -94,12 +94,12 @@ public interface PrintServiceAttributeSet extends AttributeSet {
* @param attributes whose elements are to be added to this attribute
* set.
*
* @return <tt>true</tt> if this attribute set changed as a result of
* @return {@code true} if this attribute set changed as a result of
* the call.
*
* @throws UnmodifiableSetException
* (Unchecked exception) Thrown if this attribute set does not
* support the <tt>addAll()</tt> method.
* support the {@code addAll()} method.
* @throws ClassCastException
* (Unchecked exception) Thrown if some element in the specified
* set is not an instance of interface {@link PrintServiceAttribute

View File

@ -59,8 +59,8 @@ import javax.print.attribute.PrintJobAttribute;
* java.util.Collections}).
* <P>
* <B>IPP Compatibility:</B> The string value returned by each individual {@link
* JobStateReason JobStateReason} object's <CODE>toString()</CODE> method gives
* the IPP keyword value. The category name returned by <CODE>getName()</CODE>
* JobStateReason JobStateReason} object's {@code toString()} method gives
* the IPP keyword value. The category name returned by {@code getName()}
* gives the IPP attribute name.
*
* @author Alan Kaminsky
@ -114,11 +114,11 @@ public final class JobStateReasons
* @param collection Collection to copy.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <CODE>collection</CODE> is null or
* if any element in <CODE>collection</CODE> is null.
* (unchecked exception) Thrown if {@code collection} is null or
* if any element in {@code collection} is null.
* @throws ClassCastException
* (unchecked exception) Thrown if any element in
* <CODE>collection</CODE> is not an instance of class {@link
* {@code collection} is not an instance of class {@link
* JobStateReason JobStateReason}.
*/
public JobStateReasons(Collection<JobStateReason> collection) {
@ -130,11 +130,11 @@ public final class JobStateReasons
* not already present. The element to be added must be an instance of class
* {@link JobStateReason JobStateReason}. If this job state reasons
* attribute already contains the specified element, the call leaves this
* job state reasons attribute unchanged and returns <tt>false</tt>.
* job state reasons attribute unchanged and returns {@code false}.
*
* @param o Element to be added to this job state reasons attribute.
*
* @return <tt>true</tt> if this job state reasons attribute did not
* @return {@code true} if this job state reasons attribute did not
* already contain the specified element.
*
* @throws NullPointerException
@ -169,7 +169,7 @@ public final class JobStateReasons
* instance.
* <P>
* For class JobStateReasons, the category
* name is <CODE>"job-state-reasons"</CODE>.
* name is {@code "job-state-reasons"}.
*
* @return Attribute category name.
*/

View File

@ -72,10 +72,10 @@ import javax.print.attribute.PrintServiceAttribute;
* <P>
* <B>IPP Compatibility:</B> The string values returned by each individual
* {@link PrinterStateReason PrinterStateReason} object's and the associated
* {@link Severity Severity} object's <CODE>toString()</CODE> methods,
* {@link Severity Severity} object's {@code toString()} methods,
* concatenated
* together with a hyphen (<CODE>"-"</CODE>) in between, gives the IPP keyword
* value. The category name returned by <CODE>getName()</CODE> gives the IPP
* together with a hyphen ({@code "-"}) in between, gives the IPP keyword
* value. The category name returned by {@code getName()} gives the IPP
* attribute name.
*
* @author Alan Kaminsky
@ -133,12 +133,12 @@ public final class PrinterStateReasons
* @param map Map to copy.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <CODE>map</CODE> is null or if any
* key or value in <CODE>map</CODE> is null.
* (unchecked exception) Thrown if {@code map} is null or if any
* key or value in {@code map} is null.
* @throws ClassCastException
* (unchecked exception) Thrown if any key in <CODE>map</CODE> is not
* (unchecked exception) Thrown if any key in {@code map} is not
* an instance of class {@link PrinterStateReason PrinterStateReason} or
* if any value in <CODE>map</CODE> is not an instance of class
* if any value in {@code map} is not an instance of class
* {@link Severity Severity}.
*/
public PrinterStateReasons(Map<PrinterStateReason,Severity> map) {
@ -159,16 +159,16 @@ public final class PrinterStateReasons
* an instance of class {@link Severity Severity}.
*
* @return Previous severity associated with the given printer state
* reason, or <tt>null</tt> if the given printer state reason was
* reason, or {@code null} if the given printer state reason was
* not present.
*
* @throws NullPointerException
* (unchecked exception) Thrown if <CODE>reason</CODE> is null or
* <CODE>severity</CODE> is null.
* (unchecked exception) Thrown if {@code reason} is null or
* {@code severity} is null.
* @throws ClassCastException
* (unchecked exception) Thrown if <CODE>reason</CODE> is not an
* (unchecked exception) Thrown if {@code reason} is not an
* instance of class {@link PrinterStateReason PrinterStateReason} or if
* <CODE>severity</CODE> is not an instance of class {@link Severity
* {@code severity} is not an instance of class {@link Severity
* Severity}.
* @since 1.5
*/
@ -201,7 +201,7 @@ public final class PrinterStateReasons
* instance.
* <P>
* For class PrinterStateReasons, the
* category name is <CODE>"printer-state-reasons"</CODE>.
* category name is {@code "printer-state-reasons"}.
*
* @return Attribute category name.
*/
@ -228,7 +228,7 @@ public final class PrinterStateReasons
* Severity} level.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <CODE>severity</CODE> is null.
* (unchecked exception) Thrown if {@code severity} is null.
*/
public Set<PrinterStateReason> printerStateReasonSet(Severity severity) {
if (severity == null) {

View File

@ -54,28 +54,28 @@ import java.io.PrintStream;
* <p> The BoxLayout manager is constructed with an axis parameter that
* specifies the type of layout that will be done. There are four choices:
*
* <blockquote><b><tt>X_AXIS</tt></b> - Components are laid out horizontally
* <blockquote><b>{@code X_AXIS}</b> - Components are laid out horizontally
* from left to right.</blockquote>
*
* <blockquote><b><tt>Y_AXIS</tt></b> - Components are laid out vertically
* <blockquote><b>{@code Y_AXIS}</b> - Components are laid out vertically
* from top to bottom.</blockquote>
*
* <blockquote><b><tt>LINE_AXIS</tt></b> - Components are laid out the way
* <blockquote><b>{@code LINE_AXIS}</b> - Components are laid out the way
* words are laid out in a line, based on the container's
* <tt>ComponentOrientation</tt> property. If the container's
* <tt>ComponentOrientation</tt> is horizontal then components are laid out
* {@code ComponentOrientation} property. If the container's
* {@code ComponentOrientation} is horizontal then components are laid out
* horizontally, otherwise they are laid out vertically. For horizontal
* orientations, if the container's <tt>ComponentOrientation</tt> is left to
* orientations, if the container's {@code ComponentOrientation} is left to
* right then components are laid out left to right, otherwise they are laid
* out right to left. For vertical orientations components are always laid out
* from top to bottom.</blockquote>
*
* <blockquote><b><tt>PAGE_AXIS</tt></b> - Components are laid out the way
* <blockquote><b>{@code PAGE_AXIS}</b> - Components are laid out the way
* text lines are laid out on a page, based on the container's
* <tt>ComponentOrientation</tt> property. If the container's
* <tt>ComponentOrientation</tt> is horizontal then components are laid out
* {@code ComponentOrientation} property. If the container's
* {@code ComponentOrientation} is horizontal then components are laid out
* vertically, otherwise they are laid out horizontally. For horizontal
* orientations, if the container's <tt>ComponentOrientation</tt> is left to
* orientations, if the container's {@code ComponentOrientation} is left to
* right then components are laid out left to right, otherwise they are laid
* out right to left.&nbsp; For vertical orientations components are always
* laid out from top to bottom.</blockquote>
@ -102,10 +102,10 @@ import java.io.PrintStream;
* BoxLayout attempts to make all components in the column
* as wide as the widest component.
* If that fails, it aligns them horizontally
* according to their X alignments. For <code>PAGE_AXIS</code> layout,
* according to their X alignments. For {@code PAGE_AXIS} layout,
* horizontal alignment is done based on the leading edge of the component.
* In other words, an X alignment value of 0.0 means the left edge of a
* component if the container's <code>ComponentOrientation</code> is left to
* component if the container's {@code ComponentOrientation} is left to
* right and it means the right edge of the component otherwise.
* <p>
* Instead of using BoxLayout directly, many programs use the Box class.
@ -125,7 +125,7 @@ import java.io.PrintStream;
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans&trade;
* has been added to the <code>java.beans</code> package.
* has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see Box
@ -152,14 +152,14 @@ public class BoxLayout implements LayoutManager2, Serializable {
/**
* Specifies that components should be laid out in the direction of
* a line of text as determined by the target container's
* <code>ComponentOrientation</code> property.
* {@code ComponentOrientation} property.
*/
public static final int LINE_AXIS = 2;
/**
* Specifies that components should be laid out in the direction that
* lines flow across a page as determined by the target container's
* <code>ComponentOrientation</code> property.
* {@code ComponentOrientation} property.
*/
public static final int PAGE_AXIS = 3;
@ -169,12 +169,10 @@ public class BoxLayout implements LayoutManager2, Serializable {
*
* @param target the container that needs to be laid out
* @param axis the axis to lay out components along. Can be one of:
* <code>BoxLayout.X_AXIS</code>,
* <code>BoxLayout.Y_AXIS</code>,
* <code>BoxLayout.LINE_AXIS</code> or
* <code>BoxLayout.PAGE_AXIS</code>
* {@code BoxLayout.X_AXIS, BoxLayout.Y_AXIS,
* BoxLayout.LINE_AXIS} or {@code BoxLayout.PAGE_AXIS}
*
* @exception AWTError if the value of <code>axis</code> is invalid
* @exception AWTError if the value of {@code axis} is invalid
*/
@ConstructorProperties({"target", "axis"})
public BoxLayout(Container target, int axis) {
@ -192,10 +190,8 @@ public class BoxLayout implements LayoutManager2, Serializable {
*
* @param target the container that needs to be laid out
* @param axis the axis to lay out components along. Can be one of:
* <code>BoxLayout.X_AXIS</code>,
* <code>BoxLayout.Y_AXIS</code>,
* <code>BoxLayout.LINE_AXIS</code> or
* <code>BoxLayout.PAGE_AXIS</code>
* {@code BoxLayout.X_AXIS, BoxLayout.Y_AXIS,
* BoxLayout.LINE_AXIS} or {@code BoxLayout.PAGE_AXIS}
*
* @param dbg the stream to which debugging messages should be sent,
* null if none
@ -219,10 +215,8 @@ public class BoxLayout implements LayoutManager2, Serializable {
/**
* Returns the axis that was used to lay out components.
* Returns one of:
* <code>BoxLayout.X_AXIS</code>,
* <code>BoxLayout.Y_AXIS</code>,
* <code>BoxLayout.LINE_AXIS</code> or
* <code>BoxLayout.PAGE_AXIS</code>
* {@code BoxLayout.X_AXIS, BoxLayout.Y_AXIS,
* BoxLayout.LINE_AXIS} or {@code BoxLayout.PAGE_AXIS}
*
* @return the axis that was used to lay out components
*

View File

@ -80,7 +80,7 @@ public class ListSelectionEvent extends EventObject
/**
* Returns the index of the first row whose selection may have changed.
* {@code getFirstIndex() &lt;= getLastIndex()}
* {@code getFirstIndex() <= getLastIndex()}
*
* @return the first row whose selection value may have changed,
* where zero is the first row
@ -89,7 +89,7 @@ public class ListSelectionEvent extends EventObject
/**
* Returns the index of the last row whose selection may have changed.
* {@code getLastIndex() &gt;= getFirstIndex()}
* {@code getLastIndex() >= getFirstIndex()}
*
* @return the last row whose selection value may have changed,
* where zero is the first row

View File

@ -30,8 +30,8 @@ import java.util.Enumeration;
* A generic interface for a mutable collection of unique attributes.
*
* Implementations will probably want to provide a constructor of the
* form:<tt>
* public XXXAttributeSet(ConstAttributeSet source);</tt>
* form: <pre>{@code
* public XXXAttributeSet(ConstAttributeSet source);}</pre>
*
*/
public interface MutableAttributeSet extends AttributeSet {
@ -55,21 +55,21 @@ public interface MutableAttributeSet extends AttributeSet {
public void addAttributes(AttributeSet attributes);
/**
* Removes an attribute with the given <code>name</code>.
* Removes an attribute with the given {@code name}.
*
* @param name the attribute name
*/
public void removeAttribute(Object name);
/**
* Removes an attribute set with the given <code>names</code>.
* Removes an attribute set with the given {@code names}.
*
* @param names the set of names
*/
public void removeAttributes(Enumeration<?> names);
/**
* Removes a set of attributes with the given <code>name</code>.
* Removes a set of attributes with the given {@code name}.
*
* @param attributes the set of attributes
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. 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
@ -71,7 +71,7 @@ import sun.util.logging.PlatformLogger;
* are read the same way as described above (as before
* the fix for 4638447).
*/
final class DebugSettings {
public final class DebugSettings {
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.debug.DebugSettings");
/* standard debug property key names */
@ -87,28 +87,21 @@ final class DebugSettings {
};
/* global instance of the settings object */
private static DebugSettings instance = null;
private static final DebugSettings instance = new DebugSettings();
private Properties props = new Properties();
private final Properties props = new Properties();
static void init() {
if (instance != null) {
static synchronized void init() {
if (!instance.props.isEmpty()) {
return;
}
NativeLibLoader.loadLibraries();
instance = new DebugSettings();
instance.loadProperties();
instance.loadNativeSettings();
}
private DebugSettings() {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
loadProperties();
return null;
}
});
public static DebugSettings getInstance() {
return instance;
}
/*

View File

@ -33,33 +33,33 @@ import java.util.List;
import java.util.RandomAccess;
/**
* Resizable-array implementation of the <tt>List</tt> interface. Implements
* Resizable-array implementation of the {@code List} interface. Implements
* all optional list operations, and permits all elements, including
* <tt>null</tt>. In addition to implementing the <tt>List</tt> interface,
* {@code null}. In addition to implementing the {@code List} interface,
* this class provides methods to manipulate the size of the array that is
* used internally to store the list. (This class is roughly equivalent to
* <tt>Vector</tt>, except that it is unsynchronized.)<p>
* {@code Vector}, except that it is unsynchronized.)<p>
*
* The <tt>size</tt>, <tt>isEmpty</tt>, <tt>get</tt>, <tt>set</tt>,
* <tt>iterator</tt>, and <tt>listIterator</tt> operations run in constant
* time. The <tt>add</tt> operation runs in <i>amortized constant time</i>,
* The {@code size}, {@code isEmpty}, {@code get}, {@code set},
* {@code iterator}, and {@code listIterator} operations run in constant
* time. The {@code add} operation runs in <i>amortized constant time</i>,
* that is, adding n elements requires O(n) time. All of the other operations
* run in linear time (roughly speaking). The constant factor is low compared
* to that for the <tt>LinkedList</tt> implementation.<p>
* to that for the {@code LinkedList} implementation.<p>
*
* Each <tt>IdentityArrayList</tt> instance has a <i>capacity</i>. The capacity is
* Each {@code IdentityArrayList} instance has a <i>capacity</i>. The capacity is
* the size of the array used to store the elements in the list. It is always
* at least as large as the list size. As elements are added to an IdentityArrayList,
* its capacity grows automatically. The details of the growth policy are not
* specified beyond the fact that adding an element has constant amortized
* time cost.<p>
*
* An application can increase the capacity of an <tt>IdentityArrayList</tt> instance
* before adding a large number of elements using the <tt>ensureCapacity</tt>
* An application can increase the capacity of an {@code IdentityArrayList} instance
* before adding a large number of elements using the {@code ensureCapacity}
* operation. This may reduce the amount of incremental reallocation.
*
* <p><strong>Note that this implementation is not synchronized.</strong>
* If multiple threads access an <tt>IdentityArrayList</tt> instance concurrently,
* If multiple threads access an {@code IdentityArrayList} instance concurrently,
* and at least one of the threads modifies the list structurally, it
* <i>must</i> be synchronized externally. (A structural modification is
* any operation that adds or deletes one or more elements, or explicitly
@ -73,10 +73,10 @@ import java.util.RandomAccess;
* unsynchronized access to the list:<pre>
* List list = Collections.synchronizedList(new IdentityArrayList(...));</pre>
*
* <p>The iterators returned by this class's <tt>iterator</tt> and
* <tt>listIterator</tt> methods are <i>fail-fast</i>: if the list is
* <p>The iterators returned by this class's {@code iterator} and
* {@code listIterator} methods are <i>fail-fast</i>: if the list is
* structurally modified at any time after the iterator is created, in any way
* except through the iterator's own <tt>remove</tt> or <tt>add</tt> methods,
* except through the iterator's own {@code remove} or {@code add} methods,
* the iterator will throw a {@link ConcurrentModificationException}. Thus, in
* the face of concurrent modification, the iterator fails quickly and cleanly,
* rather than risking arbitrary, non-deterministic behavior at an undetermined
@ -85,7 +85,7 @@ import java.util.RandomAccess;
* Note that the fail-fast behavior of an iterator cannot be guaranteed
* as it is, generally speaking, impossible to make any hard guarantees in the
* presence of unsynchronized concurrent modification. Fail-fast iterators
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
* throw {@code ConcurrentModificationException} on a best-effort basis.
* Therefore, it would be wrong to write a program that depended on this
* exception for its correctness: <i>the fail-fast behavior of iterators
* should be used only to detect bugs.</i><p>
@ -149,9 +149,9 @@ public class IdentityArrayList<E> extends AbstractList<E>
}
/**
* Trims the capacity of this <tt>IdentityArrayList</tt> instance to be the
* Trims the capacity of this {@code IdentityArrayList} instance to be the
* list's current size. An application can use this operation to minimize
* the storage of an <tt>IdentityArrayList</tt> instance.
* the storage of an {@code IdentityArrayList} instance.
*/
public void trimToSize() {
modCount++;
@ -162,7 +162,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
}
/**
* Increases the capacity of this <tt>IdentityArrayList</tt> instance, if
* Increases the capacity of this {@code IdentityArrayList} instance, if
* necessary, to ensure that it can hold at least the number of elements
* specified by the minimum capacity argument.
*
@ -191,22 +191,22 @@ public class IdentityArrayList<E> extends AbstractList<E>
}
/**
* Returns <tt>true</tt> if this list contains no elements.
* Returns {@code true} if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
* @return {@code true} if this list contains no elements
*/
public boolean isEmpty() {
return size == 0;
}
/**
* Returns <tt>true</tt> if this list contains the specified element.
* More formally, returns <tt>true</tt> if and only if this list contains
* at least one element <tt>e</tt> such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o == e)</tt>.
* Returns {@code true} if this list contains the specified element.
* More formally, returns {@code true} if and only if this list contains
* at least one element {@code e} such that
* {@code Objects.equals(o, e)}.
*
* @param o element whose presence in this list is to be tested
* @return <tt>true</tt> if this list contains the specified element
* @return {@code true} if this list contains the specified element
*/
public boolean contains(Object o) {
return indexOf(o) >= 0;
@ -215,8 +215,8 @@ public class IdentityArrayList<E> extends AbstractList<E>
/**
* Returns the index of the first occurrence of the specified element
* in this list, or -1 if this list does not contain the element.
* More formally, returns the lowest index <tt>i</tt> such that
* <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o == get(i))</tt>,
* More formally, returns the lowest index {@code i} such that
* {@code Objects.equals(o, get(i))},
* or -1 if there is no such index.
*/
public int indexOf(Object o) {
@ -231,8 +231,8 @@ public class IdentityArrayList<E> extends AbstractList<E>
/**
* Returns the index of the last occurrence of the specified element
* in this list, or -1 if this list does not contain the element.
* More formally, returns the highest index <tt>i</tt> such that
* <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o == get(i))</tt>,
* More formally, returns the highest index {@code i} such that
* {@code Objects.equals(o, get(i))},
* or -1 if there is no such index.
*/
public int lastIndexOf(Object o) {
@ -273,7 +273,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
* <p>If the list fits in the specified array with room to spare
* (i.e., the array has more elements than the list), the element in
* the array immediately following the end of the collection is set to
* <tt>null</tt>. (This is useful in determining the length of the
* {@code null}. (This is useful in determining the length of the
* list <i>only</i> if the caller knows that the list does not contain
* any null elements.)
*
@ -336,7 +336,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
* Appends the specified element to the end of this list.
*
* @param e element to be appended to this list
* @return <tt>true</tt> (as specified by {@link Collection#add})
* @return {@code true} (as specified by {@link Collection#add})
*/
public boolean add(E e) {
ensureCapacity(size + 1); // Increments modCount!!
@ -392,14 +392,13 @@ public class IdentityArrayList<E> extends AbstractList<E>
* Removes the first occurrence of the specified element from this list,
* if it is present. If the list does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
* <tt>i</tt> such that
* <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o == get(i))</tt>
* (if such an element exists). Returns <tt>true</tt> if this list
* {@code i} such that {@code Objects.equals(o, get(i))}
* (if such an element exists). Returns {@code true} if this list
* contained the specified element (or equivalently, if this list
* changed as a result of the call).
*
* @param o element to be removed from this list, if present
* @return <tt>true</tt> if this list contained the specified element
* @return {@code true} if this list contained the specified element
*/
public boolean remove(Object o) {
for (int index = 0; index < size; index++) {
@ -448,7 +447,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
* list is nonempty.)
*
* @param c collection containing elements to be added to this list
* @return <tt>true</tt> if this list changed as a result of the call
* @return {@code true} if this list changed as a result of the call
* @throws NullPointerException if the specified collection is null
*/
public boolean addAll(Collection<? extends E> c) {
@ -471,7 +470,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
* @param index index at which to insert the first element from the
* specified collection
* @param c collection containing elements to be added to this list
* @return <tt>true</tt> if this list changed as a result of the call
* @return {@code true} if this list changed as a result of the call
* @throws IndexOutOfBoundsException {@inheritDoc}
* @throws NullPointerException if the specified collection is null
*/
@ -494,10 +493,10 @@ public class IdentityArrayList<E> extends AbstractList<E>
/**
* Removes from this list all of the elements whose index is between
* <tt>fromIndex</tt>, inclusive, and <tt>toIndex</tt>, exclusive.
* {@code fromIndex}, inclusive, and {@code toIndex}, exclusive.
* Shifts any succeeding elements to the left (reduces their index).
* This call shortens the list by <tt>(toIndex - fromIndex)</tt> elements.
* (If <tt>toIndex==fromIndex</tt>, this operation has no effect.)
* This call shortens the list by {@code (toIndex - fromIndex)} elements.
* (If {@code toIndex==fromIndex}, this operation has no effect.)
*
* @param fromIndex index of first element to be removed
* @param toIndex index after last element to be removed

View File

@ -35,18 +35,18 @@ import java.util.ListIterator;
import java.util.NoSuchElementException;
/**
* Linked list implementation of the <tt>List</tt> interface. Implements all
* Linked list implementation of the {@code List} interface. Implements all
* optional list operations, and permits all elements (including
* <tt>null</tt>). In addition to implementing the <tt>List</tt> interface,
* the <tt>IdentityLinkedList</tt> class provides uniformly named methods to
* <tt>get</tt>, <tt>remove</tt> and <tt>insert</tt> an element at the
* {@code null}). In addition to implementing the {@code List} interface,
* the {@code IdentityLinkedList} class provides uniformly named methods to
* {@code get}, {@code remove} and {@code insert} an element at the
* beginning and end of the list. These operations allow linked lists to be
* used as a stack, {@linkplain java.util.Queue queue}, or {@linkplain Deque
* double-ended queue}. <p>
*
* The class implements the <tt>Deque</tt> interface, providing
* first-in-first-out queue operations for <tt>add</tt>,
* <tt>poll</tt>, along with other stack and deque operations.<p>
* The class implements the {@code Deque} interface, providing
* first-in-first-out queue operations for {@code add},
* {@code poll}, along with other stack and deque operations.<p>
*
* All of the operations perform as could be expected for a doubly-linked
* list. Operations that index into the list will traverse the list from
@ -67,11 +67,11 @@ import java.util.NoSuchElementException;
* unsynchronized access to the list:<pre>
* List list = Collections.synchronizedList(new IdentityLinkedList(...));</pre>
*
* <p>The iterators returned by this class's <tt>iterator</tt> and
* <tt>listIterator</tt> methods are <i>fail-fast</i>: if the list is
* <p>The iterators returned by this class's {@code iterator} and
* {@code listIterator} methods are <i>fail-fast</i>: if the list is
* structurally modified at any time after the iterator is created, in
* any way except through the Iterator's own <tt>remove</tt> or
* <tt>add</tt> methods, the iterator will throw a {@link
* any way except through the Iterator's own {@code remove} or
* {@code add} methods, the iterator will throw a {@link
* ConcurrentModificationException}. Thus, in the face of concurrent
* modification, the iterator fails quickly and cleanly, rather than
* risking arbitrary, non-deterministic behavior at an undetermined
@ -80,7 +80,7 @@ import java.util.NoSuchElementException;
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
* as it is, generally speaking, impossible to make any hard guarantees in the
* presence of unsynchronized concurrent modification. Fail-fast iterators
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
* throw {@code ConcurrentModificationException} on a best-effort basis.
* Therefore, it would be wrong to write a program that depended on this
* exception for its correctness: <i>the fail-fast behavior of iterators
* should be used only to detect bugs.</i>
@ -180,13 +180,13 @@ public class IdentityLinkedList<E>
}
/**
* Returns <tt>true</tt> if this list contains the specified element.
* More formally, returns <tt>true</tt> if and only if this list contains
* at least one element <tt>e</tt> such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o == e)</tt>.
* Returns {@code true} if this list contains the specified element.
* More formally, returns {@code true} if and only if this list contains
* at least one element {@code e} such that
* {@code Objects.equals(o, e)}.
*
* @param o element whose presence in this list is to be tested
* @return <tt>true</tt> if this list contains the specified element
* @return {@code true} if this list contains the specified element
*/
public boolean contains(Object o) {
return indexOf(o) != -1;
@ -207,7 +207,7 @@ public class IdentityLinkedList<E>
* <p>This method is equivalent to {@link #addLast}.
*
* @param e element to be appended to this list
* @return <tt>true</tt> (as specified by {@link Collection#add})
* @return {@code true} (as specified by {@link Collection#add})
*/
public boolean add(E e) {
addBefore(e, header);
@ -218,13 +218,13 @@ public class IdentityLinkedList<E>
* Removes the first occurrence of the specified element from this list,
* if it is present. If this list does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
* <tt>i</tt> such that <tt>get(i)==o</tt>
* (if such an element exists). Returns <tt>true</tt> if this list
* {@code i} such that {@code get(i)==o}
* (if such an element exists). Returns {@code true} if this list
* contained the specified element (or equivalently, if this list
* changed as a result of the call).
*
* @param o element to be removed from this list, if present
* @return <tt>true</tt> if this list contained the specified element
* @return {@code true} if this list contained the specified element
*/
public boolean remove(Object o) {
for (Entry<E> e = header.next; e != header; e = e.next) {
@ -245,7 +245,7 @@ public class IdentityLinkedList<E>
* this list, and it's nonempty.)
*
* @param c collection containing elements to be added to this list
* @return <tt>true</tt> if this list changed as a result of the call
* @return {@code true} if this list changed as a result of the call
* @throws NullPointerException if the specified collection is null
*/
public boolean addAll(Collection<? extends E> c) {
@ -263,7 +263,7 @@ public class IdentityLinkedList<E>
* @param index index at which to insert the first element
* from the specified collection
* @param c collection containing elements to be added to this list
* @return <tt>true</tt> if this list changed as a result of the call
* @return {@code true} if this list changed as a result of the call
* @throws IndexOutOfBoundsException {@inheritDoc}
* @throws NullPointerException if the specified collection is null
*/
@ -388,8 +388,8 @@ public class IdentityLinkedList<E>
/**
* Returns the index of the first occurrence of the specified element
* in this list, or -1 if this list does not contain the element.
* More formally, returns the lowest index <tt>i</tt> such that
* <tt>get(i)==o</tt>,
* More formally, returns the lowest index {@code i} such that
* {@code get(i)==o},
* or -1 if there is no such index.
*
* @param o element to search for
@ -410,8 +410,8 @@ public class IdentityLinkedList<E>
/**
* Returns the index of the last occurrence of the specified element
* in this list, or -1 if this list does not contain the element.
* More formally, returns the highest index <tt>i</tt> such that
* <tt>get(i)==o</tt>,
* More formally, returns the highest index {@code i} such that
* {@code get(i)==o},
* or -1 if there is no such index.
*
* @param o element to search for
@ -433,7 +433,7 @@ public class IdentityLinkedList<E>
/**
* Retrieves, but does not remove, the head (first element) of this list.
* @return the head of this list, or <tt>null</tt> if this list is empty
* @return the head of this list, or {@code null} if this list is empty
* @since 1.5
*/
public E peek() {
@ -454,7 +454,7 @@ public class IdentityLinkedList<E>
/**
* Retrieves and removes the head (first element) of this list
* @return the head of this list, or <tt>null</tt> if this list is empty
* @return the head of this list, or {@code null} if this list is empty
* @since 1.5
*/
public E poll() {
@ -478,7 +478,7 @@ public class IdentityLinkedList<E>
* Adds the specified element as the tail (last element) of this list.
*
* @param e the element to add
* @return <tt>true</tt> (as specified by {@link java.util.Queue#offer})
* @return {@code true} (as specified by {@link java.util.Queue#offer})
* @since 1.5
*/
public boolean offer(E e) {
@ -490,7 +490,7 @@ public class IdentityLinkedList<E>
* Inserts the specified element at the front of this list.
*
* @param e the element to insert
* @return <tt>true</tt> (as specified by {@link Deque#offerFirst})
* @return {@code true} (as specified by {@link Deque#offerFirst})
* @since 1.6
*/
public boolean offerFirst(E e) {
@ -502,7 +502,7 @@ public class IdentityLinkedList<E>
* Inserts the specified element at the end of this list.
*
* @param e the element to insert
* @return <tt>true</tt> (as specified by {@link Deque#offerLast})
* @return {@code true} (as specified by {@link Deque#offerLast})
* @since 1.6
*/
public boolean offerLast(E e) {
@ -512,9 +512,9 @@ public class IdentityLinkedList<E>
/**
* Retrieves, but does not remove, the first element of this list,
* or returns <tt>null</tt> if this list is empty.
* or returns {@code null} if this list is empty.
*
* @return the first element of this list, or <tt>null</tt>
* @return the first element of this list, or {@code null}
* if this list is empty
* @since 1.6
*/
@ -526,9 +526,9 @@ public class IdentityLinkedList<E>
/**
* Retrieves, but does not remove, the last element of this list,
* or returns <tt>null</tt> if this list is empty.
* or returns {@code null} if this list is empty.
*
* @return the last element of this list, or <tt>null</tt>
* @return the last element of this list, or {@code null}
* if this list is empty
* @since 1.6
*/
@ -540,9 +540,9 @@ public class IdentityLinkedList<E>
/**
* Retrieves and removes the first element of this list,
* or returns <tt>null</tt> if this list is empty.
* or returns {@code null} if this list is empty.
*
* @return the first element of this list, or <tt>null</tt> if
* @return the first element of this list, or {@code null} if
* this list is empty
* @since 1.6
*/
@ -554,9 +554,9 @@ public class IdentityLinkedList<E>
/**
* Retrieves and removes the last element of this list,
* or returns <tt>null</tt> if this list is empty.
* or returns {@code null} if this list is empty.
*
* @return the last element of this list, or <tt>null</tt> if
* @return the last element of this list, or {@code null} if
* this list is empty
* @since 1.6
*/
@ -600,7 +600,7 @@ public class IdentityLinkedList<E>
* does not contain the element, it is unchanged.
*
* @param o element to be removed from this list, if present
* @return <tt>true</tt> if the list contained the specified element
* @return {@code true} if the list contained the specified element
* @since 1.6
*/
public boolean removeFirstOccurrence(Object o) {
@ -613,7 +613,7 @@ public class IdentityLinkedList<E>
* does not contain the element, it is unchanged.
*
* @param o element to be removed from this list, if present
* @return <tt>true</tt> if the list contained the specified element
* @return {@code true} if the list contained the specified element
* @since 1.6
*/
public boolean removeLastOccurrence(Object o) {
@ -629,19 +629,19 @@ public class IdentityLinkedList<E>
/**
* Returns a list-iterator of the elements in this list (in proper
* sequence), starting at the specified position in the list.
* Obeys the general contract of <tt>List.listIterator(int)</tt>.<p>
* Obeys the general contract of {@code List.listIterator(int)}.<p>
*
* The list-iterator is <i>fail-fast</i>: if the list is structurally
* modified at any time after the Iterator is created, in any way except
* through the list-iterator's own <tt>remove</tt> or <tt>add</tt>
* through the list-iterator's own {@code remove} or {@code add}
* methods, the list-iterator will throw a
* <tt>ConcurrentModificationException</tt>. Thus, in the face of
* {@code ConcurrentModificationException}. Thus, in the face of
* concurrent modification, the iterator fails quickly and cleanly, rather
* than risking arbitrary, non-deterministic behavior at an undetermined
* time in the future.
*
* @param index index of the first element to be returned from the
* list-iterator (by a call to <tt>next</tt>)
* list-iterator (by a call to {@code next})
* @return a ListIterator of the elements in this list (in proper
* sequence), starting at the specified position in the list
* @throws IndexOutOfBoundsException {@inheritDoc}
@ -834,7 +834,7 @@ public class IdentityLinkedList<E>
*
* <p>If the list fits in the specified array with room to spare (i.e.,
* the array has more elements than the list), the element in the array
* immediately following the end of the list is set to <tt>null</tt>.
* immediately following the end of the list is set to {@code null}.
* (This is useful in determining the length of the list <i>only</i> if
* the caller knows that the list does not contain any null elements.)
*
@ -843,15 +843,15 @@ public class IdentityLinkedList<E>
* precise control over the runtime type of the output array, and may,
* under certain circumstances, be used to save allocation costs.
*
* <p>Suppose <tt>x</tt> is a list known to contain only strings.
* <p>Suppose {@code x} is a list known to contain only strings.
* The following code can be used to dump the list into a newly
* allocated array of <tt>String</tt>:
* allocated array of {@code String}:
*
* <pre>
* String[] y = x.toArray(new String[0]);</pre>
*
* Note that <tt>toArray(new Object[0])</tt> is identical in function to
* <tt>toArray()</tt>.
* Note that {@code toArray(new Object[0])} is identical in function to
* {@code toArray()}.
*
* @param a the array into which the elements of the list are to
* be stored, if it is big enough; otherwise, a new array of the

View File

@ -71,6 +71,13 @@ public final class CompositeFont extends Font2D {
} else {
numSlots = componentNames.length;
}
/* We will limit the number of slots to 254.
* We store the slot for a glyph id in a byte and we may use one slot
* for an EUDC font, and we may also create a composite
* using this composite as a backup for a physical font.
* So we want to leave space for the two additional slots.
*/
numSlots = (numSlots <= 254) ? numSlots : 254;
/* Only the first "numMetricsSlots" slots are used for font metrics.
* the rest are considered "fallback" slots".

View File

@ -420,14 +420,13 @@ public class FileFontStrike extends PhysicalStrike {
/* The following method is called from CompositeStrike as a special case.
*/
private static final int SLOTZEROMAX = 0xffffff;
int getSlot0GlyphImagePtrs(int[] glyphCodes, long[] images, int len) {
int convertedCnt = 0;
for (int i=0; i<len; i++) {
int glyphCode = glyphCodes[i];
if (glyphCode >= SLOTZEROMAX) {
if (glyphCode >>> 24 != 0) {
return convertedCnt;
} else {
convertedCnt++;

View File

@ -72,7 +72,7 @@ import java.util.concurrent.FutureTask;
*/
public class SwingUtilities2 {
/**
* The <code>AppContext</code> key for our one <code>LAFState</code>
* The {@code AppContext} key for our one {@code LAFState}
* instance.
*/
public static final Object LAF_STATE_KEY =
@ -180,7 +180,7 @@ public class SwingUtilities2 {
/**
* Key used in client properties used to indicate that the
* <code>ComponentUI</code> of the JComponent instance should be returned.
* {@code ComponentUI} of the JComponent instance should be returned.
*/
public static final Object COMPONENT_UI_PROPERTY_KEY =
new StringBuffer("ComponentUIPropertyKey");
@ -221,8 +221,8 @@ public class SwingUtilities2 {
* @param text characters to be tested
* @param start start
* @param limit limit
* @return <tt>true</tt> if TextLayout is required
* <tt>false</tt> if TextLayout is not required
* @return {@code true} if TextLayout is required
* {@code false} if TextLayout is not required
*/
public static final boolean isComplexLayout(char[] text, int start, int limit) {
return FontUtilities.isComplexText(text, start, limit);
@ -374,7 +374,7 @@ public class SwingUtilities2 {
/**
* Returns the width of the passed in String.
* If the passed String is <code>null</code>, returns zero.
* If the passed String is {@code null}, returns zero.
*
* @param c JComponent that will display the string, may be null
* @param fm FontMetrics used to measure the String width
@ -761,7 +761,7 @@ public class SwingUtilities2 {
/**
* Request focus on the given component if it doesn't already have it
* and <code>isRequestFocusEnabled()</code> returns true.
* and {@code isRequestFocusEnabled()} returns true.
*/
public static void adjustFocus(JComponent c) {
if (!c.hasFocus() && c.isRequestFocusEnabled()) {
@ -1200,9 +1200,9 @@ public class SwingUtilities2 {
/**
* LSBCacheEntry is used to cache the left side bearing (lsb) for
* a particular <code>Font</code> and <code>FontRenderContext</code>.
* a particular {@code Font} and {@code FontRenderContext}.
* This only caches characters that fall in the range
* <code>MIN_CHAR_INDEX</code> to <code>MAX_CHAR_INDEX</code>.
* {@code MIN_CHAR_INDEX} to {@code MAX_CHAR_INDEX}.
*/
private static class LSBCacheEntry {
// Used to indicate a particular entry in lsb has not been set.
@ -1472,20 +1472,20 @@ public class SwingUtilities2 {
}
/**
* Utility method that creates a <code>UIDefaults.LazyValue</code> that
* creates an <code>ImageIcon</code> <code>UIResource</code> for the
* Utility method that creates a {@code UIDefaults.LazyValue} that
* creates an {@code ImageIcon} {@code UIResource} for the
* specified image file name. The image is loaded using
* <code>getResourceAsStream</code>, starting with a call to that method
* {@code getResourceAsStream}, starting with a call to that method
* on the base class parameter. If it cannot be found, searching will
* continue through the base class' inheritance hierarchy, up to and
* including <code>rootClass</code>.
* including {@code rootClass}.
*
* @param baseClass the first class to use in searching for the resource
* @param rootClass an ancestor of <code>baseClass</code> to finish the
* @param rootClass an ancestor of {@code baseClass} to finish the
* search at
* @param imageFile the name of the file to be found
* @return a lazy value that creates the <code>ImageIcon</code>
* <code>UIResource</code> for the image,
* @return a lazy value that creates the {@code ImageIcon}
* {@code UIResource} for the image,
* or null if it cannot be found
*/
public static Object makeIcon(final Class<?> baseClass,
@ -1495,22 +1495,22 @@ public class SwingUtilities2 {
}
/**
* Utility method that creates a <code>UIDefaults.LazyValue</code> that
* creates an <code>ImageIcon</code> <code>UIResource</code> for the
* Utility method that creates a {@code UIDefaults.LazyValue} that
* creates an {@code ImageIcon} {@code UIResource} for the
* specified image file name. The image is loaded using
* <code>getResourceAsStream</code>, starting with a call to that method
* {@code getResourceAsStream}, starting with a call to that method
* on the base class parameter. If it cannot be found, searching will
* continue through the base class' inheritance hierarchy, up to and
* including <code>rootClass</code>.
* including {@code rootClass}.
*
* Finds an image with a given name without privileges enabled.
*
* @param baseClass the first class to use in searching for the resource
* @param rootClass an ancestor of <code>baseClass</code> to finish the
* @param rootClass an ancestor of {@code baseClass} to finish the
* search at
* @param imageFile the name of the file to be found
* @return a lazy value that creates the <code>ImageIcon</code>
* <code>UIResource</code> for the image,
* @return a lazy value that creates the {@code ImageIcon}
* {@code UIResource} for the image,
* or null if it cannot be found
*/
public static Object makeIcon_Unprivileged(final Class<?> baseClass,
@ -1604,11 +1604,11 @@ public class SwingUtilities2 {
}
/**
* Returns an integer from the defaults table. If <code>key</code> does
* not map to a valid <code>Integer</code>, or can not be convered from
* a <code>String</code> to an integer, the value 0 is returned.
* Returns an integer from the defaults table. If {@code key} does
* not map to a valid {@code Integer}, or can not be convered from
* a {@code String} to an integer, the value 0 is returned.
*
* @param key an <code>Object</code> specifying the int.
* @param key an {@code Object} specifying the int.
* @return the int
*/
public static int getUIDefaultsInt(Object key) {
@ -1617,13 +1617,13 @@ public class SwingUtilities2 {
/**
* Returns an integer from the defaults table that is appropriate
* for the given locale. If <code>key</code> does not map to a valid
* <code>Integer</code>, or can not be convered from a <code>String</code>
* for the given locale. If {@code key} does not map to a valid
* {@code Integer}, or can not be convered from a {@code String}
* to an integer, the value 0 is returned.
*
* @param key an <code>Object</code> specifying the int. Returned value
* is 0 if <code>key</code> is not available,
* @param l the <code>Locale</code> for which the int is desired
* @param key an {@code Object} specifying the int. Returned value
* is 0 if {@code key} is not available,
* @param l the {@code Locale} for which the int is desired
* @return the int
*/
public static int getUIDefaultsInt(Object key, Locale l) {
@ -1631,14 +1631,14 @@ public class SwingUtilities2 {
}
/**
* Returns an integer from the defaults table. If <code>key</code> does
* not map to a valid <code>Integer</code>, or can not be convered from
* a <code>String</code> to an integer, <code>default</code> is
* Returns an integer from the defaults table. If {@code key} does
* not map to a valid {@code Integer}, or can not be convered from
* a {@code String} to an integer, {@code default} is
* returned.
*
* @param key an <code>Object</code> specifying the int. Returned value
* is 0 if <code>key</code> is not available,
* @param defaultValue Returned value if <code>key</code> is not available,
* @param key an {@code Object} specifying the int. Returned value
* is 0 if {@code key} is not available,
* @param defaultValue Returned value if {@code key} is not available,
* or is not an Integer
* @return the int
*/
@ -1648,14 +1648,14 @@ public class SwingUtilities2 {
/**
* Returns an integer from the defaults table that is appropriate
* for the given locale. If <code>key</code> does not map to a valid
* <code>Integer</code>, or can not be convered from a <code>String</code>
* to an integer, <code>default</code> is returned.
* for the given locale. If {@code key} does not map to a valid
* {@code Integer}, or can not be convered from a {@code String}
* to an integer, {@code default} is returned.
*
* @param key an <code>Object</code> specifying the int. Returned value
* is 0 if <code>key</code> is not available,
* @param l the <code>Locale</code> for which the int is desired
* @param defaultValue Returned value if <code>key</code> is not available,
* @param key an {@code Object} specifying the int. Returned value
* is 0 if {@code key} is not available,
* @param l the {@code Locale} for which the int is desired
* @param defaultValue Returned value if {@code key} is not available,
* or is not an Integer
* @return the int
*/
@ -1749,7 +1749,7 @@ public class SwingUtilities2 {
* @param task the task to submit
* @param result the result to return upon successful completion
* @return a Future representing pending completion of the task,
* and whose <tt>get()</tt> method will return the given
* and whose {@code get()} method will return the given
* result value upon completion
* @throws NullPointerException if the task is null
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. 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
@ -25,15 +25,16 @@
package sun.awt.X11;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.peer.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.awt.UNIXToolkit;
import sun.awt.X11GraphicsConfig;
class XRobotPeer implements RobotPeer {
private static volatile boolean isGtkSupported;
private X11GraphicsConfig xgc = null;
/*
* native implementation uses some static shared data (pipes, processes)
@ -44,46 +45,65 @@ class XRobotPeer implements RobotPeer {
XRobotPeer(GraphicsConfiguration gc) {
this.xgc = (X11GraphicsConfig)gc;
SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks());
setup(tk.getNumberOfButtons(),
AWTAccessor.getInputEventAccessor().getButtonDownMasks());
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (!isGtkSupported) {
if (toolkit instanceof UNIXToolkit
&& ((UNIXToolkit) toolkit).loadGTK()) {
isGtkSupported = true;
}
}
}
@Override
public void dispose() {
// does nothing
}
@Override
public void mouseMove(int x, int y) {
mouseMoveImpl(xgc, x, y);
}
@Override
public void mousePress(int buttons) {
mousePressImpl(buttons);
}
@Override
public void mouseRelease(int buttons) {
mouseReleaseImpl(buttons);
}
@Override
public void mouseWheel(int wheelAmt) {
mouseWheelImpl(wheelAmt);
mouseWheelImpl(wheelAmt);
}
@Override
public void keyPress(int keycode) {
keyPressImpl(keycode);
}
@Override
public void keyRelease(int keycode) {
keyReleaseImpl(keycode);
}
@Override
public int getRGBPixel(int x, int y) {
int pixelArray[] = new int[1];
getRGBPixelsImpl(xgc, x, y, 1, 1, pixelArray);
getRGBPixelsImpl(xgc, x, y, 1, 1, pixelArray, isGtkSupported);
return pixelArray[0];
}
@Override
public int [] getRGBPixels(Rectangle bounds) {
int pixelArray[] = new int[bounds.width*bounds.height];
getRGBPixelsImpl(xgc, bounds.x, bounds.y, bounds.width, bounds.height, pixelArray);
getRGBPixelsImpl(xgc, bounds.x, bounds.y, bounds.width, bounds.height,
pixelArray, isGtkSupported);
return pixelArray;
}
@ -97,5 +117,6 @@ class XRobotPeer implements RobotPeer {
private static native synchronized void keyPressImpl(int keycode);
private static native synchronized void keyReleaseImpl(int keycode);
private static native synchronized void getRGBPixelsImpl(X11GraphicsConfig xgc, int x, int y, int width, int height, int pixelArray[]);
private static native synchronized void getRGBPixelsImpl(X11GraphicsConfig xgc,
int x, int y, int width, int height, int pixelArray[], boolean isGtkSupported);
}

View File

@ -1219,10 +1219,11 @@ Java_sun_font_FontConfigManager_getFontConfig
minGlyphs = val;
}
}
FcCharSet *unionCharset = NULL;
for (j=0; j<nfonts; j++) {
FcPattern *fontPattern = fontset->fonts[j];
FcChar8 *fontformat;
FcCharSet *unionCharset = NULL, *charset;
FcCharSet *charset = NULL;
fontformat = NULL;
(*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
@ -1280,6 +1281,9 @@ Java_sun_font_FontConfigManager_getFontConfig
if (!includeFallbacks) {
break;
}
if (fontCount == 254) {
break; // CompositeFont will only use up to 254 slots from here.
}
}
/* Once we get here 'fontCount' is the number of returned fonts

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