From 9224d25f96ad206d23827945b73d8f8b56d37e9d Mon Sep 17 00:00:00 2001
From: Miroslav Kos
Date: Sun, 30 Dec 2012 00:00:00 +0100
Subject: [PATCH 001/159] 8029237: Update copyright year to match last edit in
jaxws repository for 2012
Reviewed-by: chegar
---
jaxws/build.properties | 2 +-
jaxws/build.xml | 2 +-
.../jaf_classes/com/sun/activation/registries/LogSupport.java | 2 +-
.../jaf_classes/com/sun/activation/registries/MailcapFile.java | 2 +-
.../com/sun/activation/registries/MailcapParseException.java | 2 +-
.../com/sun/activation/registries/MailcapTokenizer.java | 2 +-
.../com/sun/activation/registries/MimeTypeEntry.java | 2 +-
.../jaf_classes/com/sun/activation/registries/MimeTypeFile.java | 2 +-
.../jaf_classes/javax/activation/ActivationDataFlavor.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/CommandInfo.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/CommandMap.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/CommandObject.java | 2 +-
.../share/jaf_classes/javax/activation/DataContentHandler.java | 2 +-
.../jaf_classes/javax/activation/DataContentHandlerFactory.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/DataHandler.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/DataSource.java | 2 +-
.../src/share/jaf_classes/javax/activation/FileDataSource.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java | 2 +-
.../share/jaf_classes/javax/activation/MailcapCommandMap.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/MimeType.java | 2 +-
.../jaf_classes/javax/activation/MimeTypeParameterList.java | 2 +-
.../jaf_classes/javax/activation/MimeTypeParseException.java | 2 +-
.../jaf_classes/javax/activation/MimetypesFileTypeMap.java | 2 +-
.../src/share/jaf_classes/javax/activation/SecuritySupport.java | 2 +-
jaxws/src/share/jaf_classes/javax/activation/URLDataSource.java | 2 +-
.../javax/activation/UnsupportedDataTypeException.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/ClassType.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/CodeWriter.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JAnnotatable.java | 2 +-
.../com/sun/codemodel/internal/JAnnotationArrayMember.java | 2 +-
.../com/sun/codemodel/internal/JAnnotationStringValue.java | 2 +-
.../com/sun/codemodel/internal/JAnnotationUse.java | 2 +-
.../com/sun/codemodel/internal/JAnnotationValue.java | 2 +-
.../com/sun/codemodel/internal/JAnnotationWriter.java | 2 +-
.../com/sun/codemodel/internal/JAnonymousClass.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JArray.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JArrayClass.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JArrayCompRef.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JAssignment.java | 2 +-
.../com/sun/codemodel/internal/JAssignmentTarget.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JAtom.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JBlock.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JBreak.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JCase.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JCast.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JCatchBlock.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JClass.java | 2 +-
.../sun/codemodel/internal/JClassAlreadyExistsException.java | 2 +-
.../com/sun/codemodel/internal/JClassContainer.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JCodeModel.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JCommentPart.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JConditional.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JContinue.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JDeclaration.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JDefinedClass.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JDirectClass.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JDoLoop.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JDocComment.java | 2 +-
.../com/sun/codemodel/internal/JDocCommentable.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JEnumConstant.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JExpr.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JExpression.java | 2 +-
.../com/sun/codemodel/internal/JExpressionImpl.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JFieldRef.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JFieldVar.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JForEach.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JForLoop.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JFormatter.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JGenerable.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JGenerifiable.java | 2 +-
.../com/sun/codemodel/internal/JGenerifiableImpl.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JInvocation.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JJavaName.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JLabel.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JMethod.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JMod.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JMods.java | 2 +-
.../com/sun/codemodel/internal/JNarrowedClass.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JNullType.java | 2 +-
.../src/share/jaxws_classes/com/sun/codemodel/internal/JOp.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JPackage.java | 2 +-
.../com/sun/codemodel/internal/JPrimitiveType.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JResourceFile.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JReturn.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JStatement.java | 2 +-
.../com/sun/codemodel/internal/JStringLiteral.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JSwitch.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JThrow.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JTryBlock.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JType.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JTypeVar.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JTypeWildcard.java | 2 +-
.../share/jaxws_classes/com/sun/codemodel/internal/JVar.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/JWhileLoop.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/SecureLoader.java | 2 +-
.../com/sun/codemodel/internal/TypedAnnotationWriter.java | 2 +-
.../com/sun/codemodel/internal/fmt/JBinaryFile.java | 2 +-
.../com/sun/codemodel/internal/fmt/JPropertyFile.java | 2 +-
.../com/sun/codemodel/internal/fmt/JSerializedObject.java | 2 +-
.../com/sun/codemodel/internal/fmt/JStaticFile.java | 2 +-
.../com/sun/codemodel/internal/fmt/JStaticJavaFile.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/fmt/JTextFile.java | 2 +-
.../com/sun/codemodel/internal/fmt/SecureLoader.java | 2 +-
.../jaxws_classes/com/sun/codemodel/internal/package-info.java | 2 +-
.../com/sun/codemodel/internal/util/ClassNameComparator.java | 2 +-
.../com/sun/codemodel/internal/util/EncoderFactory.java | 2 +-
.../com/sun/codemodel/internal/util/JavadocEscapeWriter.java | 2 +-
.../com/sun/codemodel/internal/util/MS1252Encoder.java | 2 +-
.../com/sun/codemodel/internal/util/SingleByteEncoder.java | 2 +-
.../com/sun/codemodel/internal/util/Surrogate.java | 2 +-
.../com/sun/codemodel/internal/util/UnicodeEscapeWriter.java | 2 +-
.../com/sun/codemodel/internal/writer/FileCodeWriter.java | 2 +-
.../com/sun/codemodel/internal/writer/FilterCodeWriter.java | 2 +-
.../com/sun/codemodel/internal/writer/ProgressCodeWriter.java | 2 +-
.../com/sun/codemodel/internal/writer/PrologCodeWriter.java | 2 +-
.../sun/codemodel/internal/writer/SingleStreamCodeWriter.java | 2 +-
.../com/sun/codemodel/internal/writer/ZipCodeWriter.java | 2 +-
.../jaxws_classes/com/sun/org/glassfish/gmbal/AMXClient.java | 2 +-
.../com/sun/org/glassfish/gmbal/AMXMBeanInterface.java | 2 +-
.../jaxws_classes/com/sun/org/glassfish/gmbal/AMXMetadata.java | 2 +-
.../jaxws_classes/com/sun/org/glassfish/gmbal/Description.java | 2 +-
.../com/sun/org/glassfish/gmbal/DescriptorFields.java | 2 +-
.../com/sun/org/glassfish/gmbal/DescriptorKey.java | 2 +-
.../com/sun/org/glassfish/gmbal/GmbalException.java | 2 +-
.../jaxws_classes/com/sun/org/glassfish/gmbal/GmbalMBean.java | 2 +-
.../com/sun/org/glassfish/gmbal/GmbalMBeanNOPImpl.java | 2 +-
.../share/jaxws_classes/com/sun/org/glassfish/gmbal/Impact.java | 2 +-
.../com/sun/org/glassfish/gmbal/IncludeSubclass.java | 2 +-
.../com/sun/org/glassfish/gmbal/InheritedAttribute.java | 2 +-
.../com/sun/org/glassfish/gmbal/InheritedAttributes.java | 2 +-
.../com/sun/org/glassfish/gmbal/ManagedAttribute.java | 2 +-
.../jaxws_classes/com/sun/org/glassfish/gmbal/ManagedData.java | 2 +-
.../com/sun/org/glassfish/gmbal/ManagedObject.java | 2 +-
.../com/sun/org/glassfish/gmbal/ManagedObjectManager.java | 2 +-
.../sun/org/glassfish/gmbal/ManagedObjectManagerFactory.java | 2 +-
.../sun/org/glassfish/gmbal/ManagedObjectManagerNOPImpl.java | 2 +-
.../com/sun/org/glassfish/gmbal/ManagedOperation.java | 2 +-
.../jaxws_classes/com/sun/org/glassfish/gmbal/NameValue.java | 2 +-
.../com/sun/org/glassfish/gmbal/ParameterNames.java | 2 +-
.../com/sun/org/glassfish/gmbal/util/GenericConstructor.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/jxc/Messages.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/jxc/ap/Const.java | 2 +-
.../com/sun/tools/internal/jxc/ap/ErrorReceiverImpl.java | 2 +-
.../sun/tools/internal/jxc/ap/InlineAnnotationReaderImpl.java | 2 +-
.../com/sun/tools/internal/jxc/ap/MessageBundle.properties | 2 +-
.../jaxws_classes/com/sun/tools/internal/jxc/ap/Messages.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/jxc/ap/package.html | 2 +-
.../com/sun/tools/internal/jxc/gen/config/config.rng | 2 +-
.../com/sun/tools/internal/jxc/gen/config/config.xsd | 2 +-
.../com/sun/tools/internal/xjc/AbortException.java | 2 +-
.../com/sun/tools/internal/xjc/BadCommandLineException.java | 2 +-
.../com/sun/tools/internal/xjc/ConsoleErrorReporter.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/ErrorReceiver.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/Language.java | 2 +-
.../share/jaxws_classes/com/sun/tools/internal/xjc/Plugin.java | 2 +-
.../com/sun/tools/internal/xjc/ProgressCodeWriter.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/XJCListener.java | 2 +-
.../com/sun/tools/internal/xjc/addon/accessors/PluginImpl.java | 2 +-
.../sun/tools/internal/xjc/addon/at_generated/PluginImpl.java | 2 +-
.../com/sun/tools/internal/xjc/addon/code_injector/Const.java | 2 +-
.../sun/tools/internal/xjc/addon/code_injector/PluginImpl.java | 2 +-
.../com/sun/tools/internal/xjc/addon/episode/PluginImpl.java | 2 +-
.../com/sun/tools/internal/xjc/addon/episode/package-info.java | 2 +-
.../tools/internal/xjc/addon/locator/SourceLocationAddOn.java | 2 +-
.../tools/internal/xjc/addon/sync/SynchronizedMethodAddOn.java | 2 +-
.../com/sun/tools/internal/xjc/api/ClassNameAllocator.java | 2 +-
.../com/sun/tools/internal/xjc/api/ErrorListener.java | 2 +-
.../com/sun/tools/internal/xjc/api/J2SJAXBModel.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/api/JAXBModel.java | 2 +-
.../com/sun/tools/internal/xjc/api/JavaCompiler.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/api/Mapping.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/api/Property.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/api/Reference.java | 2 +-
.../com/sun/tools/internal/xjc/api/S2JJAXBModel.java | 2 +-
.../com/sun/tools/internal/xjc/api/SchemaCompiler.java | 2 +-
.../com/sun/tools/internal/xjc/api/SpecVersion.java | 2 +-
.../com/sun/tools/internal/xjc/api/TypeAndAnnotation.java | 2 +-
.../tools/internal/xjc/api/impl/s2j/AbstractMappingImpl.java | 2 +-
.../sun/tools/internal/xjc/api/impl/s2j/BeanMappingImpl.java | 2 +-
.../internal/xjc/api/impl/s2j/DowngradingErrorHandler.java | 2 +-
.../com/sun/tools/internal/xjc/api/impl/s2j/ElementAdapter.java | 2 +-
.../internal/xjc/api/impl/s2j/ElementCollectionAdapter.java | 2 +-
.../sun/tools/internal/xjc/api/impl/s2j/ElementMappingImpl.java | 2 +-
.../tools/internal/xjc/api/impl/s2j/ElementSingleAdapter.java | 2 +-
.../com/sun/tools/internal/xjc/api/impl/s2j/JAXBModelImpl.java | 2 +-
.../com/sun/tools/internal/xjc/api/impl/s2j/PropertyImpl.java | 2 +-
.../com/sun/tools/internal/xjc/api/impl/s2j/package.html | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/api/package.html | 2 +-
.../com/sun/tools/internal/xjc/api/util/ApClassLoader.java | 2 +-
.../com/sun/tools/internal/xjc/api/util/FilerCodeWriter.java | 2 +-
.../com/sun/tools/internal/xjc/api/util/Messages.java | 2 +-
.../com/sun/tools/internal/xjc/api/util/Messages.properties | 2 +-
.../tools/internal/xjc/api/util/ToolsJarNotFoundException.java | 2 +-
.../com/sun/tools/internal/xjc/api/util/package.html | 2 +-
.../sun/tools/internal/xjc/generator/bean/ClassOutlineImpl.java | 2 +-
.../tools/internal/xjc/generator/bean/ElementOutlineImpl.java | 2 +-
.../internal/xjc/generator/bean/ImplStructureStrategy.java | 2 +-
.../com/sun/tools/internal/xjc/generator/bean/Messages.java | 2 +-
.../com/sun/tools/internal/xjc/generator/bean/MethodWriter.java | 2 +-
.../internal/xjc/generator/bean/ObjectFactoryGenerator.java | 2 +-
.../internal/xjc/generator/bean/ObjectFactoryGeneratorImpl.java | 2 +-
.../tools/internal/xjc/generator/bean/PackageOutlineImpl.java | 2 +-
.../xjc/generator/bean/PrivateObjectFactoryGenerator.java | 2 +-
.../xjc/generator/bean/PublicObjectFactoryGenerator.java | 2 +-
.../tools/internal/xjc/generator/bean/field/AbstractField.java | 2 +-
.../internal/xjc/generator/bean/field/AbstractListField.java | 2 +-
.../sun/tools/internal/xjc/generator/bean/field/ArrayField.java | 2 +-
.../sun/tools/internal/xjc/generator/bean/field/ConstField.java | 2 +-
.../internal/xjc/generator/bean/field/ConstFieldRenderer.java | 2 +-
.../internal/xjc/generator/bean/field/ContentListField.java | 2 +-
.../internal/xjc/generator/bean/field/DefaultFieldRenderer.java | 2 +-
.../tools/internal/xjc/generator/bean/field/DummyListField.java | 2 +-
.../tools/internal/xjc/generator/bean/field/FieldRenderer.java | 2 +-
.../internal/xjc/generator/bean/field/FieldRendererFactory.java | 2 +-
.../internal/xjc/generator/bean/field/GenericFieldRenderer.java | 2 +-
.../sun/tools/internal/xjc/generator/bean/field/IsSetField.java | 2 +-
.../internal/xjc/generator/bean/field/IsSetFieldRenderer.java | 2 +-
.../internal/xjc/generator/bean/field/MessageBundle.properties | 2 +-
.../sun/tools/internal/xjc/generator/bean/field/Messages.java | 2 +-
.../xjc/generator/bean/field/NoExtendedContentField.java | 2 +-
.../tools/internal/xjc/generator/bean/field/SingleField.java | 2 +-
.../xjc/generator/bean/field/SinglePrimitiveAccessField.java | 2 +-
.../tools/internal/xjc/generator/bean/field/UnboxedField.java | 2 +-
.../internal/xjc/generator/bean/field/UntypedListField.java | 2 +-
.../xjc/generator/bean/field/UntypedListFieldRenderer.java | 2 +-
.../sun/tools/internal/xjc/generator/bean/field/package.html | 2 +-
.../com/sun/tools/internal/xjc/generator/package-info.java | 2 +-
.../sun/tools/internal/xjc/generator/util/BlockReference.java | 2 +-
.../internal/xjc/generator/util/ExistingBlockReference.java | 2 +-
.../tools/internal/xjc/generator/util/LazyBlockReference.java | 2 +-
.../tools/internal/xjc/generator/util/WhitespaceNormalizer.java | 2 +-
.../com/sun/tools/internal/xjc/model/AbstractCElement.java | 2 +-
.../com/sun/tools/internal/xjc/model/AbstractCTypeInfoImpl.java | 2 +-
.../sun/tools/internal/xjc/model/AutoClassNameAllocator.java | 2 +-
.../com/sun/tools/internal/xjc/model/CAdapter.java | 2 +-
.../sun/tools/internal/xjc/model/CAttributePropertyInfo.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/model/CClass.java | 2 +-
.../com/sun/tools/internal/xjc/model/CClassInfo.java | 2 +-
.../com/sun/tools/internal/xjc/model/CClassInfoParent.java | 2 +-
.../com/sun/tools/internal/xjc/model/CClassRef.java | 2 +-
.../com/sun/tools/internal/xjc/model/CCustomizable.java | 2 +-
.../com/sun/tools/internal/xjc/model/CCustomizations.java | 2 +-
.../com/sun/tools/internal/xjc/model/CDefaultValue.java | 2 +-
.../com/sun/tools/internal/xjc/model/CElement.java | 2 +-
.../com/sun/tools/internal/xjc/model/CElementInfo.java | 2 +-
.../com/sun/tools/internal/xjc/model/CElementPropertyInfo.java | 2 +-
.../com/sun/tools/internal/xjc/model/CEnumConstant.java | 2 +-
.../com/sun/tools/internal/xjc/model/CEnumLeafInfo.java | 2 +-
.../com/sun/tools/internal/xjc/model/CNonElement.java | 2 +-
.../com/sun/tools/internal/xjc/model/CPluginCustomization.java | 2 +-
.../com/sun/tools/internal/xjc/model/CPropertyVisitor.java | 2 +-
.../sun/tools/internal/xjc/model/CReferencePropertyInfo.java | 2 +-
.../sun/tools/internal/xjc/model/CSingleTypePropertyInfo.java | 2 +-
.../com/sun/tools/internal/xjc/model/CValuePropertyInfo.java | 2 +-
.../com/sun/tools/internal/xjc/model/CWildcardTypeInfo.java | 2 +-
.../sun/tools/internal/xjc/model/ClassNameAllocatorWrapper.java | 2 +-
.../com/sun/tools/internal/xjc/model/Constructor.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/model/Model.java | 2 +-
.../com/sun/tools/internal/xjc/model/Multiplicity.java | 2 +-
.../com/sun/tools/internal/xjc/model/Populatable.java | 2 +-
.../com/sun/tools/internal/xjc/model/SymbolSpace.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/model/TypeUse.java | 2 +-
.../com/sun/tools/internal/xjc/model/TypeUseFactory.java | 2 +-
.../com/sun/tools/internal/xjc/model/TypeUseImpl.java | 2 +-
.../com/sun/tools/internal/xjc/model/nav/EagerNClass.java | 2 +-
.../com/sun/tools/internal/xjc/model/nav/NClass.java | 2 +-
.../com/sun/tools/internal/xjc/model/nav/NClassByJClass.java | 2 +-
.../sun/tools/internal/xjc/model/nav/NParameterizedType.java | 2 +-
.../com/sun/tools/internal/xjc/model/nav/NType.java | 2 +-
.../com/sun/tools/internal/xjc/model/nav/package.html | 2 +-
.../com/sun/tools/internal/xjc/outline/Aspect.java | 2 +-
.../com/sun/tools/internal/xjc/outline/ClassOutline.java | 2 +-
.../com/sun/tools/internal/xjc/outline/ElementOutline.java | 2 +-
.../com/sun/tools/internal/xjc/outline/EnumConstantOutline.java | 2 +-
.../com/sun/tools/internal/xjc/outline/EnumOutline.java | 2 +-
.../com/sun/tools/internal/xjc/outline/FieldAccessor.java | 2 +-
.../com/sun/tools/internal/xjc/outline/FieldOutline.java | 2 +-
.../com/sun/tools/internal/xjc/outline/Outline.java | 2 +-
.../com/sun/tools/internal/xjc/outline/PackageOutline.java | 2 +-
.../com/sun/tools/internal/xjc/outline/package.html | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/package-info.java | 2 +-
.../internal/xjc/reader/AbstractExtensionBindingChecker.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/reader/Const.java | 2 +-
.../sun/tools/internal/xjc/reader/ExtensionBindingChecker.java | 2 +-
.../com/sun/tools/internal/xjc/reader/MessageBundle.properties | 2 +-
.../com/sun/tools/internal/xjc/reader/Messages.java | 2 +-
.../com/sun/tools/internal/xjc/reader/ModelChecker.java | 2 +-
.../com/sun/tools/internal/xjc/reader/RawTypeSet.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/reader/Ring.java | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/reader/Util.java | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/Block.java | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/Element.java | 2 +-
.../sun/tools/internal/xjc/reader/dtd/MessageBundle.properties | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/Messages.java | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/ModelGroup.java | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/Occurence.java | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/TDTDReader.java | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/Term.java | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/BIAttribute.java | 2 +-
.../tools/internal/xjc/reader/dtd/bindinfo/BIConstructor.java | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/BIContent.java | 2 +-
.../tools/internal/xjc/reader/dtd/bindinfo/BIConversion.java | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/BIElement.java | 2 +-
.../tools/internal/xjc/reader/dtd/bindinfo/BIEnumeration.java | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/BIInterface.java | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/DOMLocator.java | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/bindinfo/DOMUtil.java | 2 +-
.../xjc/reader/dtd/bindinfo/DTDExtensionBindingChecker.java | 2 +-
.../internal/xjc/reader/dtd/bindinfo/MessageBundle.properties | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/Messages.java | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.rng | 2 +-
.../sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.xsd | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/bindinfo/package.html | 2 +-
.../com/sun/tools/internal/xjc/reader/dtd/bindinfo/xjc.xsd | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/Choice.java | 2 +-
.../sun/tools/internal/xjc/reader/gbind/ConnectedComponent.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/Element.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/ElementSet.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/ElementSets.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/Expression.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/Graph.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/OneOrMore.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/Sequence.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/SinkNode.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/SourceNode.java | 2 +-
.../com/sun/tools/internal/xjc/reader/gbind/package.html | 2 +-
.../internalizer/ContentHandlerNamespacePrefixAdapter.java | 2 +-
.../sun/tools/internal/xjc/reader/internalizer/DOMBuilder.java | 2 +-
.../tools/internal/xjc/reader/internalizer/DOMForestParser.java | 2 +-
.../internal/xjc/reader/internalizer/DOMForestScanner.java | 2 +-
.../internal/xjc/reader/internalizer/InternalizationLogic.java | 2 +-
.../tools/internal/xjc/reader/internalizer/LocatorTable.java | 2 +-
.../internal/xjc/reader/internalizer/MessageBundle.properties | 2 +-
.../sun/tools/internal/xjc/reader/internalizer/Messages.java | 2 +-
.../internal/xjc/reader/internalizer/NamespaceContextImpl.java | 2 +-
.../tools/internal/xjc/reader/internalizer/VersionChecker.java | 2 +-
.../internal/xjc/reader/internalizer/WhitespaceStripper.java | 2 +-
.../com/sun/tools/internal/xjc/reader/internalizer/package.html | 2 +-
.../com/sun/tools/internal/xjc/reader/package.html | 2 +-
.../com/sun/tools/internal/xjc/reader/relaxng/BindStyle.java | 2 +-
.../tools/internal/xjc/reader/relaxng/ContentModelBinder.java | 2 +-
.../com/sun/tools/internal/xjc/reader/relaxng/DatatypeLib.java | 2 +-
.../com/sun/tools/internal/xjc/reader/relaxng/DefineFinder.java | 2 +-
.../sun/tools/internal/xjc/reader/relaxng/NameCalculator.java | 2 +-
.../sun/tools/internal/xjc/reader/relaxng/RELAXNGCompiler.java | 2 +-
.../xjc/reader/relaxng/RELAXNGInternalizationLogic.java | 2 +-
.../tools/internal/xjc/reader/relaxng/RawTypeSetBuilder.java | 2 +-
.../tools/internal/xjc/reader/relaxng/TypePatternBinder.java | 2 +-
.../sun/tools/internal/xjc/reader/relaxng/TypeUseBinder.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/Abstractifier.java | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/BindBlue.java | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/BindGreen.java | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/BindPurple.java | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/BindRed.java | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/BindYellow.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/BindingComponent.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/ClassBinder.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/ClassBinderFilter.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/ClassSelector.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/CollisionInfo.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/ColorBinder.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/DefaultClassBinder.java | 2 +-
.../internal/xjc/reader/xmlschema/DefaultParticleBinder.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/ErrorReporter.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/ExpressionBuilder.java | 2 +-
.../internal/xjc/reader/xmlschema/ExpressionParticleBinder.java | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/GElement.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/GElementImpl.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/GWildcardElement.java | 2 +-
.../internal/xjc/reader/xmlschema/MessageBundle.properties | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/Messages.java | 2 +-
.../internal/xjc/reader/xmlschema/MultiplicityCounter.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/ParticleBinder.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/RawTypeSetBuilder.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/RefererFinder.java | 2 +-
.../xjc/reader/xmlschema/UnusedCustomizationChecker.java | 2 +-
.../internal/xjc/reader/xmlschema/WildcardNameClassBuilder.java | 2 +-
.../xjc/reader/xmlschema/bindinfo/AbstractDeclarationImpl.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/bindinfo/BIClass.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BIConversion.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BIDeclaration.java | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/bindinfo/BIDom.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/bindinfo/BIEnum.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BIEnumMember.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BIFactoryMethod.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BIGlobalBinding.java | 2 +-
.../xjc/reader/xmlschema/bindinfo/BIInlineBinaryData.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BIProperty.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BISchemaBinding.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/BISerializable.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/bindinfo/BIXDom.java | 2 +-
.../xjc/reader/xmlschema/bindinfo/BIXPluginCustomization.java | 2 +-
.../xjc/reader/xmlschema/bindinfo/BIXSubstitutable.java | 2 +-
.../xjc/reader/xmlschema/bindinfo/CollectionTypeAttribute.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/EnumMemberMode.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/ForkingFilter.java | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/LocalScoping.java | 2 +-
.../xjc/reader/xmlschema/bindinfo/MessageBundle.properties | 2 +-
.../tools/internal/xjc/reader/xmlschema/bindinfo/Messages.java | 2 +-
.../xjc/reader/xmlschema/bindinfo/OptionalPropertyMode.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/bindinfo/binding.rng | 2 +-
.../tools/internal/xjc/reader/xmlschema/bindinfo/binding.xsd | 2 +-
.../internal/xjc/reader/xmlschema/bindinfo/package-info.java | 2 +-
.../tools/internal/xjc/reader/xmlschema/bindinfo/package.html | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/bindinfo/xjc.xsd | 2 +-
.../com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/xs.xsd | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/ct/CTBuilder.java | 2 +-
.../reader/xmlschema/ct/ChoiceContentComplexTypeBuilder.java | 2 +-
.../xjc/reader/xmlschema/ct/ComplexTypeBindingMode.java | 2 +-
.../xjc/reader/xmlschema/ct/ComplexTypeFieldBuilder.java | 2 +-
.../xjc/reader/xmlschema/ct/ExtendedComplexTypeBuilder.java | 2 +-
.../xjc/reader/xmlschema/ct/FreshComplexTypeBuilder.java | 2 +-
.../internal/xjc/reader/xmlschema/ct/MessageBundle.properties | 2 +-
.../sun/tools/internal/xjc/reader/xmlschema/ct/Messages.java | 2 +-
.../xjc/reader/xmlschema/ct/MixedComplexTypeBuilder.java | 2 +-
.../reader/xmlschema/ct/MixedExtendedComplexTypeBuilder.java | 2 +-
.../reader/xmlschema/ct/MultiWildcardComplexTypeBuilder.java | 2 +-
.../xjc/reader/xmlschema/ct/RestrictedComplexTypeBuilder.java | 2 +-
.../xjc/reader/xmlschema/ct/STDerivedComplexTypeBuilder.java | 2 +-
.../reader/xmlschema/parser/CustomizationContextChecker.java | 2 +-
.../reader/xmlschema/parser/IncorrectNamespaceURIChecker.java | 2 +-
.../internal/xjc/reader/xmlschema/parser/LSInputSAXWrapper.java | 2 +-
.../xjc/reader/xmlschema/parser/MessageBundle.properties | 2 +-
.../tools/internal/xjc/reader/xmlschema/parser/Messages.java | 2 +-
.../reader/xmlschema/parser/XMLSchemaInternalizationLogic.java | 2 +-
.../com/sun/tools/internal/xjc/runtime/JAXBContextFactory.java | 2 +-
.../sun/tools/internal/xjc/runtime/ZeroOneBooleanAdapter.java | 2 +-
.../com/sun/tools/internal/xjc/runtime/package.html | 2 +-
.../com/sun/tools/internal/xjc/util/CodeModelClassFactory.java | 2 +-
.../com/sun/tools/internal/xjc/util/ErrorReceiverFilter.java | 2 +-
.../com/sun/tools/internal/xjc/util/ForkContentHandler.java | 2 +-
.../com/sun/tools/internal/xjc/util/ForkEntityResolver.java | 2 +-
.../com/sun/tools/internal/xjc/util/MessageBundle.properties | 2 +-
.../jaxws_classes/com/sun/tools/internal/xjc/util/Messages.java | 2 +-
.../com/sun/tools/internal/xjc/util/MimeTypeRange.java | 2 +-
.../sun/tools/internal/xjc/util/NamespaceContextAdapter.java | 2 +-
.../com/sun/tools/internal/xjc/util/NullStream.java | 2 +-
.../com/sun/tools/internal/xjc/util/ReadOnlyAdapter.java | 2 +-
.../com/sun/tools/internal/xjc/util/StringCutter.java | 2 +-
.../com/sun/tools/internal/xjc/util/SubtreeCutter.java | 2 +-
.../com/sun/tools/internal/xjc/writer/SignatureWriter.java | 2 +-
.../com/sun/xml/internal/bind/AccessorFactory.java | 2 +-
.../com/sun/xml/internal/bind/AccessorFactoryImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/bind/AnyTypeAdapter.java | 2 +-
.../com/sun/xml/internal/bind/CycleRecoverable.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/bind/IDResolver.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/bind/Locatable.java | 2 +-
.../com/sun/xml/internal/bind/ValidationEventLocatorEx.java | 2 +-
.../com/sun/xml/internal/bind/XmlAccessorFactory.java | 2 +-
.../sun/xml/internal/bind/annotation/OverrideAnnotationOf.java | 2 +-
.../com/sun/xml/internal/bind/annotation/XmlIsSet.java | 2 +-
.../com/sun/xml/internal/bind/annotation/XmlLocation.java | 2 +-
.../com/sun/xml/internal/bind/api/AccessorException.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/bind/api/Bridge.java | 2 +-
.../com/sun/xml/internal/bind/api/BridgeContext.java | 2 +-
.../com/sun/xml/internal/bind/api/ClassResolver.java | 2 +-
.../com/sun/xml/internal/bind/api/CompositeStructure.java | 2 +-
.../com/sun/xml/internal/bind/api/ErrorListener.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/bind/api/Messages.java | 2 +-
.../com/sun/xml/internal/bind/api/Messages.properties | 2 +-
.../com/sun/xml/internal/bind/api/RawAccessor.java | 2 +-
.../com/sun/xml/internal/bind/api/package-info.java | 2 +-
.../xml/internal/bind/marshaller/CharacterEscapeHandler.java | 2 +-
.../com/sun/xml/internal/bind/marshaller/DataWriter.java | 2 +-
.../com/sun/xml/internal/bind/marshaller/DumbEscapeHandler.java | 2 +-
.../com/sun/xml/internal/bind/marshaller/Messages.java | 2 +-
.../com/sun/xml/internal/bind/marshaller/Messages.properties | 2 +-
.../sun/xml/internal/bind/marshaller/MinimumEscapeHandler.java | 2 +-
.../sun/xml/internal/bind/marshaller/NamespacePrefixMapper.java | 2 +-
.../com/sun/xml/internal/bind/marshaller/NioEscapeHandler.java | 2 +-
.../com/sun/xml/internal/bind/marshaller/XMLWriter.java | 2 +-
.../com/sun/xml/internal/bind/unmarshaller/DOMScanner.java | 2 +-
.../com/sun/xml/internal/bind/unmarshaller/InfosetScanner.java | 2 +-
.../com/sun/xml/internal/bind/unmarshaller/Messages.java | 2 +-
.../com/sun/xml/internal/bind/unmarshaller/Messages.properties | 2 +-
.../com/sun/xml/internal/bind/unmarshaller/Patcher.java | 2 +-
.../com/sun/xml/internal/bind/util/AttributesImpl.java | 2 +-
.../xml/internal/bind/util/ValidationEventLocatorExImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/bind/util/Which.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/bind/v2/TODO.java | 2 +-
.../com/sun/xml/internal/bind/v2/WellKnownNamespace.java | 2 +-
.../com/sun/xml/internal/bind/v2/bytecode/ClassTailor.java | 2 +-
.../com/sun/xml/internal/bind/v2/bytecode/SecureLoader.java | 2 +-
.../com/sun/xml/internal/bind/v2/bytecode/package.html | 2 +-
.../v2/model/annotation/AbstractInlineAnnotationReaderImpl.java | 2 +-
.../xml/internal/bind/v2/model/annotation/AnnotationReader.java | 2 +-
.../xml/internal/bind/v2/model/annotation/AnnotationSource.java | 2 +-
.../xml/internal/bind/v2/model/annotation/ClassLocatable.java | 2 +-
.../xml/internal/bind/v2/model/annotation/FieldLocatable.java | 2 +-
.../sun/xml/internal/bind/v2/model/annotation/Locatable.java | 2 +-
.../internal/bind/v2/model/annotation/LocatableAnnotation.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/annotation/Messages.java | 2 +-
.../xml/internal/bind/v2/model/annotation/Messages.properties | 2 +-
.../xml/internal/bind/v2/model/annotation/MethodLocatable.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/annotation/Quick.java | 2 +-
.../bind/v2/model/annotation/RuntimeAnnotationReader.java | 2 +-
.../bind/v2/model/annotation/RuntimeInlineAnnotationReader.java | 2 +-
.../sun/xml/internal/bind/v2/model/annotation/SecureLoader.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/annotation/package.html | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/Adapter.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/ArrayInfo.java | 2 +-
.../xml/internal/bind/v2/model/core/AttributePropertyInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/core/BuiltinLeafInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/ClassInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/Element.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/ElementInfo.java | 2 +-
.../xml/internal/bind/v2/model/core/ElementPropertyInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/EnumConstant.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/EnumLeafInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/ID.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/LeafInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/core/MapPropertyInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/MaybeElement.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/NonElement.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/NonElementRef.java | 2 +-
.../xml/internal/bind/v2/model/core/ReferencePropertyInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/TypeInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/TypeInfoSet.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/TypeRef.java | 2 +-
.../sun/xml/internal/bind/v2/model/core/ValuePropertyInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/core/WildcardMode.java | 2 +-
.../sun/xml/internal/bind/v2/model/core/WildcardTypeInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/AnyTypeImpl.java | 2 +-
.../internal/bind/v2/model/impl/AttributePropertyInfoImpl.java | 2 +-
.../xml/internal/bind/v2/model/impl/BuiltinLeafInfoImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/ClassInfoImpl.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/DummyPropertyInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/ERPropertyInfoImpl.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/ElementInfoImpl.java | 2 +-
.../internal/bind/v2/model/impl/ElementPropertyInfoImpl.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/EnumConstantImpl.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/EnumLeafInfoImpl.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/FieldPropertySeed.java | 2 +-
.../internal/bind/v2/model/impl/GetterSetterPropertySeed.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/LeafInfoImpl.java | 2 +-
.../xml/internal/bind/v2/model/impl/MapPropertyInfoImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/Messages.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/Messages.properties | 2 +-
.../sun/xml/internal/bind/v2/model/impl/PropertyInfoImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/PropertySeed.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/RegistryInfoImpl.java | 2 +-
.../xml/internal/bind/v2/model/impl/RuntimeArrayInfoImpl.java | 2 +-
.../bind/v2/model/impl/RuntimeAttributePropertyInfoImpl.java | 2 +-
.../xml/internal/bind/v2/model/impl/RuntimeClassInfoImpl.java | 2 +-
.../bind/v2/model/impl/RuntimeElementPropertyInfoImpl.java | 2 +-
.../internal/bind/v2/model/impl/RuntimeEnumConstantImpl.java | 2 +-
.../internal/bind/v2/model/impl/RuntimeEnumLeafInfoImpl.java | 2 +-
.../internal/bind/v2/model/impl/RuntimeMapPropertyInfoImpl.java | 2 +-
.../bind/v2/model/impl/RuntimeReferencePropertyInfoImpl.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/RuntimeTypeRefImpl.java | 2 +-
.../bind/v2/model/impl/RuntimeValuePropertyInfoImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/SecureLoader.java | 2 +-
.../internal/bind/v2/model/impl/SingleTypePropertyInfoImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/TypeInfoImpl.java | 2 +-
.../sun/xml/internal/bind/v2/model/impl/TypeInfoSetImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/TypeRefImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/Util.java | 2 +-
.../xml/internal/bind/v2/model/impl/ValuePropertyInfoImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/impl/package.html | 2 +-
.../xml/internal/bind/v2/model/nav/GenericArrayTypeImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/nav/TypeVisitor.java | 2 +-
.../sun/xml/internal/bind/v2/model/nav/WildcardTypeImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/model/nav/package.html | 2 +-
.../xml/internal/bind/v2/model/runtime/RuntimeArrayInfo.java | 2 +-
.../bind/v2/model/runtime/RuntimeAttributePropertyInfo.java | 2 +-
.../internal/bind/v2/model/runtime/RuntimeBuiltinLeafInfo.java | 2 +-
.../xml/internal/bind/v2/model/runtime/RuntimeClassInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/runtime/RuntimeElement.java | 2 +-
.../xml/internal/bind/v2/model/runtime/RuntimeElementInfo.java | 2 +-
.../bind/v2/model/runtime/RuntimeElementPropertyInfo.java | 2 +-
.../xml/internal/bind/v2/model/runtime/RuntimeEnumLeafInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/runtime/RuntimeLeafInfo.java | 2 +-
.../internal/bind/v2/model/runtime/RuntimeMapPropertyInfo.java | 2 +-
.../internal/bind/v2/model/runtime/RuntimeNonElementRef.java | 2 +-
.../xml/internal/bind/v2/model/runtime/RuntimePropertyInfo.java | 2 +-
.../bind/v2/model/runtime/RuntimeReferencePropertyInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/runtime/RuntimeTypeInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/runtime/RuntimeTypeRef.java | 2 +-
.../bind/v2/model/runtime/RuntimeValuePropertyInfo.java | 2 +-
.../sun/xml/internal/bind/v2/model/runtime/package-info.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/AnyTypeBeanInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/AssociationMap.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/AttributeAccessor.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/BinderImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/BridgeContextImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/BridgeImpl.java | 2 +-
.../internal/bind/v2/runtime/CompositeStructureBeanInfo.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/DomPostInitAction.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/FilterTransducer.java | 2 +-
.../internal/bind/v2/runtime/IllegalAnnotationException.java | 2 +-
.../internal/bind/v2/runtime/IllegalAnnotationsException.java | 2 +-
.../xml/internal/bind/v2/runtime/InlineBinaryTransducer.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/InternalBridge.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/LifecycleMethods.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/Location.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/Messages.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/Messages.properties | 2 +-
.../sun/xml/internal/bind/v2/runtime/MimeTypedTransducer.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/Name.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/NameBuilder.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/NameList.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/NamespaceContext2.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/SchemaTypeTransducer.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/StAXPostInitAction.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/SwaRefAdapter.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/Transducer.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/output/C14nXmlOutput.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/output/DOMOutput.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/output/Encoded.java | 2 +-
.../bind/v2/runtime/output/FastInfosetStreamWriterOutput.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/output/ForkXmlOutput.java | 2 +-
.../internal/bind/v2/runtime/output/IndentingUTF8XmlOutput.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/output/MTOMXmlOutput.java | 2 +-
.../internal/bind/v2/runtime/output/NamespaceContextImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/output/Pcdata.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/output/SAXOutput.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/output/SecureLoader.java | 2 +-
.../bind/v2/runtime/output/StAXExStreamWriterOutput.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/output/UTF8XmlOutput.java | 2 +-
.../internal/bind/v2/runtime/output/XMLEventWriterOutput.java | 2 +-
.../internal/bind/v2/runtime/output/XMLStreamWriterOutput.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/output/XmlOutput.java | 2 +-
.../internal/bind/v2/runtime/output/XmlOutputAbstractImpl.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/output/package-info.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/package.html | 2 +-
.../xml/internal/bind/v2/runtime/property/ArrayERProperty.java | 2 +-
.../bind/v2/runtime/property/ArrayElementLeafProperty.java | 2 +-
.../bind/v2/runtime/property/ArrayElementNodeProperty.java | 2 +-
.../internal/bind/v2/runtime/property/ArrayElementProperty.java | 2 +-
.../bind/v2/runtime/property/ArrayReferenceNodeProperty.java | 2 +-
.../internal/bind/v2/runtime/property/AttributeProperty.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/property/Messages.java | 2 +-
.../xml/internal/bind/v2/runtime/property/Messages.properties | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/property/Property.java | 2 +-
.../xml/internal/bind/v2/runtime/property/PropertyFactory.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/property/PropertyImpl.java | 2 +-
.../bind/v2/runtime/property/SingleElementNodeProperty.java | 2 +-
.../bind/v2/runtime/property/SingleReferenceNodeProperty.java | 2 +-
.../bind/v2/runtime/property/StructureLoaderBuilder.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/property/TagAndType.java | 2 +-
.../internal/bind/v2/runtime/property/UnmarshallerChain.java | 2 +-
.../xml/internal/bind/v2/runtime/property/ValueProperty.java | 2 +-
.../xml/internal/bind/v2/runtime/reflect/AdaptedAccessor.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/reflect/AdaptedLister.java | 2 +-
.../bind/v2/runtime/reflect/DefaultTransducedAccessor.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/reflect/ListIterator.java | 2 +-
.../bind/v2/runtime/reflect/ListTransducedAccessorImpl.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/reflect/Messages.java | 2 +-
.../xml/internal/bind/v2/runtime/reflect/Messages.properties | 2 +-
.../xml/internal/bind/v2/runtime/reflect/NullSafeAccessor.java | 2 +-
.../bind/v2/runtime/reflect/PrimitiveArrayListerByte.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/reflect/opt/Bean.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/reflect/opt/Const.java | 2 +-
.../bind/v2/runtime/reflect/opt/FieldAccessor_Byte.java | 2 +-
.../internal/bind/v2/runtime/reflect/opt/FieldAccessor_Ref.java | 2 +-
.../bind/v2/runtime/reflect/opt/MethodAccessor_Byte.java | 2 +-
.../bind/v2/runtime/reflect/opt/MethodAccessor_Ref.java | 2 +-
.../runtime/reflect/opt/OptimizedTransducedAccessorFactory.java | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/reflect/opt/Ref.java | 2 +-
.../xml/internal/bind/v2/runtime/reflect/opt/SecureLoader.java | 2 +-
.../runtime/reflect/opt/TransducedAccessor_field_Boolean.java | 2 +-
.../v2/runtime/reflect/opt/TransducedAccessor_field_Byte.java | 2 +-
.../runtime/reflect/opt/TransducedAccessor_field_Integer.java | 2 +-
.../v2/runtime/reflect/opt/TransducedAccessor_method_Byte.java | 2 +-
.../runtime/reflect/opt/TransducedAccessor_method_Integer.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/reflect/opt/package.html | 2 +-
.../com/sun/xml/internal/bind/v2/runtime/reflect/package.html | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/AttributesEx.java | 2 +-
.../internal/bind/v2/runtime/unmarshaller/AttributesExImpl.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/Base64Data.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/ChildLoader.java | 2 +-
.../bind/v2/runtime/unmarshaller/DefaultIDResolver.java | 2 +-
.../v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/Discarder.java | 2 +-
.../bind/v2/runtime/unmarshaller/FastInfosetConnector.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/IntArrayData.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/unmarshaller/IntData.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/Intercepter.java | 2 +-
.../bind/v2/runtime/unmarshaller/InterningXmlVisitor.java | 2 +-
.../bind/v2/runtime/unmarshaller/LeafPropertyLoader.java | 2 +-
.../bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/LocatorEx.java | 2 +-
.../internal/bind/v2/runtime/unmarshaller/LocatorExWrapper.java | 2 +-
.../internal/bind/v2/runtime/unmarshaller/MTOMDecorator.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/unmarshaller/Patcher.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/unmarshaller/Receiver.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/SecureLoader.java | 2 +-
.../internal/bind/v2/runtime/unmarshaller/StAXConnector.java | 2 +-
.../bind/v2/runtime/unmarshaller/StAXEventConnector.java | 2 +-
.../internal/bind/v2/runtime/unmarshaller/StAXExConnector.java | 2 +-
.../bind/v2/runtime/unmarshaller/StAXStreamConnector.java | 2 +-
.../internal/bind/v2/runtime/unmarshaller/StructureLoader.java | 2 +-
.../sun/xml/internal/bind/v2/runtime/unmarshaller/TagName.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java | 2 +-
.../bind/v2/runtime/unmarshaller/ValidatingUnmarshaller.java | 2 +-
.../bind/v2/runtime/unmarshaller/ValuePropertyLoader.java | 2 +-
.../internal/bind/v2/runtime/unmarshaller/WildcardLoader.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/XmlVisitor.java | 2 +-
.../xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java | 2 +-
.../sun/xml/internal/bind/v2/schemagen/FoolProofResolver.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/Form.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/GroupKind.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/Messages.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/Messages.properties | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/MultiMap.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/Tree.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/Util.java | 2 +-
.../sun/xml/internal/bind/v2/schemagen/episode/Bindings.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/episode/Klass.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/episode/Package.java | 2 +-
.../xml/internal/bind/v2/schemagen/episode/SchemaBindings.java | 2 +-
.../xml/internal/bind/v2/schemagen/episode/package-info.java | 2 +-
.../com/sun/xml/internal/bind/v2/schemagen/package-info.java | 2 +-
.../bind/v2/schemagen/xmlschema/ContentModelContainer.java | 2 +-
.../sun/xml/internal/bind/v2/schemagen/xmlschema/Particle.java | 2 +-
.../sun/xml/internal/bind/v2/schemagen/xmlschema/package.html | 2 +-
.../internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng | 2 +-
.../sun/xml/internal/bind/v2/util/ByteArrayOutputStreamEx.java | 2 +-
.../com/sun/xml/internal/bind/v2/util/CollisionCheckStack.java | 2 +-
.../com/sun/xml/internal/bind/v2/util/DataSourceSource.java | 2 +-
.../com/sun/xml/internal/bind/v2/util/FatalAdapter.java | 2 +-
.../com/sun/xml/internal/bind/v2/util/FlattenIterator.java | 2 +-
.../com/sun/xml/internal/bind/v2/util/QNameMap.java | 2 +-
.../com/sun/xml/internal/bind/v2/util/StackRecorder.java | 2 +-
.../com/sun/xml/internal/bind/v2/util/TypeCast.java | 2 +-
.../sun/xml/internal/fastinfoset/AbstractResourceBundle.java | 2 +-
.../com/sun/xml/internal/fastinfoset/DecoderStateTables.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/fastinfoset/Encoder.java | 2 +-
.../com/sun/xml/internal/fastinfoset/EncodingConstants.java | 2 +-
.../com/sun/xml/internal/fastinfoset/Notation.java | 2 +-
.../com/sun/xml/internal/fastinfoset/OctetBufferListener.java | 2 +-
.../com/sun/xml/internal/fastinfoset/QualifiedName.java | 2 +-
.../com/sun/xml/internal/fastinfoset/UnparsedEntity.java | 2 +-
.../fastinfoset/algorithm/BuiltInEncodingAlgorithmFactory.java | 2 +-
.../fastinfoset/algorithm/BuiltInEncodingAlgorithmState.java | 2 +-
.../internal/fastinfoset/algorithm/DoubleEncodingAlgorithm.java | 2 +-
.../algorithm/IEEE754FloatingPointEncodingAlgorithm.java | 2 +-
.../internal/fastinfoset/algorithm/IntEncodingAlgorithm.java | 2 +-
.../fastinfoset/algorithm/IntegerEncodingAlgorithm.java | 2 +-
.../internal/fastinfoset/algorithm/LongEncodingAlgorithm.java | 2 +-
.../internal/fastinfoset/algorithm/ShortEncodingAlgorithm.java | 2 +-
.../internal/fastinfoset/algorithm/UUIDEncodingAlgorithm.java | 2 +-
.../fastinfoset/alphabet/BuiltInRestrictedAlphabets.java | 2 +-
.../sun/xml/internal/fastinfoset/dom/DOMDocumentSerializer.java | 2 +-
.../internal/fastinfoset/org/apache/xerces/util/XMLChar.java | 2 +-
.../com/sun/xml/internal/fastinfoset/sax/Features.java | 2 +-
.../com/sun/xml/internal/fastinfoset/sax/Properties.java | 2 +-
.../sun/xml/internal/fastinfoset/sax/SAXDocumentSerializer.java | 2 +-
.../fastinfoset/sax/SAXDocumentSerializerWithPrefixMapping.java | 2 +-
.../com/sun/xml/internal/fastinfoset/sax/SystemIdResolver.java | 2 +-
.../com/sun/xml/internal/fastinfoset/stax/EventLocation.java | 2 +-
.../xml/internal/fastinfoset/stax/StAXDocumentSerializer.java | 2 +-
.../com/sun/xml/internal/fastinfoset/stax/StAXManager.java | 2 +-
.../sun/xml/internal/fastinfoset/stax/events/AttributeBase.java | 2 +-
.../xml/internal/fastinfoset/stax/events/CharactersEvent.java | 2 +-
.../sun/xml/internal/fastinfoset/stax/events/CommentEvent.java | 2 +-
.../com/sun/xml/internal/fastinfoset/stax/events/DTDEvent.java | 2 +-
.../sun/xml/internal/fastinfoset/stax/events/EmptyIterator.java | 2 +-
.../xml/internal/fastinfoset/stax/events/EndDocumentEvent.java | 2 +-
.../xml/internal/fastinfoset/stax/events/EndElementEvent.java | 2 +-
.../internal/fastinfoset/stax/events/EntityDeclarationImpl.java | 2 +-
.../internal/fastinfoset/stax/events/EntityReferenceEvent.java | 2 +-
.../com/sun/xml/internal/fastinfoset/stax/events/EventBase.java | 2 +-
.../sun/xml/internal/fastinfoset/stax/events/NamespaceBase.java | 2 +-
.../fastinfoset/stax/events/ProcessingInstructionEvent.java | 2 +-
.../sun/xml/internal/fastinfoset/stax/events/ReadIterator.java | 2 +-
.../fastinfoset/stax/events/StAXEventAllocatorBase.java | 2 +-
.../xml/internal/fastinfoset/stax/events/StAXEventReader.java | 2 +-
.../xml/internal/fastinfoset/stax/events/StAXEventWriter.java | 2 +-
.../xml/internal/fastinfoset/stax/events/StAXFilteredEvent.java | 2 +-
.../internal/fastinfoset/stax/events/StartDocumentEvent.java | 2 +-
.../com/sun/xml/internal/fastinfoset/stax/events/Util.java | 2 +-
.../sun/xml/internal/fastinfoset/stax/events/XMLConstants.java | 2 +-
.../xml/internal/fastinfoset/stax/factory/StAXEventFactory.java | 2 +-
.../xml/internal/fastinfoset/stax/factory/StAXInputFactory.java | 2 +-
.../xml/internal/fastinfoset/stax/util/StAXFilteredParser.java | 2 +-
.../xml/internal/fastinfoset/stax/util/StAXParserWrapper.java | 2 +-
.../fastinfoset/tools/FI_DOM_Or_XML_DOM_SAX_SAXEvent.java | 2 +-
.../fastinfoset/tools/FI_SAX_Or_XML_SAX_DOM_SAX_SAXEvent.java | 2 +-
.../internal/fastinfoset/tools/FI_SAX_Or_XML_SAX_SAXEvent.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/FI_SAX_XML.java | 2 +-
.../fastinfoset/tools/FI_StAX_SAX_Or_XML_SAX_SAXEvent.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/PrintTable.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/SAX2StAXWriter.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/StAX2SAXReader.java | 2 +-
.../sun/xml/internal/fastinfoset/tools/VocabularyGenerator.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/XML_DOM_FI.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/XML_DOM_SAX_FI.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/XML_SAX_FI.java | 2 +-
.../com/sun/xml/internal/fastinfoset/tools/XML_SAX_StAX_FI.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/CharArray.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/CharArrayArray.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/CharArrayIntMap.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/CharArrayString.java | 2 +-
.../xml/internal/fastinfoset/util/ContiguousCharArrayArray.java | 2 +-
.../internal/fastinfoset/util/DuplicateAttributeVerifier.java | 2 +-
.../xml/internal/fastinfoset/util/FixedEntryStringIntMap.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/KeyIntMap.java | 2 +-
.../internal/fastinfoset/util/LocalNameQualifiedNamesMap.java | 2 +-
.../fastinfoset/util/NamespaceContextImplementation.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/PrefixArray.java | 2 +-
.../sun/xml/internal/fastinfoset/util/QualifiedNameArray.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/StringArray.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/StringIntMap.java | 2 +-
.../com/sun/xml/internal/fastinfoset/util/ValueArray.java | 2 +-
.../internal/fastinfoset/util/ValueArrayResourceException.java | 2 +-
.../sun/xml/internal/fastinfoset/vocab/ParserVocabulary.java | 2 +-
.../xml/internal/fastinfoset/vocab/SerializerVocabulary.java | 2 +-
.../com/sun/xml/internal/fastinfoset/vocab/Vocabulary.java | 2 +-
.../xml/internal/org/jvnet/fastinfoset/EncodingAlgorithm.java | 2 +-
.../org/jvnet/fastinfoset/EncodingAlgorithmException.java | 2 +-
.../org/jvnet/fastinfoset/EncodingAlgorithmIndexes.java | 2 +-
.../xml/internal/org/jvnet/fastinfoset/ExternalVocabulary.java | 2 +-
.../internal/org/jvnet/fastinfoset/FastInfosetException.java | 2 +-
.../xml/internal/org/jvnet/fastinfoset/FastInfosetParser.java | 2 +-
.../xml/internal/org/jvnet/fastinfoset/FastInfosetResult.java | 2 +-
.../internal/org/jvnet/fastinfoset/FastInfosetSerializer.java | 2 +-
.../xml/internal/org/jvnet/fastinfoset/FastInfosetSource.java | 2 +-
.../xml/internal/org/jvnet/fastinfoset/RestrictedAlphabet.java | 2 +-
.../com/sun/xml/internal/org/jvnet/fastinfoset/Vocabulary.java | 2 +-
.../org/jvnet/fastinfoset/VocabularyApplicationData.java | 2 +-
.../org/jvnet/fastinfoset/sax/EncodingAlgorithmAttributes.java | 2 +-
.../jvnet/fastinfoset/sax/EncodingAlgorithmContentHandler.java | 2 +-
.../org/jvnet/fastinfoset/sax/ExtendedContentHandler.java | 2 +-
.../internal/org/jvnet/fastinfoset/sax/FastInfosetReader.java | 2 +-
.../internal/org/jvnet/fastinfoset/sax/FastInfosetWriter.java | 2 +-
.../org/jvnet/fastinfoset/sax/PrimitiveTypeContentHandler.java | 2 +-
.../jvnet/fastinfoset/sax/RestrictedAlphabetContentHandler.java | 2 +-
.../sax/helpers/EncodingAlgorithmAttributesImpl.java | 2 +-
.../fastinfoset/sax/helpers/FastInfosetDefaultHandler.java | 2 +-
.../org/jvnet/fastinfoset/stax/FastInfosetStreamReader.java | 2 +-
.../jvnet/fastinfoset/stax/LowLevelFastInfosetStreamWriter.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/Annotations.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/BuildException.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/CommentList.java | 2 +-
.../sun/xml/internal/rngom/ast/builder/DataPatternBuilder.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/Div.java | 2 +-
.../internal/rngom/ast/builder/ElementAnnotationBuilder.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/Grammar.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/GrammarSection.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/Include.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/IncludedGrammar.java | 2 +-
.../sun/xml/internal/rngom/ast/builder/NameClassBuilder.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/SchemaBuilder.java | 2 +-
.../com/sun/xml/internal/rngom/ast/builder/Scope.java | 2 +-
.../com/sun/xml/internal/rngom/ast/om/Location.java | 2 +-
.../sun/xml/internal/rngom/ast/om/ParsedElementAnnotation.java | 2 +-
.../com/sun/xml/internal/rngom/ast/om/ParsedNameClass.java | 2 +-
.../com/sun/xml/internal/rngom/ast/om/ParsedPattern.java | 2 +-
.../sun/xml/internal/rngom/ast/util/CheckingSchemaBuilder.java | 2 +-
.../com/sun/xml/internal/rngom/ast/util/LocatorImpl.java | 2 +-
.../com/sun/xml/internal/rngom/ast/util/package.html | 2 +-
.../com/sun/xml/internal/rngom/binary/AfterPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/Alphabet.java | 2 +-
.../com/sun/xml/internal/rngom/binary/AttributePattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/BinaryPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/ChoicePattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/DataExceptPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/DataPattern.java | 2 +-
.../xml/internal/rngom/binary/DuplicateAttributeDetector.java | 2 +-
.../com/sun/xml/internal/rngom/binary/ElementPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/EmptyPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/ErrorPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/GroupPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/InterleavePattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/ListPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/Messages.properties | 2 +-
.../com/sun/xml/internal/rngom/binary/NotAllowedPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/OneOrMorePattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/Pattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/PatternBuilder.java | 2 +-
.../com/sun/xml/internal/rngom/binary/PatternInterner.java | 2 +-
.../com/sun/xml/internal/rngom/binary/RefPattern.java | 2 +-
.../internal/rngom/binary/RestrictionViolationException.java | 2 +-
.../com/sun/xml/internal/rngom/binary/SchemaPatternBuilder.java | 2 +-
.../com/sun/xml/internal/rngom/binary/StringPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/TextPattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/ValuePattern.java | 2 +-
.../com/sun/xml/internal/rngom/binary/package.html | 2 +-
.../xml/internal/rngom/binary/visitor/ChildElementFinder.java | 2 +-
.../sun/xml/internal/rngom/binary/visitor/PatternFunction.java | 2 +-
.../sun/xml/internal/rngom/binary/visitor/PatternVisitor.java | 2 +-
.../sun/xml/internal/rngom/binary/visitor/PatternWalker.java | 2 +-
.../com/sun/xml/internal/rngom/digested/Annotation.java | 2 +-
.../com/sun/xml/internal/rngom/digested/CommentListImpl.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DAnnotation.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DAttributePattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DChoicePattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DContainerPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DDefine.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DElementPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DEmptyPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DGrammarPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DGroupPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DInterleavePattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DListPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DMixedPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DNotAllowedPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DOMPrinter.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DOneOrMorePattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DOptionalPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DPatternVisitor.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DPatternWalker.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DRefPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DSchemaBuilderImpl.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DTextPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DUnaryPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DValuePattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DXmlTokenPattern.java | 2 +-
.../com/sun/xml/internal/rngom/digested/DZeroOrMorePattern.java | 2 +-
.../internal/rngom/digested/ElementAnnotationBuilderImpl.java | 2 +-
.../com/sun/xml/internal/rngom/digested/ElementWrapper.java | 2 +-
.../com/sun/xml/internal/rngom/digested/IncludeImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/rngom/digested/Main.java | 2 +-
.../com/sun/xml/internal/rngom/digested/PatternParseable.java | 2 +-
.../com/sun/xml/internal/rngom/digested/package.html | 2 +-
.../sun/xml/internal/rngom/dt/CachedDatatypeLibraryFactory.java | 2 +-
.../xml/internal/rngom/dt/CascadingDatatypeLibraryFactory.java | 2 +-
.../internal/rngom/dt/DoNothingDatatypeLibraryFactoryImpl.java | 2 +-
.../xml/internal/rngom/dt/builtin/BuiltinDatatypeBuilder.java | 2 +-
.../xml/internal/rngom/dt/builtin/BuiltinDatatypeLibrary.java | 2 +-
.../rngom/dt/builtin/BuiltinDatatypeLibraryFactory.java | 2 +-
.../internal/rngom/dt/builtin/CompatibilityDatatypeLibrary.java | 2 +-
.../com/sun/xml/internal/rngom/dt/builtin/Messages.properties | 2 +-
.../com/sun/xml/internal/rngom/dt/builtin/package.html | 2 +-
.../com/sun/xml/internal/rngom/nc/AnyNameExceptNameClass.java | 2 +-
.../com/sun/xml/internal/rngom/nc/ChoiceNameClass.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/rngom/nc/NameClass.java | 2 +-
.../com/sun/xml/internal/rngom/nc/NameClassVisitor.java | 2 +-
.../com/sun/xml/internal/rngom/nc/NameClassWalker.java | 2 +-
.../com/sun/xml/internal/rngom/nc/NsNameClass.java | 2 +-
.../com/sun/xml/internal/rngom/nc/NsNameExceptNameClass.java | 2 +-
.../com/sun/xml/internal/rngom/nc/NullNameClass.java | 2 +-
.../com/sun/xml/internal/rngom/nc/OverlapDetector.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/rngom/nc/package.html | 2 +-
.../jaxws_classes/com/sun/xml/internal/rngom/parse/Context.java | 2 +-
.../sun/xml/internal/rngom/parse/IllegalSchemaException.java | 2 +-
.../com/sun/xml/internal/rngom/parse/Messages.properties | 2 +-
.../com/sun/xml/internal/rngom/parse/Parseable.java | 2 +-
.../sun/xml/internal/rngom/parse/compact/CompactParseable.java | 2 +-
.../com/sun/xml/internal/rngom/parse/compact/CompactSyntax.java | 2 +-
.../internal/rngom/parse/compact/CompactSyntaxConstants.java | 2 +-
.../internal/rngom/parse/compact/CompactSyntaxTokenManager.java | 2 +-
.../com/sun/xml/internal/rngom/parse/compact/EOFException.java | 2 +-
.../xml/internal/rngom/parse/compact/EscapeSyntaxException.java | 2 +-
.../sun/xml/internal/rngom/parse/compact/JavaCharStream.java | 2 +-
.../sun/xml/internal/rngom/parse/compact/Messages.properties | 2 +-
.../sun/xml/internal/rngom/parse/compact/ParseException.java | 2 +-
.../com/sun/xml/internal/rngom/parse/compact/Token.java | 2 +-
.../com/sun/xml/internal/rngom/parse/compact/TokenMgrError.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/AnnotationsHost.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/Base.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/CommentListHost.java | 2 +-
.../xml/internal/rngom/parse/host/DataPatternBuilderHost.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/DivHost.java | 2 +-
.../internal/rngom/parse/host/ElementAnnotationBuilderHost.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/GrammarHost.java | 2 +-
.../sun/xml/internal/rngom/parse/host/GrammarSectionHost.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/IncludeHost.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/LocationHost.java | 2 +-
.../sun/xml/internal/rngom/parse/host/NameClassBuilderHost.java | 2 +-
.../internal/rngom/parse/host/ParsedElementAnnotationHost.java | 2 +-
.../sun/xml/internal/rngom/parse/host/ParsedNameClassHost.java | 2 +-
.../sun/xml/internal/rngom/parse/host/ParsedPatternHost.java | 2 +-
.../sun/xml/internal/rngom/parse/host/SchemaBuilderHost.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/ScopeHost.java | 2 +-
.../com/sun/xml/internal/rngom/parse/host/package.html | 2 +-
.../com/sun/xml/internal/rngom/parse/xml/DtdContext.java | 2 +-
.../com/sun/xml/internal/rngom/parse/xml/Messages.properties | 2 +-
.../com/sun/xml/internal/rngom/parse/xml/SAXParseable.java | 2 +-
.../com/sun/xml/internal/rngom/util/Localizer.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/rngom/util/Uri.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/rngom/util/Utf16.java | 2 +-
.../sun/xml/internal/rngom/xml/sax/AbstractLexicalHandler.java | 2 +-
.../com/sun/xml/internal/rngom/xml/sax/XMLReaderCreator.java | 2 +-
.../com/sun/xml/internal/rngom/xml/sax/XmlBaseHandler.java | 2 +-
.../com/sun/xml/internal/rngom/xml/util/EncodingMap.java | 2 +-
.../com/sun/xml/internal/rngom/xml/util/Naming.java | 2 +-
.../sun/xml/internal/rngom/xml/util/WellKnownNamespaces.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/Attribute.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/Cdata.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/Comment.java | 2 +-
.../com/sun/xml/internal/txw2/ContainerElement.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/Content.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/ContentVisitor.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/DatatypeWriter.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/Document.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/EndDocument.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/EndTag.java | 2 +-
.../com/sun/xml/internal/txw2/IllegalAnnotationException.java | 2 +-
.../com/sun/xml/internal/txw2/IllegalSignatureException.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/NamespaceDecl.java | 2 +-
.../com/sun/xml/internal/txw2/NamespaceResolver.java | 2 +-
.../com/sun/xml/internal/txw2/NamespaceSupport.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/Pcdata.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/StartDocument.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/StartTag.java | 2 +-
.../src/share/jaxws_classes/com/sun/xml/internal/txw2/TXW.java | 2 +-
.../src/share/jaxws_classes/com/sun/xml/internal/txw2/Text.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/TxwException.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/TypedXmlWriter.java | 2 +-
.../com/sun/xml/internal/txw2/annotation/XmlAttribute.java | 2 +-
.../com/sun/xml/internal/txw2/annotation/XmlCDATA.java | 2 +-
.../com/sun/xml/internal/txw2/annotation/XmlElement.java | 2 +-
.../com/sun/xml/internal/txw2/annotation/XmlNamespace.java | 2 +-
.../com/sun/xml/internal/txw2/annotation/XmlValue.java | 2 +-
.../com/sun/xml/internal/txw2/annotation/package.html | 2 +-
.../sun/xml/internal/txw2/output/CharacterEscapeHandler.java | 2 +-
.../com/sun/xml/internal/txw2/output/DataWriter.java | 2 +-
.../sun/xml/internal/txw2/output/DelegatingXMLStreamWriter.java | 2 +-
.../com/sun/xml/internal/txw2/output/DomSerializer.java | 2 +-
.../com/sun/xml/internal/txw2/output/DumbEscapeHandler.java | 2 +-
.../com/sun/xml/internal/txw2/output/DumpSerializer.java | 2 +-
.../com/sun/xml/internal/txw2/output/IndentingXMLFilter.java | 2 +-
.../sun/xml/internal/txw2/output/IndentingXMLStreamWriter.java | 2 +-
.../com/sun/xml/internal/txw2/output/ResultFactory.java | 2 +-
.../com/sun/xml/internal/txw2/output/SaxSerializer.java | 2 +-
.../com/sun/xml/internal/txw2/output/StaxSerializer.java | 2 +-
.../com/sun/xml/internal/txw2/output/StreamSerializer.java | 2 +-
.../com/sun/xml/internal/txw2/output/TXWResult.java | 2 +-
.../com/sun/xml/internal/txw2/output/TXWSerializer.java | 2 +-
.../com/sun/xml/internal/txw2/output/XmlSerializer.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/txw2/output/package.html | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/txw2/package.html | 2 +-
.../xml/internal/ws/org/objectweb/asm/AnnotationVisitor.java | 2 +-
.../sun/xml/internal/ws/org/objectweb/asm/AnnotationWriter.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Attribute.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/ByteVector.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/ClassReader.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/ClassVisitor.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/ClassWriter.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Edge.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/FieldVisitor.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/FieldWriter.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Frame.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Handler.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Item.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Label.java | 2 +-
.../sun/xml/internal/ws/org/objectweb/asm/MethodVisitor.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/MethodWriter.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Opcodes.java | 2 +-
.../com/sun/xml/internal/ws/org/objectweb/asm/Type.java | 2 +-
.../com/sun/xml/internal/ws/policy/AssertionSet.java | 2 +-
.../xml/internal/ws/policy/AssertionValidationProcessor.java | 2 +-
.../com/sun/xml/internal/ws/policy/ComplexAssertion.java | 2 +-
.../xml/internal/ws/policy/EffectiveAlternativeSelector.java | 2 +-
.../com/sun/xml/internal/ws/policy/EffectivePolicyModifier.java | 2 +-
.../com/sun/xml/internal/ws/policy/NestedPolicy.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/ws/policy/Policy.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyAssertion.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyConstants.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyException.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyIntersector.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/ws/policy/PolicyMap.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyMapExtender.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyMapKey.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyMapKeyHandler.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyMapMutator.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyMapUtil.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyMerger.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicyScope.java | 2 +-
.../com/sun/xml/internal/ws/policy/PolicySubject.java | 2 +-
.../com/sun/xml/internal/ws/policy/SimpleAssertion.java | 2 +-
.../com/sun/xml/internal/ws/policy/package-info.java | 2 +-
.../xml/internal/ws/policy/privateutil/Localization.properties | 2 +-
.../internal/ws/policy/privateutil/LocalizationMessages.java | 2 +-
.../sun/xml/internal/ws/policy/privateutil/PolicyLogger.java | 2 +-
.../ws/policy/privateutil/RuntimePolicyUtilsException.java | 2 +-
.../ws/policy/privateutil/ServiceConfigurationError.java | 2 +-
.../sun/xml/internal/ws/policy/privateutil/ServiceFinder.java | 2 +-
.../sun/xml/internal/ws/policy/privateutil/package-info.java | 2 +-
.../sun/xml/internal/ws/policy/sourcemodel/AssertionData.java | 2 +-
.../internal/ws/policy/sourcemodel/CompactModelGenerator.java | 2 +-
.../ws/policy/sourcemodel/DefaultPolicyAssertionCreator.java | 2 +-
.../com/sun/xml/internal/ws/policy/sourcemodel/ModelNode.java | 2 +-
.../ws/policy/sourcemodel/NormalizedModelGenerator.java | 2 +-
.../internal/ws/policy/sourcemodel/PolicyModelGenerator.java | 2 +-
.../internal/ws/policy/sourcemodel/PolicyModelMarshaller.java | 2 +-
.../internal/ws/policy/sourcemodel/PolicyModelTranslator.java | 2 +-
.../internal/ws/policy/sourcemodel/PolicyModelUnmarshaller.java | 2 +-
.../xml/internal/ws/policy/sourcemodel/PolicyReferenceData.java | 2 +-
.../xml/internal/ws/policy/sourcemodel/PolicySourceModel.java | 2 +-
.../ws/policy/sourcemodel/PolicySourceModelContext.java | 2 +-
.../ws/policy/sourcemodel/XmlPolicyModelMarshaller.java | 2 +-
.../ws/policy/sourcemodel/XmlPolicyModelUnmarshaller.java | 2 +-
.../sourcemodel/attach/ExternalAttachmentsUnmarshaller.java | 2 +-
.../xml/internal/ws/policy/sourcemodel/attach/package-info.java | 2 +-
.../sun/xml/internal/ws/policy/sourcemodel/package-info.java | 2 +-
.../ws/policy/sourcemodel/wspolicy/NamespaceVersion.java | 2 +-
.../xml/internal/ws/policy/sourcemodel/wspolicy/XmlToken.java | 2 +-
.../sun/xml/internal/ws/policy/spi/AbstractQNameValidator.java | 2 +-
.../xml/internal/ws/policy/spi/AssertionCreationException.java | 2 +-
.../sun/xml/internal/ws/policy/spi/PolicyAssertionCreator.java | 2 +-
.../xml/internal/ws/policy/spi/PolicyAssertionValidator.java | 2 +-
.../com/sun/xml/internal/ws/policy/spi/PrefixMapper.java | 2 +-
.../com/sun/xml/internal/ws/policy/spi/package-info.java | 2 +-
.../xml/internal/ws/policy/subject/PolicyMapKeyConverter.java | 2 +-
.../sun/xml/internal/ws/policy/subject/WsdlBindingSubject.java | 2 +-
.../com/sun/xml/internal/ws/policy/subject/package-info.java | 2 +-
.../com/sun/xml/internal/xsom/ForeignAttributes.java | 2 +-
.../src/share/jaxws_classes/com/sun/xml/internal/xsom/SCD.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSAnnotation.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSAttContainer.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSAttGroupDecl.java | 2 +-
.../com/sun/xml/internal/xsom/XSAttributeDecl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSAttributeUse.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSComplexType.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSComponent.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSContentType.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSDeclaration.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSElementDecl.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/xsom/XSFacet.java | 2 +-
.../com/sun/xml/internal/xsom/XSIdentityConstraint.java | 2 +-
.../com/sun/xml/internal/xsom/XSListSimpleType.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSModelGroup.java | 2 +-
.../com/sun/xml/internal/xsom/XSModelGroupDecl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSNotation.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSParticle.java | 2 +-
.../com/sun/xml/internal/xsom/XSRestrictionSimpleType.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/xsom/XSSchema.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSSchemaSet.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSSimpleType.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/xsom/XSTerm.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/xsom/XSType.java | 2 +-
.../com/sun/xml/internal/xsom/XSUnionSimpleType.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSVariety.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XSWildcard.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/xsom/XSXPath.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/XmlString.java | 2 +-
.../com/sun/xml/internal/xsom/impl/AnnotationImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/AttGroupDeclImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/AttributeDeclImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/AttributeUseImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/AttributesHolder.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ComplexTypeImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ComponentImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/Const.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ContentTypeImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/DeclarationImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ElementDecl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/EmptyImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/FacetImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ForeignAttributesImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/IdentityConstraintImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ListSimpleTypeImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ModelGroupDeclImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ModelGroupImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/NotationImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/ParticleImpl.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/xsom/impl/Ref.java | 2 +-
.../sun/xml/internal/xsom/impl/RestrictionSimpleTypeImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/SchemaImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/SchemaSetImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/SimpleTypeImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/UName.java | 2 +-
.../com/sun/xml/internal/xsom/impl/UnionSimpleTypeImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/Util.java | 2 +-
.../com/sun/xml/internal/xsom/impl/WildcardImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/XPathImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/package.html | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/BaseContentRef.java | 2 +-
.../xml/internal/xsom/impl/parser/DefaultAnnotationParser.java | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/DelayedRef.java | 2 +-
.../sun/xml/internal/xsom/impl/parser/Messages_ja.properties | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/NGCCRuntimeEx.java | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/ParserContext.java | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/Patch.java | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/PatcherManager.java | 2 +-
.../sun/xml/internal/xsom/impl/parser/SchemaDocumentImpl.java | 2 +-
.../xml/internal/xsom/impl/parser/SubstGroupBaseTypeRef.java | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/datatypes.xsd | 2 +-
.../com/sun/xml/internal/xsom/impl/parser/package.html | 2 +-
.../sun/xml/internal/xsom/impl/parser/state/AttributesImpl.java | 2 +-
.../xml/internal/xsom/impl/parser/state/NGCCEventReceiver.java | 2 +-
.../xml/internal/xsom/impl/parser/state/NGCCEventSource.java | 2 +-
.../sun/xml/internal/xsom/impl/parser/state/NGCCHandler.java | 2 +-
.../internal/xsom/impl/parser/state/NGCCInterleaveFilter.java | 2 +-
.../sun/xml/internal/xsom/impl/parser/state/NGCCRuntime.java | 2 +-
.../xml/internal/xsom/impl/parser/state/foreignAttributes.java | 2 +-
.../sun/xml/internal/xsom/impl/parser/state/qualification.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/AbstractAxisImpl.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/scd/Axis.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/Iterators.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/ParseException.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/SCDImpl.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/SCDParser.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/SCDParserConstants.java | 2 +-
.../sun/xml/internal/xsom/impl/scd/SCDParserTokenManager.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/SimpleCharStream.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/scd/Step.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/impl/scd/Token.java | 2 +-
.../com/sun/xml/internal/xsom/impl/scd/TokenMgrError.java | 2 +-
.../sun/xml/internal/xsom/impl/util/DraconianErrorHandler.java | 2 +-
.../sun/xml/internal/xsom/impl/util/ResourceEntityResolver.java | 2 +-
.../sun/xml/internal/xsom/impl/util/SchemaTreeTraverser.java | 2 +-
.../com/sun/xml/internal/xsom/impl/util/SchemaWriter.java | 2 +-
.../share/jaxws_classes/com/sun/xml/internal/xsom/package.html | 2 +-
.../com/sun/xml/internal/xsom/parser/AnnotationContext.java | 2 +-
.../com/sun/xml/internal/xsom/parser/AnnotationParser.java | 2 +-
.../sun/xml/internal/xsom/parser/AnnotationParserFactory.java | 2 +-
.../com/sun/xml/internal/xsom/parser/SchemaDocument.java | 2 +-
.../com/sun/xml/internal/xsom/parser/XMLParser.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/parser/package.html | 2 +-
.../com/sun/xml/internal/xsom/util/ComponentNameFunction.java | 2 +-
.../com/sun/xml/internal/xsom/util/DeferedCollection.java | 2 +-
.../com/sun/xml/internal/xsom/util/NameGetter.java | 2 +-
.../com/sun/xml/internal/xsom/util/NameGetter.properties | 2 +-
.../com/sun/xml/internal/xsom/util/SimpleTypeSet.java | 2 +-
.../com/sun/xml/internal/xsom/util/TypeClosure.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/util/TypeSet.java | 2 +-
.../jaxws_classes/com/sun/xml/internal/xsom/util/XSFinder.java | 2 +-
.../com/sun/xml/internal/xsom/util/XSFunctionFilter.java | 2 +-
.../sun/xml/internal/xsom/visitor/XSContentTypeFunction.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSContentTypeVisitor.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSFunction.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSSimpleTypeFunction.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSSimpleTypeVisitor.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSTermFunction.java | 2 +-
.../sun/xml/internal/xsom/visitor/XSTermFunctionWithParam.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSTermVisitor.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSVisitor.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSWildcardFunction.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/XSWildcardVisitor.java | 2 +-
.../com/sun/xml/internal/xsom/visitor/package.html | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/HandlerChain.java | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/Oneway.java | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/WebMethod.java | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/WebParam.java | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/WebResult.java | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/WebService.java | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/soap/InitParam.java | 2 +-
jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPBinding.java | 2 +-
.../share/jaxws_classes/javax/jws/soap/SOAPMessageHandler.java | 2 +-
.../share/jaxws_classes/javax/jws/soap/SOAPMessageHandlers.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/soap/package.html | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Action.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/AsyncHandler.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Binding.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/BindingProvider.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/BindingType.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Dispatch.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Endpoint.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointContext.java | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/EndpointReference.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/FaultAction.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Holder.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/LogicalMessage.java | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/ProtocolException.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Provider.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/RequestWrapper.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBinding.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/RespectBindingFeature.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Response.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/ResponseWrapper.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/Service.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/ServiceMode.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/WebEndpoint.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/WebFault.java | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/WebServiceClient.java | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/WebServiceContext.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/WebServiceException.java | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/WebServiceFeature.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/WebServicePermission.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/WebServiceProvider.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java | 2 +-
.../jaxws_classes/javax/xml/ws/handler/HandlerResolver.java | 2 +-
.../jaxws_classes/javax/xml/ws/handler/LogicalHandler.java | 2 +-
.../javax/xml/ws/handler/LogicalMessageContext.java | 2 +-
.../jaxws_classes/javax/xml/ws/handler/MessageContext.java | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/handler/PortInfo.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/handler/package.html | 2 +-
.../jaxws_classes/javax/xml/ws/handler/soap/SOAPHandler.java | 2 +-
.../javax/xml/ws/handler/soap/SOAPMessageContext.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/handler/soap/package.html | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/http/HTTPBinding.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/http/HTTPException.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/http/package.html | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/package.html | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/soap/Addressing.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOM.java | 2 +-
.../src/share/jaxws_classes/javax/xml/ws/soap/SOAPBinding.java | 2 +-
.../jaxws_classes/javax/xml/ws/soap/SOAPFaultException.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/soap/package.html | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Invoker.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/spi/ServiceDelegate.java | 2 +-
.../javax/xml/ws/spi/WebServiceFeatureAnnotation.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/spi/http/HttpContext.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/spi/http/HttpExchange.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/spi/http/HttpHandler.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/spi/http/package-info.java | 2 +-
jaxws/src/share/jaxws_classes/javax/xml/ws/spi/package.html | 2 +-
.../javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java | 2 +-
.../jaxws_classes/javax/xml/ws/wsaddressing/package-info.java | 2 +-
.../share/jaxws_classes/javax/xml/ws/wsaddressing/package.html | 2 +-
1301 files changed, 1301 insertions(+), 1301 deletions(-)
diff --git a/jaxws/build.properties b/jaxws/build.properties
index 9240acc57f8..f2c977cd749 100644
--- a/jaxws/build.properties
+++ b/jaxws/build.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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
diff --git a/jaxws/build.xml b/jaxws/build.xml
index afea552e3b8..ef0402f3b01 100644
--- a/jaxws/build.xml
+++ b/jaxws/build.xml
@@ -1,6 +1,6 @@
+
+
+
+
+ DISPLAY
+ 2
+
+
+ THERMOMETER
+ 1
+
+
+ CLOCK
+ 4
+
+
+
\ No newline at end of file
diff --git a/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java
new file mode 100644
index 00000000000..2b97b4e832d
--- /dev/null
+++ b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java
@@ -0,0 +1,49 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * Represents available modules.
+ */
+public enum Module {
+
+ DISPLAY, CLOCK, THERMOMETER, HEATER, SPEAKER, GSM, LED;
+}
diff --git a/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java
new file mode 100644
index 00000000000..6db5bae4141
--- /dev/null
+++ b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package checker;
+
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.xml.bind.JAXBContext;
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.bind.JAXBException;
+
+/**
+ * Reads the device configuration from the XML file specified by -Adevice=device.xml.
+ * For each class in a project, checks required modules. If the device doesn't have
+ * the required module, then a compilation error will be shown.
+ */
+@SupportedAnnotationTypes("checker.RequireContainer")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class PluginChecker extends javax.annotation.processing.AbstractProcessor {
+
+ /**
+ * Name of the option to get the path to the xml with device configuration.
+ */
+ public static final String DEVICE_OPTION = "device";
+ private Device device;
+
+ /**
+ * Only the device option is supported.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set getSupportedOptions() {
+ return new HashSet<>(Arrays.asList(DEVICE_OPTION));
+ }
+
+ /**
+ * Initializes the processor by loading the device configuration.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ try {
+ String deviceOption = processingEnv.getOptions().get(DEVICE_OPTION);
+ device = (Device) JAXBContext.newInstance(Device.class)
+ .createUnmarshaller().unmarshal(new File(deviceOption));
+ } catch (JAXBException e) {
+ throw new RuntimeException(
+ "Please specify device by -Adevice=device.xml\n"
+ + e.toString(), e);
+ }
+ }
+
+ /**
+ * Processes @Require annotations and checks that Device meets requirements.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean process(Set extends TypeElement> annotations,
+ RoundEnvironment roundEnv) {
+ for (Element el : roundEnv.getElementsAnnotatedWith(RequireContainer.class)) {
+ for (Require req : el.getAnnotationsByType(Require.class)) {
+ //for every Require annotation checks if device has module of required version.
+ Integer version = device.getSupportedModules().get(req.value());
+
+ if (version == null
+ || version < req.minVersion()
+ || version > req.maxVersion()) {
+ //if module is optional then show only warning not error
+ if (req.optional()) {
+ processingEnv.getMessager()
+ .printMessage(Diagnostic.Kind.WARNING,
+ "Plugin [" + el + "] requires " + req
+ + "\n but device " + (version == null
+ ? "doesn't have such module."
+ + " This module is optional."
+ + " So plugin will work but miss"
+ + " some functionality"
+ : "has " + version
+ + " version of that module"));
+ } else {
+ processingEnv.getMessager()
+ .printMessage(Diagnostic.Kind.ERROR,
+ "Plugin [" + el + "] requires " + req
+ + "\n but device "
+ + (version == null
+ ? "doesn't have such module"
+ : "has " + version
+ + " version of that module"));
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java
new file mode 100644
index 00000000000..6681c2810e2
--- /dev/null
+++ b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package checker;
+
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates that a plug-in depends on a module.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Repeatable(RequireContainer.class)
+public @interface Require {
+
+ /**
+ * Returns the required module.
+ *
+ * @return required module.
+ */
+ Module value();
+
+ /**
+ * Returns the minimum supported version of a module.
+ *
+ * @return minimum supported version of a module.
+ */
+ int minVersion() default 1;
+
+ /**
+ * Returns the maximum supported version of a module.
+ *
+ * @return maximum supported version of a module.
+ */
+ int maxVersion() default Integer.MAX_VALUE;
+
+ /**
+ * Returns true if a module is optional. A module is optional if a system
+ * works without that module but is missing some functionality. Returns false if a system
+ * won't work without the specified module.
+ *
+ * @return true if module is optional. False otherwise.
+ */
+ boolean optional() default false;
+}
diff --git a/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java
new file mode 100644
index 00000000000..d18e0d523c0
--- /dev/null
+++ b/jdk/src/share/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java
@@ -0,0 +1,51 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * A container for the repeatable @Require annotation.
+ */
+@Retention(RetentionPolicy.CLASS)
+public @interface RequireContainer {
+
+ Require[] value();
+}
diff --git a/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java b/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java
new file mode 100644
index 00000000000..3a9d842e5b0
--- /dev/null
+++ b/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+
+/**
+ * BoilerPlugin provides support for boiling water and keeping water warm.
+ */
+@Require(value = Module.CLOCK, maxVersion = 3)
+@Require(value = Module.THERMOMETER)
+@Require(value = Module.HEATER)
+@Require(value = Module.LED, optional = true) //will use if present
+public class BoilerPlugin {
+
+ /**
+ * Heats water up to 100 degrees Celsius.
+ */
+ public void boil() {
+ boil(100);
+ }
+
+ /**
+ * Heats water up to temperature.
+ *
+ * @param temperature - desired temperature of the water in the boiler
+ */
+ public void boil(int temperature) {
+ /*
+ * Turn on heater and wait while temperature reaches desired temperature
+ * in Celsius. Finally, turn off heater.
+ * If present, the LED light changes color according to the temperature.
+ */
+ }
+
+ /**
+ * Keeps desired temperature.
+ *
+ * @param temperature - desired temperature of the water in the boiler
+ * @param seconds - period of time for checking temperature in seconds
+ */
+ public void keepWarm(int temperature, int seconds) {
+ //Every n seconds check temperature and warm up, if necessary.
+ }
+
+}
diff --git a/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java b/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java
new file mode 100644
index 00000000000..b7be61025a0
--- /dev/null
+++ b/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+import java.util.Calendar;
+
+/**
+ * Introduces new features for BoilerPlugin. Features are boiling water by an
+ * SMS and boiling water by date with notification by a phone call.
+ */
+@Require(value = Module.SPEAKER)
+@Require(value = Module.GSM, minVersion = 3)
+@Require(value = Module.DISPLAY)
+public class ExtendedBoilerPlugin extends BoilerPlugin {
+
+ /**
+ * Boils water at the appointed time and wakes you up by a ring and phone
+ * call. Shows "Good morning" and a quote of the day from the Internet on the
+ * display.
+ *
+ * @param calendar - date and time when water should be boiled
+ * @param phoneNumber - phone number to call
+ */
+ public void boilAndWakeUp(Calendar calendar, int phoneNumber) {
+ //implementation
+ }
+
+ /**
+ * Boils water at the appointed time by getting an SMS of fixed format.
+ * Sends an SMS on finish.
+ *
+ * @param sms - text of SMS
+ */
+ public void boilBySMS(String sms) {
+ //implementation
+ }
+}
diff --git a/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java b/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java
new file mode 100644
index 00000000000..678785c5cf4
--- /dev/null
+++ b/jdk/src/share/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+
+/**
+ * Timer plug-in is used to support an alarm and a timer. It depends on Display and
+ * Clock modules.
+ */
+@Require(Module.DISPLAY)
+@Require(value = Module.CLOCK, maxVersion = 3)
+public class TimerPlugin {
+
+ /**
+ * Sets timer.
+ *
+ * @param time - the remaining time.
+ */
+ public void timer(long time) {
+ //start timer
+ //show the remaining time on display
+ }
+
+ /**
+ * Sets alarm.
+ *
+ * @param time - the alarm time.
+ */
+ public void alarm(long time) {
+ //start alarm
+ //show current time and alarm time on display
+ }
+}
diff --git a/jdk/src/share/sample/annotations/Validator/src/PositiveIntegerSupplier.java b/jdk/src/share/sample/annotations/Validator/src/PositiveIntegerSupplier.java
new file mode 100644
index 00000000000..0a149139b53
--- /dev/null
+++ b/jdk/src/share/sample/annotations/Validator/src/PositiveIntegerSupplier.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.util.function.Supplier;
+
+/**
+ * Supplies a positive number.
+ */
+@Validate(value = Validator.INTEGER_NUMBER,
+ description = "It's not an Integer ")
+@Validate(value = Validator.POSITIVE_NUMBER,
+ description = "It's not a positive Number")
+public class PositiveIntegerSupplier implements Supplier {
+
+ /**
+ * Returns a string representation of a positive integer.
+ *
+ * @return string representation of a positive integer.
+ */
+ @Override
+ public String get() {
+ return "20005"; //random number
+ }
+}
diff --git a/jdk/src/share/sample/annotations/Validator/src/SupplierValidator.java b/jdk/src/share/sample/annotations/Validator/src/SupplierValidator.java
new file mode 100644
index 00000000000..479ac8643e1
--- /dev/null
+++ b/jdk/src/share/sample/annotations/Validator/src/SupplierValidator.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import javax.xml.bind.ValidationException;
+import java.util.function.Supplier;
+
+/**
+ * Validates the supplier.
+ */
+public class SupplierValidator {
+
+ /**
+ * Validates the supplier.
+ *
+ * @param supplier - Supplier that needs to be validated.
+ * @return true if supplier has passed validation check. False otherwise.
+ */
+ public static boolean validate(Supplier> supplier) {
+ for (Validate annotation
+ : supplier.getClass().getAnnotationsByType(Validate.class)) {
+ try {
+ annotation.value().validate(supplier);
+ } catch (ValidationException e) {
+ System.out.println(annotation.description());
+ e.printStackTrace();
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/jdk/src/share/sample/annotations/Validator/src/Validate.java b/jdk/src/share/sample/annotations/Validator/src/Validate.java
new file mode 100644
index 00000000000..e0404ea9471
--- /dev/null
+++ b/jdk/src/share/sample/annotations/Validator/src/Validate.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates that the class should be validated by the specified validator.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(ValidateContainer.class)
+public @interface Validate {
+
+ /**
+ * Returns the validator that should validate the annotated class.
+ *
+ * @return Validator that should validate annotated class.
+ */
+ Validator value();
+
+ /**
+ * Returns text to describe the failure of the validation check.
+ *
+ * @return text to describe the failure of the validation check.
+ */
+ String description() default "";
+}
+
+/**
+ * A container for the repeatable @Validate annotation.
+ *
+ * @author Andrey Nazarov
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@interface ValidateContainer {
+
+ Validate[] value();
+}
diff --git a/jdk/src/share/sample/annotations/Validator/src/Validator.java b/jdk/src/share/sample/annotations/Validator/src/Validator.java
new file mode 100644
index 00000000000..9e074f5a8e5
--- /dev/null
+++ b/jdk/src/share/sample/annotations/Validator/src/Validator.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import javax.xml.bind.ValidationException;
+import java.util.function.Supplier;
+
+/**
+ * Enum of Validator implementations.
+ */
+public enum Validator {
+
+ /**
+ * This validator checks that the string represents an integer.
+ */
+ INTEGER_NUMBER {
+ /**
+ * Checks that the string represents an integer.
+ *
+ * @param string - a string supplier
+ * @throws ValidationException if the validation check fails
+ */
+ @Override
+ void validate(Supplier> string) throws ValidationException {
+ try {
+ Integer.parseInt((String) string.get());
+ } catch (NumberFormatException ex) {
+ throw new ValidationException("Error while validating "
+ + string.get());
+ }
+ }
+ },
+ /**
+ * This validator checks that the string represents a positive number.
+ */
+ POSITIVE_NUMBER {
+ /**
+ * Checks that the string represents a positive number.
+ *
+ * @param string - an string supplier
+ * @throws ValidationException if the validation check fails
+ */
+ @Override
+ void validate(Supplier> string) throws ValidationException {
+ try {
+ if (Double.compare(0.0, Double.parseDouble(
+ (String) string.get())) > 0) {
+ throw new Exception();
+ }
+ } catch (Exception ex) {
+ throw new ValidationException("Error while validating "
+ + string.get());
+ }
+ }
+ };
+
+ /**
+ * Checks that the supplier is valid.
+ *
+ * @param string - a string supplier
+ * @throws ValidationException if validation check fails
+ */
+ abstract void validate(Supplier> string) throws ValidationException;
+
+}
diff --git a/jdk/src/share/sample/annotations/index.html b/jdk/src/share/sample/annotations/index.html
new file mode 100644
index 00000000000..804c83df441
--- /dev/null
+++ b/jdk/src/share/sample/annotations/index.html
@@ -0,0 +1,67 @@
+
+
+
+ Repeating Annotations Demo
+
+
+
Repeating Annotations Demo
+
+
+ This demo shows how to use repeating annotations at runtime and at compile time.
+
+
+
+
Dependency checker.
+
+
+ Shows how to define repeating annotations and process them at compile time.
+ The problem domain is some code that performs useful operations on hardware devices.
+ The code relies on "modules" to be present on the devices. Applicability of the code to a particular
+ device is checked while compiling the code for a particular device.
+ A set of modules provided by a device is listed in an xml file that turns red during the compilation
+ phase and is compared with the required module set specified by annotations.
+ For instance, there is kettle with hardware modules: thermometer, display, and clock.
+ There is also a boiler plug-in that requires clock, thermometer, heater, and optionally an LED light.
+
+ Build the PluginChecker annotation processor first.
+ Then, run javac with the annotation processor against plug-in sources using the following command:
+ Shows how to define repeating annotations and process them at runtime.
+ A problem domain is code that needs to validate provided Suppliers for conformance to some criteria.
+ The criteria are implemented by the Validator class which is applied by using annotations that are placed in
+ the code whenever validation is needed. For more information, see the
+ source files.
+
+ This demo shows how to use bulk data operations with the new JDK8
+ Collections API.
+ The demo also demonstrates new features of JDK8 such as lambda expressions
+ and method/constructor references.
+
+
+
+
CSV Processor
+
+
+ Analyzes a CSV file, finds and collects useful information, computes
+ different statistics. For more information, see the source file.
+
+
+
\ No newline at end of file
diff --git a/jdk/src/share/sample/lambda/BulkDataOperations/src/CSVProcessor.java b/jdk/src/share/sample/lambda/BulkDataOperations/src/CSVProcessor.java
new file mode 100644
index 00000000000..ded9030209d
--- /dev/null
+++ b/jdk/src/share/sample/lambda/BulkDataOperations/src/CSVProcessor.java
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.function.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+
+import static java.lang.Double.parseDouble;
+import static java.util.stream.Collectors.*;
+
+/**
+ * CSVProcessor is a tool for processing CSV files. There are several
+ * command-line options. Consult the {@link #printUsageAndExit} method for
+ * instructions and command line parameters. This sample shows examples of the
+ * following features:
+ *
+ *
Lambda and bulk operations. Working with streams: map(...), filter(...),
+ * sorted(...) methods. The collect(...) method with different collectors:
+ * Collectors.maxBy(...), Collectors.minBy(...), Collectors.toList(),
+ * Collectors.toCollection(...), Collectors.groupingBy(...),
+ * Collectors.toDoubleSummaryStatistics(...), and a custom Collector.
+ *
Static method reference for printing values.
+ *
Try-with-resources feature for closing files.
+ *
Switch by String feature.
+ *
Other new APIs: Pattern.asPredicate(), BinaryOperator
+ * BufferedReader.lines(), Collection.forEach(...), Comparator.comparing(...),
+ * Comparator.reversed(), Arrays.stream(...).
+ *
+ *
+ */
+public class CSVProcessor {
+
+ //Number of characters that may be read
+ private static final int READ_AHEAD_LIMIT = 100_000_000;
+
+ /**
+ * The main method for the CSVProcessor program. Run the program with an
+ * empty argument list to see possible arguments.
+ *
+ * @param args the argument list for CSVProcessor.
+ */
+ public static void main(String[] args) {
+ if (args.length < 2) {
+ printUsageAndExit();
+ }
+ try (BufferedReader br = new BufferedReader(
+ Files.newBufferedReader(Paths.get(args[args.length - 1])))) {
+ //Assume that the first line contains column names.
+ List header = Arrays.stream(br.readLine().split(","))
+ .map(String::trim).collect(toList());
+ //Calculate an index of the column in question.
+ int column = getColumnNumber(header, args[1]);
+ switch (args[0]) {
+ case "sort":
+ verifyArgumentNumber(args, 4);
+ //Define the sort order.
+ boolean isAsc;
+ switch (args[2].toUpperCase()) {
+ case "ASC":
+ isAsc = true;
+ break;
+ case "DESC":
+ isAsc = false;
+ break;
+ default:
+ printUsageAndExit("Illegal argument" + args[2]);
+ return;//Should not be reached.
+ }
+ /*
+ * Create a comparator that compares lines by comparing
+ * values in the specified column.
+ */
+ Comparator cmp
+ = Comparator.comparing(str -> getCell(str, column),
+ String.CASE_INSENSITIVE_ORDER);
+ /*
+ * sorted(...) is used to sort records.
+ * forEach(...) is used to output sorted records.
+ */
+ br.lines().sorted(isAsc ? cmp : cmp.reversed())
+ .forEach(System.out::println);
+ break;
+ case "search":
+ verifyArgumentNumber(args, 4);
+ /*
+ * Records are filtered by a regex.
+ * forEach(...) is used to output filtered records.
+ */
+ Predicate pattern
+ = Pattern.compile(args[2]).asPredicate();
+ br.lines().filter(str -> pattern.test(getCell(str, column)))
+ .forEach(System.out::println);
+ break;
+ case "groupby":
+ verifyArgumentNumber(args, 3);
+ /*
+ * Group lines by values in the column with collect(...), and
+ * print with forEach(...) for every distinct value within
+ * the column.
+ */
+ br.lines().collect(
+ Collectors.groupingBy(str -> getCell(str, column),
+ toCollection(TreeSet::new)))
+ .forEach((str, set) -> {
+ System.out.println(str + ":");
+ set.forEach(System.out::println);
+ });
+ break;
+ case "stat":
+ verifyArgumentNumber(args, 3);
+
+ /*
+ * BufferedReader will be read several times.
+ * Mark this point to return here after each pass.
+ * BufferedReader will be read right after the headers line
+ * because it is already read.
+ */
+ br.mark(READ_AHEAD_LIMIT);
+
+ /*
+ * Statistics can be collected by a custom collector in one
+ * pass. One pass is preferable.
+ */
+ System.out.println(
+ br.lines().collect(new Statistics(column)));
+
+ /*
+ * Alternatively, statistics can be collected
+ * by a built-in API in several passes.
+ * This method demonstrates how separate operations can be
+ * implemented using a built-in API.
+ */
+ br.reset();
+ statInSeveralPasses(br, column);
+ break;
+ default:
+ printUsageAndExit("Illegal argument" + args[0]);
+ }
+ } catch (IOException e) {
+ printUsageAndExit(e.toString());
+ }
+ }
+
+ private static void statInSeveralPasses(BufferedReader br, int column)
+ throws IOException {
+ System.out.println("#-----Statistics in several passes-------#");
+ //Create a comparator to compare records by the column.
+ Comparator comparator
+ = Comparator.comparing(
+ (String str) -> parseDouble(getCell(str, column)));
+ //Find max record by using Collectors.maxBy(...)
+ System.out.println(
+ "Max: " + br.lines().collect(maxBy(comparator)).get());
+ br.reset();
+ //Find min record by using Collectors.minBy(...)
+ System.out.println(
+ "Min: " + br.lines().collect(minBy(comparator)).get());
+ br.reset();
+ //Compute the average value and sum with
+ //Collectors.toDoubleSummaryStatistics(...)
+ DoubleSummaryStatistics doubleSummaryStatistics
+ = br.lines().collect(summarizingDouble(
+ str -> parseDouble(getCell(str, column))));
+ System.out.println("Average: " + doubleSummaryStatistics.getAverage());
+ System.out.println("Sum: " + doubleSummaryStatistics.getSum());
+ }
+
+ private static void verifyArgumentNumber(String[] args, int n) {
+ if (args.length != n) {
+ printUsageAndExit("Expected " + n + " arguments but was "
+ + args.length);
+ }
+ }
+
+ private static int getColumnNumber(List header, String name) {
+ int column = header.indexOf(name);
+ if (column == -1) {
+ printUsageAndExit("There is no column with name " + name);
+ }
+ return column;
+ }
+
+ private static String getCell(String record, int column) {
+ return record.split(",")[column].trim();
+ }
+
+ private static void printUsageAndExit(String... str) {
+ System.out.println("Usages:");
+
+ System.out.println("CSVProcessor sort COLUMN_NAME ASC|DESC FILE");
+ System.out.println("Sort lines by column COLUMN_NAME in CSV FILE\n");
+
+ System.out.println("CSVProcessor search COLUMN_NAME REGEX FILE");
+ System.out.println("Search for REGEX in column COLUMN_NAME in CSV FILE\n");
+
+ System.out.println("CSVProcessor groupby COLUMN_NAME FILE");
+ System.out.println("Split lines into different groups according to column "
+ + "COLUMN_NAME value\n");
+
+ System.out.println("CSVProcessor stat COLUMN_NAME FILE");
+ System.out.println("Compute max/min/average/sum statistics by column "
+ + "COLUMN_NAME\n");
+
+ Arrays.asList(str).forEach(System.err::println);
+ System.exit(1);
+ }
+
+ /*
+ * This is a custom implementation of the Collector interface.
+ * Statistics are objects gather max,min,sum,average statistics.
+ */
+ private static class Statistics
+ implements Collector {
+
+
+ /*
+ * This implementation does not need to be thread safe because
+ * the parallel implementation of
+ * {@link java.util.stream.Stream#collect Stream.collect()}
+ * provides the necessary partitioning and isolation for safe parallel
+ * execution.
+ */
+ private String maxRecord;
+ private String minRecord;
+
+ private double sum;
+ private int lineCount;
+ private final BinaryOperator maxOperator;
+ private final BinaryOperator minOperator;
+ private final int column;
+
+ public Statistics(int column) {
+ this.column = column;
+ Comparator cmp = Comparator.comparing(
+ (String str) -> parseDouble(getCell(str, column)));
+ maxOperator = BinaryOperator.maxBy(cmp);
+ minOperator = BinaryOperator.minBy(cmp);
+ }
+
+ /*
+ * Process line.
+ */
+ public Statistics accept(String line) {
+ maxRecord = maxRecord == null
+ ? line : maxOperator.apply(maxRecord, line);
+ minRecord = minRecord == null
+ ? line : minOperator.apply(minRecord, line);
+
+ sum += parseDouble(getCell(line, column));
+ lineCount++;
+ return this;
+ }
+
+
+ /*
+ * Merge two Statistics.
+ */
+ public Statistics combine(Statistics stat) {
+ maxRecord = maxOperator.apply(maxRecord, stat.getMaxRecord());
+ minRecord = minOperator.apply(minRecord, stat.getMinRecord());
+ sum += stat.getSum();
+ lineCount += stat.getLineCount();
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("#------Statistics------#\n");
+ sb.append("Max: ").append(getMaxRecord()).append("\n");
+ sb.append("Min: ").append(getMinRecord()).append("\n");
+ sb.append("Sum = ").append(getSum()).append("\n");
+ sb.append("Average = ").append(average()).append("\n");
+ sb.append("#------Statistics------#\n");
+ return sb.toString();
+ }
+
+ @Override
+ public Supplier supplier() {
+ return () -> new Statistics(column);
+ }
+
+ @Override
+ public BiConsumer accumulator() {
+ return Statistics::accept;
+ }
+
+ @Override
+ public BinaryOperator combiner() {
+ return Statistics::combine;
+
+ }
+
+ @Override
+ public Function finisher() {
+ return stat -> stat;
+ }
+
+ @Override
+ public Set characteristics() {
+ return EnumSet.of(Characteristics.IDENTITY_FINISH);
+ }
+
+ private String getMaxRecord() {
+ return maxRecord;
+ }
+
+ private String getMinRecord() {
+ return minRecord;
+ }
+
+ private double getSum() {
+ return sum;
+ }
+
+ private double average() {
+ return sum / lineCount;
+ }
+
+ private int getLineCount() {
+ return lineCount;
+ }
+
+ }
+
+}
diff --git a/jdk/src/share/sample/lambda/BulkDataOperations/src/Grep.java b/jdk/src/share/sample/lambda/BulkDataOperations/src/Grep.java
new file mode 100644
index 00000000000..cb4bdf765cb
--- /dev/null
+++ b/jdk/src/share/sample/lambda/BulkDataOperations/src/Grep.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Grep prints lines matching a regex. See {@link #printUsageAndExit(String...)}
+ * method for instructions and command line parameters. This sample shows
+ * examples of using next features:
+ *
+ *
Lambda and bulk operations. Working with streams:
+ * map(...),filter(...),flatMap(...),limit(...) methods.
+ *
Static method reference for printing values.
+ *
New Collections API forEach(...) method.
+ *
Try-with-resources feature.
+ *
new Files.walk(...), Files.lines(...) API.
+ *
Streams that need to be closed.
+ *
+ *
+ */
+public class Grep {
+
+ private static void printUsageAndExit(String... str) {
+ System.out.println("Usage: " + Grep.class.getSimpleName()
+ + " [OPTION]... PATTERN FILE...");
+ System.out.println("Search for PATTERN in each FILE. "
+ + "If FILE is a directory then whole file tree of the directory"
+ + " will be processed.");
+ System.out.println("Example: grep -m 100 'hello world' menu.h main.c");
+ System.out.println("Options:");
+ System.out.println(" -m NUM: stop analysis after NUM matches");
+ Arrays.asList(str).forEach(System.err::println);
+ System.exit(1);
+ }
+
+ /**
+ * The main method for the Grep program. Run program with empty argument
+ * list to see possible arguments.
+ *
+ * @param args the argument list for Grep.
+ * @throws java.io.IOException If an I/O error occurs.
+ */
+ public static void main(String[] args) throws IOException {
+ long maxCount = Long.MAX_VALUE;
+ if (args.length < 2) {
+ printUsageAndExit();
+ }
+ int i = 0;
+ //parse OPTIONS
+ while (args[i].startsWith("-")) {
+ switch (args[i]) {
+ case "-m":
+ try {
+ maxCount = Long.parseLong(args[++i]);
+ } catch (NumberFormatException ex) {
+ printUsageAndExit(ex.toString());
+ }
+ break;
+ default:
+ printUsageAndExit("Unexpected option " + args[i]);
+ }
+ i++;
+ }
+ //parse PATTERN
+ Pattern pattern = Pattern.compile(args[i++]);
+ if (i == args.length) {
+ printUsageAndExit("There are no files for input");
+ }
+
+ try {
+ /*
+ * First obtain the list of all paths.
+ * For a small number of arguments there is little to be gained
+ * by producing this list in parallel. For one argument
+ * there will be no parallelism.
+ *
+ * File names are converted to paths. If a path is a directory then
+ * Stream is populated with whole file tree of the directory by
+ * flatMap() method. Files are filtered from directories.
+ */
+ List files = Arrays.stream(args, i, args.length)
+ .map(Paths::get)
+ // flatMap will ensure each I/O-based stream will be closed
+ .flatMap(Grep::getPathStream)
+ .filter(Files::isRegularFile)
+ .collect(toList());
+ /*
+ * Then operate on that list in parallel.
+ * This is likely to give a more even distribution of work for
+ * parallel execution.
+ *
+ * Lines are extracted from files. Lines are filtered by pattern.
+ * Stream is limited by number of matches. Each remaining string is
+ * displayed in std output by method reference System.out::println.
+ */
+ files.parallelStream()
+ // flatMap will ensure each I/O-based stream will be closed
+ .flatMap(Grep::path2Lines)
+ .filter(pattern.asPredicate())
+ .limit(maxCount)
+ .forEachOrdered(System.out::println);
+ } catch (UncheckedIOException ioe) {
+ printUsageAndExit(ioe.toString());
+ }
+ }
+
+ /**
+ * Flattens file system hierarchy into a stream. This code is not inlined
+ * for the reason of Files.walk() throwing a checked IOException that must
+ * be caught.
+ *
+ * @param path - the file or directory
+ * @return Whole file tree starting from path, a stream with one element -
+ * the path itself - if it is a file.
+ */
+ private static Stream getPathStream(Path path) {
+ try {
+ return Files.walk(path);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ /**
+ * Produces a stream of lines from a file. The result is a stream in order
+ * to close it later. This code is not inlined for the reason of
+ * Files.lines() throwing a checked IOException that must be caught.
+ *
+ * @param path - the file to read
+ * @return stream of lines from the file
+ */
+ private static Stream path2Lines(Path path) {
+ try {
+ return Files.lines(path);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+}
diff --git a/jdk/src/share/sample/lambda/BulkDataOperations/src/PasswordGenerator.java b/jdk/src/share/sample/lambda/BulkDataOperations/src/PasswordGenerator.java
new file mode 100644
index 00000000000..e4677985929
--- /dev/null
+++ b/jdk/src/share/sample/lambda/BulkDataOperations/src/PasswordGenerator.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.IntStream;
+
+/**
+ * Generates password of desired length. See {@link #usage} method
+ * for instructions and command line parameters. This sample shows usages of:
+ *
+ *
Method references.
+ *
Lambda and bulk operations. A stream of random integers is mapped to
+ * chars, limited by desired length and printed in standard output as password
+ * string.
+ *
+ *
+ */
+public class PasswordGenerator {
+
+ private static void usage() {
+ System.out.println("Usage: PasswordGenerator LENGTH");
+ System.out.println(
+ "Password Generator produces password of desired LENGTH.");
+ }
+
+ private static final List PASSWORD_CHARS = new ArrayList<>();
+
+ //Valid symbols.
+ static {
+ IntStream.rangeClosed('0', '9').forEach(PASSWORD_CHARS::add); // 0-9
+ IntStream.rangeClosed('A', 'Z').forEach(PASSWORD_CHARS::add); // A-Z
+ IntStream.rangeClosed('a', 'z').forEach(PASSWORD_CHARS::add); // a-z
+ }
+
+ /**
+ * The main method for the PasswordGenerator program. Run program with empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for PasswordGenerator.
+ */
+ public static void main(String[] args) {
+
+ if (args.length != 1) {
+ usage();
+ return;
+ }
+
+ long passwordLength;
+ try {
+ passwordLength = Long.parseLong(args[0]);
+ if (passwordLength < 1) {
+ printMessageAndUsage("Length has to be positive");
+ return;
+ }
+ } catch (NumberFormatException ex) {
+ printMessageAndUsage("Unexpected number format" + args[0]);
+ return;
+ }
+ /*
+ * Stream of random integers is created containing Integer values
+ * in range from 0 to PASSWORD_CHARS.size().
+ * The stream is limited by passwordLength.
+ * Valid chars are selected by generated index.
+ */
+ new SecureRandom().ints(passwordLength, 0, PASSWORD_CHARS.size())
+ .map(PASSWORD_CHARS::get)
+ .forEach(i -> System.out.print((char) i));
+ }
+
+ private static void printMessageAndUsage(String message) {
+ System.err.println(message);
+ usage();
+ }
+
+}
diff --git a/jdk/src/share/sample/lambda/BulkDataOperations/src/WC.java b/jdk/src/share/sample/lambda/BulkDataOperations/src/WC.java
new file mode 100644
index 00000000000..c724f159a19
--- /dev/null
+++ b/jdk/src/share/sample/lambda/BulkDataOperations/src/WC.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.function.Consumer;
+import java.util.regex.Pattern;
+
+/**
+ * WC - Prints newline, word, and character counts for each file. See
+ * the {@link #usage} method for instructions and command line parameters. This
+ * sample shows usages of:
+ *
+ *
Lambda and bulk operations. Shows how to create a custom collector to
+ * gather custom statistics. Implements the collection of statistics using a
+ * built-in API.
+ *
Constructor reference.
+ *
Try-with-resources feature.
+ *
+ *
+ */
+public class WC {
+
+ //The number of characters that may be read.
+ private static final int READ_AHEAD_LIMIT = 100_000_000;
+
+ //The pattern for splitting strings by non word characters to get words.
+ private static final Pattern nonWordPattern = Pattern.compile("\\W");
+
+ /**
+ * The main method for the WC program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for WC
+ * @throws java.io.IOException If an input exception occurred.
+ */
+ public static void main(String[] args) throws IOException {
+
+ if (args.length != 1) {
+ usage();
+ return;
+ }
+
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(args[0]))) {
+ reader.mark(READ_AHEAD_LIMIT);
+ /*
+ * Statistics can be gathered in four passes using a built-in API.
+ * The method demonstrates how separate operations can be
+ * implemented using a built-in API.
+ */
+ collectInFourPasses(reader);
+ /*
+ * Usage of several passes to collect data is not the best way.
+ * Statistics can be gathered by a custom collector in one pass.
+ */
+ reader.reset();
+ collectInOnePass(reader);
+ } catch (FileNotFoundException e) {
+ usage();
+ System.err.println(e);
+ }
+ }
+
+ private static void collectInFourPasses(BufferedReader reader)
+ throws IOException {
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is turned into a stream of chars by the flatMapToInt(...)
+ * method.
+ * Length of the stream is counted by count().
+ */
+ System.out.println("Character count = "
+ + reader.lines().flatMapToInt(String::chars).count());
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is split by nonWordPattern into words by flatMap(...)
+ * method.
+ * Empty lines are removed by the filter(...) method.
+ * Length of the stream is counted by count().
+ */
+ reader.reset();
+ System.out.println("Word count = "
+ + reader.lines()
+ .flatMap(nonWordPattern::splitAsStream)
+ .filter(str -> !str.isEmpty()).count());
+
+ reader.reset();
+ System.out.println("Newline count = " + reader.lines().count());
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is mapped to its length.
+ * Maximum of the lengths is calculated.
+ */
+ reader.reset();
+ System.out.println("Max line length = "
+ + reader.lines().mapToInt(String::length).max().getAsInt());
+ }
+
+ private static void collectInOnePass(BufferedReader reader) {
+ /*
+ * The collect() method has three parameters:
+ * The first parameter is the {@code WCStatistic} constructor reference.
+ * collect() will create {@code WCStatistics} instances, where
+ * statistics will be aggregated.
+ * The second parameter shows how {@code WCStatistics} will process
+ * String.
+ * The third parameter shows how to merge two {@code WCStatistic}
+ * instances.
+ *
+ * Also {@code Collector} can be used, which would be more reusable
+ * solution. See {@code CSVProcessor} example for how {@code Collector}
+ * can be implemented.
+ *
+ * Note that the any performance increase when going parallel will
+ * depend on the size of the input (lines) and the cost per-element.
+ */
+ WCStatistics wc = reader.lines().parallel()
+ .collect(WCStatistics::new,
+ WCStatistics::accept,
+ WCStatistics::combine);
+ System.out.println(wc);
+ }
+
+ private static void usage() {
+ System.out.println("Usage: " + WC.class.getSimpleName() + " FILE");
+ System.out.println("Print newline, word,"
+ + " character counts and max line length for FILE.");
+ }
+
+ private static class WCStatistics implements Consumer {
+ /*
+ * @implNote This implementation does not need to be thread safe because
+ * the parallel implementation of
+ * {@link java.util.stream.Stream#collect Stream.collect()}
+ * provides the necessary partitioning and isolation for safe parallel
+ * execution.
+ */
+
+ private long characterCount;
+ private long lineCount;
+ private long wordCount;
+ private long maxLineLength;
+
+
+ /*
+ * Processes line.
+ */
+ @Override
+ public void accept(String line) {
+ characterCount += line.length();
+ lineCount++;
+ wordCount += nonWordPattern.splitAsStream(line)
+ .filter(str -> !str.isEmpty()).count();
+ maxLineLength = Math.max(maxLineLength, line.length());
+ }
+
+ /*
+ * Merges two WCStatistics.
+ */
+ public void combine(WCStatistics stat) {
+ wordCount += stat.wordCount;
+ lineCount += stat.lineCount;
+ characterCount += stat.characterCount;
+ maxLineLength = Math.max(maxLineLength, stat.maxLineLength);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("#------WCStatistic------#\n");
+ sb.append("Character count = ").append(characterCount).append('\n');
+ sb.append("Word count = ").append(wordCount).append('\n');
+ sb.append("Newline count = ").append(lineCount).append('\n');
+ sb.append("Max line length = ").append(maxLineLength).append('\n');
+ return sb.toString();
+ }
+ }
+}
From a7acbb1cb79a7250ab6f0ebd45bc512e4d08f135 Mon Sep 17 00:00:00 2001
From: Andrey Nazarov
Date: Fri, 31 Jan 2014 11:57:38 +0100
Subject: [PATCH 070/159] 8032020: Update try-with-resources demo
Reviewed-by: darcy, alanb, smarks
---
.../sample/try-with-resources/index.html | 36 +++++
.../src/CustomAutoCloseableSample.java | 137 ++++++++++++++++++
.../sample/try-with-resources/src/Unzip.java | 83 +++++++++++
.../sample/try-with-resources/src/ZipCat.java | 83 +++++++++++
4 files changed, 339 insertions(+)
create mode 100644 jdk/src/share/sample/try-with-resources/index.html
create mode 100644 jdk/src/share/sample/try-with-resources/src/CustomAutoCloseableSample.java
create mode 100644 jdk/src/share/sample/try-with-resources/src/Unzip.java
create mode 100644 jdk/src/share/sample/try-with-resources/src/ZipCat.java
diff --git a/jdk/src/share/sample/try-with-resources/index.html b/jdk/src/share/sample/try-with-resources/index.html
new file mode 100644
index 00000000000..ff237d89ce6
--- /dev/null
+++ b/jdk/src/share/sample/try-with-resources/index.html
@@ -0,0 +1,36 @@
+
+
+
+
+ Try-with-Resources Feature Demo
+
+
+
Try-with-Resources Feature Demo
+
+
+ This demo shows how to use the try-with-resources feature introduced in JDK7.
+
+
+
+
Custom AutoCloseable.
+
+
+ Shows how to use a custom resource with the try-with-resources construct.
+ For more information, see the source file.
+
+
+
\ No newline at end of file
diff --git a/jdk/src/share/sample/try-with-resources/src/CustomAutoCloseableSample.java b/jdk/src/share/sample/try-with-resources/src/CustomAutoCloseableSample.java
new file mode 100644
index 00000000000..9bbe09aa1ed
--- /dev/null
+++ b/jdk/src/share/sample/try-with-resources/src/CustomAutoCloseableSample.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * This sample demonstrates the ability to create custom resource that
+ * implements the {@code AutoCloseable} interface. This resource can be used in
+ * the try-with-resources construct.
+ */
+public class CustomAutoCloseableSample {
+
+ /**
+ * The main method for the CustomAutoCloseableSample program.
+ *
+ * @param args is not used.
+ */
+ public static void main(String[] args) {
+ /*
+ * TeeStream will be closed automatically after the try block.
+ */
+ try (TeeStream teeStream = new TeeStream(System.out, Paths.get("out.txt"));
+ PrintStream out = new PrintStream(teeStream)) {
+ out.print("Hello, world");
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Passes the output through to the specified output stream while copying it into a file.
+ * The TeeStream functionality is similar to the Unix tee utility.
+ * TeeStream implements AutoCloseable interface. See OutputStream for details.
+ */
+ public static class TeeStream extends OutputStream {
+
+ private final OutputStream fileStream;
+ private final OutputStream outputStream;
+
+ /**
+ * Creates a TeeStream.
+ *
+ * @param outputStream an output stream.
+ * @param outputFile an path to file.
+ * @throws IOException If an I/O error occurs.
+ */
+ public TeeStream(OutputStream outputStream, Path outputFile) throws IOException {
+ this.fileStream = new BufferedOutputStream(Files.newOutputStream(outputFile));
+ this.outputStream = outputStream;
+ }
+
+ /**
+ * Writes the specified byte to the specified output stream
+ * and copies it to the file.
+ *
+ * @param b the byte to be written.
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public void write(int b) throws IOException {
+ fileStream.write(b);
+ outputStream.write(b);
+ }
+
+ /**
+ * Flushes this output stream and forces any buffered output bytes
+ * to be written out.
+ * The flush method of TeeStream flushes
+ * the specified output stream and the file output stream.
+ *
+ * @throws IOException if an I/O error occurs.
+ */
+ @Override
+ public void flush() throws IOException {
+ outputStream.flush();
+ fileStream.flush();
+ }
+
+ /**
+ * Closes underlying streams and resources.
+ * The external output stream won't be closed.
+ * This method is the member of AutoCloseable interface and
+ * it will be invoked automatically after the try-with-resources block.
+ *
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public void close() throws IOException {
+ try (OutputStream file = fileStream) {
+ flush();
+ }
+ }
+ }
+}
diff --git a/jdk/src/share/sample/try-with-resources/src/Unzip.java b/jdk/src/share/sample/try-with-resources/src/Unzip.java
new file mode 100644
index 00000000000..d75eba52c78
--- /dev/null
+++ b/jdk/src/share/sample/try-with-resources/src/Unzip.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.*;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+/**
+ * Extract (unzip) a file to the current directory.
+ */
+public class Unzip {
+
+ /**
+ * The main method for the Unzip program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for {@code Unzip}.
+ */
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ System.out.println("Usage: Unzip zipfile");
+ }
+ final Path destDir = Paths.get(".");
+ /*
+ * Create AutoCloseable FileSystem. It will be closed automatically
+ * after the try block.
+ */
+ try (FileSystem zipFileSystem = FileSystems.newFileSystem(Paths.get(args[0]), null)) {
+
+ Path top = zipFileSystem.getPath("/");
+ Files.walk(top).skip(1).forEach(file -> {
+ Path target = destDir.resolve(top.relativize(file).toString());
+ System.out.println("Extracting " + target);
+ try {
+ Files.copy(file, target, REPLACE_EXISTING);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ });
+ } catch (UncheckedIOException | IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/jdk/src/share/sample/try-with-resources/src/ZipCat.java b/jdk/src/share/sample/try-with-resources/src/ZipCat.java
new file mode 100644
index 00000000000..4bbf513a538
--- /dev/null
+++ b/jdk/src/share/sample/try-with-resources/src/ZipCat.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+/**
+ * Prints data of the specified file to standard output from a zip archive.
+ */
+public class ZipCat {
+
+ /**
+ * The main method for the ZipCat program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for ZipCat
+ */
+ public static void main(String[] args) {
+ if (args.length != 2) {
+ System.out.println("Usage: ZipCat zipfile fileToPrint");
+ }
+ /*
+ * Creates AutoCloseable FileSystem and BufferedReader.
+ * They will be closed automatically after the try block.
+ * If reader initialization fails, then zipFileSystem will be closed
+ * automatically.
+ */
+ try (FileSystem zipFileSystem
+ = FileSystems.newFileSystem(Paths.get(args[0]),null);
+ InputStream input
+ = Files.newInputStream(zipFileSystem.getPath(args[1]))) {
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = input.read(buffer)) != -1) {
+ System.out.write(buffer, 0, len);
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
From 9378d4b0660391d7372f824ba184dad882d45cf1 Mon Sep 17 00:00:00 2001
From: Taras Ledkov
Date: Fri, 31 Jan 2014 11:57:53 +0100
Subject: [PATCH 071/159] 8032056: Create demo to illustrate new practices of
the default methods usage
Reviewed-by: briangoetz, rfield, psandoz
---
.../lambda/DefaultMethods/ArrayIterator.java | 118 ++++++++++++++
.../DefaultMethods/DiamondInheritance.java | 145 ++++++++++++++++++
.../lambda/DefaultMethods/Inheritance.java | 142 +++++++++++++++++
.../sample/lambda/DefaultMethods/MixIn.java | 114 ++++++++++++++
.../lambda/DefaultMethods/Reflection.java | 136 ++++++++++++++++
.../lambda/DefaultMethods/SimplestUsage.java | 91 +++++++++++
6 files changed, 746 insertions(+)
create mode 100644 jdk/src/share/sample/lambda/DefaultMethods/ArrayIterator.java
create mode 100644 jdk/src/share/sample/lambda/DefaultMethods/DiamondInheritance.java
create mode 100644 jdk/src/share/sample/lambda/DefaultMethods/Inheritance.java
create mode 100644 jdk/src/share/sample/lambda/DefaultMethods/MixIn.java
create mode 100644 jdk/src/share/sample/lambda/DefaultMethods/Reflection.java
create mode 100644 jdk/src/share/sample/lambda/DefaultMethods/SimplestUsage.java
diff --git a/jdk/src/share/sample/lambda/DefaultMethods/ArrayIterator.java b/jdk/src/share/sample/lambda/DefaultMethods/ArrayIterator.java
new file mode 100644
index 00000000000..2eca80149b8
--- /dev/null
+++ b/jdk/src/share/sample/lambda/DefaultMethods/ArrayIterator.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * The code sample illustrates the usage of default methods in the JDK 8. Most
+ * implementations of {@link Iterator} don't provide a useful
+ * {@link Iterator#remove()} method, however,
+ * they still have to implement this method to throw
+ * an UnsupportedOperationException. With the default method, the same
+ * default behavior in interface Iterator itself can be provided.
+ */
+public class ArrayIterator {
+
+ /** Close the constructor because ArrayIterator is part of the utility
+ * class.
+ */
+ protected ArrayIterator() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns an iterator that goes over the elements in the array.
+ *
+ * @param type of an array element
+ * @param array source array to iterate over it
+ * @return an iterator that goes over the elements in the array
+ */
+ public static Iterator iterator(final E[] array) {
+ return new Iterator() {
+ /**
+ * Index of the current position
+ *
+ */
+ private int index = 0;
+
+ /**
+ * Returns the next element in the iteration
+ *
+ * @return the next element in the iteration
+ * @throws NoSuchElementException if the iteration has no more
+ * elements
+ */
+ @Override
+ public boolean hasNext() {
+ return (index < array.length);
+ }
+
+ /**
+ * Returns {@code true} if the iteration has more elements. (In
+ * other words, returns {@code true} if {@link #next} returns
+ * an element, rather than throwing an exception.)
+ *
+ * @return {@code true} if the iteration has more elements
+ */
+ @Override
+ public E next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ return array[index++];
+ }
+
+ /**
+ * This method does not need to be overwritten in JDK 8.
+ */
+ //@Override
+ //public void remove() {
+ // throw UnsupportedOperationException(
+ // "Arrays don't support remove.")
+ //}
+ };
+ }
+
+ /**
+ * Sample usage of the ArrayIterator
+ *
+ * @param args command-line arguments
+ */
+ public static void main(final String[] args) {
+ Iterator it = ArrayIterator.iterator(
+ new String[]{"one", "two", "three"});
+
+ while (it.hasNext()) {
+ System.out.println(it.next());
+ }
+ }
+}
diff --git a/jdk/src/share/sample/lambda/DefaultMethods/DiamondInheritance.java b/jdk/src/share/sample/lambda/DefaultMethods/DiamondInheritance.java
new file mode 100644
index 00000000000..9214d58a788
--- /dev/null
+++ b/jdk/src/share/sample/lambda/DefaultMethods/DiamondInheritance.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * This sample diamond interface inheritance with default methods.
+ * If there's not already a unique method implementation to inherit,
+ * you must provide it. The inheritance diagram is similar to the following:
+ *
+ *
+ * Both {@link Horse} and {@link Bird} interfaces implements the go
+ * method. The {@link Pegasus} class have to overrides the
+ * go method.
+ *
+ * The new syntax of super-call is used here:
+ *
+ * <interface_name>.super.<method>(...);
+ * For example: Horse.super.go();
+ *
So, Pegasus moves like a horse.
+ */
+public class DiamondInheritance {
+
+ /**
+ * Base interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the "go" action for concrete animal
+ *
+ * @return string representation of the "go" action for concrete animal
+ */
+ String go();
+ }
+
+ /**
+ * Interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Horse extends Animal {
+
+ /**
+ * Return string representation of the "go" action for horse
+ *
+ * @return string representation of the "go" action for horse
+ */
+ @Override
+ default String go() {
+ return this.getClass().getSimpleName() + " walks on four legs";
+ }
+ }
+
+ /**
+ * Interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Bird extends Animal {
+
+ /**
+ * Return string representation of the "go" action for bird
+ *
+ * @return string representation of the "go" action for bird
+ */
+ @Override
+ default String go() {
+ return this.getClass().getSimpleName() + " walks on two legs";
+ }
+
+ /**
+ * Return string representation of the "fly" action for bird
+ *
+ * @return string representation of the "fly" action for bird
+ */
+ default String fly() {
+ return "I can fly";
+ }
+ }
+
+ /**
+ * Class to illustrate the diamond inheritance. Pegasus must mix horse and
+ * bird behavior.
+ *
+ * @see DiamondInheritance
+ */
+ public static class Pegasus implements Horse, Bird {
+
+ /**
+ * Return string representation of the "go" action for the fictitious
+ * creature Pegasus
+ *
+ * @return string representation of the "go" action for the fictitious
+ * creature Pegasus
+ */
+ @Override
+ public String go() {
+ return Horse.super.go();
+ }
+ }
+
+ /**
+ * Illustrate the behavior of the {@link Pegasus} class
+ *
+ * @param args command line arguments
+ */
+ public static void main(final String[] args) {
+ System.out.println(new Pegasus().go());
+ }
+}
diff --git a/jdk/src/share/sample/lambda/DefaultMethods/Inheritance.java b/jdk/src/share/sample/lambda/DefaultMethods/Inheritance.java
new file mode 100644
index 00000000000..961de2c24d5
--- /dev/null
+++ b/jdk/src/share/sample/lambda/DefaultMethods/Inheritance.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * The sample illustrates rules to resolve conflicts between inheritance
+ * candidates with default methods. There are two simple rules:
+ *
+ *
Class wins. If the superclass has a concrete or abstract declaration of
+ * this method, then it is preferred over all defaults.
+ *
Subtype wins. If an interface extends another interface, and both provide
+ * a default, then the more specific interface wins.
+ *
+ */
+public class Inheritance {
+
+ /**
+ * The behavior of an creature that can swim
+ */
+ public interface Swimable {
+
+ /**
+ * Return string representation of the swim action for a creature that
+ * can swim
+ *
+ * @return string representation of the swim action for a creature
+ * that can swim
+ */
+ default String swim() {
+ return "I can swim.";
+ }
+ }
+
+ /**
+ * The abstract class that overrides {@link #swim} method
+ */
+ public abstract static class Fish implements Swimable {
+
+ /**
+ * Return string representation of the swim action for a fish
+ *
+ * @return string representation of the swim action for a fish
+ */
+ @Override
+ public String swim() {
+ return this.getClass().getSimpleName() + " swims under water";
+ }
+ }
+
+ /**
+ * This class is used for the illustration rule of 1. See the source code
+ * of the {@link #main} method.
+ *
+ * System.out.println(new Tuna().swim()); //"Tuna swims under water" output is suspected here
+ *
+ */
+ public static class Tuna extends Fish implements Swimable {
+ }
+
+ /**
+ * The behavior of an creature that can dive: the interface that overrides
+ * {@link #swim} method (subtype of {@link Swimable})
+ */
+ public interface Diveable extends Swimable {
+
+ /**
+ * Return string representation of the swim action for a creature that
+ * can dive
+ *
+ * @return string representation of the swim action for a creature
+ * that can dive
+ */
+ @Override
+ default String swim() {
+ return "I can swim on the surface of the water.";
+ }
+
+ /**
+ * Return string representation of the dive action for a creature that
+ * can dive
+ *
+ * @return string representation of the dive action for a creature
+ * that can dive
+ */
+ default String dive() {
+ return "I can dive.";
+ }
+ }
+
+ /**
+ * This class is used for the illustration of rule 2. See the source code
+ * of the {@link #main} method
+ *
+ * //"I can swim on the surface of the water." output is suspected here
+ * System.out.println(new Duck().swim());
+ *
+ */
+ public static class Duck implements Swimable, Diveable {
+ }
+
+ /**
+ * Illustrate behavior of the classes: {@link Tuna} and {@link Duck}
+ *
+ * @param args command line arguments
+ */
+ public static void main(final String[] args) {
+ // Illustrates rule 1. The Fish.swim() implementation wins
+ //"Tuna swims under water" is output
+ System.out.println(new Tuna().swim());
+
+ // Illustrates rule 2. The Diveable.swim() implementation wins
+ //"I can swim on the surface of the water." is output
+ System.out.println(new Duck().swim());
+ }
+}
diff --git a/jdk/src/share/sample/lambda/DefaultMethods/MixIn.java b/jdk/src/share/sample/lambda/DefaultMethods/MixIn.java
new file mode 100644
index 00000000000..d9ed81dee27
--- /dev/null
+++ b/jdk/src/share/sample/lambda/DefaultMethods/MixIn.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+/**
+ * The example illustrates how to use the default method for mixin.
+ * @see BuildType
+ * @see Debuggable
+ */
+public class MixIn {
+
+ /**
+ * Implement this interface for a class that must be in debug print
+ */
+ public interface Debuggable {
+
+ /**
+ * Print the class name and all fields to a string. Uses reflection to
+ * obtain and access fields of this object.
+ *
+ * @return the string formatted like the following:
+ * State of the: <Class Name>
+ * <member name> : <value>
+ * ...
+ *
+ */
+ default String toDebugString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("State of the: ").append(
+ this.getClass().getSimpleName()).append("\n");
+ for (Class cls = this.getClass();
+ cls != null;
+ cls = cls.getSuperclass()) {
+ for (Field f : cls.getDeclaredFields()) {
+ try {
+ f.setAccessible(true);
+ sb.append(f.getName()).append(" : ").
+ append(f.get(this)).append("\n");
+ } catch (IllegalAccessException e) {
+ }
+ }
+ }
+ return sb.toString();
+ }
+ }
+
+ /**
+ * Sample exception class to demonstrate mixin. This enum inherits the
+ * behavior of the {@link Debuggable}
+ */
+ public static enum BuildType implements Debuggable {
+
+ BUILD(0, "-build"),
+ PLAN(0, "-plan"),
+ EXCLUDE(1, "-exclude"),
+ TOTAL(2, "-total");
+
+ private final int compareOrder;
+ private final String pathSuffix;
+
+ private BuildType(int compareOrder, String pathSuffix) {
+ this.compareOrder = compareOrder;
+ this.pathSuffix = pathSuffix;
+ }
+
+ public int getCompareOrder() {
+ return compareOrder;
+ }
+
+ public String getPathSuffix() {
+ return pathSuffix;
+ }
+ }
+
+ /**
+ * Illustrate the behavior of the MixClass
+ *
+ * @param args command-line arguments
+ * @throws java.io.IOException internal demo error
+ */
+ public static void main(final String[] args) throws IOException {
+ System.out.println(BuildType.BUILD.toDebugString());
+ }
+}
diff --git a/jdk/src/share/sample/lambda/DefaultMethods/Reflection.java b/jdk/src/share/sample/lambda/DefaultMethods/Reflection.java
new file mode 100644
index 00000000000..78424a240e8
--- /dev/null
+++ b/jdk/src/share/sample/lambda/DefaultMethods/Reflection.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+/**
+ * The code sample illustrates changes in the reflection API linked
+ * default methods. Since Java SE 8, a new method is added into the class
+ * java.lang.reflect.Method, with which you can reflectively
+ * determine whether or not a default method provided by an interface
+ * (Method.isDefault()).
+ */
+public class Reflection {
+
+ /**
+ * Base interface to illustrate the new reflection API.
+ *
+ * @see Dog
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the eat action for Animal
+ *
+ * @return string representation of the eat action for Animal
+ */
+ default String eat() {
+ return this.getClass().getSimpleName()
+ + " eats like an ordinary animal";
+ }
+
+ /**
+ * Return string representation of the sleep action for Animal
+ *
+ * @return string representation of the sleep action for Animal
+ */
+ default String sleep() {
+ return this.getClass().getSimpleName()
+ + " sleeps like an ordinary animal";
+ }
+
+ /**
+ * Return string representation of the go action for Animal
+ *
+ * @return string representation of the go action for Animal
+ */
+ String go();
+ }
+
+ /**
+ * Dog class to illustrate the new reflection API. You can see that:
+ *
+ *
the {@link #go} and {@link #sleep} methods are not default.
+ * {@link #go} is not the default implementation and the {@link #sleep}
+ * method implementation wins as subtype (according with {@link Inheritance}
+ * rule. 2)
+ *
the {@link #eat} is a simple default method that is not overridden
+ * in this class.
+ *
+ *
+ */
+ public static class Dog implements Animal {
+
+ /**
+ * Return string representation of the go action for Dog
+ *
+ * @return string representation of the go action for Dog
+ */
+ @Override
+ public String go() {
+ return "Dog walks on four legs";
+ }
+
+ /**
+ * Return string representation of the sleep action for Dog
+ *
+ * @return string representation of the sleep action for Dog
+ */
+ @Override
+ public String sleep() {
+ return "Dog sleeps";
+ }
+ }
+
+ /**
+ * Illustrate the usage of the method java.lang.reflect.Method.isDefault()
+ *
+ * @param args command-line arguments
+ * @throws NoSuchMethodException internal demo error
+ */
+ public static void main(final String[] args) throws NoSuchMethodException {
+ Dog dog = new Dog();
+ Stream.of(Dog.class.getMethod("eat"), Dog.class.getMethod("go"), Dog.class.getMethod("sleep"))
+ .forEach((m) -> {
+ System.out.println("Method name: " + m.getName());
+ System.out.println(" isDefault: " + m.isDefault());
+ System.out.print(" invoke: ");
+ try {
+ m.invoke(dog);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ }
+ System.out.println();
+ });
+ }
+}
diff --git a/jdk/src/share/sample/lambda/DefaultMethods/SimplestUsage.java b/jdk/src/share/sample/lambda/DefaultMethods/SimplestUsage.java
new file mode 100644
index 00000000000..a971858f589
--- /dev/null
+++ b/jdk/src/share/sample/lambda/DefaultMethods/SimplestUsage.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * The sample illustrates the simplest use case of the default methods.
+ */
+public class SimplestUsage {
+
+ /**
+ * The Animal interface provides the default implementation
+ * of the {@link #eat} method.
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the eat action for Animal
+ *
+ * @return string representation of the eat action for Animal
+ */
+ default String eat() {
+ return this.getClass().getSimpleName()
+ + " eats like an ordinary animal";
+ }
+ }
+
+ /**
+ * The Dog class doesn't have its own implementation of the {@link #eat}
+ * method and uses the default implementation.
+ */
+ public static class Dog implements Animal {
+ }
+
+ /**
+ * The Mosquito class implements {@link #eat} method, its own implementation
+ * overrides the default implementation.
+ *
+ */
+ public static class Mosquito implements Animal {
+
+ /**
+ * Return string representation of the eat action for Mosquito
+ *
+ * @return string representation of the eat action for Mosquito
+ */
+ @Override
+ public String eat() {
+ return "Mosquito consumes blood";
+ }
+ }
+
+ /**
+ * Illustrate behavior of the classes: {@link Dog} and {@link Mosquito}
+ *
+ * @param args command-line arguments
+ */
+ public static void main(String[] args) {
+ // "Dog eats like an ordinary animal" is output
+ System.out.println(new Dog().eat());
+
+ // "Mosquito consumes blood" is output
+ System.out.println(new Mosquito().eat());
+ }
+}
From e3f4248c427de75f5d7fa953e283946cf0745079 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?=
Date: Fri, 31 Jan 2014 12:06:34 +0100
Subject: [PATCH 072/159] 8032518: fatal error has been detected by the Java
Runtime Environment(access violation)
Reviewed-by: sla, dholmes, jbachorik, dsamersoff, coleenp
---
.../native/sun/management/DiagnosticCommandImpl.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/jdk/src/share/native/sun/management/DiagnosticCommandImpl.c b/jdk/src/share/native/sun/management/DiagnosticCommandImpl.c
index 6258ac3e9cf..59f3f7db971 100644
--- a/jdk/src/share/native/sun/management/DiagnosticCommandImpl.c
+++ b/jdk/src/share/native/sun/management/DiagnosticCommandImpl.c
@@ -30,12 +30,12 @@
JNIEXPORT void JNICALL Java_sun_management_DiagnosticCommandImpl_setNotificationEnabled
(JNIEnv *env, jobject dummy, jboolean enabled) {
- if(jmm_version > JMM_VERSION_1_2_2) {
- jmm_interface->SetDiagnosticFrameworkNotificationEnabled(env, enabled);
- } else {
+ if (jmm_version <= JMM_VERSION_1_2_2) {
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
"JMX interface to diagnostic framework notifications is not supported by this VM");
+ return;
}
+ jmm_interface->SetDiagnosticFrameworkNotificationEnabled(env, enabled);
}
JNIEXPORT jobjectArray JNICALL
@@ -124,6 +124,7 @@ Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo
result = (*env)->NewObjectArray(env, num_commands, dcmdInfoCls, NULL);
if (result == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
+ return NULL;
}
if (num_commands == 0) {
/* Handle the 'zero commands' case specially to avoid calling 'malloc()' */
@@ -133,6 +134,7 @@ Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo
dcmd_info_array = (dcmdInfo*) malloc(num_commands * sizeof(dcmdInfo));
if (dcmd_info_array == NULL) {
JNU_ThrowOutOfMemoryError(env, NULL);
+ return NULL;
}
jmm_interface->GetDiagnosticCommandInfo(env, commands, dcmd_info_array);
for (i=0; iSetObjectArrayElement(env, result, i, obj);
}
From 49605b7bf933f2e1470498aeb415f85103c5641b Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Fri, 31 Jan 2014 11:10:36 +0000
Subject: [PATCH 073/159] 7150539: HttpURLConnection.getResponseMessage()
doesn't throw IOException on server error (OS X)
Reviewed-by: michaelm, alanb
---
jdk/test/sun/net/www/http/HttpClient/RetryPost.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/test/sun/net/www/http/HttpClient/RetryPost.java b/jdk/test/sun/net/www/http/HttpClient/RetryPost.java
index 2f5add47afa..da7d868c3f2 100644
--- a/jdk/test/sun/net/www/http/HttpClient/RetryPost.java
+++ b/jdk/test/sun/net/www/http/HttpClient/RetryPost.java
@@ -55,8 +55,8 @@ public class RetryPost
void doClient() {
try {
InetSocketAddress address = httpServer.getAddress();
- URL url = new URL("http://" + address.getHostName() + ":" + address.getPort() + "/test/");
- HttpURLConnection uc = (HttpURLConnection)url.openConnection();
+ URL url = new URL("http://localhost:" + address.getPort() + "/test/");
+ HttpURLConnection uc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
uc.setDoOutput(true);
uc.setRequestMethod("POST");
uc.getResponseCode();
From 592907e7f24d7262a2c0f69cd123c0e88d3d6753 Mon Sep 17 00:00:00 2001
From: Ivan Gerasimov
Date: Thu, 30 Jan 2014 00:02:46 +0400
Subject: [PATCH 074/159] 8027348: (process) Enhancement of handling async
close of ProcessInputStream
Reviewed-by: martin
---
.../classes/java/lang/UNIXProcess.java.bsd | 44 +++---
.../classes/java/lang/UNIXProcess.java.linux | 44 +++---
.../java/lang/ProcessBuilder/CloseRace.java | 140 +++++++++++++++++
.../java/lang/Runtime/exec/CloseRace.java | 146 ------------------
4 files changed, 176 insertions(+), 198 deletions(-)
create mode 100644 jdk/test/java/lang/ProcessBuilder/CloseRace.java
delete mode 100644 jdk/test/java/lang/Runtime/exec/CloseRace.java
diff --git a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd
index df22bd2f3b9..7f0c3b12bf0 100644
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd
@@ -342,47 +342,39 @@ final class UNIXProcess extends Process {
ProcessPipeInputStream(int fd) {
super(new FileInputStream(newFileDescriptor(fd)));
}
-
- private InputStream drainInputStream(InputStream in)
+ private static byte[] drainInputStream(InputStream in)
throws IOException {
int n = 0;
int j;
byte[] a = null;
- synchronized (closeLock) {
- if (buf == null) // asynchronous close()?
- return null; // discard
- j = in.available();
- }
- while (j > 0) {
+ while ((j = in.available()) > 0) {
a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
- synchronized (closeLock) {
- if (buf == null) // asynchronous close()?
- return null; // discard
- n += in.read(a, n, j);
- j = in.available();
- }
+ n += in.read(a, n, j);
}
- return (a == null) ?
- ProcessBuilder.NullInputStream.INSTANCE :
- new ByteArrayInputStream(n == a.length ? a : Arrays.copyOf(a, n));
+ return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
}
/** Called by the process reaper thread when the process exits. */
synchronized void processExited() {
- try {
- InputStream in = this.in;
- if (in != null) {
- InputStream stragglers = drainInputStream(in);
- in.close();
- this.in = stragglers;
- }
- } catch (IOException ignored) { }
+ synchronized (closeLock) {
+ try {
+ InputStream in = this.in;
+ // this stream is closed if and only if: in == null
+ if (in != null) {
+ byte[] stragglers = drainInputStream(in);
+ in.close();
+ this.in = (stragglers == null) ?
+ ProcessBuilder.NullInputStream.INSTANCE :
+ new ByteArrayInputStream(stragglers);
+ }
+ } catch (IOException ignored) {}
+ }
}
@Override
public void close() throws IOException {
// BufferedInputStream#close() is not synchronized unlike most other methods.
- // Synchronizing helps avoid racing with drainInputStream().
+ // Synchronizing helps avoid race with processExited().
synchronized (closeLock) {
super.close();
}
diff --git a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
index 5ce8a61682a..be267d3ef0c 100644
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
@@ -344,47 +344,39 @@ final class UNIXProcess extends Process {
ProcessPipeInputStream(int fd) {
super(new FileInputStream(newFileDescriptor(fd)));
}
-
- private InputStream drainInputStream(InputStream in)
+ private static byte[] drainInputStream(InputStream in)
throws IOException {
int n = 0;
int j;
byte[] a = null;
- synchronized (closeLock) {
- if (buf == null) // asynchronous close()?
- return null; // discard
- j = in.available();
- }
- while (j > 0) {
+ while ((j = in.available()) > 0) {
a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
- synchronized (closeLock) {
- if (buf == null) // asynchronous close()?
- return null; // discard
- n += in.read(a, n, j);
- j = in.available();
- }
+ n += in.read(a, n, j);
}
- return (a == null) ?
- ProcessBuilder.NullInputStream.INSTANCE :
- new ByteArrayInputStream(n == a.length ? a : Arrays.copyOf(a, n));
+ return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
}
/** Called by the process reaper thread when the process exits. */
synchronized void processExited() {
- try {
- InputStream in = this.in;
- if (in != null) {
- InputStream stragglers = drainInputStream(in);
- in.close();
- this.in = stragglers;
- }
- } catch (IOException ignored) { }
+ synchronized (closeLock) {
+ try {
+ InputStream in = this.in;
+ // this stream is closed if and only if: in == null
+ if (in != null) {
+ byte[] stragglers = drainInputStream(in);
+ in.close();
+ this.in = (stragglers == null) ?
+ ProcessBuilder.NullInputStream.INSTANCE :
+ new ByteArrayInputStream(stragglers);
+ }
+ } catch (IOException ignored) {}
+ }
}
@Override
public void close() throws IOException {
// BufferedInputStream#close() is not synchronized unlike most other methods.
- // Synchronizing helps avoid racing with drainInputStream().
+ // Synchronizing helps avoid race with processExited().
synchronized (closeLock) {
super.close();
}
diff --git a/jdk/test/java/lang/ProcessBuilder/CloseRace.java b/jdk/test/java/lang/ProcessBuilder/CloseRace.java
new file mode 100644
index 00000000000..ff2e81fe7a8
--- /dev/null
+++ b/jdk/test/java/lang/ProcessBuilder/CloseRace.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2013, 2014 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.
+ *
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8024521
+ * @summary Closing ProcessPipeInputStream at the time the process exits is racy
+ * and leads to data corruption. Run this test manually (as
+ * an ordinary java program) with -Xmx8M to repro bug 8024521.
+ * @run main/othervm -Xmx8M -Dtest.duration=2 CloseRace
+ */
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CloseRace {
+ private static final String BIG_FILE = "bigfile";
+
+ private static final int[] procFDs = new int[6];
+
+ /** default value sufficient to repro bug 8024521. */
+ private static final int testDurationSeconds
+ = Integer.getInteger("test.duration", 600);
+
+ static boolean fdInUse(int i) {
+ return new File("/proc/self/fd/" + i).exists();
+ }
+
+ static boolean[] procFDsInUse() {
+ boolean[] inUse = new boolean[procFDs.length];
+ for (int i = 0; i < procFDs.length; i++)
+ inUse[i] = fdInUse(procFDs[i]);
+ return inUse;
+ }
+
+ static int count(boolean[] bits) {
+ int count = 0;
+ for (int i = 0; i < bits.length; i++)
+ count += bits[i] ? 1 : 0;
+ return count;
+ }
+
+ public static void main(String args[]) throws Exception {
+ if (!(new File("/proc/self/fd").isDirectory()))
+ return;
+
+ // Catch Errors from process reaper
+ Thread.setDefaultUncaughtExceptionHandler
+ ((t, e) -> { e.printStackTrace(); System.exit(1); });
+
+ try (RandomAccessFile f = new RandomAccessFile(BIG_FILE, "rw")) {
+ f.setLength(Runtime.getRuntime().maxMemory()); // provoke OOME
+ }
+
+ for (int i = 0, j = 0; j < procFDs.length; i++)
+ if (!fdInUse(i))
+ procFDs[j++] = i;
+
+ Thread[] threads = {
+ new Thread(new OpenLoop()),
+ new Thread(new ExecLoop()),
+ };
+ for (Thread thread : threads)
+ thread.start();
+
+ Thread.sleep(testDurationSeconds * 1000);
+
+ for (Thread thread : threads)
+ thread.interrupt();
+ for (Thread thread : threads)
+ thread.join();
+ }
+
+ static class OpenLoop implements Runnable {
+ public void run() {
+ while (!Thread.interrupted()) {
+ try {
+ // wait for ExecLoop to finish creating process
+ do {} while (count(procFDsInUse()) != 3);
+ List iss = new ArrayList<>(4);
+
+ // eat up three "holes" (closed ends of pipe fd pairs)
+ for (int i = 0; i < 3; i++)
+ iss.add(new FileInputStream(BIG_FILE));
+ do {} while (count(procFDsInUse()) == procFDs.length);
+ // hopefully this will racily occupy empty fd slot
+ iss.add(new FileInputStream(BIG_FILE));
+ Thread.sleep(1); // Widen race window
+ for (InputStream is : iss)
+ is.close();
+ } catch (InterruptedException e) {
+ break;
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+ }
+ }
+ }
+
+ static class ExecLoop implements Runnable {
+ public void run() {
+ ProcessBuilder builder = new ProcessBuilder("/bin/true");
+ while (!Thread.interrupted()) {
+ try {
+ // wait for OpenLoop to finish
+ do {} while (count(procFDsInUse()) > 0);
+ Process process = builder.start();
+ InputStream is = process.getInputStream();
+ process.waitFor();
+ is.close();
+ } catch (InterruptedException e) {
+ break;
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+ }
+ }
+ }
+}
diff --git a/jdk/test/java/lang/Runtime/exec/CloseRace.java b/jdk/test/java/lang/Runtime/exec/CloseRace.java
deleted file mode 100644
index a1e57902e31..00000000000
--- a/jdk/test/java/lang/Runtime/exec/CloseRace.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- *
- * 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.
- */
-
-/**
- * @test
- * @bug 8024521
- * @summary Closing ProcessPipeInputStream at the time the process exits is racy
- * and leads to the data corruption.
- * @library /lib/testlibrary
- * @run main/othervm/timeout=80 CloseRace
- */
-
-/**
- * This test has a little chance to catch the race during the given default
- * time gap of 20 seconds. To increase the time gap, set the system property
- * CloseRaceTimeGap=N to the number of seconds.
- * Jtreg's timeoutFactor should also be set appropriately.
- *
- * For example, to run the test for 10 minutes:
- * > jtreg \
- * -testjdk:$(PATH_TO_TESTED_JDK) \
- * -timeoutFactor:10 \
- * -DCloseRaceTimeGap=600 \
- * $(PATH_TO_TESTED_JDK_SOURCE)/test/java/lang/Runtime/exec/CloseRace.java
- */
-
-import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import jdk.testlibrary.OutputAnalyzer;
-import static jdk.testlibrary.ProcessTools.*;
-
-public class CloseRace {
-
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = createJavaProcessBuilder("-Xmx64M", "CloseRace$Child",
- System.getProperty("CloseRaceTimeGap", "20"));
- OutputAnalyzer oa = new OutputAnalyzer(pb.start());
- oa.stderrShouldNotContain("java.lang.OutOfMemoryError");
- }
-
- public static class Child {
- private static final String BIG_FILE = "bigfile";
- private static final String SMALL_FILE = "smallfile";
- private static int timeGap = 20; // seconds
-
- public static void main(String args[]) throws Exception {
- if (args.length > 0) {
- try {
- timeGap = Integer.parseUnsignedInt(args[0]);
- timeGap = Integer.max(timeGap, 10);
- timeGap = Integer.min(timeGap, 10 * 60 * 60); // no more than 10 hours
- } catch (NumberFormatException ignore) {}
- }
- try (RandomAccessFile f = new RandomAccessFile(BIG_FILE, "rw")) {
- f.setLength(1024 * 1024 * 1024); // 1 Gb, greater than max heap size
- }
- try (FileOutputStream fs = new FileOutputStream(SMALL_FILE);
- PrintStream ps = new PrintStream(fs)) {
- for (int i = 0; i < 128; ++i)
- ps.println("line of text");
- }
-
- List threads = new LinkedList<>();
- for (int i = 0; i < 99; ++i) {
- Thread t = new Thread (new OpenLoop());
- t.start();
- threads.add(t);
- }
- Thread t2 = new Thread (new ExecLoop());
- t2.start();
- threads.add(t2);
-
- Thread.sleep(timeGap);
-
- for (Thread t : threads) {
- t.interrupt();
- t.join();
- }
- }
-
- private static class OpenLoop implements Runnable {
- public void run() {
- final Path bigFilePath = Paths.get(BIG_FILE);
- while (!Thread.interrupted()) {
- try (InputStream in = Files.newInputStream(bigFilePath)) {
- // Widen the race window by sleeping 1ms
- Thread.sleep(1);
- } catch (InterruptedException e) {
- break;
- } catch (Exception e) {
- System.err.println(e);
- }
- }
- }
- }
-
- private static class ExecLoop implements Runnable {
- public void run() {
- List command = new ArrayList<>(
- Arrays.asList("/bin/cat", SMALL_FILE));
- while (!Thread.interrupted()) {
- try {
- ProcessBuilder builder = new ProcessBuilder(command);
- final Process process = builder.start();
- InputStream is = process.getInputStream();
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- while (br.readLine() != null) {}
- process.waitFor();
- isr.close();
- } catch (InterruptedException e) {
- break;
- } catch (Exception e) {
- System.err.println(e);
- }
- }
- }
- }
- }
-}
From b9f32d484285c5122114022115cbaa8a65b30c1f Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Wed, 29 Jan 2014 22:55:43 +0100
Subject: [PATCH 075/159] 8033119: Improve and document boot-jdk.m4
Reviewed-by: erikj
---
common/autoconf/boot-jdk.m4 | 94 +-
common/autoconf/generated-configure.sh | 2121 ++++++++++++++++++++----
common/autoconf/spec.gmk.in | 16 +-
3 files changed, 1866 insertions(+), 365 deletions(-)
diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index ad8dab31e73..dde3c926c2f 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -23,6 +23,34 @@
# questions.
#
+########################################################################
+# This file handles detection of the Boot JDK. The Boot JDK detection
+# process has been developed as a response to solve a complex real-world
+# problem. Initially, it was simple, but it has grown as platform after
+# platform, idiosyncracy after idiosyncracy has been supported.
+#
+# The basic idea is this:
+# 1) You need an acceptable *) JDK to use as a Boot JDK
+# 2) There are several ways to locate a JDK, that are mostly platform
+# dependent **)
+# 3) You can have multiple JDKs installed
+# 4) If possible, configure should try to dig out an acceptable JDK
+# automatically, without having to resort to command-line options
+#
+# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with
+# javac) and not a JRE, etc.
+#
+# **) On Windows we typically use a well-known path.
+# On MacOSX we typically use the tool java_home.
+# On Linux we typically find javac in the $PATH, and then follow a
+# chain of symlinks that often ends up in a real JDK.
+#
+# This leads to the code where we check in different ways to locate a
+# JDK, and if one is found, check if it is acceptable. If not, we print
+# our reasons for rejecting it (useful when debugging non-working
+# configure situations) and continue checking the next one.
+########################################################################
+
# Execute the check given as argument, and verify the result
# If the Boot JDK was previously found, do nothing
# $1 A command line (typically autoconf macro) to execute
@@ -54,10 +82,10 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`]
- if test "x$FOUND_VERSION_78" = x; then
+ [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`]
+ if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
- AC_MSG_NOTICE([(Your Boot JDK must be version 7 or 8)])
+ AC_MSG_NOTICE([(Your Boot JDK must be version 7, 8 or 9)])
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -136,12 +164,26 @@ AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
])
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
+# $1: Argument to the java_home binary (optional)
AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME],
[
if test -x /usr/libexec/java_home; then
- BOOT_JDK=`/usr/libexec/java_home`
+ BOOT_JDK=`/usr/libexec/java_home $1`
BOOT_JDK_FOUND=maybe
- AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home])
+ AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home $1])
+ fi
+])
+
+# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
+AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR],
+[
+ if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+ # First check at user selected default
+ BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()])
+ # If that did not work out (e.g. too old), try explicit versions instead
+ BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.9])])
+ BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.8])])
+ BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.7])])
fi
])
@@ -201,14 +243,19 @@ AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
# $2 = name of binary
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
[
- AC_MSG_CHECKING([for $2 in Boot JDK])
- $1=$BOOT_JDK/bin/$2
- if test ! -x [$]$1; then
- AC_MSG_RESULT(not found)
- AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk])
- AC_MSG_ERROR([Could not find $2 in the Boot JDK])
- fi
- AC_MSG_RESULT(ok)
+ # Use user overridden value if available, otherwise locate tool in the Boot JDK.
+ BASIC_SETUP_TOOL($1,
+ [
+ AC_MSG_CHECKING([for $2 in Boot JDK])
+ $1=$BOOT_JDK/bin/$2
+ if test ! -x [$]$1; then
+ AC_MSG_RESULT(not found)
+ AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk])
+ AC_MSG_ERROR([Could not find $2 in the Boot JDK])
+ fi
+ AC_MSG_RESULT(ok)
+ AC_SUBST($1)
+ ])
])
###############################################################################
@@ -238,12 +285,12 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
# Test: Is bootjdk available from builddeps?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_BUILDDEPS])
+ # Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
+ BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])
+
# Test: Is $JAVA_HOME set?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
- # Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
- BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME])
-
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
@@ -275,13 +322,12 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_SUBST(BOOT_JDK)
# Setup tools from the Boot JDK.
- BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA,java)
- BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC,javac)
- BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH,javah)
- BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAP,javap)
- BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR,jar)
- BOOTJDK_CHECK_TOOL_IN_BOOTJDK(RMIC,rmic)
- BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII,native2ascii)
+ BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java)
+ BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac)
+ BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH, javah)
+ BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar)
+ BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII, native2ascii)
+ BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner)
# Finally, set some other options...
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index f7dc3f66d6d..998d2004ea2 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -792,6 +792,12 @@ LANGTOOLS_TOPDIR
BOOT_JDK_JVMARGS
JAVAC_FLAGS
BOOT_JDK_SOURCETARGET
+JARSIGNER
+NATIVE2ASCII
+JAR
+JAVAH
+JAVAC
+JAVA
BOOT_JDK
BOOT_TOOLSJAR
BOOT_RTJAR
@@ -1134,6 +1140,12 @@ DSYMUTIL
XATTR
CODESIGN
PKG_CONFIG
+JAVA
+JAVAC
+JAVAH
+JAR
+NATIVE2ASCII
+JARSIGNER
BUILD_CC
BUILD_CXX
BUILD_LD
@@ -1980,6 +1992,13 @@ Some influential environment variables:
XATTR Override default value for XATTR
CODESIGN Override default value for CODESIGN
PKG_CONFIG path to pkg-config utility
+ JAVA Override default value for JAVA
+ JAVAC Override default value for JAVAC
+ JAVAH Override default value for JAVAH
+ JAR Override default value for JAR
+ NATIVE2ASCII
+ Override default value for NATIVE2ASCII
+ JARSIGNER Override default value for JARSIGNER
BUILD_CC Override default value for BUILD_CC
BUILD_CXX Override default value for BUILD_CXX
BUILD_LD Override default value for BUILD_LD
@@ -3485,7 +3504,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# ... then the rest
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -3509,6 +3528,34 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# questions.
#
+########################################################################
+# This file handles detection of the Boot JDK. The Boot JDK detection
+# process has been developed as a response to solve a complex real-world
+# problem. Initially, it was simple, but it has grown as platform after
+# platform, idiosyncracy after idiosyncracy has been supported.
+#
+# The basic idea is this:
+# 1) You need an acceptable *) JDK to use as a Boot JDK
+# 2) There are several ways to locate a JDK, that are mostly platform
+# dependent **)
+# 3) You can have multiple JDKs installed
+# 4) If possible, configure should try to dig out an acceptable JDK
+# automatically, without having to resort to command-line options
+#
+# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with
+# javac) and not a JRE, etc.
+#
+# **) On Windows we typically use a well-known path.
+# On MacOSX we typically use the tool java_home.
+# On Linux we typically find javac in the $PATH, and then follow a
+# chain of symlinks that often ends up in a real JDK.
+#
+# This leads to the code where we check in different ways to locate a
+# JDK, and if one is found, check if it is acceptable. If not, we print
+# our reasons for rejecting it (useful when debugging non-working
+# configure situations) and continue checking the next one.
+########################################################################
+
# Execute the check given as argument, and verify the result
# If the Boot JDK was previously found, do nothing
# $1 A command line (typically autoconf macro) to execute
@@ -3527,6 +3574,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
+# $1: Argument to the java_home binary (optional)
+
+
+# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
# Look for a jdk in the given path. If there are multiple, try to select the newest.
@@ -4036,7 +4087,7 @@ fi
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1390994270
+DATE_WHEN_GENERATED=1391032272
###############################################################################
#
@@ -19491,12 +19542,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -19823,12 +19874,942 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$BOOT_JDK"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$BOOT_JDK"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$BOOT_JDK"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+$as_echo "$BOOT_JDK" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+$as_echo_n "checking Boot JDK version... " >&6; }
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+$as_echo "$BOOT_JDK_VERSION" >&6; }
+ fi # end check jdk version
+ fi # end check rt.jar
+ fi # end check javac
+ fi # end check java
+ fi # end check boot jdk found
+ fi
+
+
+ # Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
+
+ if test "x$BOOT_JDK_FOUND" = xno; then
+ # Now execute the test
+
+ if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+ # First check at user selected default
+
+ if test "x$BOOT_JDK_FOUND" = xno; then
+ # Now execute the test
+
+ if test -x /usr/libexec/java_home; then
+ BOOT_JDK=`/usr/libexec/java_home `
+ BOOT_JDK_FOUND=maybe
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using /usr/libexec/java_home " >&5
+$as_echo "$as_me: Found potential Boot JDK using /usr/libexec/java_home " >&6;}
+ fi
+
+
+ # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+ if test "x$BOOT_JDK_FOUND" = xmaybe; then
+ # Do we have a bin/java?
+ if test ! -x "$BOOT_JDK/bin/java"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have a bin/javac?
+ if test ! -x "$BOOT_JDK/bin/javac"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+ if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$BOOT_JDK"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$BOOT_JDK"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$BOOT_JDK"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+$as_echo "$BOOT_JDK" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+$as_echo_n "checking Boot JDK version... " >&6; }
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+$as_echo "$BOOT_JDK_VERSION" >&6; }
+ fi # end check jdk version
+ fi # end check rt.jar
+ fi # end check javac
+ fi # end check java
+ fi # end check boot jdk found
+ fi
+
+ # If that did not work out (e.g. too old), try explicit versions instead
+
+ if test "x$BOOT_JDK_FOUND" = xno; then
+ # Now execute the test
+
+ if test -x /usr/libexec/java_home; then
+ BOOT_JDK=`/usr/libexec/java_home -v 1.9`
+ BOOT_JDK_FOUND=maybe
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using /usr/libexec/java_home -v 1.9" >&5
+$as_echo "$as_me: Found potential Boot JDK using /usr/libexec/java_home -v 1.9" >&6;}
+ fi
+
+
+ # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+ if test "x$BOOT_JDK_FOUND" = xmaybe; then
+ # Do we have a bin/java?
+ if test ! -x "$BOOT_JDK/bin/java"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have a bin/javac?
+ if test ! -x "$BOOT_JDK/bin/javac"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+ if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$BOOT_JDK"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$BOOT_JDK"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$BOOT_JDK"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+$as_echo "$BOOT_JDK" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+$as_echo_n "checking Boot JDK version... " >&6; }
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+$as_echo "$BOOT_JDK_VERSION" >&6; }
+ fi # end check jdk version
+ fi # end check rt.jar
+ fi # end check javac
+ fi # end check java
+ fi # end check boot jdk found
+ fi
+
+
+ if test "x$BOOT_JDK_FOUND" = xno; then
+ # Now execute the test
+
+ if test -x /usr/libexec/java_home; then
+ BOOT_JDK=`/usr/libexec/java_home -v 1.8`
+ BOOT_JDK_FOUND=maybe
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using /usr/libexec/java_home -v 1.8" >&5
+$as_echo "$as_me: Found potential Boot JDK using /usr/libexec/java_home -v 1.8" >&6;}
+ fi
+
+
+ # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+ if test "x$BOOT_JDK_FOUND" = xmaybe; then
+ # Do we have a bin/java?
+ if test ! -x "$BOOT_JDK/bin/java"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have a bin/javac?
+ if test ! -x "$BOOT_JDK/bin/javac"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+ if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$BOOT_JDK"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$BOOT_JDK"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$BOOT_JDK"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+$as_echo "$BOOT_JDK" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+$as_echo_n "checking Boot JDK version... " >&6; }
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+$as_echo "$BOOT_JDK_VERSION" >&6; }
+ fi # end check jdk version
+ fi # end check rt.jar
+ fi # end check javac
+ fi # end check java
+ fi # end check boot jdk found
+ fi
+
+
+ if test "x$BOOT_JDK_FOUND" = xno; then
+ # Now execute the test
+
+ if test -x /usr/libexec/java_home; then
+ BOOT_JDK=`/usr/libexec/java_home -v 1.7`
+ BOOT_JDK_FOUND=maybe
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using /usr/libexec/java_home -v 1.7" >&5
+$as_echo "$as_me: Found potential Boot JDK using /usr/libexec/java_home -v 1.7" >&6;}
+ fi
+
+
+ # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+ if test "x$BOOT_JDK_FOUND" = xmaybe; then
+ # Do we have a bin/java?
+ if test ! -x "$BOOT_JDK/bin/java"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have a bin/javac?
+ if test ! -x "$BOOT_JDK/bin/javac"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+ if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # We're done! :-)
+ BOOT_JDK_FOUND=yes
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$BOOT_JDK"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$BOOT_JDK"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ BOOT_JDK="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$BOOT_JDK"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+$as_echo_n "checking for Boot JDK... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+$as_echo "$BOOT_JDK" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+$as_echo_n "checking Boot JDK version... " >&6; }
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+$as_echo "$BOOT_JDK_VERSION" >&6; }
+ fi # end check jdk version
+ fi # end check rt.jar
+ fi # end check javac
+ fi # end check java
+ fi # end check boot jdk found
+ fi
+
+ fi
+
+
+ # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+ if test "x$BOOT_JDK_FOUND" = xmaybe; then
+ # Do we have a bin/java?
+ if test ! -x "$BOOT_JDK/bin/java"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have a bin/javac?
+ if test ! -x "$BOOT_JDK/bin/javac"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Do we have an rt.jar? (On MacOSX it is called classes.jar)
+ if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20141,200 +21122,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # We're done! :-)
- BOOT_JDK_FOUND=yes
-
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-
- # Input might be given as Windows format, start by converting to
- # unix format.
- path="$BOOT_JDK"
- new_path=`$CYGPATH -u "$path"`
-
- # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
- # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
- # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
- # "foo.exe" is OK but "foo" is an error.
- #
- # This test is therefore slightly more accurate than "test -f" to check for file precense.
- # It is also a way to make sure we got the proper file name for the real test later on.
- test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
- if test "x$test_shortpath" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Cannot locate the the path of BOOT_JDK" "$LINENO" 5
- fi
-
- # Call helper function which possibly converts this using DOS-style short mode.
- # If so, the updated path is stored in $new_path.
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- shortmode_path=`$CYGPATH -s -m -a "$input_path"`
- path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
- if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
- # Going to short mode and back again did indeed matter. Since short mode is
- # case insensitive, let's make it lowercase to improve readability.
- shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Now convert it back to Unix-stile (cygpath)
- input_path=`$CYGPATH -u "$shortmode_path"`
- new_path="$input_path"
- fi
- fi
-
- test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
- if test "x$test_cygdrive_prefix" = x; then
- # As a simple fix, exclude /usr/bin since it's not a real path.
- if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
- # The path is in a Cygwin special directory (e.g. /home). We need this converted to
- # a path prefixed by /cygdrive for fixpath to work.
- new_path="$CYGWIN_ROOT_PATH$input_path"
- fi
- fi
-
-
- if test "x$path" != "x$new_path"; then
- BOOT_JDK="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
- fi
-
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-
- path="$BOOT_JDK"
- has_colon=`$ECHO $path | $GREP ^.:`
- new_path="$path"
- if test "x$has_colon" = x; then
- # Not in mixed or Windows style, start by that.
- new_path=`cmd //c echo $path`
- fi
-
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- fi
-
-
- windows_path="$new_path"
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
- unix_path=`$CYGPATH -u "$windows_path"`
- new_path="$unix_path"
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
- unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
- new_path="$unix_path"
- fi
-
- if test "x$path" != "x$new_path"; then
- BOOT_JDK="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BOOT_JDK to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;}
- fi
-
- # Save the first 10 bytes of this path to the storage, so fixpath can work.
- all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
-
- else
- # We're on a posix platform. Hooray! :)
- path="$BOOT_JDK"
- has_space=`$ECHO "$path" | $GREP " "`
- if test "x$has_space" != x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
- fi
-
- # Use eval to expand a potential ~
- eval path="$path"
- if test ! -f "$path" && test ! -d "$path"; then
- as_fn_error $? "The path of BOOT_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
- fi
-
- BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
- fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
-$as_echo_n "checking for Boot JDK... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
-$as_echo "$BOOT_JDK" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
-$as_echo_n "checking Boot JDK version... " >&6; }
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
-$as_echo "$BOOT_JDK_VERSION" >&6; }
- fi # end check jdk version
- fi # end check rt.jar
- fi # end check javac
- fi # end check java
- fi # end check boot jdk found
- fi
-
-
- # Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
-
- if test "x$BOOT_JDK_FOUND" = xno; then
- # Now execute the test
-
- if test -x /usr/libexec/java_home; then
- BOOT_JDK=`/usr/libexec/java_home`
- BOOT_JDK_FOUND=maybe
- { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Boot JDK using /usr/libexec/java_home" >&5
-$as_echo "$as_me: Found potential Boot JDK using /usr/libexec/java_home" >&6;}
- fi
-
-
- # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
- if test "x$BOOT_JDK_FOUND" = xmaybe; then
- # Do we have a bin/java?
- if test ! -x "$BOOT_JDK/bin/java"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring" >&6;}
- BOOT_JDK_FOUND=no
- else
- # Do we have a bin/javac?
- if test ! -x "$BOOT_JDK/bin/javac"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be an JRE instead of an JDK)" >&5
-$as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
- BOOT_JDK_FOUND=no
- else
- # Do we have an rt.jar? (On MacOSX it is called classes.jar)
- if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
- BOOT_JDK_FOUND=no
- else
- # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
- # Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20657,12 +21450,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20872,12 +21665,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21052,12 +21845,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21260,12 +22053,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21440,12 +22233,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21648,12 +22441,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21828,12 +22621,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22036,12 +22829,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22216,12 +23009,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22411,12 +23204,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22589,12 +23382,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22785,12 +23578,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22963,12 +23756,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23158,12 +23951,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23336,12 +24129,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23532,12 +24325,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23710,12 +24503,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23887,12 +24680,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`
- if test "x$FOUND_VERSION_78" = x; then
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7 or 8)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7 or 8)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -24093,104 +24886,768 @@ $as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&
# Setup tools from the Boot JDK.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for java in Boot JDK" >&5
+ # Use user overridden value if available, otherwise locate tool in the Boot JDK.
+
+ # Publish this variable in the help.
+
+
+ if test "x$JAVA" = x; then
+ # The variable is not set by user, try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for java in Boot JDK" >&5
$as_echo_n "checking for java in Boot JDK... " >&6; }
- JAVA=$BOOT_JDK/bin/java
- if test ! -x $JAVA; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ JAVA=$BOOT_JDK/bin/java
+ if test ! -x $JAVA; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
- as_fn_error $? "Could not find java in the Boot JDK" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+ as_fn_error $? "Could not find java in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javac in Boot JDK" >&5
+ else
+ # The variable is set, but is it from the command line or the environment?
+
+ # Try to remove the string !JAVA! from our list.
+ try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!JAVA!/}
+ if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+ # If it failed, the variable was not from the command line. Ignore it,
+ # but warn the user (except for BASH, which is always set by the calling BASH).
+ if test "xJAVA" != xBASH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of JAVA from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of JAVA from the environment. Use command line variables instead." >&2;}
+ fi
+ # Try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for java in Boot JDK" >&5
+$as_echo_n "checking for java in Boot JDK... " >&6; }
+ JAVA=$BOOT_JDK/bin/java
+ if test ! -x $JAVA; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+ as_fn_error $? "Could not find java in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+ else
+ # If it succeeded, then it was overridden by the user. We will use it
+ # for the tool.
+
+ # First remove it from the list of overridden variables, so we can test
+ # for unknown variables in the end.
+ CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+ # Check if the provided tool contains a complete path.
+ tool_specified="$JAVA"
+ tool_basename="${tool_specified##*/}"
+ if test "x$tool_basename" = "x$tool_specified"; then
+ # A command without a complete path is provided, search $PATH.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool JAVA=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool JAVA=$tool_basename" >&6;}
+ # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_JAVA+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $JAVA in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_JAVA="$JAVA" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_JAVA="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+JAVA=$ac_cv_path_JAVA
+if test -n "$JAVA"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5
+$as_echo "$JAVA" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$JAVA" = x; then
+ as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+ fi
+ else
+ # Otherwise we believe it is a complete path. Use it as it is.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool JAVA=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool JAVA=$tool_specified" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JAVA" >&5
+$as_echo_n "checking for JAVA... " >&6; }
+ if test ! -x "$tool_specified"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ as_fn_error $? "User supplied tool JAVA=$tool_specified does not exist or is not executable" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+ fi
+ fi
+ fi
+
+
+
+ # Use user overridden value if available, otherwise locate tool in the Boot JDK.
+
+ # Publish this variable in the help.
+
+
+ if test "x$JAVAC" = x; then
+ # The variable is not set by user, try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javac in Boot JDK" >&5
$as_echo_n "checking for javac in Boot JDK... " >&6; }
- JAVAC=$BOOT_JDK/bin/javac
- if test ! -x $JAVAC; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ JAVAC=$BOOT_JDK/bin/javac
+ if test ! -x $JAVAC; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
- as_fn_error $? "Could not find javac in the Boot JDK" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+ as_fn_error $? "Could not find javac in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
+ else
+ # The variable is set, but is it from the command line or the environment?
+
+ # Try to remove the string !JAVAC! from our list.
+ try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!JAVAC!/}
+ if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+ # If it failed, the variable was not from the command line. Ignore it,
+ # but warn the user (except for BASH, which is always set by the calling BASH).
+ if test "xJAVAC" != xBASH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of JAVAC from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of JAVAC from the environment. Use command line variables instead." >&2;}
+ fi
+ # Try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javac in Boot JDK" >&5
+$as_echo_n "checking for javac in Boot JDK... " >&6; }
+ JAVAC=$BOOT_JDK/bin/javac
+ if test ! -x $JAVAC; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+ as_fn_error $? "Could not find javac in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+ else
+ # If it succeeded, then it was overridden by the user. We will use it
+ # for the tool.
+
+ # First remove it from the list of overridden variables, so we can test
+ # for unknown variables in the end.
+ CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+ # Check if the provided tool contains a complete path.
+ tool_specified="$JAVAC"
+ tool_basename="${tool_specified##*/}"
+ if test "x$tool_basename" = "x$tool_specified"; then
+ # A command without a complete path is provided, search $PATH.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool JAVAC=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool JAVAC=$tool_basename" >&6;}
+ # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_JAVAC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $JAVAC in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_JAVAC="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+JAVAC=$ac_cv_path_JAVAC
+if test -n "$JAVAC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
+$as_echo "$JAVAC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$JAVAC" = x; then
+ as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+ fi
+ else
+ # Otherwise we believe it is a complete path. Use it as it is.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool JAVAC=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool JAVAC=$tool_specified" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JAVAC" >&5
+$as_echo_n "checking for JAVAC... " >&6; }
+ if test ! -x "$tool_specified"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ as_fn_error $? "User supplied tool JAVAC=$tool_specified does not exist or is not executable" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+ fi
+ fi
+ fi
+
+
+
+ # Use user overridden value if available, otherwise locate tool in the Boot JDK.
+
+ # Publish this variable in the help.
+
+
+ if test "x$JAVAH" = x; then
+ # The variable is not set by user, try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
$as_echo_n "checking for javah in Boot JDK... " >&6; }
- JAVAH=$BOOT_JDK/bin/javah
- if test ! -x $JAVAH; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ JAVAH=$BOOT_JDK/bin/javah
+ if test ! -x $JAVAH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
- as_fn_error $? "Could not find javah in the Boot JDK" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+ as_fn_error $? "Could not find javah in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javap in Boot JDK" >&5
-$as_echo_n "checking for javap in Boot JDK... " >&6; }
- JAVAP=$BOOT_JDK/bin/javap
- if test ! -x $JAVAP; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ else
+ # The variable is set, but is it from the command line or the environment?
+
+ # Try to remove the string !JAVAH! from our list.
+ try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!JAVAH!/}
+ if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+ # If it failed, the variable was not from the command line. Ignore it,
+ # but warn the user (except for BASH, which is always set by the calling BASH).
+ if test "xJAVAH" != xBASH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of JAVAH from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of JAVAH from the environment. Use command line variables instead." >&2;}
+ fi
+ # Try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for javah in Boot JDK" >&5
+$as_echo_n "checking for javah in Boot JDK... " >&6; }
+ JAVAH=$BOOT_JDK/bin/javah
+ if test ! -x $JAVAH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
- as_fn_error $? "Could not find javap in the Boot JDK" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+ as_fn_error $? "Could not find javah in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jar in Boot JDK" >&5
+ else
+ # If it succeeded, then it was overridden by the user. We will use it
+ # for the tool.
+
+ # First remove it from the list of overridden variables, so we can test
+ # for unknown variables in the end.
+ CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+ # Check if the provided tool contains a complete path.
+ tool_specified="$JAVAH"
+ tool_basename="${tool_specified##*/}"
+ if test "x$tool_basename" = "x$tool_specified"; then
+ # A command without a complete path is provided, search $PATH.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool JAVAH=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool JAVAH=$tool_basename" >&6;}
+ # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_JAVAH+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $JAVAH in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_JAVAH="$JAVAH" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_JAVAH="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+JAVAH=$ac_cv_path_JAVAH
+if test -n "$JAVAH"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAH" >&5
+$as_echo "$JAVAH" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$JAVAH" = x; then
+ as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+ fi
+ else
+ # Otherwise we believe it is a complete path. Use it as it is.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool JAVAH=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool JAVAH=$tool_specified" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JAVAH" >&5
+$as_echo_n "checking for JAVAH... " >&6; }
+ if test ! -x "$tool_specified"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ as_fn_error $? "User supplied tool JAVAH=$tool_specified does not exist or is not executable" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+ fi
+ fi
+ fi
+
+
+
+ # Use user overridden value if available, otherwise locate tool in the Boot JDK.
+
+ # Publish this variable in the help.
+
+
+ if test "x$JAR" = x; then
+ # The variable is not set by user, try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jar in Boot JDK" >&5
$as_echo_n "checking for jar in Boot JDK... " >&6; }
- JAR=$BOOT_JDK/bin/jar
- if test ! -x $JAR; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ JAR=$BOOT_JDK/bin/jar
+ if test ! -x $JAR; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
- as_fn_error $? "Could not find jar in the Boot JDK" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+ as_fn_error $? "Could not find jar in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rmic in Boot JDK" >&5
-$as_echo_n "checking for rmic in Boot JDK... " >&6; }
- RMIC=$BOOT_JDK/bin/rmic
- if test ! -x $RMIC; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ else
+ # The variable is set, but is it from the command line or the environment?
+
+ # Try to remove the string !JAR! from our list.
+ try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!JAR!/}
+ if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+ # If it failed, the variable was not from the command line. Ignore it,
+ # but warn the user (except for BASH, which is always set by the calling BASH).
+ if test "xJAR" != xBASH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of JAR from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of JAR from the environment. Use command line variables instead." >&2;}
+ fi
+ # Try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jar in Boot JDK" >&5
+$as_echo_n "checking for jar in Boot JDK... " >&6; }
+ JAR=$BOOT_JDK/bin/jar
+ if test ! -x $JAR; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
- as_fn_error $? "Could not find rmic in the Boot JDK" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+ as_fn_error $? "Could not find jar in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native2ascii in Boot JDK" >&5
+ else
+ # If it succeeded, then it was overridden by the user. We will use it
+ # for the tool.
+
+ # First remove it from the list of overridden variables, so we can test
+ # for unknown variables in the end.
+ CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+ # Check if the provided tool contains a complete path.
+ tool_specified="$JAR"
+ tool_basename="${tool_specified##*/}"
+ if test "x$tool_basename" = "x$tool_specified"; then
+ # A command without a complete path is provided, search $PATH.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool JAR=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool JAR=$tool_basename" >&6;}
+ # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_JAR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $JAR in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_JAR="$JAR" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_JAR="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+JAR=$ac_cv_path_JAR
+if test -n "$JAR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5
+$as_echo "$JAR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$JAR" = x; then
+ as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+ fi
+ else
+ # Otherwise we believe it is a complete path. Use it as it is.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool JAR=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool JAR=$tool_specified" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JAR" >&5
+$as_echo_n "checking for JAR... " >&6; }
+ if test ! -x "$tool_specified"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ as_fn_error $? "User supplied tool JAR=$tool_specified does not exist or is not executable" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+ fi
+ fi
+ fi
+
+
+
+ # Use user overridden value if available, otherwise locate tool in the Boot JDK.
+
+ # Publish this variable in the help.
+
+
+ if test "x$NATIVE2ASCII" = x; then
+ # The variable is not set by user, try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native2ascii in Boot JDK" >&5
$as_echo_n "checking for native2ascii in Boot JDK... " >&6; }
- NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
- if test ! -x $NATIVE2ASCII; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
+ if test ! -x $NATIVE2ASCII; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
- as_fn_error $? "Could not find native2ascii in the Boot JDK" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+ as_fn_error $? "Could not find native2ascii in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
+ else
+ # The variable is set, but is it from the command line or the environment?
+
+ # Try to remove the string !NATIVE2ASCII! from our list.
+ try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!NATIVE2ASCII!/}
+ if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+ # If it failed, the variable was not from the command line. Ignore it,
+ # but warn the user (except for BASH, which is always set by the calling BASH).
+ if test "xNATIVE2ASCII" != xBASH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of NATIVE2ASCII from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of NATIVE2ASCII from the environment. Use command line variables instead." >&2;}
+ fi
+ # Try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native2ascii in Boot JDK" >&5
+$as_echo_n "checking for native2ascii in Boot JDK... " >&6; }
+ NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
+ if test ! -x $NATIVE2ASCII; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+ as_fn_error $? "Could not find native2ascii in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+ else
+ # If it succeeded, then it was overridden by the user. We will use it
+ # for the tool.
+
+ # First remove it from the list of overridden variables, so we can test
+ # for unknown variables in the end.
+ CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+ # Check if the provided tool contains a complete path.
+ tool_specified="$NATIVE2ASCII"
+ tool_basename="${tool_specified##*/}"
+ if test "x$tool_basename" = "x$tool_specified"; then
+ # A command without a complete path is provided, search $PATH.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool NATIVE2ASCII=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool NATIVE2ASCII=$tool_basename" >&6;}
+ # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_NATIVE2ASCII+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $NATIVE2ASCII in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_NATIVE2ASCII="$NATIVE2ASCII" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_NATIVE2ASCII="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+NATIVE2ASCII=$ac_cv_path_NATIVE2ASCII
+if test -n "$NATIVE2ASCII"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NATIVE2ASCII" >&5
+$as_echo "$NATIVE2ASCII" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$NATIVE2ASCII" = x; then
+ as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+ fi
+ else
+ # Otherwise we believe it is a complete path. Use it as it is.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool NATIVE2ASCII=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool NATIVE2ASCII=$tool_specified" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NATIVE2ASCII" >&5
+$as_echo_n "checking for NATIVE2ASCII... " >&6; }
+ if test ! -x "$tool_specified"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ as_fn_error $? "User supplied tool NATIVE2ASCII=$tool_specified does not exist or is not executable" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+ fi
+ fi
+ fi
+
+
+
+ # Use user overridden value if available, otherwise locate tool in the Boot JDK.
+
+ # Publish this variable in the help.
+
+
+ if test "x$JARSIGNER" = x; then
+ # The variable is not set by user, try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jarsigner in Boot JDK" >&5
+$as_echo_n "checking for jarsigner in Boot JDK... " >&6; }
+ JARSIGNER=$BOOT_JDK/bin/jarsigner
+ if test ! -x $JARSIGNER; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+ as_fn_error $? "Could not find jarsigner in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+ else
+ # The variable is set, but is it from the command line or the environment?
+
+ # Try to remove the string !JARSIGNER! from our list.
+ try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!JARSIGNER!/}
+ if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+ # If it failed, the variable was not from the command line. Ignore it,
+ # but warn the user (except for BASH, which is always set by the calling BASH).
+ if test "xJARSIGNER" != xBASH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of JARSIGNER from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of JARSIGNER from the environment. Use command line variables instead." >&2;}
+ fi
+ # Try to locate tool using the code snippet
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jarsigner in Boot JDK" >&5
+$as_echo_n "checking for jarsigner in Boot JDK... " >&6; }
+ JARSIGNER=$BOOT_JDK/bin/jarsigner
+ if test ! -x $JARSIGNER; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&5
+$as_echo "$as_me: Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk" >&6;}
+ as_fn_error $? "Could not find jarsigner in the Boot JDK" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+
+
+ else
+ # If it succeeded, then it was overridden by the user. We will use it
+ # for the tool.
+
+ # First remove it from the list of overridden variables, so we can test
+ # for unknown variables in the end.
+ CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+ # Check if the provided tool contains a complete path.
+ tool_specified="$JARSIGNER"
+ tool_basename="${tool_specified##*/}"
+ if test "x$tool_basename" = "x$tool_specified"; then
+ # A command without a complete path is provided, search $PATH.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool JARSIGNER=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool JARSIGNER=$tool_basename" >&6;}
+ # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_JARSIGNER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $JARSIGNER in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_JARSIGNER="$JARSIGNER" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_JARSIGNER="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+JARSIGNER=$ac_cv_path_JARSIGNER
+if test -n "$JARSIGNER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JARSIGNER" >&5
+$as_echo "$JARSIGNER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$JARSIGNER" = x; then
+ as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+ fi
+ else
+ # Otherwise we believe it is a complete path. Use it as it is.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool JARSIGNER=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool JARSIGNER=$tool_specified" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JARSIGNER" >&5
+$as_echo_n "checking for JARSIGNER... " >&6; }
+ if test ! -x "$tool_specified"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ as_fn_error $? "User supplied tool JARSIGNER=$tool_specified does not exist or is not executable" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+ fi
+ fi
+ fi
+
+
+
# Finally, set some other options...
# When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 63fc13ba005..4342d1517ee 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -438,22 +438,20 @@ POST_MCS_CMD:=@POST_MCS_CMD@
JAVA_FLAGS:=@BOOT_JDK_JVMARGS@
-JAVA=@FIXPATH@ $(BOOT_JDK)/bin/java $(JAVA_FLAGS)
+JAVA=@FIXPATH@ @JAVA@ $(JAVA_FLAGS)
-JAVAC=@FIXPATH@ $(BOOT_JDK)/bin/javac
+JAVAC:=@FIXPATH@ @JAVAC@
# Hotspot sets this variable before reading the SPEC when compiling sa-jdi.jar. Avoid
# overriding that value by using ?=.
JAVAC_FLAGS?=@JAVAC_FLAGS@
-JAVAH=@FIXPATH@ $(BOOT_JDK)/bin/javah
+JAVAH:=@FIXPATH@ @JAVAH@
-JAR=@FIXPATH@ $(BOOT_JDK)/bin/jar
+JAR:=@FIXPATH@ @JAR@
-RMIC=@FIXPATH@ $(BOOT_JDK)/bin/rmic
+NATIVE2ASCII:=@FIXPATH@ @NATIVE2ASCII@
-NATIVE2ASCII=@FIXPATH@ $(BOOT_JDK)/bin/native2ascii
-
-JARSIGNER=@FIXPATH@ $(BOOT_JDK)/bin/jarsigner
+JARSIGNER:=@FIXPATH@ @JARSIGNER@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
BOOTSTRAP_JAVAC_JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar
From 214de0eb69f80cc2cee0229037a3b9216198622f Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons
Date: Wed, 29 Jan 2014 14:32:27 -0800
Subject: [PATCH 076/159] 8032869: remove support for legacy options in javap
Reviewed-by: ksrini
---
.../com/sun/tools/classfile/Attribute.java | 33 ++++++---------
.../com/sun/tools/javap/AttributeWriter.java | 28 ++-----------
.../com/sun/tools/javap/ClassWriter.java | 17 ++++----
.../com/sun/tools/javap/JavapTask.java | 42 +------------------
.../classes/com/sun/tools/javap/Options.java | 4 +-
.../tools/javap/resources/javap.properties | 3 --
.../test/tools/javap/InvalidOptions.java | 7 ++--
7 files changed, 29 insertions(+), 105 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
index 2688036a7f5..ce5ec7076b1 100644
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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,10 +71,6 @@ public abstract class Attribute {
// defer init of standardAttributeClasses until after options set up
}
- public void setCompat(boolean compat) {
- this.compat = compat;
- }
-
public Attribute createAttribute(ClassReader cr, int name_index, byte[] data)
throws IOException {
if (standardAttributes == null) {
@@ -109,9 +105,10 @@ public abstract class Attribute {
protected void init() {
standardAttributes = new HashMap<>();
standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
- standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
+ standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
standardAttributes.put(Code, Code_attribute.class);
+ standardAttributes.put(CompilationID, CompilationID_attribute.class);
standardAttributes.put(ConstantValue, ConstantValue_attribute.class);
standardAttributes.put(Deprecated, Deprecated_attribute.class);
standardAttributes.put(EnclosingMethod, EnclosingMethod_attribute.class);
@@ -120,29 +117,23 @@ public abstract class Attribute {
standardAttributes.put(LineNumberTable, LineNumberTable_attribute.class);
standardAttributes.put(LocalVariableTable, LocalVariableTable_attribute.class);
standardAttributes.put(LocalVariableTypeTable, LocalVariableTypeTable_attribute.class);
-
- if (!compat) { // old javap does not recognize recent attributes
- standardAttributes.put(MethodParameters, MethodParameters_attribute.class);
- standardAttributes.put(CompilationID, CompilationID_attribute.class);
- standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
- standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
- standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
- standardAttributes.put(Signature, Signature_attribute.class);
- standardAttributes.put(SourceID, SourceID_attribute.class);
- }
-
+ standardAttributes.put(MethodParameters, MethodParameters_attribute.class);
+ standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
+ standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
+ standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
+ standardAttributes.put(Signature, Signature_attribute.class);
standardAttributes.put(SourceDebugExtension, SourceDebugExtension_attribute.class);
standardAttributes.put(SourceFile, SourceFile_attribute.class);
+ standardAttributes.put(SourceID, SourceID_attribute.class);
standardAttributes.put(StackMap, StackMap_attribute.class);
standardAttributes.put(StackMapTable, StackMapTable_attribute.class);
standardAttributes.put(Synthetic, Synthetic_attribute.class);
}
private Map> standardAttributes;
- private boolean compat; // don't support recent attrs in compatibility mode
}
public static Attribute read(ClassReader cr) throws IOException {
diff --git a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
index dd721c2c077..49bdc467bac 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -227,10 +227,7 @@ public class AttributeWriter extends BasicWriter
}
public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) {
- if (options.compat) // BUG 6622216 javap names some attributes incorrectly
- print("Constant value: ");
- else
- print("ConstantValue: ");
+ print("ConstantValue: ");
constantWriter.write(attr.constantvalue_index);
println();
return null;
@@ -291,20 +288,10 @@ public class AttributeWriter extends BasicWriter
public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
boolean first = true;
- if (options.compat) {
- writeInnerClassHeader();
- first = false;
- }
for (int i = 0 ; i < attr.classes.length; i++) {
InnerClasses_attribute.Info info = attr.classes[i];
//access
AccessFlags access_flags = info.inner_class_access_flags;
- if (options.compat) {
- // BUG 6622215: javap ignores certain relevant access flags
- access_flags = access_flags.ignore(ACC_STATIC | ACC_PROTECTED | ACC_PRIVATE | ACC_INTERFACE | ACC_SYNTHETIC | ACC_ENUM);
- // BUG 6622232: javap gets whitespace confused
- print(" ");
- }
if (options.checkAccess(access_flags)) {
if (first) {
writeInnerClassHeader();
@@ -346,11 +333,7 @@ public class AttributeWriter extends BasicWriter
}
private void writeInnerClassHeader() {
- if (options.compat) // BUG 6622216: javap names some attributes incorrectly
- print("InnerClass");
- else
- print("InnerClasses");
- println(":");
+ println("InnerClasses:");
indent(+1);
}
@@ -711,10 +694,7 @@ public class AttributeWriter extends BasicWriter
}
String toHex(byte b, int w) {
- if (options.compat) // BUG 6622260: javap prints negative bytes incorrectly in hex
- return toHex((int) b, w);
- else
- return toHex(b & 0xff, w);
+ return toHex(b & 0xff, w);
}
static String toHex(int i) {
diff --git a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
index 07e22dec757..83b8ba8e9e1 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
@@ -120,7 +120,7 @@ public class ClassWriter extends BasicWriter {
public void write(ClassFile cf) {
setClassFile(cf);
- if ((options.sysInfo || options.verbose) && !options.compat) {
+ if (options.sysInfo || options.verbose) {
if (uri != null) {
if (uri.getScheme().equals("file"))
println("Classfile " + uri.getPath());
@@ -152,7 +152,7 @@ public class ClassWriter extends BasicWriter {
println("Compiled from \"" + getSourceFile((SourceFile_attribute) sfa) + "\"");
}
- if ((options.sysInfo || options.verbose) && !options.compat) {
+ if (options.sysInfo || options.verbose) {
indent(-1);
}
@@ -205,8 +205,7 @@ public class ClassWriter extends BasicWriter {
attrWriter.write(cf, cf.attributes, constant_pool);
println("minor version: " + cf.minor_version);
println("major version: " + cf.major_version);
- if (!options.compat)
- writeList("flags: ", flags.getClassFlags(), "\n");
+ writeList("flags: ", flags.getClassFlags(), "\n");
indent(-1);
constantWriter.writeConstantPool();
} else {
@@ -372,7 +371,7 @@ public class ClassWriter extends BasicWriter {
}
print(" ");
print(getFieldName(f));
- if (options.showConstants && !options.compat) { // BUG 4111861 print static final field contents
+ if (options.showConstants) {
Attribute a = f.attributes.get(Attribute.ConstantValue);
if (a instanceof ConstantValue_attribute) {
print(" = ");
@@ -390,7 +389,7 @@ public class ClassWriter extends BasicWriter {
if (options.showDescriptors)
println("descriptor: " + getValue(f.descriptor));
- if (options.verbose && !options.compat)
+ if (options.verbose)
writeList("flags: ", flags.getFieldFlags(), "\n");
if (options.showAllAttrs) {
@@ -487,7 +486,7 @@ public class ClassWriter extends BasicWriter {
println("descriptor: " + getValue(m.descriptor));
}
- if (options.verbose && !options.compat) {
+ if (options.verbose) {
writeList("flags: ", flags.getMethodFlags(), "\n");
}
@@ -553,13 +552,11 @@ public class ClassWriter extends BasicWriter {
}
Signature_attribute getSignature(Attributes attributes) {
- if (options.compat) // javap does not recognize recent attributes
- return null;
return (Signature_attribute) attributes.get(Attribute.Signature);
}
String adjustVarargs(AccessFlags flags, String params) {
- if (flags.is(ACC_VARARGS) && !options.compat) {
+ if (flags.is(ACC_VARARGS)) {
int i = params.lastIndexOf("[]");
if (i > 0)
return params.substring(0, i) + "..." + params.substring(i+2);
diff --git a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
index 23576737c21..57284a4c003 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -195,48 +195,12 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
}
},
-// new Option(false, "-all") {
-// void process(JavapTask task, String opt, String arg) {
-// task.options.showAllAttrs = true;
-// }
-// },
-
- new Option(false, "-h") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- throw task.new BadArgs("err.h.not.supported");
- }
- },
-
- new Option(false, "-verify", "-verify-verbose") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- throw task.new BadArgs("err.verify.not.supported");
- }
- },
-
new Option(false, "-sysinfo") {
void process(JavapTask task, String opt, String arg) {
task.options.sysInfo = true;
}
},
- new Option(false, "-Xold") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- task.log.println(task.getMessage("warn.Xold.not.supported"));
- }
- },
-
- new Option(false, "-Xnew") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- // ignore: this _is_ the new version
- }
- },
-
- new Option(false, "-XDcompat") {
- void process(JavapTask task, String opt, String arg) {
- task.options.compat = true;
- }
- },
-
new Option(false, "-XDdetails") {
void process(JavapTask task, String opt, String arg) {
task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
@@ -520,7 +484,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
throw new BadArgs("err.unknown.option", arg).showUsage(true);
}
- if (!options.compat && options.accessOptions.size() > 1) {
+ if (options.accessOptions.size() > 1) {
StringBuilder sb = new StringBuilder();
for (String opt: options.accessOptions) {
if (sb.length() > 0)
@@ -581,8 +545,6 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
SourceWriter sourceWriter = SourceWriter.instance(context);
sourceWriter.setFileManager(fileManager);
- attributeFactory.setCompat(options.compat);
-
int result = EXIT_OK;
for (String className: classes) {
diff --git a/langtools/src/share/classes/com/sun/tools/javap/Options.java b/langtools/src/share/classes/com/sun/tools/javap/Options.java
index 7d0a9a7fe4b..fbfc30b2190 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/Options.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/Options.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -88,6 +88,4 @@ public class Options {
public boolean showInnerClasses;
public int indentWidth = 2; // #spaces per indentWidth level
public int tabColumn = 40; // column number for comments
-
- public boolean compat; // bug-for-bug compatibility mode with old javap
}
diff --git a/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties b/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties
index c77024f75f5..a704e7f5e51 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties
+++ b/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties
@@ -6,7 +6,6 @@ err.class.not.found=class not found: {0}
err.crash=A serious internal error has occurred: {0}\nPlease file a bug report, and include the following information:\n{1}
err.end.of.file=unexpected end of file while reading {0}
err.file.not.found=file not found: {0}
-err.h.not.supported=-h is no longer available - use the 'javah' program
err.incompatible.options=bad combination of options: {0}
err.internal.error=internal error: {0} {1} {2}
err.invalid.arg.for.option=invalid argument for option: {0}
@@ -15,11 +14,9 @@ err.missing.arg=no value given for {0}
err.no.classes.specified=no classes specified
err.not.standard.file.manager=can only specify class files when using a standard file manager
err.unknown.option=unknown option: {0}
-err.verify.not.supported=-verify not supported
err.no.SourceFile.attribute=no SourceFile attribute
err.source.file.not.found=source file not found
err.bad.innerclasses.attribute=bad InnerClasses attribute for {0}
-warn.Xold.not.supported=-Xold is no longer available
main.usage.summary=\
Usage: {0} \n\
diff --git a/langtools/test/tools/javap/InvalidOptions.java b/langtools/test/tools/javap/InvalidOptions.java
index d92f644ba85..764fd8a861c 100644
--- a/langtools/test/tools/javap/InvalidOptions.java
+++ b/langtools/test/tools/javap/InvalidOptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -23,8 +23,8 @@
/*
* @test
- * @bug 8027411
- * @summary test invalid options -h and -b
+ * @bug 8027411 8032869
+ * @summary test an invalid option
*/
import java.io.*;
@@ -39,7 +39,6 @@ public class InvalidOptions {
}
void run() throws Exception {
- test(2, "-h", "Error: -h is no longer available - use the javah program");
test(2, "-b", "Error: unknown option: -b",
"Usage: javap ",
"use -help for a list of possible options");
From ca53cc64e58dbb6ee6c24f750670e50843da4915 Mon Sep 17 00:00:00 2001
From: Eric McCorkle
Date: Thu, 30 Jan 2014 07:35:49 -0500
Subject: [PATCH 077/159] 8033218: Silent failure in
TypeAnnotations.resolveFrame
Change silent no-op to assertion failure when resolveFrame is called before attribution.
Reviewed-by: jfranck
---
.../classes/com/sun/tools/javac/code/TypeAnnotations.java | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
index 1ed8f161a7d..35ccc58a14e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
@@ -912,11 +912,7 @@ public class TypeAnnotations {
// not care about inner types.
JCAnnotatedType atypetree = (JCAnnotatedType) frame;
final Type utype = atypetree.underlyingType.type;
- if (utype == null) {
- // This might happen during DeferredAttr;
- // we will be back later.
- return;
- }
+ Assert.checkNonNull(utype);
Symbol tsym = utype.tsym;
if (tsym.getKind().equals(ElementKind.TYPE_PARAMETER) ||
utype.getKind().equals(TypeKind.WILDCARD) ||
From 3d9115510cebf8b94c5cc3b29a105a2f144e0d10 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Thu, 30 Jan 2014 18:26:15 +0530
Subject: [PATCH 078/159] 8032943: Improve reflection in Nashorn
Reviewed-by: jlaskey, attila, ahgross
---
.../internal/objects/NativeObject.java | 3 +-
nashorn/test/script/sandbox/classbind.js | 41 +++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
create mode 100644 nashorn/test/script/sandbox/classbind.js
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
index 5777c96c870..74d56ba614b 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
@@ -645,10 +645,12 @@ public final class NativeObject {
targetObj.addBoundProperties(source, props);
} else if (source instanceof StaticClass) {
final Class> clazz = ((StaticClass)source).getRepresentedClass();
+ Bootstrap.checkReflectionAccess(clazz);
bindBeanProperties(targetObj, source, BeansLinker.getReadableStaticPropertyNames(clazz),
BeansLinker.getWritableStaticPropertyNames(clazz), BeansLinker.getStaticMethodNames(clazz));
} else {
final Class> clazz = source.getClass();
+ Bootstrap.checkReflectionAccess(clazz);
bindBeanProperties(targetObj, source, BeansLinker.getReadableInstancePropertyNames(clazz),
BeansLinker.getWritableInstancePropertyNames(clazz), BeansLinker.getInstanceMethodNames(clazz));
}
@@ -663,7 +665,6 @@ public final class NativeObject {
propertyNames.addAll(writablePropertyNames);
final Class> clazz = source.getClass();
- Bootstrap.checkReflectionAccess(clazz);
final MethodType getterType = MethodType.methodType(Object.class, clazz);
final MethodType setterType = MethodType.methodType(Object.class, clazz, Object.class);
diff --git a/nashorn/test/script/sandbox/classbind.js b/nashorn/test/script/sandbox/classbind.js
new file mode 100644
index 00000000000..2dabb3e23d8
--- /dev/null
+++ b/nashorn/test/script/sandbox/classbind.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ *
+ * 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.
+ */
+
+/**
+ * Try to bind properties of StaticClass representing Class.
+ *
+ * @test
+ * @bug JDK-8032943: Improve reflection in Nashorn
+ */
+
+
+var obj = {}
+
+try {
+ Object.bindProperties(obj, Java.type("java.lang.Class"));
+ fail("SecurityException should have been thrown");
+} catch (e) {
+ if (! (e instanceof java.lang.SecurityException)) {
+ fail("SecurityException expected, got " + e);
+ }
+}
From 6d897ac7a88cbca14bd67ac62c02509c823d8b8a Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Thu, 30 Jan 2014 18:49:47 +0530
Subject: [PATCH 079/159] 8032954: Nashorn: extend Java.extend
Reviewed-by: jlaskey, attila, ahgross
---
.../runtime/linker/JavaAdapterFactory.java | 2 ++
nashorn/test/script/sandbox/classloader.js | 22 +++++++++++++++++++
.../script/sandbox/classloader.js.EXPECTED | 2 ++
3 files changed, 26 insertions(+)
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
index b221d000034..878c0058c76 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
@@ -110,6 +110,8 @@ public final class JavaAdapterFactory {
for (Class> type : types) {
// check for restricted package access
Context.checkPackageAccess(type);
+ // check for classes, interfaces in reflection
+ ReflectionCheckLinker.checkReflectionAccess(type);
}
}
return getAdapterInfo(types).getAdapterClassFor(classOverrides);
diff --git a/nashorn/test/script/sandbox/classloader.js b/nashorn/test/script/sandbox/classloader.js
index 7676496060d..9de1a5c37f2 100644
--- a/nashorn/test/script/sandbox/classloader.js
+++ b/nashorn/test/script/sandbox/classloader.js
@@ -26,6 +26,7 @@
*
* @test
* @security
+ * @bug JDK-8032954: Nashorn: extend Java.extend
*/
try {
@@ -39,3 +40,24 @@ try {
}
}
+try {
+ Java.extend(Java.type('java.lang.ClassLoader'));
+ fail("should have thrown SecurityException");
+} catch (e) {
+ if (e instanceof java.lang.SecurityException) {
+ print(e);
+ } else {
+ fail("expected SecurityException, got " + e);
+ }
+}
+
+try {
+ Java.extend(Java.type("javax.management.loading.MLet"));
+ fail("should have thrown SecurityException");
+} catch (e) {
+ if (e instanceof java.lang.SecurityException) {
+ print(e);
+ } else {
+ fail("expected SecurityException, got " + e);
+ }
+}
diff --git a/nashorn/test/script/sandbox/classloader.js.EXPECTED b/nashorn/test/script/sandbox/classloader.js.EXPECTED
index 356053d4e1d..8c241912f36 100644
--- a/nashorn/test/script/sandbox/classloader.js.EXPECTED
+++ b/nashorn/test/script/sandbox/classloader.js.EXPECTED
@@ -1 +1,3 @@
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection")
+java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection")
+java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection")
From ea24aa581b4702756773505782f160263c7f31db Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Thu, 30 Jan 2014 19:28:40 +0530
Subject: [PATCH 080/159] 8032948: Nashorn linkages awry
Reviewed-by: jlaskey, attila, ahgross
---
.../internal/objects/NativeObject.java | 4 +-
.../internal/runtime/linker/Bootstrap.java | 5 +-
.../runtime/linker/JavaAdapterFactory.java | 2 +-
.../linker/NashornStaticClassLinker.java | 2 +-
.../runtime/linker/ReflectionCheckLinker.java | 23 ++++-
.../scripting/ScriptEngineSecurityTest.java | 97 +++++++++++++++++++
.../api/scripting/ScriptEngineTest.java | 25 +++++
7 files changed, 150 insertions(+), 8 deletions(-)
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
index 74d56ba614b..d102c0fb011 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
@@ -645,12 +645,12 @@ public final class NativeObject {
targetObj.addBoundProperties(source, props);
} else if (source instanceof StaticClass) {
final Class> clazz = ((StaticClass)source).getRepresentedClass();
- Bootstrap.checkReflectionAccess(clazz);
+ Bootstrap.checkReflectionAccess(clazz, true);
bindBeanProperties(targetObj, source, BeansLinker.getReadableStaticPropertyNames(clazz),
BeansLinker.getWritableStaticPropertyNames(clazz), BeansLinker.getStaticMethodNames(clazz));
} else {
final Class> clazz = source.getClass();
- Bootstrap.checkReflectionAccess(clazz);
+ Bootstrap.checkReflectionAccess(clazz, false);
bindBeanProperties(targetObj, source, BeansLinker.getReadableInstancePropertyNames(clazz),
BeansLinker.getWritableInstancePropertyNames(clazz), BeansLinker.getInstanceMethodNames(clazz));
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java
index 0d5f68a1e2f..c8f39fcfaca 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java
@@ -278,9 +278,10 @@ public final class Bootstrap {
* {@code java.lang.invoke} package, as well a {@link Class} and any subclass of {@link ClassLoader}) and there is
* a security manager in the system, then it checks the {@code nashorn.JavaReflection} {@code RuntimePermission}.
* @param clazz the class being tested
+ * @param isStatic is access checked for static members (or instance members)
*/
- public static void checkReflectionAccess(Class> clazz) {
- ReflectionCheckLinker.checkReflectionAccess(clazz);
+ public static void checkReflectionAccess(Class> clazz, boolean isStatic) {
+ ReflectionCheckLinker.checkReflectionAccess(clazz, isStatic);
}
/**
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
index 878c0058c76..ccb2c87982e 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
@@ -111,7 +111,7 @@ public final class JavaAdapterFactory {
// check for restricted package access
Context.checkPackageAccess(type);
// check for classes, interfaces in reflection
- ReflectionCheckLinker.checkReflectionAccess(type);
+ ReflectionCheckLinker.checkReflectionAccess(type, true);
}
}
return getAdapterInfo(types).getAdapterClassFor(classOverrides);
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java
index 72ed97666d0..21e2d14eb4e 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java
@@ -65,7 +65,7 @@ final class NashornStaticClassLinker implements TypeBasedGuardingDynamicLinker {
return null;
}
final Class> receiverClass = ((StaticClass) self).getRepresentedClass();
- Bootstrap.checkReflectionAccess(receiverClass);
+ Bootstrap.checkReflectionAccess(receiverClass, true);
final CallSiteDescriptor desc = request.getCallSiteDescriptor();
// We intercept "new" on StaticClass instances to provide additional capabilities
if ("new".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) {
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java
index 6772cbee037..8fc76c19ed6 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java
@@ -26,6 +26,7 @@
package jdk.nashorn.internal.runtime.linker;
import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.GuardedInvocation;
import jdk.internal.dynalink.linker.LinkRequest;
@@ -47,6 +48,7 @@ final class ReflectionCheckLinker implements TypeBasedGuardingDynamicLinker{
if (type == Class.class || ClassLoader.class.isAssignableFrom(type)) {
return true;
}
+
final String name = type.getName();
return name.startsWith("java.lang.reflect.") || name.startsWith("java.lang.invoke.");
}
@@ -59,9 +61,25 @@ final class ReflectionCheckLinker implements TypeBasedGuardingDynamicLinker{
return null;
}
- static void checkReflectionAccess(Class> clazz) {
+ private static boolean isReflectiveCheckNeeded(final Class> type, final boolean isStatic) {
+ // special handling for Proxy subclasses
+ if (Proxy.class.isAssignableFrom(type)) {
+ if (Proxy.isProxyClass(type)) {
+ // real Proxy class - filter only static access
+ return isStatic;
+ }
+
+ // fake Proxy subclass - filter it always!
+ return true;
+ }
+
+ // check for any other reflective Class
+ return isReflectionClass(type);
+ }
+
+ static void checkReflectionAccess(final Class> clazz, final boolean isStatic) {
final SecurityManager sm = System.getSecurityManager();
- if (sm != null && isReflectionClass(clazz)) {
+ if (sm != null && isReflectiveCheckNeeded(clazz, isStatic)) {
checkReflectionPermission(sm);
}
}
@@ -78,6 +96,7 @@ final class ReflectionCheckLinker implements TypeBasedGuardingDynamicLinker{
if (desc.getNameTokenCount() > CallSiteDescriptor.NAME_OPERAND &&
"static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) {
if (Context.isAccessibleClass((Class>)self) && !isReflectionClass((Class>)self)) {
+
// If "getProp:static" passes access checks, allow access.
return;
}
diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java
index 4f036101bfa..9cea21ba2f5 100644
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java
@@ -27,6 +27,9 @@ package jdk.nashorn.api.scripting;
import static org.testng.Assert.fail;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
import java.util.Objects;
import javax.script.Invocable;
import javax.script.ScriptEngine;
@@ -183,4 +186,98 @@ public class ScriptEngineSecurityTest {
}
}
}
+
+ // @bug 8032948: Nashorn linkages awry
+ public static class FakeProxy extends Proxy {
+ public FakeProxy(InvocationHandler ih) {
+ super(ih);
+ }
+
+ public static Class> makeProxyClass(ClassLoader cl, Class>... ifaces) {
+ return Proxy.getProxyClass(cl, ifaces);
+ }
+ }
+
+ @Test
+ public void fakeProxySubclassAccessCheckTest() throws ScriptException {
+ if (System.getSecurityManager() == null) {
+ // pass vacuously
+ return;
+ }
+
+ final ScriptEngineManager m = new ScriptEngineManager();
+ final ScriptEngine e = m.getEngineByName("nashorn");
+
+ e.put("name", ScriptEngineSecurityTest.class.getName());
+ e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
+ e.put("intfs", new Class[] { Runnable.class });
+
+ String getClass = "Java.type(name + '$FakeProxy').getProxyClass(cl, intfs);";
+
+ // Should not be able to call static methods of Proxy via fake subclass
+ try {
+ Class c = (Class)e.eval(getClass);
+ fail("should have thrown SecurityException");
+ } catch (final Exception exp) {
+ if (! (exp instanceof SecurityException)) {
+ fail("SecurityException expected, got " + exp);
+ }
+ }
+ }
+
+ @Test
+ public void fakeProxySubclassAccessCheckTest2() throws ScriptException {
+ if (System.getSecurityManager() == null) {
+ // pass vacuously
+ return;
+ }
+
+ final ScriptEngineManager m = new ScriptEngineManager();
+ final ScriptEngine e = m.getEngineByName("nashorn");
+
+ e.put("name", ScriptEngineSecurityTest.class.getName());
+ e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
+ e.put("intfs", new Class[] { Runnable.class });
+
+ String getClass = "Java.type(name + '$FakeProxy').makeProxyClass(cl, intfs);";
+
+ // Should not be able to call static methods of Proxy via fake subclass
+ try {
+ Class c = (Class)e.eval(getClass);
+ fail("should have thrown SecurityException");
+ } catch (final Exception exp) {
+ if (! (exp instanceof SecurityException)) {
+ fail("SecurityException expected, got " + exp);
+ }
+ }
+ }
+
+ @Test
+ public static void proxyStaticAccessCheckTest() throws ScriptException {
+ final ScriptEngineManager m = new ScriptEngineManager();
+ final ScriptEngine e = m.getEngineByName("nashorn");
+ final Runnable r = (Runnable)Proxy.newProxyInstance(
+ ScriptEngineTest.class.getClassLoader(),
+ new Class[] { Runnable.class },
+ new InvocationHandler() {
+ @Override
+ public Object invoke(Object p, Method m, Object[] a) {
+ return null;
+ }
+ });
+
+ e.put("rc", r.getClass());
+ e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
+ e.put("intfs", new Class[] { Runnable.class });
+
+ // make sure static methods of Proxy is not accessible via subclass
+ try {
+ e.eval("rc.static.getProxyClass(cl, intfs)");
+ fail("Should have thrown SecurityException");
+ } catch (final Exception exp) {
+ if (! (exp instanceof SecurityException)) {
+ fail("SecurityException expected, got " + exp);
+ }
+ }
+ }
}
diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java
index 2c7df64d4b6..df8696d8e4c 100644
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java
@@ -33,7 +33,9 @@ import static org.testng.Assert.fail;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
+import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
import java.util.concurrent.Callable;
import javax.script.Compilable;
import javax.script.CompiledScript;
@@ -535,6 +537,29 @@ public class ScriptEngineTest {
assertEquals(e.eval("Window.funcJSObject(obj)"), "hello");
}
+ // @bug 8032948: Nashorn linkages awry
+ @Test
+ public void checkProxyAccess() throws ScriptException {
+ final ScriptEngineManager m = new ScriptEngineManager();
+ final ScriptEngine e = m.getEngineByName("nashorn");
+ final boolean[] reached = new boolean[1];
+ final Runnable r = (Runnable)Proxy.newProxyInstance(
+ ScriptEngineTest.class.getClassLoader(),
+ new Class[] { Runnable.class },
+ new InvocationHandler() {
+ @Override
+ public Object invoke(Object p, Method m, Object[] a) {
+ reached[0] = true;
+ return null;
+ }
+ });
+
+ e.put("r", r);
+ e.eval("r.run()");
+
+ assertTrue(reached[0]);
+ }
+
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
// Returns String that would be the result of calling PrintWriter.println
From 281b87b796c3071af54b89c638afda04be83c439 Mon Sep 17 00:00:00 2001
From: Attila Szegedi
Date: Thu, 30 Jan 2014 20:13:27 +0100
Subject: [PATCH 081/159] 8032681: Issues with Nashorn
Reviewed-by: ahgross, jlaskey, sundar
---
.../linker/GuardedTypeConversion.java | 102 +++++++
.../linker/GuardingTypeConverterFactory.java | 20 +-
.../dynalink/support/LinkerServicesImpl.java | 25 +-
.../support/TypeConverterFactory.java | 73 ++++-
.../api/scripting/NashornScriptEngine.java | 6 +-
.../nashorn/internal/objects/NativeJava.java | 37 ++-
.../internal/objects/NativeJavaImporter.java | 4 +-
.../jdk/nashorn/internal/runtime/Context.java | 16 +-
.../internal/runtime/NativeJavaPackage.java | 2 +
.../internal/runtime/ScriptFunction.java | 9 +-
.../runtime/linker/AdaptationResult.java | 3 +-
.../runtime/linker/JSObjectLinker.java | 5 +-
.../linker/JavaAdapterBytecodeGenerator.java | 275 ++++++++++--------
.../linker/JavaAdapterClassLoader.java | 35 +--
.../runtime/linker/JavaAdapterFactory.java | 94 ++++--
.../runtime/linker/JavaAdapterServices.java | 83 +++++-
.../runtime/linker/NashornBottomLinker.java | 9 +-
.../runtime/linker/NashornLinker.java | 38 ++-
.../linker/NashornPrimitiveLinker.java | 5 +-
.../linker/NashornStaticClassLinker.java | 3 +-
.../runtime/resources/Messages.properties | 1 +
nashorn/test/script/basic/JDK-8014647.js | 7 +-
.../test/script/basic/JDK-8014647.js.EXPECTED | 4 +-
.../test/script/basic/javaclassoverrides.js | 13 +-
.../basic/javaclassoverrides.js.EXPECTED | 6 +-
nashorn/test/script/sandbox/javaextend.js | 15 +
.../script/sandbox/javaextend.js.EXPECTED | 2 +
.../scripting/ScriptEngineSecurityTest.java | 19 +-
.../test/models/ClassWithFinalFinalizer.java | 31 ++
.../ClassWithInheritedFinalFinalizer.java | 29 ++
30 files changed, 727 insertions(+), 244 deletions(-)
create mode 100644 nashorn/src/jdk/internal/dynalink/linker/GuardedTypeConversion.java
create mode 100644 nashorn/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java
create mode 100644 nashorn/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java
diff --git a/nashorn/src/jdk/internal/dynalink/linker/GuardedTypeConversion.java b/nashorn/src/jdk/internal/dynalink/linker/GuardedTypeConversion.java
new file mode 100644
index 00000000000..9baed7c0ebd
--- /dev/null
+++ b/nashorn/src/jdk/internal/dynalink/linker/GuardedTypeConversion.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+ Copyright 2009-2013 Attila Szegedi
+
+ Licensed under both the Apache License, Version 2.0 (the "Apache License")
+ and the BSD License (the "BSD License"), with licensee being free to
+ choose either of the two at their discretion.
+
+ You may not use this file except in compliance with either the Apache
+ License or the BSD License.
+
+ If you choose to use this file in compliance with the Apache License, the
+ following notice applies to you:
+
+ You may obtain a copy of the Apache License at
+
+ 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,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ If you choose to use this file in compliance with the BSD License, the
+ following notice applies to you:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.linker;
+
+public class GuardedTypeConversion {
+ private final GuardedInvocation conversionInvocation;
+ private final boolean cacheable;
+
+ public GuardedTypeConversion(final GuardedInvocation conversionInvocation, final boolean cacheable) {
+ this.conversionInvocation = conversionInvocation;
+ this.cacheable = cacheable;
+ }
+
+ public GuardedInvocation getConversionInvocation() {
+ return conversionInvocation;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+}
diff --git a/nashorn/src/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java b/nashorn/src/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java
index 30ab9467ec4..5f66e8a4bca 100644
--- a/nashorn/src/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java
+++ b/nashorn/src/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java
@@ -96,19 +96,19 @@ import jdk.internal.dynalink.support.TypeUtilities;
*/
public interface GuardingTypeConverterFactory {
/**
- * Returns a guarded invocation that receives an Object of the specified source type and returns an Object converted
- * to the specified target type. The type of the invocation is targetType(sourceType), while the type of the guard
- * is boolean(sourceType). Note that this will never be invoked for type conversions allowed by the JLS 5.3 "Method
- * Invocation Conversion", see {@link TypeUtilities#isMethodInvocationConvertible(Class, Class)} for details. An
- * implementation can assume it is never requested to produce a converter for these conversions.
+ * Returns a guarded type conversion that receives an Object of the specified source type and returns an Object
+ * converted to the specified target type. The type of the invocation is targetType(sourceType), while the type of
+ * the guard is boolean(sourceType). Note that this will never be invoked for type conversions allowed by the JLS
+ * 5.3 "Method Invocation Conversion", see {@link TypeUtilities#isMethodInvocationConvertible(Class, Class)} for
+ * details. An implementation can assume it is never requested to produce a converter for these conversions.
*
* @param sourceType source type
* @param targetType the target type.
- * @return a guarded invocation that can take an object (if it passes guard) and returns another object that is its
- * representation coerced into the target type. In case the factory is certain it is unable to handle a conversion,
- * it can return null. In case the factory is certain that it can always handle the conversion, it can return an
- * unconditional invocation (one whose guard is null).
+ * @return a guarded type conversion that contains a guarded invocation that can take an object (if it passes guard)
+ * and return another object that is its representation coerced into the target type. In case the factory is certain
+ * it is unable to handle a conversion, it can return null. In case the factory is certain that it can always handle
+ * the conversion, it can return an unconditional invocation (one whose guard is null).
* @throws Exception if there was an error during creation of the converter
*/
- public GuardedInvocation convertToType(Class> sourceType, Class> targetType) throws Exception;
+ public GuardedTypeConversion convertToType(Class> sourceType, Class> targetType) throws Exception;
}
diff --git a/nashorn/src/jdk/internal/dynalink/support/LinkerServicesImpl.java b/nashorn/src/jdk/internal/dynalink/support/LinkerServicesImpl.java
index 4eb0ca9da7e..3b8e7b46abe 100644
--- a/nashorn/src/jdk/internal/dynalink/support/LinkerServicesImpl.java
+++ b/nashorn/src/jdk/internal/dynalink/support/LinkerServicesImpl.java
@@ -98,6 +98,9 @@ import jdk.internal.dynalink.linker.LinkerServices;
*/
public class LinkerServicesImpl implements LinkerServices {
+ private static final RuntimePermission GET_CURRENT_LINK_REQUEST = new RuntimePermission("dynalink.getCurrentLinkRequest");
+ private static final ThreadLocal threadLinkRequest = new ThreadLocal<>();
+
private final TypeConverterFactory typeConverterFactory;
private final GuardingDynamicLinker topLevelLinker;
@@ -135,6 +138,26 @@ public class LinkerServicesImpl implements LinkerServices {
@Override
public GuardedInvocation getGuardedInvocation(LinkRequest linkRequest) throws Exception {
- return topLevelLinker.getGuardedInvocation(linkRequest, this);
+ final LinkRequest prevLinkRequest = threadLinkRequest.get();
+ threadLinkRequest.set(linkRequest);
+ try {
+ return topLevelLinker.getGuardedInvocation(linkRequest, this);
+ } finally {
+ threadLinkRequest.set(prevLinkRequest);
+ }
+ }
+
+ /**
+ * Returns the currently processed link request, or null if the method is invoked outside of the linking process.
+ * @return the currently processed link request, or null.
+ * @throws SecurityException if the calling code doesn't have the {@code "dynalink.getCurrentLinkRequest"} runtime
+ * permission.
+ */
+ public static LinkRequest getCurrentLinkRequest() {
+ SecurityManager sm = System.getSecurityManager();
+ if(sm != null) {
+ sm.checkPermission(GET_CURRENT_LINK_REQUEST);
+ }
+ return threadLinkRequest.get();
}
}
diff --git a/nashorn/src/jdk/internal/dynalink/support/TypeConverterFactory.java b/nashorn/src/jdk/internal/dynalink/support/TypeConverterFactory.java
index 5ab541f33f9..436acad7faf 100644
--- a/nashorn/src/jdk/internal/dynalink/support/TypeConverterFactory.java
+++ b/nashorn/src/jdk/internal/dynalink/support/TypeConverterFactory.java
@@ -94,6 +94,7 @@ import java.util.List;
import jdk.internal.dynalink.linker.ConversionComparator;
import jdk.internal.dynalink.linker.ConversionComparator.Comparison;
import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardedTypeConversion;
import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
import jdk.internal.dynalink.linker.LinkerServices;
@@ -134,8 +135,8 @@ public class TypeConverterFactory {
@Override
protected MethodHandle computeValue(Class> targetType) {
if(!canAutoConvert(sourceType, targetType)) {
- final MethodHandle converter = getTypeConverterNull(sourceType, targetType);
- if(converter != null) {
+ final MethodHandle converter = getCacheableTypeConverter(sourceType, targetType);
+ if(converter != IDENTITY_CONVERSION) {
return converter;
}
}
@@ -145,6 +146,24 @@ public class TypeConverterFactory {
}
};
+ private final ClassValue> canConvert = new ClassValue>() {
+ @Override
+ protected ClassMap computeValue(final Class> sourceType) {
+ return new ClassMap(getClassLoader(sourceType)) {
+ @Override
+ protected Boolean computeValue(Class> targetType) {
+ try {
+ return getTypeConverterNull(sourceType, targetType) != null;
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ }
+ };
+
private static final ClassLoader getClassLoader(final Class> clazz) {
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
@@ -253,7 +272,7 @@ public class TypeConverterFactory {
* @return true if there can be a conversion, false if there can not.
*/
public boolean canConvert(final Class> from, final Class> to) {
- return canAutoConvert(from, to) || getTypeConverterNull(from, to) != null;
+ return canAutoConvert(from, to) || canConvert.get(from).get(to).booleanValue();
}
/**
@@ -294,11 +313,23 @@ public class TypeConverterFactory {
return TypeUtilities.isMethodInvocationConvertible(fromType, toType);
}
- /*private*/ MethodHandle getTypeConverterNull(Class> sourceType, Class> targetType) {
- final MethodHandle converter = converterMap.get(sourceType).get(targetType);
+ /*private*/ MethodHandle getCacheableTypeConverterNull(Class> sourceType, Class> targetType) {
+ final MethodHandle converter = getCacheableTypeConverter(sourceType, targetType);
return converter == IDENTITY_CONVERSION ? null : converter;
}
+ /*private*/ MethodHandle getTypeConverterNull(Class> sourceType, Class> targetType) {
+ try {
+ return getCacheableTypeConverterNull(sourceType, targetType);
+ } catch(NotCacheableConverter e) {
+ return e.converter;
+ }
+ }
+
+ /*private*/ MethodHandle getCacheableTypeConverter(Class> sourceType, Class> targetType) {
+ return converterMap.get(sourceType).get(targetType);
+ }
+
/**
* Given a source and target type, returns a method handle that converts between them. Never returns null; in worst
* case it will return an identity conversion (that might fail for some values at runtime). You can use this method
@@ -309,22 +340,44 @@ public class TypeConverterFactory {
* @return a method handle performing the conversion.
*/
public MethodHandle getTypeConverter(Class> sourceType, Class> targetType) {
- return converterIdentityMap.get(sourceType).get(targetType);
+ try {
+ return converterIdentityMap.get(sourceType).get(targetType);
+ } catch(NotCacheableConverter e) {
+ return e.converter;
+ }
}
/*private*/ MethodHandle createConverter(Class> sourceType, Class> targetType) throws Exception {
final MethodType type = MethodType.methodType(targetType, sourceType);
final MethodHandle identity = IDENTITY_CONVERSION.asType(type);
MethodHandle last = identity;
+ boolean cacheable = true;
for(int i = factories.length; i-- > 0;) {
- final GuardedInvocation next = factories[i].convertToType(sourceType, targetType);
+ final GuardedTypeConversion next = factories[i].convertToType(sourceType, targetType);
if(next != null) {
- next.assertType(type);
- last = next.compose(last);
+ cacheable = cacheable && next.isCacheable();
+ final GuardedInvocation conversionInvocation = next.getConversionInvocation();
+ conversionInvocation.assertType(type);
+ last = conversionInvocation.compose(last);
}
}
- return last == identity ? IDENTITY_CONVERSION : last;
+ if(last == identity) {
+ return IDENTITY_CONVERSION;
+ }
+ if(cacheable) {
+ return last;
+ }
+ throw new NotCacheableConverter(last);
}
/*private*/ static final MethodHandle IDENTITY_CONVERSION = MethodHandles.identity(Object.class);
+
+ private static class NotCacheableConverter extends RuntimeException {
+ final MethodHandle converter;
+
+ NotCacheableConverter(final MethodHandle converter) {
+ super("", null, false, false);
+ this.converter = converter;
+ }
+ }
}
diff --git a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java
index 8028cce229e..3c4d29fc025 100644
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java
@@ -32,6 +32,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
+import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
@@ -104,7 +105,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
private volatile Property contextProperty;
// default options passed to Nashorn Options object
- private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-doe" };
+ private static final String[] DEFAULT_OPTIONS = new String[] { "-doe" };
// Nashorn script engine error message management
private static final String MESSAGES_RESOURCE = "jdk.nashorn.api.scripting.resources.Messages";
@@ -355,7 +356,8 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
if (! isInterfaceImplemented(clazz, realSelf)) {
return null;
}
- return clazz.cast(JavaAdapterFactory.getConstructor(realSelf.getClass(), clazz).invoke(realSelf));
+ return clazz.cast(JavaAdapterFactory.getConstructor(realSelf.getClass(), clazz,
+ MethodHandles.publicLookup()).invoke(realSelf));
} finally {
if (globalChanged) {
Context.setGlobal(oldGlobal);
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java b/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java
index 5e9ac83d5e1..b863e24f2a5 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java
@@ -28,6 +28,7 @@ package jdk.nashorn.internal.objects;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+import java.lang.invoke.MethodHandles;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Deque;
@@ -463,12 +464,14 @@ public final class NativeJava {
*
* We can see several important concepts in the above example:
*
- *
Every specified list of Java types will have exactly one extender subclass in Nashorn - repeated invocations
- * of {@code extend} for the same list of types will yield the same extender type. It's a generic adapter that
- * delegates to whatever JavaScript functions its implementation object has on a per-instance basis.
+ *
Every specified list of Java types will have one extender subclass in Nashorn per caller protection domain -
+ * repeated invocations of {@code extend} for the same list of types for scripts same protection domain will yield
+ * the same extender type. It's a generic adapter that delegates to whatever JavaScript functions its implementation
+ * object has on a per-instance basis.
*
If the Java method is overloaded (as in the above example {@code List.add()}), then your JavaScript adapter
* must be prepared to deal with all overloads.
- *
You can't invoke {@code super.*()} from adapters for now.
+ *
To invoke super methods from adapters, call them on the adapter instance prefixing them with {@code super$},
+ * or use the special {@link #_super(Object, Object) super-adapter}.
*
It is also possible to specify an ordinary JavaScript object as the last argument to {@code extend}. In that
* case, it is treated as a class-level override. {@code extend} will return an extender class where all instances
* will have the methods implemented by functions on that object, just as if that object were passed as the last
@@ -486,15 +489,18 @@ public final class NativeJava {
* t.join()
*
* As you can see, you don't have to pass any object when you create a new instance of {@code R1} as its
- * {@code run()} function was defined already when extending the class. Of course, you can still provide
- * instance-level overrides on these objects. The order of precedence is instance-level method, class-level method,
- * superclass method, or {@code UnsupportedOperationException} if the superclass method is abstract. If we continue
- * our previous example:
+ * {@code run()} function was defined already when extending the class. If you also want to add instance-level
+ * overrides on these objects, you will have to repeatedly use {@code extend()} to subclass the class-level adapter.
+ * For such adapters, the order of precedence is instance-level method, class-level method, superclass method, or
+ * {@code UnsupportedOperationException} if the superclass method is abstract. If we continue our previous example:
*
- * var r2 = new R1(function() { print("r2.run() invoked!") })
+ * var R2 = Java.extend(R1);
+ * var r2 = new R2(function() { print("r2.run() invoked!") })
* r2.run()
*
* We'll see it'll print {@code "r2.run() invoked!"}, thus overriding on instance-level the class-level behavior.
+ * Note that you must use {@code Java.extend} to explicitly create an instance-override adapter class from a
+ * class-override adapter class, as the class-override adapter class is no longer abstract.
*
*
* @param self not used
@@ -541,7 +547,18 @@ public final class NativeJava {
} catch(final ClassCastException e) {
throw typeError("extend.expects.java.types");
}
- return JavaAdapterFactory.getAdapterClassFor(stypes, classOverrides);
+ // Note that while the public API documentation claims self is not used, we actually use it.
+ // ScriptFunction.findCallMethod will bind the lookup object into it, and we can then use that lookup when
+ // requesting the adapter class. Note that if Java.extend is invoked with no lookup object, it'll pass the
+ // public lookup which'll result in generation of a no-permissions adapter. A typical situation this can happen
+ // is when the extend function is bound.
+ final MethodHandles.Lookup lookup;
+ if(self instanceof MethodHandles.Lookup) {
+ lookup = (MethodHandles.Lookup)self;
+ } else {
+ lookup = MethodHandles.publicLookup();
+ }
+ return JavaAdapterFactory.getAdapterClassFor(stypes, classOverrides, lookup);
}
/**
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java b/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java
index dd9231d9386..56baf66d229 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java
@@ -33,6 +33,7 @@ import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Constructor;
import jdk.nashorn.internal.objects.annotations.Function;
import jdk.nashorn.internal.objects.annotations.ScriptClass;
+import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.NativeJavaPackage;
import jdk.nashorn.internal.runtime.PropertyMap;
import jdk.nashorn.internal.runtime.ScriptObject;
@@ -161,8 +162,9 @@ public final class NativeJavaImporter extends ScriptObject {
} else if (obj instanceof NativeJavaPackage) {
final String pkgName = ((NativeJavaPackage)obj).getName();
final String fullName = pkgName.isEmpty() ? name : (pkgName + "." + name);
+ final Context context = Global.instance().getContext();
try {
- return StaticClass.forClass(Class.forName(fullName));
+ return StaticClass.forClass(context.findClass(fullName));
} catch (final ClassNotFoundException e) {
// IGNORE
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk/nashorn/internal/runtime/Context.java
index 1817ca928ba..e15ddd2c8fb 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java
@@ -37,7 +37,6 @@ import java.io.PrintWriter;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Modifier;
-import java.util.concurrent.atomic.AtomicLong;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessControlContext;
@@ -48,7 +47,7 @@ import java.security.Permissions;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.util.Map;
-
+import java.util.concurrent.atomic.AtomicLong;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
@@ -651,6 +650,19 @@ public final class Context {
}
}
+ /**
+ * Checks that the given package name can be accessed from no permissions context.
+ *
+ * @param pkgName package name
+ * @throw SecurityException if not accessible
+ */
+ public static void checkPackageAccess(final String pkgName) {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ checkPackageAccess(sm, pkgName.endsWith(".")? pkgName : pkgName + ".");
+ }
+ }
+
/**
* Checks that the given package can be accessed from no permissions context.
*
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java
index a5abacb2134..591fd327c64 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java
@@ -85,6 +85,8 @@ public final class NativeJavaPackage extends ScriptObject {
*/
public NativeJavaPackage(final String name, final ScriptObject proto) {
super(proto, null);
+ // defense-in-path, check here for sensitive packages
+ Context.checkPackageAccess(name);
this.name = name;
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
index ae59855cb4b..d0669d709de 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
@@ -26,14 +26,13 @@
package jdk.nashorn.internal.runtime;
import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
-
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.GuardedInvocation;
import jdk.internal.dynalink.linker.LinkRequest;
@@ -524,7 +523,11 @@ public abstract class ScriptFunction extends ScriptObject {
}
} else {
final MethodHandle callHandle = getBestInvoker(type.dropParameterTypes(0, 1), request.getArguments());
- if (scopeCall) {
+ if (data.isBuiltin() && "extend".equals(data.getName())) {
+ // NOTE: the only built-in named "extend" is NativeJava.extend. As a special-case we're binding the
+ // current lookup as its "this" so it can do security-sensitive creation of adapter classes.
+ boundHandle = MH.dropArguments(MH.bindTo(callHandle, desc.getLookup()), 0, Object.class, Object.class);
+ } else if (scopeCall) {
// Make a handle that drops the passed "this" argument and substitutes either Global or Undefined
// (this, args...) => (args...)
boundHandle = MH.bindTo(callHandle, needsWrappedThis() ? Context.getGlobalTrusted() : ScriptRuntime.UNDEFINED);
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java
index de1cfccc2a9..52511e5d94e 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java
@@ -47,7 +47,8 @@ final class AdaptationResult {
ERROR_NON_PUBLIC_CLASS,
ERROR_NO_ACCESSIBLE_CONSTRUCTOR,
ERROR_MULTIPLE_SUPERCLASSES,
- ERROR_NO_COMMON_LOADER
+ ERROR_NO_COMMON_LOADER,
+ ERROR_FINAL_FINALIZER
}
static final AdaptationResult SUCCESSFUL_RESULT = new AdaptationResult(Outcome.SUCCESS, "");
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java
index f0d45317a8a..f3c8284be86 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java
@@ -32,6 +32,7 @@ import java.util.HashMap;
import java.util.Map;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardedTypeConversion;
import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
import jdk.internal.dynalink.linker.LinkRequest;
import jdk.internal.dynalink.linker.LinkerServices;
@@ -79,7 +80,7 @@ final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTy
}
@Override
- public GuardedInvocation convertToType(final Class> sourceType, final Class> targetType) throws Exception {
+ public GuardedTypeConversion convertToType(final Class> sourceType, final Class> targetType) throws Exception {
final boolean sourceIsAlwaysJSObject = JSObject.class.isAssignableFrom(sourceType);
if(!sourceIsAlwaysJSObject && !sourceType.isAssignableFrom(JSObject.class)) {
return null;
@@ -90,7 +91,7 @@ final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTy
return null;
}
- return new GuardedInvocation(converter, sourceIsAlwaysJSObject ? null : IS_JSOBJECT_GUARD).asType(MethodType.methodType(targetType, sourceType));
+ return new GuardedTypeConversion(new GuardedInvocation(converter, sourceIsAlwaysJSObject ? null : IS_JSOBJECT_GUARD).asType(MethodType.methodType(targetType, sourceType)), true);
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java
index ef2a6829a25..5aceb206331 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java
@@ -59,6 +59,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Handle;
import jdk.internal.org.objectweb.asm.Label;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.Type;
@@ -66,21 +67,23 @@ import jdk.internal.org.objectweb.asm.commons.InstructionAdapter;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.linker.AdaptationResult.Outcome;
import sun.reflect.CallerSensitive;
/**
* Generates bytecode for a Java adapter class. Used by the {@link JavaAdapterFactory}.
*
- * For every protected or public constructor in the extended class, the adapter class will have between one to three
+ * For every protected or public constructor in the extended class, the adapter class will have either one or two
* public constructors (visibility of protected constructors in the extended class is promoted to public).
- *
- *
In every case, a constructor taking a trailing ScriptObject argument preceded by original constructor arguments
- * is always created on the adapter class. When such a constructor is invoked, the passed ScriptObject's member
- * functions are used to implement and/or override methods on the original class, dispatched by name. A single
- * JavaScript function will act as the implementation for all overloaded methods of the same name. When methods on an
- * adapter instance are invoked, the functions are invoked having the ScriptObject passed in the instance constructor as
- * their "this". Subsequent changes to the ScriptObject (reassignment or removal of its functions) are not reflected in
- * the adapter instance; the method implementations are bound to functions at constructor invocation time.
+ *
+ *
For adapter classes with instance-level overrides, a constructor taking a trailing ScriptObject argument preceded
+ * by original constructor arguments is always created on the adapter class. When such a constructor is invoked, the
+ * passed ScriptObject's member functions are used to implement and/or override methods on the original class,
+ * dispatched by name. A single JavaScript function will act as the implementation for all overloaded methods of the
+ * same name. When methods on an adapter instance are invoked, the functions are invoked having the ScriptObject passed
+ * in the instance constructor as their "this". Subsequent changes to the ScriptObject (reassignment or removal of its
+ * functions) are not reflected in the adapter instance; the method implementations are bound to functions at
+ * constructor invocation time.
* {@code java.lang.Object} methods {@code equals}, {@code hashCode}, and {@code toString} can also be overridden. The
* only restriction is that since every JavaScript object already has a {@code toString} function through the
* {@code Object.prototype}, the {@code toString} in the adapter is only overridden if the passed ScriptObject has a
@@ -89,16 +92,17 @@ import sun.reflect.CallerSensitive;
*
*
* If the original types collectively have only one abstract method, or have several of them, but all share the
- * same name, an additional constructor is provided for every original constructor; this one takes a ScriptFunction as
- * its last argument preceded by original constructor arguments. This constructor will use the passed function as the
- * implementation for all abstract methods. For consistency, any concrete methods sharing the single abstract method
- * name will also be overridden by the function. When methods on the adapter instance are invoked, the ScriptFunction is
- * invoked with global or UNDEFINED as its "this" depending whether the function is non-strict or not.
+ * same name, an additional constructor for instance-level override adapter is provided for every original constructor;
+ * this one takes a ScriptFunction as its last argument preceded by original constructor arguments. This constructor
+ * will use the passed function as the implementation for all abstract methods. For consistency, any concrete methods
+ * sharing the single abstract method name will also be overridden by the function. When methods on the adapter instance
+ * are invoked, the ScriptFunction is invoked with UNDEFINED or Global as its "this" depending whether the function is
+ * strict or not.
*
*
* If the adapter being generated can have class-level overrides, constructors taking same arguments as the superclass
- * constructors are also created. These constructors simply delegate to the superclass constructor. They are used to
- * create instances of the adapter class with no instance-level overrides.
+ * constructors are created. These constructors simply delegate to the superclass constructor. They are simply used to
+ * create instances of the adapter class, with no instance-level overrides, as they don't have them.
*
*
*
@@ -111,16 +115,20 @@ import sun.reflect.CallerSensitive;
* source-level script expression new X(a, b) { ... } (which is a proprietary syntax extension Nashorn uses
* to resemble Java anonymous classes) is actually equivalent to new X(a, b, { ... }).
*
- * It is possible to create two different classes: those that can have both class-level and instance-level overrides,
- * and those that can only have instance-level overrides. When
- * {@link JavaAdapterFactory#getAdapterClassFor(Class[], ScriptObject)} is invoked with non-null {@code classOverrides}
- * parameter, an adapter class is created that can have class-level overrides, and the passed script object will be used
- * as the implementations for its methods, just as in the above case of the constructor taking a script object. Note
- * that in the case of class-level overrides, a new adapter class is created on every invocation, and the implementation
- * object is bound to the class, not to any instance. All created instances will share these functions. Of course, when
- * instances of such a class are being created, they can still take another object (or possibly a function) in their
- * constructor's trailing position and thus provide further instance-specific overrides. The order of invocation is
- * always instance-specified method, then a class-specified method, and finally the superclass method.
+ * It is possible to create two different adapter classes: those that can have class-level overrides, and those that can
+ * have instance-level overrides. When {@link JavaAdapterFactory#getAdapterClassFor(Class[], ScriptObject)} is invoked
+ * with non-null {@code classOverrides} parameter, an adapter class is created that can have class-level overrides, and
+ * the passed script object will be used as the implementations for its methods, just as in the above case of the
+ * constructor taking a script object. Note that in the case of class-level overrides, a new adapter class is created on
+ * every invocation, and the implementation object is bound to the class, not to any instance. All created instances
+ * will share these functions. If it is required to have both class-level overrides and instance-level overrides, the
+ * class-level override adapter class should be subclassed with an instance-override adapter. Since adapters delegate to
+ * super class when an overriding method handle is not specified, this will behave as expected. It is not possible to
+ * have both class-level and instance-level overrides in the same class for security reasons: adapter classes are
+ * defined with a protection domain of their creator code, and an adapter class that has both class and instance level
+ * overrides would need to have two potentially different protection domains: one for class-based behavior and one for
+ * instance-based behavior; since Java classes can only belong to a single protection domain, this could not be
+ * implemented securely.
*/
final class JavaAdapterBytecodeGenerator {
static final Type CONTEXT_TYPE = Type.getType(Context.class);
@@ -171,7 +179,6 @@ final class JavaAdapterBytecodeGenerator {
private static final int MAX_GENERATED_TYPE_NAME_LENGTH = 255;
private static final String CLASS_INIT = "";
- private static final String STATIC_GLOBAL_FIELD_NAME = "staticGlobal";
// Method name prefix for invoking super-methods
static final String SUPER_PREFIX = "super$";
@@ -199,6 +206,7 @@ final class JavaAdapterBytecodeGenerator {
private final Set finalMethods = new HashSet<>(EXCLUDED);
private final Set methodInfos = new HashSet<>();
private boolean autoConvertibleFromFunction = false;
+ private boolean hasExplicitFinalizer = false;
private final ClassWriter cw;
@@ -207,8 +215,8 @@ final class JavaAdapterBytecodeGenerator {
* @param superClass the superclass the adapter will extend.
* @param interfaces the interfaces the adapter will implement.
* @param commonLoader the class loader that can see all of superClass, interfaces, and Nashorn classes.
- * @param classOverride true to generate the bytecode for the adapter that has both class-level and instance-level
- * overrides, false to generate the bytecode for the adapter that only has instance-level overrides.
+ * @param classOverride true to generate the bytecode for the adapter that has class-level overrides, false to
+ * generate the bytecode for the adapter that has instance-level overrides.
* @throws AdaptationException if the adapter can not be generated for some reason.
*/
JavaAdapterBytecodeGenerator(final Class> superClass, final List> interfaces,
@@ -230,8 +238,7 @@ final class JavaAdapterBytecodeGenerator {
superClassName = Type.getInternalName(superClass);
generatedClassName = getGeneratedClassName(superClass, interfaces);
- cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, generatedClassName, null, superClassName, getInternalTypeNames(interfaces));
-
+ cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER, generatedClassName, null, superClassName, getInternalTypeNames(interfaces));
generateGlobalFields();
gatherMethods(superClass);
@@ -244,17 +251,16 @@ final class JavaAdapterBytecodeGenerator {
generateConstructors();
generateMethods();
generateSuperMethods();
+ if (hasExplicitFinalizer) {
+ generateFinalizerMethods();
+ }
// }
cw.visitEnd();
}
private void generateGlobalFields() {
- cw.visitField(ACC_PRIVATE | ACC_FINAL, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR, null, null).visitEnd();
+ cw.visitField(ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0), GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR, null, null).visitEnd();
usedFieldNames.add(GLOBAL_FIELD_NAME);
- if(classOverride) {
- cw.visitField(ACC_PRIVATE | ACC_FINAL | ACC_STATIC, STATIC_GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR, null, null).visitEnd();
- usedFieldNames.add(STATIC_GLOBAL_FIELD_NAME);
- }
}
JavaAdapterClassLoader createAdapterClassLoader() {
@@ -305,11 +311,9 @@ final class JavaAdapterBytecodeGenerator {
}
private void generateHandleFields() {
+ final int flags = ACC_PRIVATE | ACC_FINAL | (classOverride ? ACC_STATIC : 0);
for (final MethodInfo mi: methodInfos) {
- cw.visitField(ACC_PRIVATE | ACC_FINAL, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR, null, null).visitEnd();
- if(classOverride) {
- cw.visitField(ACC_PRIVATE | ACC_FINAL | ACC_STATIC, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR, null, null).visitEnd();
- }
+ cw.visitField(flags, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR, null, null).visitEnd();
}
}
@@ -337,7 +341,7 @@ final class JavaAdapterBytecodeGenerator {
} else {
mv.visitInsn(ACONST_NULL);
}
- mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
+ mv.putstatic(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
}
initGlobal = new Label();
mv.goTo(initGlobal);
@@ -351,15 +355,15 @@ final class JavaAdapterBytecodeGenerator {
mv.aconst(mi.getName());
mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR, false);
- mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
+ mv.putstatic(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
}
if(initGlobal != null) {
mv.visitLabel(initGlobal);
}
- // Assign "staticGlobal = Context.getGlobal()"
+ // Assign "global = Context.getGlobal()"
invokeGetGlobalWithNullCheck(mv);
- mv.putstatic(generatedClassName, STATIC_GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+ mv.putstatic(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
endInitMethod(mv);
}
@@ -390,21 +394,21 @@ final class JavaAdapterBytecodeGenerator {
// Generate a constructor that just delegates to ctor. This is used with class-level overrides, when we want
// to create instances without further per-instance overrides.
generateDelegatingConstructor(ctor);
- }
+ } else {
+ // Generate a constructor that delegates to ctor, but takes an additional ScriptObject parameter at the
+ // beginning of its parameter list.
+ generateOverridingConstructor(ctor, false);
- // Generate a constructor that delegates to ctor, but takes an additional ScriptObject parameter at the
- // beginning of its parameter list.
- generateOverridingConstructor(ctor, false);
-
- if (samName != null) {
- if (!autoConvertibleFromFunction && ctor.getParameterTypes().length == 0) {
- // If the original type only has a single abstract method name, as well as a default ctor, then it can
- // be automatically converted from JS function.
- autoConvertibleFromFunction = true;
+ if (samName != null) {
+ if (!autoConvertibleFromFunction && ctor.getParameterTypes().length == 0) {
+ // If the original type only has a single abstract method name, as well as a default ctor, then it can
+ // be automatically converted from JS function.
+ autoConvertibleFromFunction = true;
+ }
+ // If all our abstract methods have a single name, generate an additional constructor, one that takes a
+ // ScriptFunction as its first parameter and assigns it as the implementation for all abstract methods.
+ generateOverridingConstructor(ctor, true);
}
- // If all our abstract methods have a single name, generate an additional constructor, one that takes a
- // ScriptFunction as its first parameter and assigns it as the implementation for all abstract methods.
- generateOverridingConstructor(ctor, true);
}
}
@@ -430,7 +434,7 @@ final class JavaAdapterBytecodeGenerator {
}
/**
- * Generates a constructor for the adapter class. This constructor will take the same arguments as the supertype
+ * Generates a constructor for the instance adapter class. This constructor will take the same arguments as the supertype
* constructor passed as the argument here, and delegate to it. However, it will take an additional argument of
* either ScriptObject or ScriptFunction type (based on the value of the "fromFunction" parameter), and initialize
* all the method handle fields of the adapter instance with functions from the script object (or the script
@@ -498,7 +502,7 @@ final class JavaAdapterBytecodeGenerator {
mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor, false);
}
- mv.putfield(generatedClassName, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
+ mv.putfield(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
}
// Assign "this.global = Context.getGlobal()"
@@ -536,8 +540,7 @@ final class JavaAdapterBytecodeGenerator {
private static class MethodInfo {
private final Method method;
private final MethodType type;
- private String methodHandleInstanceFieldName;
- private String methodHandleClassFieldName;
+ private String methodHandleFieldName;
private MethodInfo(final Class> clazz, final String name, final Class>... argTypes) throws NoSuchMethodException {
this(clazz.getDeclaredMethod(name, argTypes));
@@ -567,25 +570,20 @@ final class JavaAdapterBytecodeGenerator {
return getName().hashCode() ^ type.hashCode();
}
- void setIsCanonical(final Set usedFieldNames, boolean classOverride) {
- methodHandleInstanceFieldName = nextName(usedFieldNames);
- if(classOverride) {
- methodHandleClassFieldName = nextName(usedFieldNames);
- }
+ void setIsCanonical(final JavaAdapterBytecodeGenerator self) {
+ methodHandleFieldName = self.nextName(getName());
}
+ }
- String nextName(final Set usedFieldNames) {
- int i = 0;
- final String name = getName();
- String nextName = name;
- while (!usedFieldNames.add(nextName)) {
- final String ordinal = String.valueOf(i++);
- final int maxNameLen = 255 - ordinal.length();
- nextName = (name.length() <= maxNameLen ? name : name.substring(0, maxNameLen)).concat(ordinal);
- }
- return nextName;
+ private String nextName(final String name) {
+ int i = 0;
+ String nextName = name;
+ while (!usedFieldNames.add(nextName)) {
+ final String ordinal = String.valueOf(i++);
+ final int maxNameLen = 255 - ordinal.length();
+ nextName = (name.length() <= maxNameLen ? name : name.substring(0, maxNameLen)).concat(ordinal);
}
-
+ return nextName;
}
private void generateMethods() {
@@ -624,23 +622,19 @@ final class JavaAdapterBytecodeGenerator {
methodDesc, null, exceptionNames));
mv.visitCode();
- final Label instanceHandleDefined = new Label();
- final Label classHandleDefined = new Label();
+ final Label handleDefined = new Label();
final Type asmReturnType = Type.getType(type.returnType());
- // See if we have instance handle defined
- mv.visitVarInsn(ALOAD, 0);
- mv.getfield(generatedClassName, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
- // stack: [instanceHandle]
- jumpIfNonNullKeepOperand(mv, instanceHandleDefined);
-
+ // See if we have overriding method handle defined
if(classOverride) {
- // See if we have the static handle
- mv.getstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
- // stack: [classHandle]
- jumpIfNonNullKeepOperand(mv, classHandleDefined);
+ mv.getstatic(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
+ } else {
+ mv.visitVarInsn(ALOAD, 0);
+ mv.getfield(generatedClassName, mi.methodHandleFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
}
+ // stack: [handle]
+ jumpIfNonNullKeepOperand(mv, handleDefined);
// No handle is available, fall back to default behavior
if(Modifier.isAbstract(method.getModifiers())) {
@@ -654,25 +648,17 @@ final class JavaAdapterBytecodeGenerator {
emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc);
}
- final Label setupGlobal = new Label();
-
+ mv.visitLabel(handleDefined);
+ // Load the creatingGlobal object
if(classOverride) {
- mv.visitLabel(classHandleDefined);
// If class handle is defined, load the static defining global
- mv.getstatic(generatedClassName, STATIC_GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
- // stack: [creatingGlobal := classGlobal, classHandle]
- mv.goTo(setupGlobal);
+ mv.getstatic(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
+ } else {
+ mv.visitVarInsn(ALOAD, 0);
+ mv.getfield(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
}
-
- mv.visitLabel(instanceHandleDefined);
- // If instance handle is defined, load the instance defining global
- mv.visitVarInsn(ALOAD, 0);
- mv.getfield(generatedClassName, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
- // stack: [creatingGlobal := instanceGlobal, instanceHandle]
-
- // fallthrough to setupGlobal
-
- // stack: [creatingGlobal, someHandle]
+ // stack: [creatingGlobal, handle]
+ final Label setupGlobal = new Label();
mv.visitLabel(setupGlobal);
// Determine the first index for a local variable
@@ -685,38 +671,39 @@ final class JavaAdapterBytecodeGenerator {
final int globalsDifferVar = nextLocalVar++;
mv.dup();
- // stack: [creatingGlobal, creatingGlobal, someHandle]
+ // stack: [creatingGlobal, creatingGlobal, handle]
// Emit code for switching to the creating global
// ScriptObject currentGlobal = Context.getGlobal();
invokeGetGlobal(mv);
mv.dup();
+
mv.visitVarInsn(ASTORE, currentGlobalVar);
- // stack: [currentGlobal, creatingGlobal, creatingGlobal, someHandle]
+ // stack: [currentGlobal, creatingGlobal, creatingGlobal, handle]
// if(definingGlobal == currentGlobal) {
final Label globalsDiffer = new Label();
mv.ifacmpne(globalsDiffer);
- // stack: [someGlobal, someHandle]
+ // stack: [creatingGlobal, handle]
// globalsDiffer = false
mv.pop();
- // stack: [someHandle]
+ // stack: [handle]
mv.iconst(0); // false
- // stack: [false, someHandle]
+ // stack: [false, handle]
final Label invokeHandle = new Label();
mv.goTo(invokeHandle);
mv.visitLabel(globalsDiffer);
// } else {
// Context.setGlobal(definingGlobal);
- // stack: [someGlobal, someHandle]
+ // stack: [creatingGlobal, handle]
invokeSetGlobal(mv);
- // stack: [someHandle]
+ // stack: [handle]
// globalsDiffer = true
mv.iconst(1);
- // stack: [true, someHandle]
+ // stack: [true, handle]
mv.visitLabel(invokeHandle);
mv.visitVarInsn(ISTORE, globalsDifferVar);
- // stack: [someHandle]
+ // stack: [handle]
// Load all parameters back on stack for dynamic invocation.
int varOffset = 1;
@@ -835,7 +822,7 @@ final class JavaAdapterBytecodeGenerator {
endMethod(mv);
}
- private void emitSuperCall(final InstructionAdapter mv, final Class owner, final String name, final String methodDesc) {
+ private void emitSuperCall(final InstructionAdapter mv, final Class> owner, final String name, final String methodDesc) {
mv.visitVarInsn(ALOAD, 0);
int nextParam = 1;
final Type methodType = Type.getMethodType(methodDesc);
@@ -853,6 +840,42 @@ final class JavaAdapterBytecodeGenerator {
mv.areturn(methodType.getReturnType());
}
+ private void generateFinalizerMethods() {
+ final String finalizerDelegateName = nextName("access$");
+ generateFinalizerDelegate(finalizerDelegateName);
+ generateFinalizerOverride(finalizerDelegateName);
+ }
+
+ private void generateFinalizerDelegate(final String finalizerDelegateName) {
+ // Generate a delegate that will be invoked from the no-permission trampoline. Note it can be private, as we'll
+ // refer to it with a MethodHandle constant pool entry in the overridden finalize() method (see
+ // generateFinalizerOverride()).
+ final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PRIVATE | ACC_STATIC,
+ finalizerDelegateName, Type.getMethodDescriptor(Type.VOID_TYPE, OBJECT_TYPE), null, null));
+
+ // Simply invoke super.finalize()
+ mv.visitVarInsn(ALOAD, 0);
+ mv.checkcast(Type.getType(generatedClassName));
+ mv.invokespecial(superClassName, "finalize", Type.getMethodDescriptor(Type.VOID_TYPE), false);
+
+ mv.visitInsn(RETURN);
+ endMethod(mv);
+ }
+
+ private void generateFinalizerOverride(final String finalizerDelegateName) {
+ final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC, "finalize",
+ VOID_NOARG_METHOD_DESCRIPTOR, null, null));
+ // Overridden finalizer will take a MethodHandle to the finalizer delegating method, ...
+ mv.aconst(new Handle(Opcodes.H_INVOKESTATIC, generatedClassName, finalizerDelegateName,
+ Type.getMethodDescriptor(Type.VOID_TYPE, OBJECT_TYPE)));
+ mv.visitVarInsn(ALOAD, 0);
+ // ...and invoke it through JavaAdapterServices.invokeNoPermissions
+ mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "invokeNoPermissions",
+ Type.getMethodDescriptor(METHOD_HANDLE_TYPE, OBJECT_TYPE), false);
+ mv.visitInsn(RETURN);
+ endMethod(mv);
+ }
+
private static String[] getExceptionNames(final Class>[] exceptions) {
final String[] exceptionNames = new String[exceptions.length];
for (int i = 0; i < exceptions.length; ++i) {
@@ -873,16 +896,32 @@ final class JavaAdapterBytecodeGenerator {
* class.
* @param type the type defining the methods.
*/
- private void gatherMethods(final Class> type) {
+ private void gatherMethods(final Class> type) throws AdaptationException {
if (Modifier.isPublic(type.getModifiers())) {
final Method[] typeMethods = type.isInterface() ? type.getMethods() : type.getDeclaredMethods();
for (final Method typeMethod: typeMethods) {
+ final String name = typeMethod.getName();
+ if(name.startsWith(SUPER_PREFIX)) {
+ continue;
+ }
final int m = typeMethod.getModifiers();
if (Modifier.isStatic(m)) {
continue;
}
if (Modifier.isPublic(m) || Modifier.isProtected(m)) {
+ // Is it a "finalize()"?
+ if(name.equals("finalize") && typeMethod.getParameterCount() == 0) {
+ if(type != Object.class) {
+ hasExplicitFinalizer = true;
+ if(Modifier.isFinal(m)) {
+ // Must be able to override an explicit finalizer
+ throw new AdaptationException(Outcome.ERROR_FINAL_FINALIZER, type.getCanonicalName());
+ }
+ }
+ continue;
+ }
+
final MethodInfo mi = new MethodInfo(typeMethod);
if (Modifier.isFinal(m) || isCallerSensitive(typeMethod)) {
finalMethods.add(mi);
@@ -890,7 +929,7 @@ final class JavaAdapterBytecodeGenerator {
if (Modifier.isAbstract(m)) {
abstractMethodNames.add(mi.getName());
}
- mi.setIsCanonical(usedFieldNames, classOverride);
+ mi.setIsCanonical(this);
}
}
}
@@ -911,7 +950,7 @@ final class JavaAdapterBytecodeGenerator {
}
}
- private void gatherMethods(final List> classes) {
+ private void gatherMethods(final List> classes) throws AdaptationException {
for(final Class> c: classes) {
gatherMethods(c);
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java
index 0062cd5f893..fa162d88d47 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java
@@ -27,10 +27,6 @@ package jdk.nashorn.internal.runtime.linker;
import java.security.AccessControlContext;
import java.security.AccessController;
-import java.security.AllPermission;
-import java.security.CodeSigner;
-import java.security.CodeSource;
-import java.security.Permissions;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.security.SecureClassLoader;
@@ -45,35 +41,29 @@ import jdk.internal.dynalink.beans.StaticClass;
*/
@SuppressWarnings("javadoc")
final class JavaAdapterClassLoader {
- private static final ProtectionDomain GENERATED_PROTECTION_DOMAIN = createGeneratedProtectionDomain();
private static final AccessControlContext CREATE_LOADER_ACC_CTXT = ClassAndLoader.createPermAccCtxt("createClassLoader");
private final String className;
- private volatile byte[] classBytes;
+ private final byte[] classBytes;
JavaAdapterClassLoader(String className, byte[] classBytes) {
this.className = className.replace('/', '.');
this.classBytes = classBytes;
}
- /**
- * clear classBytes after loading class.
- */
- void clearClassBytes() {
- this.classBytes = null;
- }
-
/**
* Loads the generated adapter class into the JVM.
* @param parentLoader the parent class loader for the generated class loader
+ * @param protectionDomain the protection domain for the generated class
* @return the generated adapter class
*/
- StaticClass generateClass(final ClassLoader parentLoader) {
+ StaticClass generateClass(final ClassLoader parentLoader, final ProtectionDomain protectionDomain) {
+ assert protectionDomain != null;
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
public StaticClass run() {
try {
- return StaticClass.forClass(Class.forName(className, true, createClassLoader(parentLoader)));
+ return StaticClass.forClass(Class.forName(className, true, createClassLoader(parentLoader, protectionDomain)));
} catch (final ClassNotFoundException e) {
throw new AssertionError(e); // cannot happen
}
@@ -88,7 +78,7 @@ final class JavaAdapterClassLoader {
// it even more by separating its invocation into a separate static method on the adapter class, but then someone
// with ability to introspect on the class and use setAccessible(true) on it could invoke the method. It's a
// security tradeoff...
- private ClassLoader createClassLoader(final ClassLoader parentLoader) {
+ private ClassLoader createClassLoader(final ClassLoader parentLoader, final ProtectionDomain protectionDomain) {
return new SecureClassLoader(parentLoader) {
private final ClassLoader myLoader = getClass().getClassLoader();
@@ -112,21 +102,10 @@ final class JavaAdapterClassLoader {
protected Class> findClass(final String name) throws ClassNotFoundException {
if(name.equals(className)) {
assert classBytes != null : "what? already cleared .class bytes!!";
- return defineClass(name, classBytes, 0, classBytes.length, GENERATED_PROTECTION_DOMAIN);
+ return defineClass(name, classBytes, 0, classBytes.length, protectionDomain);
}
throw new ClassNotFoundException(name);
}
};
}
-
- private static ProtectionDomain createGeneratedProtectionDomain() {
- // Generated classes need to have AllPermission. Since we require the "createClassLoader" RuntimePermission, we
- // can create a class loader that'll load new classes with any permissions. Our generated classes are just
- // delegating adapters, so having AllPermission can't cause anything wrong; the effective set of permissions for
- // the executing script functions will still be limited by the permissions of the caller and the permissions of
- // the script.
- final Permissions permissions = new Permissions();
- permissions.add(new AllPermission());
- return new ProtectionDomain(new CodeSource(null, (CodeSigner[])null), permissions);
- }
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
index ccb2c87982e..5e0b890a6d2 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
@@ -29,17 +29,23 @@ import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
import java.lang.invoke.MethodType;
import java.lang.reflect.Modifier;
import java.security.AccessControlContext;
import java.security.AccessController;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.Permissions;
import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import jdk.internal.dynalink.beans.StaticClass;
import jdk.internal.dynalink.support.LinkRequestImpl;
import jdk.nashorn.internal.objects.NativeJava;
@@ -70,6 +76,8 @@ import jdk.nashorn.internal.runtime.ScriptObject;
@SuppressWarnings("javadoc")
public final class JavaAdapterFactory {
+ private static final ProtectionDomain MINIMAL_PERMISSION_DOMAIN = createMinimalPermissionDomain();
+
// context with permissions needs for AdapterInfo creation
private static final AccessControlContext CREATE_ADAPTER_INFO_ACC_CTXT =
ClassAndLoader.createPermAccCtxt("createClassLoader", "getClassLoader",
@@ -99,11 +107,18 @@ public final class JavaAdapterFactory {
* @param classOverrides a JavaScript object with functions serving as the class-level overrides and
* implementations. These overrides are defined for all instances of the class, and can be further overridden on a
* per-instance basis by passing additional objects in the constructor.
+ * @param lookup the lookup object identifying the caller class. The generated adapter class will have the
+ * protection domain of the caller class iff the lookup object is full-strength, otherwise it will be completely
+ * unprivileged.
* @return an adapter class. See this class' documentation for details on the generated adapter class.
* @throws ECMAException with a TypeError if the adapter class can not be generated because the original class is
* final, non-public, or has no public or protected constructors.
*/
- public static StaticClass getAdapterClassFor(final Class>[] types, ScriptObject classOverrides) {
+ public static StaticClass getAdapterClassFor(final Class>[] types, ScriptObject classOverrides, final MethodHandles.Lookup lookup) {
+ return getAdapterClassFor(types, classOverrides, getProtectionDomain(lookup));
+ }
+
+ private static StaticClass getAdapterClassFor(final Class>[] types, ScriptObject classOverrides, final ProtectionDomain protectionDomain) {
assert types != null && types.length > 0;
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -114,7 +129,23 @@ public final class JavaAdapterFactory {
ReflectionCheckLinker.checkReflectionAccess(type, true);
}
}
- return getAdapterInfo(types).getAdapterClassFor(classOverrides);
+ return getAdapterInfo(types).getAdapterClass(classOverrides, protectionDomain);
+ }
+
+ private static ProtectionDomain getProtectionDomain(final MethodHandles.Lookup lookup) {
+ if((lookup.lookupModes() & Lookup.PRIVATE) == 0) {
+ return MINIMAL_PERMISSION_DOMAIN;
+ }
+ return getProtectionDomain(lookup.lookupClass());
+ }
+
+ private static ProtectionDomain getProtectionDomain(final Class> clazz) {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public ProtectionDomain run() {
+ return clazz.getProtectionDomain();
+ }
+ });
}
/**
@@ -129,10 +160,10 @@ public final class JavaAdapterFactory {
* @return the constructor method handle.
* @throws Exception if anything goes wrong
*/
- public static MethodHandle getConstructor(final Class> sourceType, final Class> targetType) throws Exception {
- final StaticClass adapterClass = getAdapterClassFor(new Class>[] { targetType }, null);
+ public static MethodHandle getConstructor(final Class> sourceType, final Class> targetType, final MethodHandles.Lookup lookup) throws Exception {
+ final StaticClass adapterClass = getAdapterClassFor(new Class>[] { targetType }, null, lookup);
return MH.bindTo(Bootstrap.getLinkerServices().getGuardedInvocation(new LinkRequestImpl(
- NashornCallSiteDescriptor.get(MethodHandles.publicLookup(), "dyn:new",
+ NashornCallSiteDescriptor.get(lookup, "dyn:new",
MethodType.methodType(targetType, StaticClass.class, sourceType), 0), false,
adapterClass, null)).getInvocation(), adapterClass);
}
@@ -220,10 +251,10 @@ public final class JavaAdapterFactory {
private static final ClassAndLoader SCRIPT_OBJECT_LOADER = new ClassAndLoader(ScriptObject.class, true);
private final ClassLoader commonLoader;
- private final JavaAdapterClassLoader adapterGenerator;
- // Cacheable adapter class that is shared by all adapter instances that don't have class overrides, only
- // instance overrides.
- final StaticClass instanceAdapterClass;
+ // TODO: soft reference the JavaAdapterClassLoader objects. They can be recreated when needed.
+ private final JavaAdapterClassLoader classAdapterGenerator;
+ private final JavaAdapterClassLoader instanceAdapterGenerator;
+ private final Map instanceAdapters = new ConcurrentHashMap<>();
final boolean autoConvertibleFromFunction;
final AdaptationResult adaptationResult;
@@ -231,11 +262,8 @@ public final class JavaAdapterFactory {
this.commonLoader = findCommonLoader(definingLoader);
final JavaAdapterBytecodeGenerator gen = new JavaAdapterBytecodeGenerator(superClass, interfaces, commonLoader, false);
this.autoConvertibleFromFunction = gen.isAutoConvertibleFromFunction();
- final JavaAdapterClassLoader jacl = gen.createAdapterClassLoader();
- this.instanceAdapterClass = jacl.generateClass(commonLoader);
- // loaded Class - no need to keep class bytes around
- jacl.clearClassBytes();
- this.adapterGenerator = new JavaAdapterBytecodeGenerator(superClass, interfaces, commonLoader, true).createAdapterClassLoader();
+ instanceAdapterGenerator = gen.createAdapterClassLoader();
+ this.classAdapterGenerator = new JavaAdapterBytecodeGenerator(superClass, interfaces, commonLoader, true).createAdapterClassLoader();
this.adaptationResult = AdaptationResult.SUCCESSFUL_RESULT;
}
@@ -245,22 +273,42 @@ public final class JavaAdapterFactory {
AdapterInfo(final AdaptationResult adaptationResult) {
this.commonLoader = null;
- this.adapterGenerator = null;
- this.instanceAdapterClass = null;
+ this.classAdapterGenerator = null;
+ this.instanceAdapterGenerator = null;
this.autoConvertibleFromFunction = false;
this.adaptationResult = adaptationResult;
}
- StaticClass getAdapterClassFor(ScriptObject classOverrides) {
+ StaticClass getAdapterClass(final ScriptObject classOverrides, final ProtectionDomain protectionDomain) {
if(adaptationResult.getOutcome() != AdaptationResult.Outcome.SUCCESS) {
throw adaptationResult.typeError();
}
- if(classOverrides == null) {
+ return classOverrides == null ? getInstanceAdapterClass(protectionDomain) :
+ getClassAdapterClass(classOverrides, protectionDomain);
+ }
+
+ private StaticClass getInstanceAdapterClass(final ProtectionDomain protectionDomain) {
+ CodeSource codeSource = protectionDomain.getCodeSource();
+ if(codeSource == null) {
+ codeSource = MINIMAL_PERMISSION_DOMAIN.getCodeSource();
+ }
+ StaticClass instanceAdapterClass = instanceAdapters.get(codeSource);
+ if(instanceAdapterClass != null) {
return instanceAdapterClass;
}
+ // Any "unknown source" code source will default to no permission domain.
+ final ProtectionDomain effectiveDomain = codeSource.equals(MINIMAL_PERMISSION_DOMAIN.getCodeSource()) ?
+ MINIMAL_PERMISSION_DOMAIN : protectionDomain;
+
+ instanceAdapterClass = instanceAdapterGenerator.generateClass(commonLoader, effectiveDomain);
+ final StaticClass existing = instanceAdapters.putIfAbsent(codeSource, instanceAdapterClass);
+ return existing == null ? instanceAdapterClass : existing;
+ }
+
+ private StaticClass getClassAdapterClass(final ScriptObject classOverrides, final ProtectionDomain protectionDomain) {
JavaAdapterServices.setClassOverrides(classOverrides);
try {
- return adapterGenerator.generateClass(commonLoader);
+ return classAdapterGenerator.generateClass(commonLoader, protectionDomain);
} finally {
JavaAdapterServices.setClassOverrides(null);
}
@@ -285,4 +333,12 @@ public final class JavaAdapterFactory {
throw new AdaptationException(AdaptationResult.Outcome.ERROR_NO_COMMON_LOADER, classAndLoader.getRepresentativeClass().getCanonicalName());
}
}
+
+ private static ProtectionDomain createMinimalPermissionDomain() {
+ // Generated classes need to have at least the permission to access Nashorn runtime and runtime.linker packages.
+ final Permissions permissions = new Permissions();
+ permissions.add(new RuntimePermission("accessClassInPackage.jdk.nashorn.internal.runtime"));
+ permissions.add(new RuntimePermission("accessClassInPackage.jdk.nashorn.internal.runtime.linker"));
+ return new ProtectionDomain(new CodeSource(null, (CodeSigner[])null), permissions);
+ }
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java
index 06ae1b1109b..1188c6b6f73 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java
@@ -25,10 +25,28 @@
package jdk.nashorn.internal.runtime.linker;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
+import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
+import java.security.AccessController;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.security.SecureClassLoader;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.org.objectweb.asm.Type;
+import jdk.internal.org.objectweb.asm.commons.InstructionAdapter;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
@@ -40,6 +58,7 @@ import jdk.nashorn.internal.runtime.Undefined;
*/
public final class JavaAdapterServices {
private static final ThreadLocal classOverrides = new ThreadLocal<>();
+ private static final MethodHandle NO_PERMISSIONS_INVOKER = createNoPermissionsInvoker();
private JavaAdapterServices() {
}
@@ -55,7 +74,7 @@ public final class JavaAdapterServices {
*/
public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type) {
// JS "this" will be global object or undefined depending on if 'fn' is strict or not
- return adaptHandle(fn.getBoundInvokeHandle(fn.isStrict()? ScriptRuntime.UNDEFINED : Context.getGlobal()), type);
+ return bindAndAdaptHandle(fn, fn.isStrict()? ScriptRuntime.UNDEFINED : Context.getGlobal(), type);
}
/**
@@ -83,7 +102,7 @@ public final class JavaAdapterServices {
final Object fnObj = sobj.get(name);
if (fnObj instanceof ScriptFunction) {
- return adaptHandle(((ScriptFunction)fnObj).getBoundInvokeHandle(sobj), type);
+ return bindAndAdaptHandle((ScriptFunction)fnObj, sobj, type);
} else if(fnObj == null || fnObj instanceof Undefined) {
return null;
} else {
@@ -103,11 +122,67 @@ public final class JavaAdapterServices {
return overrides;
}
+ /**
+ * Takes a method handle and an argument to it, and invokes the method handle passing it the argument. Basically
+ * equivalent to {@code method.invokeExact(arg)}, except that the method handle will be invoked in a protection
+ * domain with absolutely no permissions.
+ * @param method the method handle to invoke. The handle must have the exact type of {@code void(Object)}.
+ * @param arg the argument to pass to the handle.
+ * @throws Throwable if anything goes wrong.
+ */
+ public static void invokeNoPermissions(final MethodHandle method, final Object arg) throws Throwable {
+ NO_PERMISSIONS_INVOKER.invokeExact(method, arg);
+ }
+
static void setClassOverrides(ScriptObject overrides) {
classOverrides.set(overrides);
}
- private static MethodHandle adaptHandle(final MethodHandle handle, final MethodType type) {
- return Bootstrap.getLinkerServices().asType(ScriptObject.pairArguments(handle, type, false), type);
+ private static MethodHandle bindAndAdaptHandle(final ScriptFunction fn, final Object self, final MethodType type) {
+ return Bootstrap.getLinkerServices().asType(ScriptObject.pairArguments(fn.getBoundInvokeHandle(self), type, false), type);
+ }
+
+ private static MethodHandle createNoPermissionsInvoker() {
+ final String className = "NoPermissionsInvoker";
+
+ final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
+ cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, className, null, "java/lang/Object", null);
+ final Type objectType = Type.getType(Object.class);
+ final Type methodHandleType = Type.getType(MethodHandle.class);
+ final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "invoke",
+ Type.getMethodDescriptor(Type.VOID_TYPE, methodHandleType, objectType), null, null));
+ mv.visitCode();
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitVarInsn(ALOAD, 1);
+ mv.invokevirtual(methodHandleType.getInternalName(), "invokeExact", Type.getMethodDescriptor(
+ Type.VOID_TYPE, objectType), false);
+ mv.visitInsn(RETURN);
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+ cw.visitEnd();
+ final byte[] bytes = cw.toByteArray();
+
+ final ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public ClassLoader run() {
+ return new SecureClassLoader(null) {
+ @Override
+ protected Class> findClass(String name) throws ClassNotFoundException {
+ if(name.equals(className)) {
+ return defineClass(name, bytes, 0, bytes.length, new ProtectionDomain(
+ new CodeSource(null, (CodeSigner[])null), new Permissions()));
+ }
+ throw new ClassNotFoundException(name);
+ }
+ };
+ }
+ });
+
+ try {
+ return MethodHandles.lookup().findStatic(Class.forName(className, true, loader), "invoke",
+ MethodType.methodType(void.class, MethodHandle.class, Object.class));
+ } catch(ReflectiveOperationException e) {
+ throw new AssertionError(e.getMessage(), e);
+ }
}
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
index c94df15b192..88ccf5a4847 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
@@ -25,19 +25,20 @@
package jdk.nashorn.internal.runtime.linker;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.Map;
import java.util.HashMap;
+import java.util.Map;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.beans.BeansLinker;
import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardedTypeConversion;
import jdk.internal.dynalink.linker.GuardingDynamicLinker;
import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
import jdk.internal.dynalink.linker.LinkRequest;
@@ -134,9 +135,9 @@ final class NashornBottomLinker implements GuardingDynamicLinker, GuardingTypeCo
}
@Override
- public GuardedInvocation convertToType(final Class> sourceType, final Class> targetType) throws Exception {
+ public GuardedTypeConversion convertToType(final Class> sourceType, final Class> targetType) throws Exception {
final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType);
- return gi == null ? null : gi.asType(MH.type(targetType, sourceType));
+ return gi == null ? null : new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true);
}
/**
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java
index 27e4573f572..0ac5f9a56e5 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java
@@ -29,7 +29,10 @@ import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Deque;
import java.util.List;
import java.util.Map;
@@ -37,16 +40,17 @@ import javax.script.Bindings;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.ConversionComparator;
import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardedTypeConversion;
import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
import jdk.internal.dynalink.linker.LinkRequest;
import jdk.internal.dynalink.linker.LinkerServices;
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.internal.dynalink.support.Guards;
+import jdk.internal.dynalink.support.LinkerServicesImpl;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import jdk.nashorn.api.scripting.ScriptUtils;
import jdk.nashorn.internal.objects.NativeArray;
-import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.JSType;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
@@ -100,9 +104,16 @@ final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTyp
}
@Override
- public GuardedInvocation convertToType(final Class> sourceType, final Class> targetType) throws Exception {
- final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType);
- return gi == null ? null : gi.asType(MH.type(targetType, sourceType));
+ public GuardedTypeConversion convertToType(final Class> sourceType, final Class> targetType) throws Exception {
+ GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType);
+ if(gi != null) {
+ return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true);
+ }
+ gi = getSamTypeConverter(sourceType, targetType);
+ if(gi != null) {
+ return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), false);
+ }
+ return null;
}
/**
@@ -126,12 +137,7 @@ final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTyp
return arrayConverter;
}
- final GuardedInvocation mirrorConverter = getMirrorConverter(sourceType, targetType);
- if(mirrorConverter != null) {
- return mirrorConverter;
- }
-
- return getSamTypeConverter(sourceType, targetType);
+ return getMirrorConverter(sourceType, targetType);
}
/**
@@ -150,13 +156,23 @@ final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTyp
final boolean isSourceTypeGeneric = sourceType.isAssignableFrom(ScriptFunction.class);
if ((isSourceTypeGeneric || ScriptFunction.class.isAssignableFrom(sourceType)) && isAutoConvertibleFromFunction(targetType)) {
- final MethodHandle ctor = JavaAdapterFactory.getConstructor(ScriptFunction.class, targetType);
+ final MethodHandle ctor = JavaAdapterFactory.getConstructor(ScriptFunction.class, targetType, getCurrentLookup());
assert ctor != null; // if isAutoConvertibleFromFunction() returned true, then ctor must exist.
return new GuardedInvocation(ctor, isSourceTypeGeneric ? IS_SCRIPT_FUNCTION : null);
}
return null;
}
+ private static Lookup getCurrentLookup() {
+ final LinkRequest currentRequest = AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public LinkRequest run() {
+ return LinkerServicesImpl.getCurrentLinkRequest();
+ }
+ });
+ return currentRequest == null ? MethodHandles.publicLookup() : currentRequest.getCallSiteDescriptor().getLookup();
+ }
+
/**
* Returns a guarded invocation that converts from a source type that is NativeArray to a Java array or List or
* Deque type.
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java
index ccd95fda642..5cc1cd2c632 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java
@@ -31,6 +31,7 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import jdk.internal.dynalink.linker.ConversionComparator;
import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardedTypeConversion;
import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
import jdk.internal.dynalink.linker.LinkRequest;
import jdk.internal.dynalink.linker.LinkerServices;
@@ -75,13 +76,13 @@ final class NashornPrimitiveLinker implements TypeBasedGuardingDynamicLinker, Gu
* @return a conditional converter from source to target type
*/
@Override
- public GuardedInvocation convertToType(final Class> sourceType, final Class> targetType) {
+ public GuardedTypeConversion convertToType(final Class> sourceType, final Class> targetType) {
final MethodHandle mh = JavaArgumentConverters.getConverter(targetType);
if (mh == null) {
return null;
}
- return new GuardedInvocation(mh, canLinkTypeStatic(sourceType) ? null : GUARD_PRIMITIVE).asType(mh.type().changeParameterType(0, sourceType));
+ return new GuardedTypeConversion(new GuardedInvocation(mh, canLinkTypeStatic(sourceType) ? null : GUARD_PRIMITIVE).asType(mh.type().changeParameterType(0, sourceType)), true);
}
/**
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java
index 21e2d14eb4e..272b4ec0ac4 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java
@@ -76,7 +76,8 @@ final class NashornStaticClassLinker implements TypeBasedGuardingDynamicLinker {
if (NashornLinker.isAbstractClass(receiverClass)) {
// Change this link request into a link request on the adapter class.
final Object[] args = request.getArguments();
- args[0] = JavaAdapterFactory.getAdapterClassFor(new Class>[] { receiverClass }, null);
+ args[0] = JavaAdapterFactory.getAdapterClassFor(new Class>[] { receiverClass }, null,
+ linkRequest.getCallSiteDescriptor().getLookup());
final LinkRequest adapterRequest = request.replaceArguments(request.getCallSiteDescriptor(), args);
final GuardedInvocation gi = checkNullConstructor(delegate(linkerServices, adapterRequest), receiverClass);
// Finally, modify the guard to test for the original abstract class.
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
index 1a37ba7bf76..95993c9f40e 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -130,6 +130,7 @@ type.error.extend.ERROR_NON_PUBLIC_CLASS=Can not extend/implement non-public cla
type.error.extend.ERROR_NO_ACCESSIBLE_CONSTRUCTOR=Can not extend class {0} as it has no public or protected constructors.
type.error.extend.ERROR_MULTIPLE_SUPERCLASSES=Can not extend multiple classes {0}. At most one of the specified types can be a class, the rest must all be interfaces.
type.error.extend.ERROR_NO_COMMON_LOADER=Can not find a common class loader for ScriptObject and {0}.
+type.error.extend.ERROR_FINAL_FINALIZER=Can not extend class because {0} has a final finalize method.
type.error.no.constructor.matches.args=Can not construct {0} with the passed arguments; they do not match any of its constructor signatures.
type.error.no.method.matches.args=Can not invoke method {0} with the passed arguments; they do not match any of its method signatures.
type.error.method.not.constructor=Java method {0} can't be used as a constructor.
diff --git a/nashorn/test/script/basic/JDK-8014647.js b/nashorn/test/script/basic/JDK-8014647.js
index 8ecc21101d5..8d06848f557 100644
--- a/nashorn/test/script/basic/JDK-8014647.js
+++ b/nashorn/test/script/basic/JDK-8014647.js
@@ -32,9 +32,10 @@ var RunnableImpl1 = Java.extend(java.lang.Runnable, function() { print("I'm runn
var RunnableImpl2 = Java.extend(java.lang.Runnable, function() { print("I'm runnable 2!") })
var r1 = new RunnableImpl1()
var r2 = new RunnableImpl2()
-var r3 = new RunnableImpl2(function() { print("I'm runnable 3!") })
+var RunnableImpl3 = Java.extend(RunnableImpl2);
+var r3 = new RunnableImpl3({ run: function() { print("I'm runnable 3!") }})
r1.run()
r2.run()
r3.run()
-print("r1.class === r2.class: " + (r1.class === r2.class))
-print("r2.class === r3.class: " + (r2.class === r3.class))
+print("r1.class !== r2.class: " + (r1.class !== r2.class))
+print("r2.class !== r3.class: " + (r2.class !== r3.class))
diff --git a/nashorn/test/script/basic/JDK-8014647.js.EXPECTED b/nashorn/test/script/basic/JDK-8014647.js.EXPECTED
index 641a13b1d45..f4f51dcc38f 100644
--- a/nashorn/test/script/basic/JDK-8014647.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8014647.js.EXPECTED
@@ -1,5 +1,5 @@
I'm runnable 1!
I'm runnable 2!
I'm runnable 3!
-r1.class === r2.class: false
-r2.class === r3.class: true
+r1.class !== r2.class: true
+r2.class !== r3.class: true
diff --git a/nashorn/test/script/basic/javaclassoverrides.js b/nashorn/test/script/basic/javaclassoverrides.js
index e7ad61d841f..2fa7a85720d 100644
--- a/nashorn/test/script/basic/javaclassoverrides.js
+++ b/nashorn/test/script/basic/javaclassoverrides.js
@@ -46,7 +46,8 @@ var R2 = Java.extend(java.lang.Runnable, {
var r1 = new R1
var r2 = new R2
// Create one with an instance-override too
-var r3 = new R2(function() { print("r3.run() invoked") })
+var R3 = Java.extend(R2)
+var r3 = new R3({ run: function() { print("r3.run() invoked") }})
// Run 'em - we're passing them through a Thread to make sure they indeed
// are full-blown Runnables
@@ -60,9 +61,9 @@ runInThread(r2)
runInThread(r3)
// Two class-override classes differ
-print("r1.class != r2.class: " + (r1.class != r2.class))
-// However, adding instance-overrides doesn't change the class
-print("r2.class == r3.class: " + (r2.class == r3.class))
+print("r1.class !== r2.class: " + (r1.class !== r2.class))
+// instance-override class also differs
+print("r2.class !== r3.class: " + (r2.class !== r3.class))
function checkAbstract(r) {
try {
@@ -77,10 +78,10 @@ function checkAbstract(r) {
// overrides nor instance overrides are present
var RAbstract = Java.extend(java.lang.Runnable, {})
checkAbstract(new RAbstract()) // class override (empty)
-checkAbstract(new RAbstract() {}) // class+instance override (empty)
+checkAbstract(new (Java.extend(RAbstract))() {}) // class+instance override (empty)
// Check we delegate to superclass if neither class
// overrides nor instance overrides are present
var ExtendsList = Java.extend(java.util.ArrayList, {})
print("(new ExtendsList).size() = " + (new ExtendsList).size())
-print("(new ExtendsList(){}).size() = " + (new ExtendsList(){}).size())
\ No newline at end of file
+print("(new (Java.extend(ExtendsList)){}).size() = " + (new (Java.extend(ExtendsList)){}).size())
diff --git a/nashorn/test/script/basic/javaclassoverrides.js.EXPECTED b/nashorn/test/script/basic/javaclassoverrides.js.EXPECTED
index 6c534302d48..ceec09cff85 100644
--- a/nashorn/test/script/basic/javaclassoverrides.js.EXPECTED
+++ b/nashorn/test/script/basic/javaclassoverrides.js.EXPECTED
@@ -1,9 +1,9 @@
R1.run() invoked
R2.run() invoked
r3.run() invoked
-r1.class != r2.class: true
-r2.class == r3.class: true
+r1.class !== r2.class: true
+r2.class !== r3.class: true
Got exception: java.lang.UnsupportedOperationException
Got exception: java.lang.UnsupportedOperationException
(new ExtendsList).size() = 0
-(new ExtendsList(){}).size() = 0
+(new (Java.extend(ExtendsList)){}).size() = 0
diff --git a/nashorn/test/script/sandbox/javaextend.js b/nashorn/test/script/sandbox/javaextend.js
index 33cc6b01fa0..60eab74d14c 100644
--- a/nashorn/test/script/sandbox/javaextend.js
+++ b/nashorn/test/script/sandbox/javaextend.js
@@ -51,6 +51,21 @@ try {
print(e)
}
+// Can't extend a class with explicit non-overridable finalizer
+try {
+ Java.extend(model("ClassWithFinalFinalizer"))
+} catch(e) {
+ print(e)
+}
+
+// Can't extend a class with inherited non-overridable finalizer
+try {
+ Java.extend(model("ClassWithInheritedFinalFinalizer"))
+} catch(e) {
+ print(e)
+}
+
+
// Can't extend two classes
try {
Java.extend(java.lang.Thread,java.lang.Number)
diff --git a/nashorn/test/script/sandbox/javaextend.js.EXPECTED b/nashorn/test/script/sandbox/javaextend.js.EXPECTED
index 69c7818929c..c72774595e8 100644
--- a/nashorn/test/script/sandbox/javaextend.js.EXPECTED
+++ b/nashorn/test/script/sandbox/javaextend.js.EXPECTED
@@ -1,6 +1,8 @@
TypeError: Can not extend final class jdk.nashorn.test.models.FinalClass.
TypeError: Can not extend class jdk.nashorn.test.models.NoAccessibleConstructorClass as it has no public or protected constructors.
TypeError: Can not extend/implement non-public class/interface jdk.nashorn.test.models.NonPublicClass.
+TypeError: Can not extend class because jdk.nashorn.test.models.ClassWithFinalFinalizer has a final finalize method.
+TypeError: Can not extend class because jdk.nashorn.test.models.ClassWithFinalFinalizer has a final finalize method.
TypeError: Can not extend multiple classes java.lang.Number and java.lang.Thread. At most one of the specified types can be a class, the rest must all be interfaces.
abcdabcd
run-object
diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java
index 9cea21ba2f5..6d0d40f6042 100644
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java
@@ -33,8 +33,8 @@ import java.lang.reflect.Proxy;
import java.util.Objects;
import javax.script.Invocable;
import javax.script.ScriptEngine;
-import javax.script.ScriptException;
import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
import org.testng.annotations.Test;
/**
@@ -130,6 +130,23 @@ public class ScriptEngineSecurityTest {
}
}
+
+ @Test
+ public void securitySystemExitFromFinalizerThread() throws ScriptException {
+ if (System.getSecurityManager() == null) {
+ // pass vacuously
+ return;
+ }
+
+ final ScriptEngineManager m = new ScriptEngineManager();
+ final ScriptEngine e = m.getEngineByName("nashorn");
+ e.eval("var o = Java.extend(Java.type('javax.imageio.spi.ServiceRegistry'), { deregisterAll: this.exit.bind(null, 1234)});\n" +
+ "new o(new java.util.ArrayList().iterator())");
+ System.gc();
+ System.runFinalization();
+ // NOTE: this test just exits the VM if it fails.
+ }
+
@Test
public void securitySystemLoadLibrary() {
if (System.getSecurityManager() == null) {
diff --git a/nashorn/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java b/nashorn/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java
new file mode 100644
index 00000000000..ba0d86d8a96
--- /dev/null
+++ b/nashorn/test/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+package jdk.nashorn.test.models;
+
+public class ClassWithFinalFinalizer {
+ protected final void finalize() {
+ }
+}
diff --git a/nashorn/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java b/nashorn/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java
new file mode 100644
index 00000000000..80393fbbe2b
--- /dev/null
+++ b/nashorn/test/src/jdk/nashorn/test/models/ClassWithInheritedFinalFinalizer.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+package jdk.nashorn.test.models;
+
+public class ClassWithInheritedFinalFinalizer extends ClassWithFinalFinalizer {
+}
From 30e97838505eafa1a970716718249c7b497b103f Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons
Date: Thu, 30 Jan 2014 17:46:25 -0800
Subject: [PATCH 082/159] 8033180: An inappropriate newline symbol in the help
section
Reviewed-by: ksrini
---
.../com/sun/tools/javap/JavapTask.java | 16 ++--
langtools/test/tools/javap/T8033180.java | 88 +++++++++++++++++++
2 files changed, 99 insertions(+), 5 deletions(-)
create mode 100644 langtools/test/tools/javap/T8033180.java
diff --git a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
index 57284a4c003..6033433d40e 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
@@ -430,7 +430,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
} catch (BadArgs e) {
reportError(e.key, e.args);
if (e.showUsage) {
- log.println(getMessage("main.usage.summary", progname));
+ printLines(getMessage("main.usage.summary", progname));
}
return EXIT_CMDERR;
} catch (InternalError e) {
@@ -839,27 +839,33 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
}
private void showHelp() {
- log.println(getMessage("main.usage", progname));
+ printLines(getMessage("main.usage", progname));
for (Option o: recognizedOptions) {
String name = o.aliases[0].substring(1); // there must always be at least one name
if (name.startsWith("X") || name.equals("fullversion") || name.equals("h") || name.equals("verify"))
continue;
- log.println(getMessage("main.opt." + name));
+ printLines(getMessage("main.opt." + name));
}
String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" };
for (String o: fmOptions) {
if (fileManager.isSupportedOption(o) == -1)
continue;
String name = o.substring(1);
- log.println(getMessage("main.opt." + name));
+ printLines(getMessage("main.opt." + name));
}
}
private void showVersion(boolean full) {
- log.println(version(full ? "full" : "release"));
+ printLines(version(full ? "full" : "release"));
}
+ private void printLines(String msg) {
+ log.println(msg.replace("\n", nl));
+ }
+
+ private static final String nl = System.getProperty("line.separator");
+
private static final String versionRBName = "com.sun.tools.javap.resources.version";
private static ResourceBundle versionRB;
diff --git a/langtools/test/tools/javap/T8033180.java b/langtools/test/tools/javap/T8033180.java
new file mode 100644
index 00000000000..e7840eaf03f
--- /dev/null
+++ b/langtools/test/tools/javap/T8033180.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8033180
+ * @summary Bad newline characters
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class T8033180 {
+
+ public static void main(String... args) throws Exception {
+ new T8033180().run();
+ }
+
+ void run() throws Exception {
+ // fast-track this case, because test cannot fail in this case
+ if (lineSep.equals(nl))
+ return;
+
+ test("-help");
+ test("-version");
+
+ if (errors > 0)
+ throw new Exception(errors + " errors occurred");
+ }
+
+ static final String lineSep = System.getProperty("line.separator");
+ static final String nl = "\n";
+
+ void test(String... opts) throws Exception {
+ System.err.println("test " + Arrays.asList(opts));
+ List args = new ArrayList();
+ args.addAll(Arrays.asList(opts));
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ int rc = com.sun.tools.javap.Main.run(args.toArray(new String[args.size()]), pw);
+ pw.close();
+ String out = sw.toString();
+ if (rc != 0)
+ throw new Exception("javap failed unexpectedly: rc=" + rc);
+
+ // remove all valid platform newline sequences
+ String out2 = out.replace(lineSep, "");
+
+ // count the remaining simple newline characters
+ int count = 0;
+ int i = out2.indexOf(nl, 0);
+ while (i != -1) {
+ count++;
+ i = out2.indexOf(nl, i + nl.length());
+ }
+
+ if (count > 0)
+ error(count + " newline characters found");
+ }
+
+ void error(String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors = 0;
+}
+
From a9618434af9ab788d8c91c306bc7ab836772ab34 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Fri, 31 Jan 2014 10:24:58 +0100
Subject: [PATCH 083/159] 8033292: only warn, not fail, on unknown variables in
configure
Reviewed-by: erikj
---
common/autoconf/basics.m4 | 2 +-
common/autoconf/generated-configure.sh | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4
index 6bd29145e39..d34615d5a2a 100644
--- a/common/autoconf/basics.m4
+++ b/common/autoconf/basics.m4
@@ -250,7 +250,7 @@ AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
# Replace the separating ! with spaces before presenting for end user.
unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
- AC_MSG_ERROR([The following variables are unknown to configure: $unknown_variables])
+ AC_MSG_WARN([The following variables might be unknown to configure: $unknown_variables])
fi
])
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 998d2004ea2..a03ee5cdb85 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -4087,7 +4087,7 @@ fi
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1391032272
+DATE_WHEN_GENERATED=1391160222
###############################################################################
#
@@ -48539,7 +48539,8 @@ $as_echo "no, disabling ccaching of precompiled headers" >&6; }
if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
# Replace the separating ! with spaces before presenting for end user.
unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
- as_fn_error $? "The following variables are unknown to configure: $unknown_variables" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The following variables might be unknown to configure: $unknown_variables" >&5
+$as_echo "$as_me: WARNING: The following variables might be unknown to configure: $unknown_variables" >&2;}
fi
From e72d99fef1791ccff064b21ad0a492cf2e1dbc30 Mon Sep 17 00:00:00 2001
From: Naoto Sato
Date: Fri, 31 Jan 2014 10:04:16 -0800
Subject: [PATCH 084/159] 8030696: Norwegian locales nb_NO and nn_NO should be
available locales
Reviewed-by: okutsu
---
jdk/make/gensrc/GensrcLocaleDataMetaInfo.gmk | 4 +--
.../resources/no/LocaleNames_no.properties | 2 ++
.../no/LocaleNames_no_NO_NY.properties | 4 ++-
jdk/test/java/util/Locale/LocaleTest.java | 27 +++++++++++++++----
4 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/jdk/make/gensrc/GensrcLocaleDataMetaInfo.gmk b/jdk/make/gensrc/GensrcLocaleDataMetaInfo.gmk
index 98947a0b92c..bf2e3a34552 100644
--- a/jdk/make/gensrc/GensrcLocaleDataMetaInfo.gmk
+++ b/jdk/make/gensrc/GensrcLocaleDataMetaInfo.gmk
@@ -53,8 +53,8 @@ endif
# The EN locales
EN_LOCALES := en%
-# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
-ALL_NON_EN_LOCALES := ja-JP-JP th-TH-TH
+# Locales that don't have any resource files should be included here.
+ALL_NON_EN_LOCALES := ja-JP-JP nb-NO nn-NO th-TH-TH
SED_ARGS := -e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
diff --git a/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no.properties b/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no.properties
index 3a43b04dcc9..f39dfb66568 100644
--- a/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no.properties
+++ b/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no.properties
@@ -38,6 +38,8 @@
# language names
# key is ISO 639 language code
+nb=bokm\u00e5l
+nn=nynorsk
no=norsk
# country names
diff --git a/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no_NO_NY.properties b/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no_NO_NY.properties
index 3a43b04dcc9..e56e415a512 100644
--- a/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no_NO_NY.properties
+++ b/jdk/src/share/classes/sun/util/resources/no/LocaleNames_no_NO_NY.properties
@@ -38,12 +38,14 @@
# language names
# key is ISO 639 language code
+nb=bokm\u00e5l
+nn=nynorsk
no=norsk
# country names
# key is ISO 3166 country code
-NO=Norge
+NO=Noreg
# variant names
diff --git a/jdk/test/java/util/Locale/LocaleTest.java b/jdk/test/java/util/Locale/LocaleTest.java
index 8c9c4f16199..2a6824222b3 100644
--- a/jdk/test/java/util/Locale/LocaleTest.java
+++ b/jdk/test/java/util/Locale/LocaleTest.java
@@ -25,7 +25,7 @@
* @bug 4052404 4052440 4084688 4092475 4101316 4105828 4107014 4107953 4110613
* 4118587 4118595 4122371 4126371 4126880 4135316 4135752 4139504 4139940 4143951
* 4147315 4147317 4147552 4335196 4778440 4940539 5010672 6475525 6544471 6627549
- * 6786276 7066203 7085757
+ * 6786276 7066203 7085757 8030696
* @summary test Locales
*/
/*
@@ -62,6 +62,8 @@
*/
import java.text.*;
+import java.util.Arrays;
+import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.Date;
@@ -925,16 +927,20 @@ test commented out pending API-change approval
}
/*
- * @bug 4147552 4778440
+ * @bug 4147552 4778440 8030696
*/
public void Test4147552() {
Locale[] locales = { new Locale("no", "NO"), new Locale("no", "NO", "B"),
- new Locale("no", "NO", "NY") };
+ new Locale("no", "NO", "NY"), new Locale("nb", "NO"),
+ new Locale("nn", "NO") };
String[] englishDisplayNames = { "Norwegian (Norway)",
"Norwegian (Norway,Bokm\u00e5l)",
- "Norwegian (Norway,Nynorsk)" };
+ "Norwegian (Norway,Nynorsk)",
+ "Norwegian Bokm\u00e5l (Norway)",
+ "Norwegian Nynorsk (Norway)" };
String[] norwegianDisplayNames = { "norsk (Norge)",
- "norsk (Norge,bokm\u00e5l)", "norsk (Norge,nynorsk)" };
+ "norsk (Norge,bokm\u00e5l)", "norsk (Noreg,nynorsk)",
+ "bokm\u00e5l (Norge)", "nynorsk (Noreg)" };
for (int i = 0; i < locales.length; i++) {
Locale loc = locales[i];
@@ -948,6 +954,17 @@ test commented out pending API-change approval
}
}
+ /*
+ * @bug 8030696
+ */
+ public void Test8030696() {
+ List av = Arrays.asList(Locale.getAvailableLocales());
+ if (!av.contains(new Locale("nb", "NO")) ||
+ !av.contains(new Locale("nn", "NO"))) {
+ errln("\"nb-NO\" and/or \"nn-NO\" locale(s) not returned from getAvailableLocales().");
+ }
+ }
+
static String escapeUnicode(String s) {
StringBuffer buf = new StringBuffer();
for (int i=0; i
Date: Fri, 31 Jan 2014 18:32:07 +0000
Subject: [PATCH 085/159] 8011645: CopyOnWriteArrayList.COWSubList.subList does
not validate range properly
Reviewed-by: martin, psandoz
---
.../util/concurrent/CopyOnWriteArrayList.java | 2 +-
.../CopyOnWriteArrayList/COWSubList.java | 58 +++++++++++++++++++
2 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 jdk/test/java/util/concurrent/CopyOnWriteArrayList/COWSubList.java
diff --git a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java
index fae67b2b2d0..162ad3b51d1 100644
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java
@@ -1400,7 +1400,7 @@ public class CopyOnWriteArrayList
lock.lock();
try {
checkForComodification();
- if (fromIndex < 0 || toIndex > size)
+ if (fromIndex < 0 || toIndex > size || fromIndex > toIndex)
throw new IndexOutOfBoundsException();
return new COWSubList(l, fromIndex + offset,
toIndex + offset);
diff --git a/jdk/test/java/util/concurrent/CopyOnWriteArrayList/COWSubList.java b/jdk/test/java/util/concurrent/CopyOnWriteArrayList/COWSubList.java
new file mode 100644
index 00000000000..5cbfea7ec6b
--- /dev/null
+++ b/jdk/test/java/util/concurrent/CopyOnWriteArrayList/COWSubList.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8011645
+ * @summary CopyOnWriteArrayList.COWSubList.subList does not validate range properly
+ */
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public class COWSubList {
+ public static void main(String[] args) {
+ List list = new CopyOnWriteArrayList<>();
+ list.add("A");
+ list.add("B");
+ list.add("C");
+ list.add("D");
+ list.add("E");
+
+ expectThrow(() -> list.subList(-1, 5));
+ expectThrow(() -> list.subList(0, 6));
+ expectThrow(() -> list.subList(4, 3));
+ expectThrow(() -> list.subList(0, 5).subList(-1, 5));
+ expectThrow(() -> list.subList(0, 5).subList(0, 6));
+ expectThrow(() -> list.subList(0, 5).subList(4, 3));
+ }
+
+ static void expectThrow(Runnable r) {
+ try {
+ r.run();
+ throw new RuntimeException("Failed: expected IOOBE to be thrown");
+ } catch (IndexOutOfBoundsException x) {
+ // ok, excpeted
+ }
+ }
+}
+
From 930a4614e6bc8ecdc04a8da28a2bb30f8a0ef1be Mon Sep 17 00:00:00 2001
From: Roger Riggs
Date: Fri, 31 Jan 2014 13:42:31 -0500
Subject: [PATCH 086/159] 8032221: Typo in java.util.date
Trancate -> truncate; updated html and to use {@code ...}
Reviewed-by: darcy, lancea
---
jdk/src/share/classes/java/util/Date.java | 343 +++++++++++-----------
1 file changed, 170 insertions(+), 173 deletions(-)
diff --git a/jdk/src/share/classes/java/util/Date.java b/jdk/src/share/classes/java/util/Date.java
index 502daaefdbb..f16ea496604 100644
--- a/jdk/src/share/classes/java/util/Date.java
+++ b/jdk/src/share/classes/java/util/Date.java
@@ -41,20 +41,20 @@ import sun.util.calendar.Gregorian;
import sun.util.calendar.ZoneInfo;
/**
- * The class Date represents a specific instant
+ * The class {@code Date} represents a specific instant
* in time, with millisecond precision.
*
- * Prior to JDK 1.1, the class Date had two additional
+ * Prior to JDK 1.1, the class {@code Date} had two additional
* functions. It allowed the interpretation of dates as year, month, day, hour,
* minute, and second values. It also allowed the formatting and parsing
* of date strings. Unfortunately, the API for these functions was not
* amenable to internationalization. As of JDK 1.1, the
- * Calendar class should be used to convert between dates and time
- * fields and the DateFormat class should be used to format and
+ * {@code Calendar} class should be used to convert between dates and time
+ * fields and the {@code DateFormat} class should be used to format and
* parse date strings.
- * The corresponding methods in Date are deprecated.
+ * The corresponding methods in {@code Date} are deprecated.
*
- * Although the Date class is intended to reflect
+ * Although the {@code Date} class is intended to reflect
* coordinated universal time (UTC), it may not do so exactly,
* depending on the host environment of the Java Virtual Machine.
* Nearly all modern operating systems assume that 1 day =
@@ -93,12 +93,12 @@ import sun.util.calendar.ZoneInfo;
* http://tycho.usno.navy.mil/systime.html
*
*
- * In all methods of class Date that accept or return
+ * In all methods of class {@code Date} that accept or return
* year, month, date, hours, minutes, and seconds values, the
* following representations are used:
*
*
A year y is represented by the integer
- * y- 1900.
+ * y {@code - 1900}.
*
A month is represented by an integer from 0 to 11; 0 is January,
* 1 is February, and so forth; thus 11 is December.
*
A date (day of month) is represented by an integer from 1 to 31
@@ -155,7 +155,7 @@ public class Date
private static final long serialVersionUID = 7523967970034938905L;
/**
- * Allocates a Date object and initializes it so that
+ * Allocates a {@code Date} object and initializes it so that
* it represents the time at which it was allocated, measured to the
* nearest millisecond.
*
@@ -166,7 +166,7 @@ public class Date
}
/**
- * Allocates a Date object and initializes it to
+ * Allocates a {@code Date} object and initializes it to
* represent the specified number of milliseconds since the
* standard base time known as "the epoch", namely January 1,
* 1970, 00:00:00 GMT.
@@ -179,18 +179,18 @@ public class Date
}
/**
- * Allocates a Date object and initializes it so that
+ * Allocates a {@code Date} object and initializes it so that
* it represents midnight, local time, at the beginning of the day
- * specified by the year, month, and
- * date arguments.
+ * specified by the {@code year}, {@code month}, and
+ * {@code date} arguments.
*
* @param year the year minus 1900.
* @param month the month between 0-11.
* @param date the day of the month between 1-31.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(year + 1900, month, date)
- * or GregorianCalendar(year + 1900, month, date).
+ * replaced by {@code Calendar.set(year + 1900, month, date)}
+ * or {@code GregorianCalendar(year + 1900, month, date)}.
*/
@Deprecated
public Date(int year, int month, int date) {
@@ -198,10 +198,10 @@ public class Date
}
/**
- * Allocates a Date object and initializes it so that
+ * Allocates a {@code Date} object and initializes it so that
* it represents the instant at the start of the minute specified by
- * the year, month, date,
- * hrs, and min arguments, in the local
+ * the {@code year}, {@code month}, {@code date},
+ * {@code hrs}, and {@code min} arguments, in the local
* time zone.
*
* @param year the year minus 1900.
@@ -211,9 +211,8 @@ public class Date
* @param min the minutes between 0-59.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(year + 1900, month, date,
- * hrs, min) or GregorianCalendar(year + 1900,
- * month, date, hrs, min).
+ * replaced by {@code Calendar.set(year + 1900, month, date, hrs, min)}
+ * or {@code GregorianCalendar(year + 1900, month, date, hrs, min)}.
*/
@Deprecated
public Date(int year, int month, int date, int hrs, int min) {
@@ -221,10 +220,10 @@ public class Date
}
/**
- * Allocates a Date object and initializes it so that
+ * Allocates a {@code Date} object and initializes it so that
* it represents the instant at the start of the second specified
- * by the year, month, date,
- * hrs, min, and sec arguments,
+ * by the {@code year}, {@code month}, {@code date},
+ * {@code hrs}, {@code min}, and {@code sec} arguments,
* in the local time zone.
*
* @param year the year minus 1900.
@@ -235,9 +234,8 @@ public class Date
* @param sec the seconds between 0-59.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(year + 1900, month, date,
- * hrs, min, sec) or GregorianCalendar(year + 1900,
- * month, date, hrs, min, sec).
+ * replaced by {@code Calendar.set(year + 1900, month, date, hrs, min, sec)}
+ * or {@code GregorianCalendar(year + 1900, month, date, hrs, min, sec)}.
*/
@Deprecated
public Date(int year, int month, int date, int hrs, int min, int sec) {
@@ -258,16 +256,16 @@ public class Date
}
/**
- * Allocates a Date object and initializes it so that
+ * Allocates a {@code Date} object and initializes it so that
* it represents the date and time indicated by the string
- * s, which is interpreted as if by the
+ * {@code s}, which is interpreted as if by the
* {@link Date#parse} method.
*
* @param s a string representation of the date.
* @see java.text.DateFormat
* @see java.util.Date#parse(java.lang.String)
* @deprecated As of JDK version 1.1,
- * replaced by DateFormat.parse(String s).
+ * replaced by {@code DateFormat.parse(String s)}.
*/
@Deprecated
public Date(String s) {
@@ -292,7 +290,7 @@ public class Date
* Determines the date and time based on the arguments. The
* arguments are interpreted as a year, month, day of the month,
* hour of the day, minute within the hour, and second within the
- * minute, exactly as for the Date constructor with six
+ * minute, exactly as for the {@code Date} constructor with six
* arguments, except that the arguments are interpreted relative
* to UTC rather than to the local time zone. The time indicated is
* returned represented as the distance, measured in milliseconds,
@@ -308,10 +306,9 @@ public class Date
* the date and time specified by the arguments.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(year + 1900, month, date,
- * hrs, min, sec) or GregorianCalendar(year + 1900,
- * month, date, hrs, min, sec), using a UTC
- * TimeZone, followed by Calendar.getTime().getTime().
+ * replaced by {@code Calendar.set(year + 1900, month, date, hrs, min, sec)}
+ * or {@code GregorianCalendar(year + 1900, month, date, hrs, min, sec)}, using a UTC
+ * {@code TimeZone}, followed by {@code Calendar.getTime().getTime()}.
*/
@Deprecated
public static long UTC(int year, int month, int date,
@@ -338,12 +335,12 @@ public class Date
}
/**
- * Attempts to interpret the string s as a representation
+ * Attempts to interpret the string {@code s} as a representation
* of a date and time. If the attempt is successful, the time
* indicated is returned represented as the distance, measured in
* milliseconds, of that time from the epoch (00:00:00 GMT on
* January 1, 1970). If the attempt fails, an
- * IllegalArgumentException is thrown.
+ * {@code IllegalArgumentException} is thrown.
*
* It accepts many syntaxes; in particular, it recognizes the IETF
* standard date syntax: "Sat, 12 Aug 1995 13:30:00 GMT". It also
@@ -353,11 +350,11 @@ public class Date
* meridian). If no time zone is specified, the local time zone is
* assumed. GMT and UTC are considered equivalent.
*
- * The string s is processed from left to right, looking for
- * data of interest. Any material in s that is within the
- * ASCII parenthesis characters ( and ) is ignored.
+ * The string {@code s} is processed from left to right, looking for
+ * data of interest. Any material in {@code s} that is within the
+ * ASCII parenthesis characters {@code (} and {@code )} is ignored.
* Parentheses may be nested. Otherwise, the only characters permitted
- * within s are these ASCII characters:
+ * within {@code s} are these ASCII characters:
*
* abcdefghijklmnopqrstuvwxyz
* ABCDEFGHIJKLMNOPQRSTUVWXYZ
@@ -365,18 +362,18 @@ public class Date
* and whitespace characters.
* A consecutive sequence of decimal digits is treated as a decimal
* number:
- *
If a number is preceded by + or - and a year
+ *
If a number is preceded by {@code +} or {@code -} and a year
* has already been recognized, then the number is a time-zone
* offset. If the number is less than 24, it is an offset measured
* in hours. Otherwise, it is regarded as an offset in minutes,
* expressed in 24-hour time format without punctuation. A
- * preceding - means a westward offset. Time zone offsets
+ * preceding {@code -} means a westward offset. Time zone offsets
* are always relative to UTC (Greenwich). Thus, for example,
- * -5 occurring in the string would mean "five hours west
- * of Greenwich" and +0430 would mean "four hours and
+ * {@code -5} occurring in the string would mean "five hours west
+ * of Greenwich" and {@code +0430} would mean "four hours and
* thirty minutes east of Greenwich." It is permitted for the
- * string to specify GMT, UT, or UTC
- * redundantly-for example, GMT-5 or utc+0430.
+ * string to specify {@code GMT}, {@code UT}, or {@code UTC}
+ * redundantly-for example, {@code GMT-5} or {@code utc+0430}.
*
The number is regarded as a year number if one of the
* following conditions is true:
*
@@ -399,8 +396,8 @@ public class Date
* unless an hour has already been recognized, in which case it is
* regarded as a minute.
*
If the number is followed by a slash, it is regarded as a month
- * (it is decreased by 1 to produce a number in the range 0
- * to 11), unless a month has already been recognized, in
+ * (it is decreased by 1 to produce a number in the range {@code 0}
+ * to {@code 11}), unless a month has already been recognized, in
* which case it is regarded as a day of the month.
*
If the number is followed by whitespace, a comma, a hyphen, or
* end of string, then if an hour has been recognized but not a
@@ -409,31 +406,31 @@ public class Date
* otherwise, it is regarded as a day of the month.
* A consecutive sequence of letters is regarded as a word and treated
* as follows:
- *
A word that matches AM, ignoring case, is ignored (but
+ *
A word that matches {@code AM}, ignoring case, is ignored (but
* the parse fails if an hour has not been recognized or is less
- * than 1 or greater than 12).
- *
A word that matches PM, ignoring case, adds 12
+ * than {@code 1} or greater than {@code 12}).
+ *
A word that matches {@code PM}, ignoring case, adds {@code 12}
* to the hour (but the parse fails if an hour has not been
- * recognized or is less than 1 or greater than 12).
- *
Any word that matches any prefix of SUNDAY, MONDAY, TUESDAY,
- * WEDNESDAY, THURSDAY, FRIDAY, or SATURDAY, ignoring
- * case, is ignored. For example, sat, Friday, TUE, and
- * Thurs are ignored.
- *
Otherwise, any word that matches any prefix of JANUARY,
+ * recognized or is less than {@code 1} or greater than {@code 12}).
+ *
Any word that matches any prefix of {@code SUNDAY, MONDAY, TUESDAY,
+ * WEDNESDAY, THURSDAY, FRIDAY}, or {@code SATURDAY}, ignoring
+ * case, is ignored. For example, {@code sat, Friday, TUE}, and
+ * {@code Thurs} are ignored.
+ *
Otherwise, any word that matches any prefix of {@code JANUARY,
* FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER,
- * OCTOBER, NOVEMBER
, or DECEMBER, ignoring case, and
+ * OCTOBER, NOVEMBER}, or {@code DECEMBER}, ignoring case, and
* considering them in the order given here, is recognized as
- * specifying a month and is converted to a number (0 to
- * 11). For example, aug, Sept, april, and
- * NOV are recognized as months. So is Ma, which
- * is recognized as MARCH, not MAY.
- *
Any word that matches GMT, UT, or UTC, ignoring
+ * specifying a month and is converted to a number ({@code 0} to
+ * {@code 11}). For example, {@code aug, Sept, april}, and
+ * {@code NOV} are recognized as months. So is {@code Ma}, which
+ * is recognized as {@code MARCH}, not {@code MAY}.
+ *
Any word that matches {@code GMT, UT}, or {@code UTC}, ignoring
* case, is treated as referring to UTC.
- *
Any word that matches EST, CST, MST, or PST,
+ *
Any word that matches {@code EST, CST, MST}, or {@code PST},
* ignoring case, is recognized as referring to the time zone in
* North America that is five, six, seven, or eight hours west of
- * Greenwich, respectively. Any word that matches EDT, CDT,
- * MDT, or PDT, ignoring case, is recognized as
+ * Greenwich, respectively. Any word that matches {@code EDT, CDT,
+ * MDT}, or {@code PDT}, ignoring case, is recognized as
* referring to the same time zone, respectively, during daylight
* saving time.
* Once the entire string s has been scanned, it is converted to a time
@@ -448,7 +445,7 @@ public class Date
* represented by the string argument.
* @see java.text.DateFormat
* @deprecated As of JDK version 1.1,
- * replaced by DateFormat.parse(String s).
+ * replaced by {@code DateFormat.parse(String s)}.
*/
@Deprecated
public static long parse(String s) {
@@ -638,13 +635,13 @@ public class Date
/**
* Returns a value that is the result of subtracting 1900 from the
* year that contains or begins with the instant in time represented
- * by this Date object, as interpreted in the local
+ * by this {@code Date} object, as interpreted in the local
* time zone.
*
* @return the year represented by this date, minus 1900.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.get(Calendar.YEAR) - 1900.
+ * replaced by {@code Calendar.get(Calendar.YEAR) - 1900}.
*/
@Deprecated
public int getYear() {
@@ -652,8 +649,8 @@ public class Date
}
/**
- * Sets the year of this Date object to be the specified
- * value plus 1900. This Date object is modified so
+ * Sets the year of this {@code Date} object to be the specified
+ * value plus 1900. This {@code Date} object is modified so
* that it represents a point in time within the specified year,
* with the month, date, hour, minute, and second the same as
* before, as interpreted in the local time zone. (Of course, if
@@ -664,7 +661,7 @@ public class Date
* @param year the year value.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(Calendar.YEAR, year + 1900).
+ * replaced by {@code Calendar.set(Calendar.YEAR, year + 1900)}.
*/
@Deprecated
public void setYear(int year) {
@@ -673,14 +670,14 @@ public class Date
/**
* Returns a number representing the month that contains or begins
- * with the instant in time represented by this Date object.
- * The value returned is between 0 and 11,
- * with the value 0 representing January.
+ * with the instant in time represented by this {@code Date} object.
+ * The value returned is between {@code 0} and {@code 11},
+ * with the value {@code 0} representing January.
*
* @return the month represented by this date.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.get(Calendar.MONTH).
+ * replaced by {@code Calendar.get(Calendar.MONTH)}.
*/
@Deprecated
public int getMonth() {
@@ -689,7 +686,7 @@ public class Date
/**
* Sets the month of this date to the specified value. This
- * Date object is modified so that it represents a point
+ * {@code Date} object is modified so that it represents a point
* in time within the specified month, with the year, date, hour,
* minute, and second the same as before, as interpreted in the
* local time zone. If the date was October 31, for example, and
@@ -699,7 +696,7 @@ public class Date
* @param month the month value between 0-11.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(Calendar.MONTH, int month).
+ * replaced by {@code Calendar.set(Calendar.MONTH, int month)}.
*/
@Deprecated
public void setMonth(int month) {
@@ -719,16 +716,16 @@ public class Date
}
/**
- * Returns the day of the month represented by this Date object.
- * The value returned is between 1 and 31
+ * Returns the day of the month represented by this {@code Date} object.
+ * The value returned is between {@code 1} and {@code 31}
* representing the day of the month that contains or begins with the
- * instant in time represented by this Date object, as
+ * instant in time represented by this {@code Date} object, as
* interpreted in the local time zone.
*
* @return the day of the month represented by this date.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.get(Calendar.DAY_OF_MONTH).
+ * replaced by {@code Calendar.get(Calendar.DAY_OF_MONTH)}.
* @deprecated
*/
@Deprecated
@@ -737,8 +734,8 @@ public class Date
}
/**
- * Sets the day of the month of this Date object to the
- * specified value. This Date object is modified so that
+ * Sets the day of the month of this {@code Date} object to the
+ * specified value. This {@code Date} object is modified so that
* it represents a point in time within the specified day of the
* month, with the year, month, hour, minute, and second the same
* as before, as interpreted in the local time zone. If the date
@@ -749,7 +746,7 @@ public class Date
* @param date the day of the month value between 1-31.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date).
+ * replaced by {@code Calendar.set(Calendar.DAY_OF_MONTH, int date)}.
*/
@Deprecated
public void setDate(int date) {
@@ -758,17 +755,17 @@ public class Date
/**
* Returns the day of the week represented by this date. The
- * returned value (0 = Sunday, 1 = Monday,
- * 2 = Tuesday, 3 = Wednesday, 4 =
- * Thursday, 5 = Friday, 6 = Saturday)
+ * returned value ({@code 0} = Sunday, {@code 1} = Monday,
+ * {@code 2} = Tuesday, {@code 3} = Wednesday, {@code 4} =
+ * Thursday, {@code 5} = Friday, {@code 6} = Saturday)
* represents the day of the week that contains or begins with
- * the instant in time represented by this Date object,
+ * the instant in time represented by this {@code Date} object,
* as interpreted in the local time zone.
*
* @return the day of the week represented by this date.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.get(Calendar.DAY_OF_WEEK).
+ * replaced by {@code Calendar.get(Calendar.DAY_OF_WEEK)}.
*/
@Deprecated
public int getDay() {
@@ -776,16 +773,16 @@ public class Date
}
/**
- * Returns the hour represented by this Date object. The
- * returned value is a number (0 through 23)
+ * Returns the hour represented by this {@code Date} object. The
+ * returned value is a number ({@code 0} through {@code 23})
* representing the hour within the day that contains or begins
- * with the instant in time represented by this Date
+ * with the instant in time represented by this {@code Date}
* object, as interpreted in the local time zone.
*
* @return the hour represented by this date.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.get(Calendar.HOUR_OF_DAY).
+ * replaced by {@code Calendar.get(Calendar.HOUR_OF_DAY)}.
*/
@Deprecated
public int getHours() {
@@ -793,8 +790,8 @@ public class Date
}
/**
- * Sets the hour of this Date object to the specified value.
- * This Date object is modified so that it represents a point
+ * Sets the hour of this {@code Date} object to the specified value.
+ * This {@code Date} object is modified so that it represents a point
* in time within the specified hour of the day, with the year, month,
* date, minute, and second the same as before, as interpreted in the
* local time zone.
@@ -802,7 +799,7 @@ public class Date
* @param hours the hour value.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(Calendar.HOUR_OF_DAY, int hours).
+ * replaced by {@code Calendar.set(Calendar.HOUR_OF_DAY, int hours)}.
*/
@Deprecated
public void setHours(int hours) {
@@ -812,12 +809,12 @@ public class Date
/**
* Returns the number of minutes past the hour represented by this date,
* as interpreted in the local time zone.
- * The value returned is between 0 and 59.
+ * The value returned is between {@code 0} and {@code 59}.
*
* @return the number of minutes past the hour represented by this date.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.get(Calendar.MINUTE).
+ * replaced by {@code Calendar.get(Calendar.MINUTE)}.
*/
@Deprecated
public int getMinutes() {
@@ -825,8 +822,8 @@ public class Date
}
/**
- * Sets the minutes of this Date object to the specified value.
- * This Date object is modified so that it represents a point
+ * Sets the minutes of this {@code Date} object to the specified value.
+ * This {@code Date} object is modified so that it represents a point
* in time within the specified minute of the hour, with the year, month,
* date, hour, and second the same as before, as interpreted in the
* local time zone.
@@ -834,7 +831,7 @@ public class Date
* @param minutes the value of the minutes.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(Calendar.MINUTE, int minutes).
+ * replaced by {@code Calendar.set(Calendar.MINUTE, int minutes)}.
*/
@Deprecated
public void setMinutes(int minutes) {
@@ -843,14 +840,14 @@ public class Date
/**
* Returns the number of seconds past the minute represented by this date.
- * The value returned is between 0 and 61. The
- * values 60 and 61 can only occur on those
+ * The value returned is between {@code 0} and {@code 61}. The
+ * values {@code 60} and {@code 61} can only occur on those
* Java Virtual Machines that take leap seconds into account.
*
* @return the number of seconds past the minute represented by this date.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.get(Calendar.SECOND).
+ * replaced by {@code Calendar.get(Calendar.SECOND)}.
*/
@Deprecated
public int getSeconds() {
@@ -858,8 +855,8 @@ public class Date
}
/**
- * Sets the seconds of this Date to the specified value.
- * This Date object is modified so that it represents a
+ * Sets the seconds of this {@code Date} to the specified value.
+ * This {@code Date} object is modified so that it represents a
* point in time within the specified second of the minute, with
* the year, month, date, hour, and minute the same as before, as
* interpreted in the local time zone.
@@ -867,7 +864,7 @@ public class Date
* @param seconds the seconds value.
* @see java.util.Calendar
* @deprecated As of JDK version 1.1,
- * replaced by Calendar.set(Calendar.SECOND, int seconds).
+ * replaced by {@code Calendar.set(Calendar.SECOND, int seconds)}.
*/
@Deprecated
public void setSeconds(int seconds) {
@@ -876,7 +873,7 @@ public class Date
/**
* Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
- * represented by this Date object.
+ * represented by this {@code Date} object.
*
* @return the number of milliseconds since January 1, 1970, 00:00:00 GMT
* represented by this date.
@@ -893,8 +890,8 @@ public class Date
}
/**
- * Sets this Date object to represent a point in time that is
- * time milliseconds after January 1, 1970 00:00:00 GMT.
+ * Sets this {@code Date} object to represent a point in time that is
+ * {@code time} milliseconds after January 1, 1970 00:00:00 GMT.
*
* @param time the number of milliseconds.
*/
@@ -907,11 +904,11 @@ public class Date
* Tests if this date is before the specified date.
*
* @param when a date.
- * @return true if and only if the instant of time
- * represented by this Date object is strictly
- * earlier than the instant represented by when;
- * false otherwise.
- * @exception NullPointerException if when is null.
+ * @return {@code true} if and only if the instant of time
+ * represented by this {@code Date} object is strictly
+ * earlier than the instant represented by {@code when};
+ * {@code false} otherwise.
+ * @exception NullPointerException if {@code when} is null.
*/
public boolean before(Date when) {
return getMillisOf(this) < getMillisOf(when);
@@ -921,11 +918,11 @@ public class Date
* Tests if this date is after the specified date.
*
* @param when a date.
- * @return true if and only if the instant represented
- * by this Date object is strictly later than the
- * instant represented by when;
- * false otherwise.
- * @exception NullPointerException if when is null.
+ * @return {@code true} if and only if the instant represented
+ * by this {@code Date} object is strictly later than the
+ * instant represented by {@code when};
+ * {@code false} otherwise.
+ * @exception NullPointerException if {@code when} is null.
*/
public boolean after(Date when) {
return getMillisOf(this) > getMillisOf(when);
@@ -933,17 +930,17 @@ public class Date
/**
* Compares two dates for equality.
- * The result is true if and only if the argument is
- * not null and is a Date object that
+ * The result is {@code true} if and only if the argument is
+ * not {@code null} and is a {@code Date} object that
* represents the same point in time, to the millisecond, as this object.
*
- * Thus, two Date objects are equal if and only if the
- * getTime method returns the same long
+ * Thus, two {@code Date} objects are equal if and only if the
+ * {@code getTime} method returns the same {@code long}
* value for both.
*
* @param obj the object to compare with.
- * @return true if the objects are the same;
- * false otherwise.
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
* @see java.util.Date#getTime()
*/
public boolean equals(Object obj) {
@@ -951,7 +948,7 @@ public class Date
}
/**
- * Returns the millisecond value of this Date object
+ * Returns the millisecond value of this {@code Date} object
* without affecting its internal state.
*/
static final long getMillisOf(Date date) {
@@ -965,13 +962,13 @@ public class Date
/**
* Compares two Dates for ordering.
*
- * @param anotherDate the Date to be compared.
- * @return the value 0 if the argument Date is equal to
- * this Date; a value less than 0 if this Date
+ * @param anotherDate the {@code Date} to be compared.
+ * @return the value {@code 0} if the argument Date is equal to
+ * this Date; a value less than {@code 0} if this Date
* is before the Date argument; and a value greater than
- * 0 if this Date is after the Date argument.
+ * {@code 0} if this Date is after the Date argument.
* @since 1.2
- * @exception NullPointerException if anotherDate is null.
+ * @exception NullPointerException if {@code anotherDate} is null.
*/
public int compareTo(Date anotherDate) {
long thisTime = getMillisOf(this);
@@ -981,7 +978,7 @@ public class Date
/**
* Returns a hash code value for this object. The result is the
- * exclusive OR of the two halves of the primitive long
+ * exclusive OR of the two halves of the primitive {@code long}
* value returned by the {@link Date#getTime}
* method. That is, the hash code is the value of the expression:
*
{@code
@@ -996,29 +993,29 @@ public class Date
}
/**
- * Converts this Date object to a String
+ * Converts this {@code Date} object to a {@code String}
* of the form:
*
* dow mon dd hh:mm:ss zzz yyyy
* where:
- *
dow is the day of the week (Sun, Mon, Tue, Wed,
- * Thu, Fri, Sat).
- *
mon is the month (Jan, Feb, Mar, Apr, May, Jun,
- * Jul, Aug, Sep, Oct, Nov, Dec).
- *
dd is the day of the month (01 through
- * 31), as two decimal digits.
- *
hh is the hour of the day (00 through
- * 23), as two decimal digits.
- *
mm is the minute within the hour (00 through
- * 59), as two decimal digits.
- *
ss is the second within the minute (00 through
- * 61, as two decimal digits.
- *
zzz is the time zone (and may reflect daylight saving
+ *
{@code dow} is the day of the week ({@code Sun, Mon, Tue, Wed,
+ * Thu, Fri, Sat}).
+ *
{@code mon} is the month ({@code Jan, Feb, Mar, Apr, May, Jun,
+ * Jul, Aug, Sep, Oct, Nov, Dec}).
+ *
{@code dd} is the day of the month ({@code 01} through
+ * {@code 31}), as two decimal digits.
+ *
{@code hh} is the hour of the day ({@code 00} through
+ * {@code 23}), as two decimal digits.
+ *
{@code mm} is the minute within the hour ({@code 00} through
+ * {@code 59}), as two decimal digits.
+ *
{@code ss} is the second within the minute ({@code 00} through
+ * {@code 61}, as two decimal digits.
+ *
{@code zzz} is the time zone (and may reflect daylight saving
* time). Standard time zone abbreviations include those
- * recognized by the method parse. If time zone
- * information is not available, then zzz is empty -
+ * recognized by the method {@code parse}. If time zone
+ * information is not available, then {@code zzz} is empty -
* that is, it consists of no characters at all.
- *
yyyy is the year, as four decimal digits.
+ *
{@code yyyy} is the year, as four decimal digits.
*
*
* @return a string representation of this date.
@@ -1053,7 +1050,7 @@ public class Date
/**
* Converts the given name to its 3-letter abbreviation (e.g.,
* "monday" -> "Mon") and stored the abbreviation in the given
- * StringBuilder.
+ * {@code StringBuilder}.
*/
private static final StringBuilder convertToAbbr(StringBuilder sb, String name) {
sb.append(Character.toUpperCase(name.charAt(0)));
@@ -1062,11 +1059,11 @@ public class Date
}
/**
- * Creates a string representation of this Date object in an
+ * Creates a string representation of this {@code Date} object in an
* implementation-dependent form. The intent is that the form should
* be familiar to the user of the Java application, wherever it may
* happen to be running. The intent is comparable to that of the
- * "%c" format supported by the strftime()
+ * "{@code %c}" format supported by the {@code strftime()}
* function of ISO C.
*
* @return a string representation of this date, using the locale
@@ -1075,7 +1072,7 @@ public class Date
* @see java.util.Date#toString()
* @see java.util.Date#toGMTString()
* @deprecated As of JDK version 1.1,
- * replaced by DateFormat.format(Date date).
+ * replaced by {@code DateFormat.format(Date date)}.
*/
@Deprecated
public String toLocaleString() {
@@ -1084,23 +1081,23 @@ public class Date
}
/**
- * Creates a string representation of this Date object of
+ * Creates a string representation of this {@code Date} object of
* the form:
*
* d mon yyyy hh:mm:ss GMT
* where:
- *
d is the day of the month (1 through 31),
+ *
d is the day of the month ({@code 1} through {@code 31}),
* as one or two decimal digits.
- *
mon is the month (Jan, Feb, Mar, Apr, May, Jun, Jul,
- * Aug, Sep, Oct, Nov, Dec).
+ *
mon is the month ({@code Jan, Feb, Mar, Apr, May, Jun, Jul,
+ * Aug, Sep, Oct, Nov, Dec}).
*
yyyy is the year, as four decimal digits.
- *
hh is the hour of the day (00 through 23),
+ *
hh is the hour of the day ({@code 00} through {@code 23}),
* as two decimal digits.
- *
mm is the minute within the hour (00 through
- * 59), as two decimal digits.
- *
ss is the second within the minute (00 through
- * 61), as two decimal digits.
- *
GMT is exactly the ASCII letters "GMT" to indicate
+ *
mm is the minute within the hour ({@code 00} through
+ * {@code 59}), as two decimal digits.
+ *
ss is the second within the minute ({@code 00} through
+ * {@code 61}), as two decimal digits.
+ *
GMT is exactly the ASCII letters "{@code GMT}" to indicate
* Greenwich Mean Time.
*
* The result does not depend on the local time zone.
@@ -1111,8 +1108,8 @@ public class Date
* @see java.util.Date#toString()
* @see java.util.Date#toLocaleString()
* @deprecated As of JDK version 1.1,
- * replaced by DateFormat.format(Date date), using a
- * GMT TimeZone.
+ * replaced by {@code DateFormat.format(Date date)}, using a
+ * GMT {@code TimeZone}.
*/
@Deprecated
public String toGMTString() {
@@ -1135,7 +1132,7 @@ public class Date
/**
* Returns the offset, measured in minutes, for the local time zone
* relative to UTC that is appropriate for the time represented by
- * this Date object.
+ * this {@code Date} object.
*
* For example, in Massachusetts, five time zones west of Greenwich:
*
@@ -1161,8 +1158,8 @@ public class Date
* @see java.util.Calendar#DST_OFFSET
* @see java.util.TimeZone#getDefault
* @deprecated As of JDK version 1.1,
- * replaced by -(Calendar.get(Calendar.ZONE_OFFSET) +
- * Calendar.get(Calendar.DST_OFFSET)) / (60 * 1000).
+ * replaced by {@code -(Calendar.get(Calendar.ZONE_OFFSET) +
+ * Calendar.get(Calendar.DST_OFFSET)) / (60 * 1000)}.
*/
@Deprecated
public int getTimezoneOffset() {
@@ -1313,7 +1310,7 @@ public class Date
/**
* Save the state of this object to a stream (i.e., serialize it).
*
- * @serialData The value returned by getTime()
+ * @serialData The value returned by {@code getTime()}
* is emitted (long). This represents the offset from
* January 1, 1970, 00:00:00 GMT in milliseconds.
*/
@@ -1336,7 +1333,7 @@ public class Date
* Obtains an instance of {@code Date} from an {@code Instant} object.
*
* {@code Instant} uses a precision of nanoseconds, whereas {@code Date}
- * uses a precision of milliseconds. The conversion will trancate any
+ * uses a precision of milliseconds. The conversion will truncate any
* excess precision information as though the amount in nanoseconds was
* subject to integer division by one million.
*
From 806b45a0f25d94ac3827a5cd6027fcbedffc80b2 Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Sat, 1 Feb 2014 10:27:55 -0800
Subject: [PATCH 087/159] 8033223: Fix serial lint warnings in sun.{font,
java2d[.*]}
Reviewed-by: bae
---
.../com/sun/imageio/plugins/common/BogusColorSpace.java | 3 ++-
.../com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java | 1 +
jdk/src/share/classes/sun/font/FontScalerException.java | 3 ++-
jdk/src/share/classes/sun/java2d/InvalidPipeException.java | 3 ++-
jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java | 3 ++-
5 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/common/BogusColorSpace.java b/jdk/src/share/classes/com/sun/imageio/plugins/common/BogusColorSpace.java
index ea7fa4f0272..81924044610 100644
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/BogusColorSpace.java
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/BogusColorSpace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -31,6 +31,7 @@ import java.awt.color.ColorSpace;
* A dummy ColorSpace to enable ColorModel
* for image data which do not have an innate color representation.
*/
+@SuppressWarnings("serial") // JDK-implementation class
public class BogusColorSpace extends ColorSpace {
/**
* Return the type given the number of components.
diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java
index 21e5a26ad8d..393548e5b14 100644
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java
@@ -558,6 +558,7 @@ class JFIFMarkerSegment extends MarkerSegment {
// Could put reason codes in here to be parsed in writeJFXXSegment
// in order to provide more meaningful warnings.
+ @SuppressWarnings("serial") // JDK-implementation class
private class IllegalThumbException extends Exception {}
/**
diff --git a/jdk/src/share/classes/sun/font/FontScalerException.java b/jdk/src/share/classes/sun/font/FontScalerException.java
index 32db6d80679..b88aed62773 100644
--- a/jdk/src/share/classes/sun/font/FontScalerException.java
+++ b/jdk/src/share/classes/sun/font/FontScalerException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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,6 +25,7 @@
package sun.font;
+@SuppressWarnings("serial") // JDK-implementation class
public class FontScalerException extends Exception {
public FontScalerException() {
super("Font scaler encountered runtime problem.");
diff --git a/jdk/src/share/classes/sun/java2d/InvalidPipeException.java b/jdk/src/share/classes/sun/java2d/InvalidPipeException.java
index 569bdc7682d..22ac0661093 100644
--- a/jdk/src/share/classes/sun/java2d/InvalidPipeException.java
+++ b/jdk/src/share/classes/sun/java2d/InvalidPipeException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -34,6 +34,7 @@ package sun.java2d;
* windows which toggle the need to use platform graphics or direct
* graphics access.
*/
+@SuppressWarnings("serial") // JDK-implementation class
public class InvalidPipeException extends IllegalStateException {
/**
* Constructs an InvalidPipeException with no detail message.
diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
index 2f862cdeb10..1bcb05ccbb7 100644
--- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
+++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -376,6 +376,7 @@ class LCMSImageLayout {
return (int)res;
}
+ @SuppressWarnings("serial") // JDK-implementation class
public static class ImageLayoutException extends Exception {
public ImageLayoutException(String message) {
super(message);
From 4724c454cddd53730e0123b3996b60d5d9d84182 Mon Sep 17 00:00:00 2001
From: Jan Lahoda
Date: Sun, 2 Feb 2014 12:12:01 +0100
Subject: [PATCH 088/159] 8030091: Request to update error messages from javac
for negative varargs test cases
Introducing a new error message for vararg parameter not being the last parameter, improving error message for unexpected character after a parameter.
Reviewed-by: jjg, sogoel
---
.../sun/tools/javac/parser/JavacParser.java | 14 ++++++++--
.../tools/javac/resources/compiler.properties | 5 +++-
.../diags/examples/VarargsMustBeLast.java | 28 +++++++++++++++++++
.../javac/parser/ErroneousParameters.java | 16 +++++++++++
.../javac/parser/ErroneousParameters.out | 14 ++++++++++
.../TestParseErrors/TestParseErrors.out | 2 +-
6 files changed, 74 insertions(+), 5 deletions(-)
create mode 100644 langtools/test/tools/javac/diags/examples/VarargsMustBeLast.java
create mode 100644 langtools/test/tools/javac/parser/ErroneousParameters.java
create mode 100644 langtools/test/tools/javac/parser/ErroneousParameters.out
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
index 55f46195024..49f68b13ae6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -3648,12 +3648,20 @@ public class JavacParser implements Parser {
params.append(lastParam);
}
this.allowThisIdent = false;
- while ((lastParam.mods.flags & Flags.VARARGS) == 0 && token.kind == COMMA) {
+ while (token.kind == COMMA) {
+ if ((lastParam.mods.flags & Flags.VARARGS) != 0) {
+ error(lastParam, "varargs.must.be.last");
+ }
nextToken();
params.append(lastParam = formalParameter(lambdaParameters));
}
}
- accept(RPAREN);
+ if (token.kind == RPAREN) {
+ nextToken();
+ } else {
+ setErrorEndPos(token.pos);
+ reportSyntaxError(S.prevToken().endPos, "expected3", COMMA, RPAREN, LBRACKET);
+ }
return params.toList();
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
index 709a11ae096..abbdf4847c6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2014, 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
@@ -597,6 +597,9 @@ compiler.err.varargs.and.old.array.syntax=\
compiler.err.varargs.and.receiver =\
varargs notation not allowed on receiver parameter
+compiler.err.varargs.must.be.last =\
+ varargs parameter must be the last parameter
+
compiler.err.array.and.receiver =\
legacy array notation not allowed on receiver parameter
diff --git a/langtools/test/tools/javac/diags/examples/VarargsMustBeLast.java b/langtools/test/tools/javac/diags/examples/VarargsMustBeLast.java
new file mode 100644
index 00000000000..bff1fbb6fcb
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/VarargsMustBeLast.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+// key: compiler.err.varargs.must.be.last
+
+class VarargMustBeFinal {
+ public void invalidVarArg(String... invalidVarArg, String extra) { }
+}
diff --git a/langtools/test/tools/javac/parser/ErroneousParameters.java b/langtools/test/tools/javac/parser/ErroneousParameters.java
new file mode 100644
index 00000000000..f6311d6f2db
--- /dev/null
+++ b/langtools/test/tools/javac/parser/ErroneousParameters.java
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8030091
+ * @summary Producing reasonable errors for unexpected tokens in method parameters
+ * @compile/fail/ref=ErroneousParameters.out -XDrawDiagnostics ErroneousParameters.java
+ */
+
+public class ErroneousParameters {
+
+ public static void test(int... extraVarArg, int additionalParam) { }
+ public static void test(byte param...) { }
+ public static void test(char param,) { }
+ public static void test(short param[) { }
+ public static void test(int param=) { }
+
+}
diff --git a/langtools/test/tools/javac/parser/ErroneousParameters.out b/langtools/test/tools/javac/parser/ErroneousParameters.out
new file mode 100644
index 00000000000..89d9e3743e6
--- /dev/null
+++ b/langtools/test/tools/javac/parser/ErroneousParameters.out
@@ -0,0 +1,14 @@
+ErroneousParameters.java:10:36: compiler.err.varargs.must.be.last
+ErroneousParameters.java:11:39: compiler.err.expected3: ',', ')', '['
+ErroneousParameters.java:11:42: compiler.err.illegal.start.of.type
+ErroneousParameters.java:11:43: compiler.err.expected: token.identifier
+ErroneousParameters.java:11:45: compiler.err.expected: ';'
+ErroneousParameters.java:12:40: compiler.err.illegal.start.of.type
+ErroneousParameters.java:12:41: compiler.err.expected3: ',', ')', '['
+ErroneousParameters.java:12:43: compiler.err.expected: ';'
+ErroneousParameters.java:13:41: compiler.err.expected: ']'
+ErroneousParameters.java:14:38: compiler.err.expected3: ',', ')', '['
+ErroneousParameters.java:14:39: compiler.err.illegal.start.of.type
+ErroneousParameters.java:14:40: compiler.err.expected: token.identifier
+ErroneousParameters.java:14:42: compiler.err.expected: ';'
+13 errors
diff --git a/langtools/test/tools/javac/processing/errors/TestParseErrors/TestParseErrors.out b/langtools/test/tools/javac/processing/errors/TestParseErrors/TestParseErrors.out
index 947e921dd4d..11cff7ddcf1 100644
--- a/langtools/test/tools/javac/processing/errors/TestParseErrors/TestParseErrors.out
+++ b/langtools/test/tools/javac/processing/errors/TestParseErrors/TestParseErrors.out
@@ -1,6 +1,6 @@
ParseErrors.java:37:37: compiler.err.expected: token.identifier
ParseErrors.java:38:1: compiler.err.illegal.start.of.type
-ParseErrors.java:38:2: compiler.err.expected: ')'
+ParseErrors.java:38:2: compiler.err.expected3: ',', ')', '['
ParseErrors.java:40:6: compiler.err.expected: ';'
ParseErrors.java:40:20: compiler.err.illegal.start.of.type
ParseErrors.java:41:5: compiler.err.expected: '('
From 24b84458a100ee4e55697820c2c52a20f95da957 Mon Sep 17 00:00:00 2001
From: Alan Bateman
Date: Mon, 3 Feb 2014 14:00:43 +0000
Subject: [PATCH 089/159] 8028792: (ch) Channels native code needs to be
checked for methods calling JNI with pending excepitons 8032668: Check
jdk/src/solaris/native/java/io for pending JNI exception issues
Reviewed-by: chegar, simonis
---
.../sun/nio/fs/AixNativeDispatcher.java | 2 +-
.../native/sun/nio/fs/AixNativeDispatcher.c | 17 +++---
.../native/java/io/UnixFileSystem_md.c | 11 ++--
.../native/sun/nio/ch/DatagramChannelImpl.c | 22 ++++----
jdk/src/solaris/native/sun/nio/ch/FileKey.c | 4 +-
jdk/src/solaris/native/sun/nio/ch/IOUtil.c | 4 +-
.../sun/nio/ch/ServerSocketChannelImpl.c | 17 +++++-
.../native/sun/nio/ch/sctp/SctpChannelImpl.c | 4 +-
.../solaris/native/sun/nio/ch/sctp/SctpNet.c | 10 ++--
.../native/sun/nio/fs/BsdNativeDispatcher.c | 9 ++--
.../native/sun/nio/fs/LinuxNativeDispatcher.c | 8 +--
.../sun/nio/fs/SolarisNativeDispatcher.c | 9 ++--
.../native/sun/nio/fs/UnixNativeDispatcher.c | 36 +++++++++----
.../native/java/io/FileDescriptor_md.c | 4 +-
.../native/java/io/WinNTFileSystem_md.c | 47 ++++++++--------
.../native/sun/nio/ch/DatagramChannelImpl.c | 20 ++++---
jdk/src/windows/native/sun/nio/ch/FileKey.c | 6 +--
jdk/src/windows/native/sun/nio/ch/IOUtil.c | 6 +--
jdk/src/windows/native/sun/nio/ch/Iocp.c | 11 ++--
.../sun/nio/ch/ServerSocketChannelImpl.c | 14 +++--
.../native/sun/nio/ch/SocketChannelImpl.c | 4 +-
.../sun/nio/fs/WindowsNativeDispatcher.c | 53 ++++++++++---------
22 files changed, 194 insertions(+), 124 deletions(-)
diff --git a/jdk/src/aix/classes/sun/nio/fs/AixNativeDispatcher.java b/jdk/src/aix/classes/sun/nio/fs/AixNativeDispatcher.java
index d46d80fc97f..76e833ae19a 100644
--- a/jdk/src/aix/classes/sun/nio/fs/AixNativeDispatcher.java
+++ b/jdk/src/aix/classes/sun/nio/fs/AixNativeDispatcher.java
@@ -43,7 +43,7 @@ class AixNativeDispatcher extends UnixNativeDispatcher {
static native UnixMountEntry[] getmntctl() throws UnixException;
// initialize
- private static native int init();
+ private static native void init();
static {
AccessController.doPrivileged(new PrivilegedAction() {
diff --git a/jdk/src/aix/native/sun/nio/fs/AixNativeDispatcher.c b/jdk/src/aix/native/sun/nio/fs/AixNativeDispatcher.c
index 82d8f6203e7..e7afb205280 100644
--- a/jdk/src/aix/native/sun/nio/fs/AixNativeDispatcher.c
+++ b/jdk/src/aix/native/sun/nio/fs/AixNativeDispatcher.c
@@ -56,23 +56,26 @@ static void throwUnixException(JNIEnv* env, int errnum) {
/**
* Initialization
*/
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
Java_sun_nio_fs_AixNativeDispatcher_init(JNIEnv* env, jclass this)
{
- jint flags = 0;
jclass clazz;
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
- if (clazz == NULL) {
- return 0;
- }
+ CHECK_NULL(clazz);
entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+ CHECK_NULL(entry_name);
entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+ CHECK_NULL(entry_dir);
entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+ CHECK_NULL(entry_fstype);
entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
+ CHECK_NULL(entry_options);
entry_cls = (*env)->NewGlobalRef(env, clazz);
-
- return 0;
+ if (entry_cls == NULL) {
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return;
+ }
}
/**
diff --git a/jdk/src/solaris/native/java/io/UnixFileSystem_md.c b/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
index 5f95cd998c8..487e8a2bac3 100644
--- a/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
+++ b/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
@@ -283,6 +283,10 @@ Java_java_io_UnixFileSystem_list(JNIEnv *env, jobject this,
struct dirent64 *result;
int len, maxlen;
jobjectArray rv, old;
+ jclass str_class;
+
+ str_class = JNU_ClassString(env);
+ CHECK_NULL_RETURN(str_class, NULL);
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
dir = opendir(path);
@@ -299,7 +303,7 @@ Java_java_io_UnixFileSystem_list(JNIEnv *env, jobject this,
/* Allocate an initial String array */
len = 0;
maxlen = 16;
- rv = (*env)->NewObjectArray(env, maxlen, JNU_ClassString(env), NULL);
+ rv = (*env)->NewObjectArray(env, maxlen, str_class, NULL);
if (rv == NULL) goto error;
/* Scan the directory */
@@ -309,8 +313,7 @@ Java_java_io_UnixFileSystem_list(JNIEnv *env, jobject this,
continue;
if (len == maxlen) {
old = rv;
- rv = (*env)->NewObjectArray(env, maxlen <<= 1,
- JNU_ClassString(env), NULL);
+ rv = (*env)->NewObjectArray(env, maxlen <<= 1, str_class, NULL);
if (rv == NULL) goto error;
if (JNU_CopyObjectArray(env, rv, old, len) < 0) goto error;
(*env)->DeleteLocalRef(env, old);
@@ -329,7 +332,7 @@ Java_java_io_UnixFileSystem_list(JNIEnv *env, jobject this,
/* Copy the final results into an appropriately-sized array */
old = rv;
- rv = (*env)->NewObjectArray(env, len, JNU_ClassString(env), NULL);
+ rv = (*env)->NewObjectArray(env, len, str_class, NULL);
if (rv == NULL) {
return NULL;
}
diff --git a/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
index 816270c9b8e..f5dd361c4fc 100644
--- a/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
@@ -56,18 +56,28 @@ JNIEXPORT void JNICALL
Java_sun_nio_ch_DatagramChannelImpl_initIDs(JNIEnv *env, jclass clazz)
{
clazz = (*env)->FindClass(env, "java/net/InetSocketAddress");
+ CHECK_NULL(clazz);
isa_class = (*env)->NewGlobalRef(env, clazz);
+ if (isa_class == NULL) {
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return;
+ }
isa_ctorID = (*env)->GetMethodID(env, clazz, "",
"(Ljava/net/InetAddress;I)V");
+ CHECK_NULL(isa_ctorID);
clazz = (*env)->FindClass(env, "sun/nio/ch/DatagramChannelImpl");
+ CHECK_NULL(clazz);
dci_senderID = (*env)->GetFieldID(env, clazz, "sender",
"Ljava/net/SocketAddress;");
+ CHECK_NULL(dci_senderID);
dci_senderAddrID = (*env)->GetFieldID(env, clazz,
"cachedSenderInetAddress",
"Ljava/net/InetAddress;");
+ CHECK_NULL(dci_senderAddrID);
dci_senderPortID = (*env)->GetFieldID(env, clazz,
"cachedSenderPort", "I");
+ CHECK_NULL(dci_senderPortID);
}
JNIEXPORT void JNICALL
@@ -121,7 +131,7 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this,
* but that is acceptable.
*/
if (rv < 0 && errno == EAFNOSUPPORT)
- rv = errno = 0;
+ rv = errno = 0;
#endif
}
#endif
@@ -192,17 +202,11 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
if (senderAddr == NULL) {
jobject isa = NULL;
int port;
- jobject ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa,
- &port);
-
+ jobject ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
if (ia != NULL) {
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
}
-
- if (isa == NULL) {
- JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
- return IOS_THROWN;
- }
+ CHECK_NULL_RETURN(isa, IOS_THROWN);
(*env)->SetObjectField(env, this, dci_senderAddrID, ia);
(*env)->SetIntField(env, this, dci_senderPortID,
diff --git a/jdk/src/solaris/native/sun/nio/ch/FileKey.c b/jdk/src/solaris/native/sun/nio/ch/FileKey.c
index ddb88329eca..bdb42a6324b 100644
--- a/jdk/src/solaris/native/sun/nio/ch/FileKey.c
+++ b/jdk/src/solaris/native/sun/nio/ch/FileKey.c
@@ -43,8 +43,8 @@ static jfieldID key_st_ino; /* id for FileKey.st_ino */
JNIEXPORT void JNICALL
Java_sun_nio_ch_FileKey_initIDs(JNIEnv *env, jclass clazz)
{
- key_st_dev = (*env)->GetFieldID(env, clazz, "st_dev", "J");
- key_st_ino = (*env)->GetFieldID(env, clazz, "st_ino", "J");
+ CHECK_NULL(key_st_dev = (*env)->GetFieldID(env, clazz, "st_dev", "J"));
+ CHECK_NULL(key_st_ino = (*env)->GetFieldID(env, clazz, "st_ino", "J"));
}
diff --git a/jdk/src/solaris/native/sun/nio/ch/IOUtil.c b/jdk/src/solaris/native/sun/nio/ch/IOUtil.c
index 7dbf010fcac..438bf41ddea 100644
--- a/jdk/src/solaris/native/sun/nio/ch/IOUtil.c
+++ b/jdk/src/solaris/native/sun/nio/ch/IOUtil.c
@@ -42,8 +42,8 @@ static jfieldID fd_fdID; /* for jint 'fd' in java.io.FileDescriptor */
JNIEXPORT void JNICALL
Java_sun_nio_ch_IOUtil_initIDs(JNIEnv *env, jclass clazz)
{
- clazz = (*env)->FindClass(env, "java/io/FileDescriptor");
- fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I");
+ CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
+ CHECK_NULL(fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"));
}
JNIEXPORT jboolean JNICALL
diff --git a/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
index 7a730cc0b25..e96c9b0cc0a 100644
--- a/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
@@ -57,12 +57,20 @@ Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(JNIEnv *env, jclass c)
jclass cls;
cls = (*env)->FindClass(env, "java/io/FileDescriptor");
+ CHECK_NULL(cls);
fd_fdID = (*env)->GetFieldID(env, cls, "fd", "I");
+ CHECK_NULL(fd_fdID);
cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
+ CHECK_NULL(cls);
isa_class = (*env)->NewGlobalRef(env, cls);
+ if (isa_class == NULL) {
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return;
+ }
isa_ctorID = (*env)->GetMethodID(env, cls, "",
"(Ljava/net/InetAddress;I)V");
+ CHECK_NULL(isa_ctorID);
}
JNIEXPORT jint JNICALL
@@ -79,6 +87,10 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
jint remote_port;
NET_AllocSockaddr(&sa, &alloc_len);
+ if (sa == NULL) {
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return IOS_THROWN;
+ }
/*
* accept connection but ignore ECONNABORTED indicating that
@@ -110,8 +122,9 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
(*env)->SetIntField(env, newfdo, fd_fdID, newfd);
remote_ia = NET_SockaddrToInetAddress(env, sa, (int *)&remote_port);
free((void *)sa);
- isa = (*env)->NewObject(env, isa_class, isa_ctorID,
- remote_ia, remote_port);
+ CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
+ isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
+ CHECK_NULL_RETURN(isa, IOS_THROWN);
(*env)->SetObjectArrayElement(env, isaa, 0, isa);
return 1;
}
diff --git a/jdk/src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c
index 225556b4d9f..54e16af7f6b 100644
--- a/jdk/src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c
@@ -214,6 +214,7 @@ void handleSendFailed
/* retrieved address from sockaddr */
isaObj = SockAddrToInetSocketAddress(env, sap);
+ CHECK_NULL(isaObj);
/* data retrieved from sff_data */
if (dataLength > 0) {
@@ -338,6 +339,7 @@ void handlePeerAddrChange
}
addressObj = SockAddrToInetSocketAddress(env, (struct sockaddr*)&spc->spc_aaddr);
+ CHECK_NULL(addressObj);
/* create PeerAddressChanged */
resultObj = (*env)->NewObject(env, spc_class, spc_ctrID, spc->spc_assoc_id,
@@ -394,6 +396,7 @@ void handleMessage
}
isa = SockAddrToInetSocketAddress(env, sap);
+ CHECK_NULL(isa);
getControlData(msg, cdata);
/* create MessageInfoImpl */
@@ -580,4 +583,3 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect
return Java_sun_nio_ch_SocketChannelImpl_checkConnect(env, this,
fdo, block, ready);
}
-
diff --git a/jdk/src/solaris/native/sun/nio/ch/sctp/SctpNet.c b/jdk/src/solaris/native/sun/nio/ch/sctp/SctpNet.c
index 57c4fae4fa5..f03be57b5d0 100644
--- a/jdk/src/solaris/native/sun/nio/ch/sctp/SctpNet.c
+++ b/jdk/src/solaris/native/sun/nio/ch/sctp/SctpNet.c
@@ -382,8 +382,9 @@ JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0
ia = NET_SockaddrToInetAddress(env, sap, &port);
if (ia != NULL)
isa = (*env)->NewObject(env, isaCls, isaCtrID, ia, port);
- if (isa != NULL)
- (*env)->SetObjectArrayElement(env, isaa, i, isa);
+ if (isa == NULL)
+ break;
+ (*env)->SetObjectArrayElement(env, isaa, i, isa);
if (sap->sa_family == AF_INET)
addr_buf = ((struct sockaddr_in*)addr_buf) + 1;
@@ -433,8 +434,9 @@ jobjectArray getRemoteAddresses
ia = NET_SockaddrToInetAddress(env, sap, &port);
if (ia != NULL)
isa = (*env)->NewObject(env, isaCls, isaCtrID, ia, port);
- if (isa != NULL)
- (*env)->SetObjectArrayElement(env, isaa, i, isa);
+ if (isa == NULL)
+ break;
+ (*env)->SetObjectArrayElement(env, isaa, i, isa);
if (sap->sa_family == AF_INET)
addr_buf = ((struct sockaddr_in*)addr_buf) + 1;
diff --git a/jdk/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c b/jdk/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c
index 0b4f2a74dff..9453f75d3de 100644
--- a/jdk/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c
+++ b/jdk/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c
@@ -72,13 +72,15 @@ Java_sun_nio_fs_BsdNativeDispatcher_initIDs(JNIEnv* env, jclass this)
jclass clazz;
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+ CHECK_NULL(entry_name);
entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+ CHECK_NULL(entry_dir);
entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+ CHECK_NULL(entry_fstype);
entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
+ CHECK_NULL(entry_options);
}
JNIEXPORT jlong JNICALL
@@ -201,4 +203,3 @@ Java_sun_nio_fs_BsdNativeDispatcher_endfsstat(JNIEnv* env, jclass this, jlong va
free(iter);
}
}
-
diff --git a/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c b/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
index 1de7d5b3c98..c8500db5c87 100644
--- a/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
+++ b/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
@@ -68,13 +68,15 @@ Java_sun_nio_fs_LinuxNativeDispatcher_init(JNIEnv *env, jclass clazz)
my_flistxattr_func = (flistxattr_func*)dlsym(RTLD_DEFAULT, "flistxattr");
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
- if (clazz == NULL)
- return;
-
+ CHECK_NULL(clazz);
entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+ CHECK_NULL(entry_name);
entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+ CHECK_NULL(entry_dir);
entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+ CHECK_NULL(entry_fstype);
entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
+ CHECK_NULL(entry_options);
}
JNIEXPORT jint JNICALL
diff --git a/jdk/src/solaris/native/sun/nio/fs/SolarisNativeDispatcher.c b/jdk/src/solaris/native/sun/nio/fs/SolarisNativeDispatcher.c
index 1480ea9046b..de04bbddc7c 100644
--- a/jdk/src/solaris/native/sun/nio/fs/SolarisNativeDispatcher.c
+++ b/jdk/src/solaris/native/sun/nio/fs/SolarisNativeDispatcher.c
@@ -55,14 +55,17 @@ static void throwUnixException(JNIEnv* env, int errnum) {
JNIEXPORT void JNICALL
Java_sun_nio_fs_SolarisNativeDispatcher_init(JNIEnv *env, jclass clazz) {
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
- if (clazz == NULL)
- return;
-
+ CHECK_NULL(clazz);
entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+ CHECK_NULL(entry_name);
entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+ CHECK_NULL(entry_dir);
entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+ CHECK_NULL(entry_fstype);
entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
+ CHECK_NULL(entry_options);
entry_dev = (*env)->GetFieldID(env, clazz, "dev", "J");
+ CHECK_NULL(entry_dev);
}
JNIEXPORT jint JNICALL
diff --git a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
index 12f399d8512..8901376361d 100644
--- a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+++ b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
@@ -179,46 +179,64 @@ Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
jclass clazz;
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixFileAttributes");
- if (clazz == NULL) {
- return 0;
- }
+ CHECK_NULL_RETURN(clazz, 0);
attrs_st_mode = (*env)->GetFieldID(env, clazz, "st_mode", "I");
+ CHECK_NULL_RETURN(attrs_st_mode, 0);
attrs_st_ino = (*env)->GetFieldID(env, clazz, "st_ino", "J");
+ CHECK_NULL_RETURN(attrs_st_ino, 0);
attrs_st_dev = (*env)->GetFieldID(env, clazz, "st_dev", "J");
+ CHECK_NULL_RETURN(attrs_st_dev, 0);
attrs_st_rdev = (*env)->GetFieldID(env, clazz, "st_rdev", "J");
+ CHECK_NULL_RETURN(attrs_st_rdev, 0);
attrs_st_nlink = (*env)->GetFieldID(env, clazz, "st_nlink", "I");
+ CHECK_NULL_RETURN(attrs_st_nlink, 0);
attrs_st_uid = (*env)->GetFieldID(env, clazz, "st_uid", "I");
+ CHECK_NULL_RETURN(attrs_st_uid, 0);
attrs_st_gid = (*env)->GetFieldID(env, clazz, "st_gid", "I");
+ CHECK_NULL_RETURN(attrs_st_gid, 0);
attrs_st_size = (*env)->GetFieldID(env, clazz, "st_size", "J");
+ CHECK_NULL_RETURN(attrs_st_size, 0);
attrs_st_atime_sec = (*env)->GetFieldID(env, clazz, "st_atime_sec", "J");
+ CHECK_NULL_RETURN(attrs_st_atime_sec, 0);
attrs_st_atime_nsec = (*env)->GetFieldID(env, clazz, "st_atime_nsec", "J");
+ CHECK_NULL_RETURN(attrs_st_atime_nsec, 0);
attrs_st_mtime_sec = (*env)->GetFieldID(env, clazz, "st_mtime_sec", "J");
+ CHECK_NULL_RETURN(attrs_st_mtime_sec, 0);
attrs_st_mtime_nsec = (*env)->GetFieldID(env, clazz, "st_mtime_nsec", "J");
+ CHECK_NULL_RETURN(attrs_st_mtime_nsec, 0);
attrs_st_ctime_sec = (*env)->GetFieldID(env, clazz, "st_ctime_sec", "J");
+ CHECK_NULL_RETURN(attrs_st_ctime_sec, 0);
attrs_st_ctime_nsec = (*env)->GetFieldID(env, clazz, "st_ctime_nsec", "J");
+ CHECK_NULL_RETURN(attrs_st_ctime_nsec, 0);
#ifdef _DARWIN_FEATURE_64_BIT_INODE
attrs_st_birthtime_sec = (*env)->GetFieldID(env, clazz, "st_birthtime_sec", "J");
+ CHECK_NULL_RETURN(attrs_st_birthtime_sec, 0);
#endif
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixFileStoreAttributes");
- if (clazz == NULL) {
- return 0;
- }
+ CHECK_NULL_RETURN(clazz, 0);
attrs_f_frsize = (*env)->GetFieldID(env, clazz, "f_frsize", "J");
+ CHECK_NULL_RETURN(attrs_f_frsize, 0);
attrs_f_blocks = (*env)->GetFieldID(env, clazz, "f_blocks", "J");
+ CHECK_NULL_RETURN(attrs_f_blocks, 0);
attrs_f_bfree = (*env)->GetFieldID(env, clazz, "f_bfree", "J");
+ CHECK_NULL_RETURN(attrs_f_bfree, 0);
attrs_f_bavail = (*env)->GetFieldID(env, clazz, "f_bavail", "J");
+ CHECK_NULL_RETURN(attrs_f_bavail, 0);
clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
- if (clazz == NULL) {
- return 0;
- }
+ CHECK_NULL_RETURN(clazz, 0);
entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+ CHECK_NULL_RETURN(entry_name, 0);
entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+ CHECK_NULL_RETURN(entry_dir, 0);
entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+ CHECK_NULL_RETURN(entry_fstype, 0);
entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
+ CHECK_NULL_RETURN(entry_options, 0);
entry_dev = (*env)->GetFieldID(env, clazz, "dev", "J");
+ CHECK_NULL_RETURN(entry_dev, 0);
/* system calls that might not be available at run time */
diff --git a/jdk/src/windows/native/java/io/FileDescriptor_md.c b/jdk/src/windows/native/java/io/FileDescriptor_md.c
index 221bf1d9217..db04cd47653 100644
--- a/jdk/src/windows/native/java/io/FileDescriptor_md.c
+++ b/jdk/src/windows/native/java/io/FileDescriptor_md.c
@@ -48,8 +48,8 @@ jfieldID IO_handle_fdID;
JNIEXPORT void JNICALL
Java_java_io_FileDescriptor_initIDs(JNIEnv *env, jclass fdClass) {
- IO_fd_fdID = (*env)->GetFieldID(env, fdClass, "fd", "I");
- IO_handle_fdID = (*env)->GetFieldID(env, fdClass, "handle", "J");
+ CHECK_NULL(IO_fd_fdID = (*env)->GetFieldID(env, fdClass, "fd", "I"));
+ CHECK_NULL(IO_handle_fdID = (*env)->GetFieldID(env, fdClass, "handle", "J"));
}
JNIEXPORT jlong JNICALL
diff --git a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
index 3c8b821e027..ec7d9d7294b 100644
--- a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
+++ b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
@@ -59,10 +59,12 @@ JNIEXPORT void JNICALL
Java_java_io_WinNTFileSystem_initIDs(JNIEnv *env, jclass cls)
{
HMODULE handle;
- jclass fileClass = (*env)->FindClass(env, "java/io/File");
- if (!fileClass) return;
- ids.path =
- (*env)->GetFieldID(env, fileClass, "path", "Ljava/lang/String;");
+ jclass fileClass;
+
+ fileClass = (*env)->FindClass(env, "java/io/File");
+ CHECK_NULL(fileClass);
+ ids.path = (*env)->GetFieldID(env, fileClass, "path", "Ljava/lang/String;");
+ CHECK_NULL(ids.path);
// GetFinalPathNameByHandle requires Windows Vista or newer
if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
@@ -243,8 +245,8 @@ Java_java_io_WinNTFileSystem_canonicalize0(JNIEnv *env, jobject this,
WCHAR canonicalPath[MAX_PATH_LENGTH];
WITH_UNICODE_STRING(env, pathname, path) {
- /*we estimate the max length of memory needed as
- "currentDir. length + pathname.length"
+ /* we estimate the max length of memory needed as
+ "currentDir. length + pathname.length"
*/
int len = (int)wcslen(path);
len += currentDirLength(path, len);
@@ -256,12 +258,11 @@ Java_java_io_WinNTFileSystem_canonicalize0(JNIEnv *env, jobject this,
}
free(cp);
}
- } else
- if (wcanonicalize(path, canonicalPath, MAX_PATH_LENGTH) >= 0) {
+ } else if (wcanonicalize(path, canonicalPath, MAX_PATH_LENGTH) >= 0) {
rv = (*env)->NewString(env, canonicalPath, (jsize)wcslen(canonicalPath));
}
} END_UNICODE_STRING(env, path);
- if (rv == NULL) {
+ if (rv == NULL && !(*env)->ExceptionCheck(env)) {
JNU_ThrowIOExceptionWithLastError(env, "Bad pathname");
}
return rv;
@@ -288,15 +289,14 @@ Java_java_io_WinNTFileSystem_canonicalizeWithPrefix0(JNIEnv *env, jobject this,
}
free(cp);
}
- } else
- if (wcanonicalizeWithPrefix(canonicalPrefix,
- pathWithCanonicalPrefix,
- canonicalPath, MAX_PATH_LENGTH) >= 0) {
+ } else if (wcanonicalizeWithPrefix(canonicalPrefix,
+ pathWithCanonicalPrefix,
+ canonicalPath, MAX_PATH_LENGTH) >= 0) {
rv = (*env)->NewString(env, canonicalPath, (jsize)wcslen(canonicalPath));
}
} END_UNICODE_STRING(env, pathWithCanonicalPrefix);
} END_UNICODE_STRING(env, canonicalPrefix);
- if (rv == NULL) {
+ if (rv == NULL && !(*env)->ExceptionCheck(env)) {
JNU_ThrowIOExceptionWithLastError(env, "Bad pathname");
}
return rv;
@@ -616,8 +616,13 @@ Java_java_io_WinNTFileSystem_list(JNIEnv *env, jobject this, jobject file)
jobjectArray rv, old;
DWORD fattr;
jstring name;
+ jclass str_class;
+ WCHAR *pathbuf;
- WCHAR *pathbuf = fileToNTPath(env, file, ids.path);
+ str_class = JNU_ClassString(env);
+ CHECK_NULL_RETURN(str_class, NULL);
+
+ pathbuf = fileToNTPath(env, file, ids.path);
if (pathbuf == NULL)
return NULL;
search_path = (WCHAR*)malloc(2*wcslen(pathbuf) + 6);
@@ -664,7 +669,7 @@ Java_java_io_WinNTFileSystem_list(JNIEnv *env, jobject this, jobject file)
return NULL;
} else {
// No files found - return an empty array
- rv = (*env)->NewObjectArray(env, 0, JNU_ClassString(env), NULL);
+ rv = (*env)->NewObjectArray(env, 0, str_class, NULL);
return rv;
}
}
@@ -672,7 +677,7 @@ Java_java_io_WinNTFileSystem_list(JNIEnv *env, jobject this, jobject file)
/* Allocate an initial String array */
len = 0;
maxlen = 16;
- rv = (*env)->NewObjectArray(env, maxlen, JNU_ClassString(env), NULL);
+ rv = (*env)->NewObjectArray(env, maxlen, str_class, NULL);
if (rv == NULL) // Couldn't allocate an array
return NULL;
/* Scan the directory */
@@ -686,10 +691,8 @@ Java_java_io_WinNTFileSystem_list(JNIEnv *env, jobject this, jobject file)
return NULL; // error;
if (len == maxlen) {
old = rv;
- rv = (*env)->NewObjectArray(env, maxlen <<= 1,
- JNU_ClassString(env), NULL);
- if ( rv == NULL
- || JNU_CopyObjectArray(env, rv, old, len) < 0)
+ rv = (*env)->NewObjectArray(env, maxlen <<= 1, str_class, NULL);
+ if (rv == NULL || JNU_CopyObjectArray(env, rv, old, len) < 0)
return NULL; // error
(*env)->DeleteLocalRef(env, old);
}
@@ -704,7 +707,7 @@ Java_java_io_WinNTFileSystem_list(JNIEnv *env, jobject this, jobject file)
/* Copy the final results into an appropriately-sized array */
old = rv;
- rv = (*env)->NewObjectArray(env, len, JNU_ClassString(env), NULL);
+ rv = (*env)->NewObjectArray(env, len, str_class, NULL);
if (rv == NULL)
return NULL; /* error */
if (JNU_CopyObjectArray(env, rv, old, len) < 0)
diff --git a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
index ab46f8d7faa..ecc96a1d8bb 100644
--- a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
@@ -45,18 +45,28 @@ JNIEXPORT void JNICALL
Java_sun_nio_ch_DatagramChannelImpl_initIDs(JNIEnv *env, jclass clazz)
{
clazz = (*env)->FindClass(env, "java/net/InetSocketAddress");
+ CHECK_NULL(clazz);
isa_class = (*env)->NewGlobalRef(env, clazz);
+ if (isa_class == NULL) {
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return;
+ }
isa_ctorID = (*env)->GetMethodID(env, clazz, "",
"(Ljava/net/InetAddress;I)V");
+ CHECK_NULL(isa_ctorID);
clazz = (*env)->FindClass(env, "sun/nio/ch/DatagramChannelImpl");
+ CHECK_NULL(clazz);
dci_senderID = (*env)->GetFieldID(env, clazz, "sender",
"Ljava/net/SocketAddress;");
+ CHECK_NULL(dci_senderID);
dci_senderAddrID = (*env)->GetFieldID(env, clazz,
"cachedSenderInetAddress",
"Ljava/net/InetAddress;");
+ CHECK_NULL(dci_senderAddrID);
dci_senderPortID = (*env)->GetFieldID(env, clazz,
"cachedSenderPort", "I");
+ CHECK_NULL(dci_senderPortID);
}
/*
@@ -185,17 +195,11 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
if (senderAddr == NULL) {
jobject isa = NULL;
int port;
- jobject ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa,
- &port);
-
+ jobject ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
if (ia != NULL) {
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
}
-
- if (isa == NULL) {
- JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
- return IOS_THROWN;
- }
+ CHECK_NULL_RETURN(isa, IOS_THROWN);
// update cachedSenderInetAddress/cachedSenderPort
(*env)->SetObjectField(env, this, dci_senderAddrID, ia);
diff --git a/jdk/src/windows/native/sun/nio/ch/FileKey.c b/jdk/src/windows/native/sun/nio/ch/FileKey.c
index e095296abeb..65306d1d639 100644
--- a/jdk/src/windows/native/sun/nio/ch/FileKey.c
+++ b/jdk/src/windows/native/sun/nio/ch/FileKey.c
@@ -38,9 +38,9 @@ static jfieldID key_indexLow; /* id for FileKey.nFileIndexLow */
JNIEXPORT void JNICALL
Java_sun_nio_ch_FileKey_initIDs(JNIEnv *env, jclass clazz)
{
- key_volumeSN = (*env)->GetFieldID(env, clazz, "dwVolumeSerialNumber", "J");
- key_indexHigh = (*env)->GetFieldID(env, clazz, "nFileIndexHigh", "J");
- key_indexLow = (*env)->GetFieldID(env, clazz, "nFileIndexLow", "J");
+ CHECK_NULL(key_volumeSN = (*env)->GetFieldID(env, clazz, "dwVolumeSerialNumber", "J"));
+ CHECK_NULL(key_indexHigh = (*env)->GetFieldID(env, clazz, "nFileIndexHigh", "J"));
+ CHECK_NULL(key_indexLow = (*env)->GetFieldID(env, clazz, "nFileIndexLow", "J"));
}
diff --git a/jdk/src/windows/native/sun/nio/ch/IOUtil.c b/jdk/src/windows/native/sun/nio/ch/IOUtil.c
index 10c72e4682f..370dcf5e23f 100644
--- a/jdk/src/windows/native/sun/nio/ch/IOUtil.c
+++ b/jdk/src/windows/native/sun/nio/ch/IOUtil.c
@@ -52,9 +52,9 @@ Java_sun_security_provider_NativeSeedGenerator_nativeGenerateSeed
JNIEXPORT void JNICALL
Java_sun_nio_ch_IOUtil_initIDs(JNIEnv *env, jclass clazz)
{
- clazz = (*env)->FindClass(env, "java/io/FileDescriptor");
- fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I");
- handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J");
+ CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
+ CHECK_NULL(fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"));
+ CHECK_NULL(handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J"));
}
/**************************************************************
diff --git a/jdk/src/windows/native/sun/nio/ch/Iocp.c b/jdk/src/windows/native/sun/nio/ch/Iocp.c
index 8f87a8937f7..f9556234075 100644
--- a/jdk/src/windows/native/sun/nio/ch/Iocp.c
+++ b/jdk/src/windows/native/sun/nio/ch/Iocp.c
@@ -46,16 +46,15 @@ Java_sun_nio_ch_Iocp_initIDs(JNIEnv* env, jclass this)
jclass clazz;
clazz = (*env)->FindClass(env, "sun/nio/ch/Iocp$CompletionStatus");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
completionStatus_error = (*env)->GetFieldID(env, clazz, "error", "I");
- if (completionStatus_error == NULL) return;
+ CHECK_NULL(completionStatus_error);
completionStatus_bytesTransferred = (*env)->GetFieldID(env, clazz, "bytesTransferred", "I");
- if (completionStatus_bytesTransferred == NULL) return;
+ CHECK_NULL(completionStatus_bytesTransferred);
completionStatus_completionKey = (*env)->GetFieldID(env, clazz, "completionKey", "I");
- if (completionStatus_completionKey == NULL) return;
+ CHECK_NULL(completionStatus_completionKey);
completionStatus_overlapped = (*env)->GetFieldID(env, clazz, "overlapped", "J");
+ CHECK_NULL(completionStatus_overlapped);
}
JNIEXPORT jint JNICALL
diff --git a/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c
index 2af833c2eb7..30d6d641645 100644
--- a/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c
@@ -56,12 +56,20 @@ JNIEXPORT void JNICALL
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(JNIEnv *env, jclass cls)
{
cls = (*env)->FindClass(env, "java/io/FileDescriptor");
+ CHECK_NULL(cls);
fd_fdID = (*env)->GetFieldID(env, cls, "fd", "I");
+ CHECK_NULL(fd_fdID);
cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
+ CHECK_NULL(cls);
isa_class = (*env)->NewGlobalRef(env, cls);
+ if (isa_class == NULL) {
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return;
+ }
isa_ctorID = (*env)->GetMethodID(env, cls, "",
"(Ljava/net/InetAddress;I)V");
+ CHECK_NULL(isa_ctorID);
}
JNIEXPORT void JNICALL
@@ -99,10 +107,10 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
(*env)->SetIntField(env, newfdo, fd_fdID, newfd);
remote_ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, (int *)&remote_port);
+ CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
- isa = (*env)->NewObject(env, isa_class, isa_ctorID,
- remote_ia, remote_port);
+ isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
+ CHECK_NULL_RETURN(isa, IOS_THROWN);
(*env)->SetObjectArrayElement(env, isaa, 0, isa);
-
return 1;
}
diff --git a/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c
index be50fd69439..5f9fc5000e1 100644
--- a/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c
@@ -42,8 +42,8 @@ static jfieldID ia_addrID; /* java.net.InetAddress.address */
JNIEXPORT void JNICALL
Java_sun_nio_ch_SocketChannelImpl_initIDs(JNIEnv *env, jclass cls)
{
- cls = (*env)->FindClass(env, "java/net/InetAddress");
- ia_addrID = (*env)->GetFieldID(env, cls, "address", "I");
+ CHECK_NULL(cls = (*env)->FindClass(env, "java/net/InetAddress"));
+ CHECK_NULL(ia_addrID = (*env)->GetFieldID(env, cls, "address", "I"));
}
jint
diff --git a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
index 62d8a892b05..3b981f3760b 100644
--- a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
+++ b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
@@ -111,65 +111,70 @@ Java_sun_nio_fs_WindowsNativeDispatcher_initIDs(JNIEnv* env, jclass this)
HMODULE h;
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$FirstFile");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
findFirst_handle = (*env)->GetFieldID(env, clazz, "handle", "J");
+ CHECK_NULL(findFirst_handle);
findFirst_name = (*env)->GetFieldID(env, clazz, "name", "Ljava/lang/String;");
+ CHECK_NULL(findFirst_name);
findFirst_attributes = (*env)->GetFieldID(env, clazz, "attributes", "I");
+ CHECK_NULL(findFirst_attributes);
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$FirstStream");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
findStream_handle = (*env)->GetFieldID(env, clazz, "handle", "J");
+ CHECK_NULL(findStream_handle);
findStream_name = (*env)->GetFieldID(env, clazz, "name", "Ljava/lang/String;");
+ CHECK_NULL(findStream_name);
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$VolumeInformation");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
volumeInfo_fsName = (*env)->GetFieldID(env, clazz, "fileSystemName", "Ljava/lang/String;");
+ CHECK_NULL(volumeInfo_fsName);
volumeInfo_volName = (*env)->GetFieldID(env, clazz, "volumeName", "Ljava/lang/String;");
+ CHECK_NULL(volumeInfo_volName);
volumeInfo_volSN = (*env)->GetFieldID(env, clazz, "volumeSerialNumber", "I");
+ CHECK_NULL(volumeInfo_volSN);
volumeInfo_flags = (*env)->GetFieldID(env, clazz, "flags", "I");
+ CHECK_NULL(volumeInfo_flags);
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$DiskFreeSpace");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
diskSpace_bytesAvailable = (*env)->GetFieldID(env, clazz, "freeBytesAvailable", "J");
+ CHECK_NULL(diskSpace_bytesAvailable);
diskSpace_totalBytes = (*env)->GetFieldID(env, clazz, "totalNumberOfBytes", "J");
+ CHECK_NULL(diskSpace_totalBytes);
diskSpace_totalFree = (*env)->GetFieldID(env, clazz, "totalNumberOfFreeBytes", "J");
+ CHECK_NULL(diskSpace_totalFree);
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$Account");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
account_domain = (*env)->GetFieldID(env, clazz, "domain", "Ljava/lang/String;");
+ CHECK_NULL(account_domain);
account_name = (*env)->GetFieldID(env, clazz, "name", "Ljava/lang/String;");
+ CHECK_NULL(account_name);
account_use = (*env)->GetFieldID(env, clazz, "use", "I");
+ CHECK_NULL(account_use);
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$AclInformation");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
aclInfo_aceCount = (*env)->GetFieldID(env, clazz, "aceCount", "I");
+ CHECK_NULL(aclInfo_aceCount);
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$CompletionStatus");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
completionStatus_error = (*env)->GetFieldID(env, clazz, "error", "I");
+ CHECK_NULL(completionStatus_error);
completionStatus_bytesTransferred = (*env)->GetFieldID(env, clazz, "bytesTransferred", "I");
+ CHECK_NULL(completionStatus_bytesTransferred);
completionStatus_completionKey = (*env)->GetFieldID(env, clazz, "completionKey", "J");
+ CHECK_NULL(completionStatus_completionKey);
clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$BackupResult");
- if (clazz == NULL) {
- return;
- }
+ CHECK_NULL(clazz);
backupResult_bytesTransferred = (*env)->GetFieldID(env, clazz, "bytesTransferred", "I");
+ CHECK_NULL(backupResult_bytesTransferred);
backupResult_context = (*env)->GetFieldID(env, clazz, "context", "J");
+ CHECK_NULL(backupResult_context);
// get handle to kernel32
if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
From 0abb2b14edd9f7b4de461efa47fe31b4cbfb92c1 Mon Sep 17 00:00:00 2001
From: Alan Bateman
Date: Mon, 3 Feb 2014 14:18:45 +0000
Subject: [PATCH 090/159] 8030795:
java/nio/file/Files/probeContentType/ForceLoad.java failing with
ServiceConfigurationError without jtreg -agentvm option
Reviewed-by: michaelm
---
jdk/test/java/nio/file/Files/probeContentType/ForceLoad.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/jdk/test/java/nio/file/Files/probeContentType/ForceLoad.java b/jdk/test/java/nio/file/Files/probeContentType/ForceLoad.java
index 5bb19ddaaa0..4a4edb26eb8 100644
--- a/jdk/test/java/nio/file/Files/probeContentType/ForceLoad.java
+++ b/jdk/test/java/nio/file/Files/probeContentType/ForceLoad.java
@@ -25,6 +25,8 @@
* @bug 4313887
* @summary Test library dependencies by invoking Files.probeContentType
* before other methods that would cause nio.dll to be loaded.
+ * @build ForceLoad SimpleFileTypeDetector
+ * @run main/othervm ForceLoad
*/
import java.nio.file.*;
From b2af3087a436f146c58752433a7ba2170c79d515 Mon Sep 17 00:00:00 2001
From: Michael McMahon
Date: Mon, 3 Feb 2014 14:40:28 +0000
Subject: [PATCH 091/159] 8033425: Delay loading of net library in PortConfig
initialization (workaround for for 8033367)
Reviewed-by: alanb, chegar
---
.../share/classes/java/net/SocketPermission.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/jdk/src/share/classes/java/net/SocketPermission.java b/jdk/src/share/classes/java/net/SocketPermission.java
index 70b004af3bc..0f720c52283 100644
--- a/jdk/src/share/classes/java/net/SocketPermission.java
+++ b/jdk/src/share/classes/java/net/SocketPermission.java
@@ -235,13 +235,11 @@ public final class SocketPermission extends Permission
private static Debug debug = null;
private static boolean debugInit = false;
- // ephemeral port range for this system
- private static final int ephemeralLow = initEphemeralPorts(
- "low", DEF_EPH_LOW
- );
- private static final int ephemeralHigh = initEphemeralPorts(
- "high", PORT_MAX
- );
+ // lazy initializer
+ private static class EphemeralRange {
+ static final int low = initEphemeralPorts("low", DEF_EPH_LOW);
+ static final int high = initEphemeralPorts("high", PORT_MAX);
+ };
static {
Boolean tmp = java.security.AccessController.doPrivileged(
@@ -1235,6 +1233,9 @@ public final class SocketPermission extends Permission
int policyLow, int policyHigh, int targetLow, int targetHigh
)
{
+ final int ephemeralLow = EphemeralRange.low;
+ final int ephemeralHigh = EphemeralRange.high;
+
if (targetLow == 0) {
// check policy includes ephemeral range
if (!inRange(policyLow, policyHigh, ephemeralLow, ephemeralHigh)) {
From 1c571143473e30c79d62cec3959916a3eae0bd2d Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Mon, 3 Feb 2014 09:52:36 -0800
Subject: [PATCH 092/159] 8033416: Remove sun.misc.FpUtils
Reviewed-by: alanb, bpb, psandoz
---
jdk/src/share/classes/java/lang/Double.java | 3 +-
.../share/classes/sun/misc/DoubleConsts.java | 6 +-
.../share/classes/sun/misc/FloatConsts.java | 5 +-
jdk/src/share/classes/sun/misc/FpUtils.java | 931 ------------------
jdk/test/java/lang/Math/HypotTests.java | 5 +-
.../java/lang/Math/IeeeRecommendedTests.java | 40 +-
jdk/test/java/lang/Math/Log1pTests.java | 5 +-
jdk/test/java/lang/Math/Tests.java | 177 +++-
8 files changed, 203 insertions(+), 969 deletions(-)
delete mode 100644 jdk/src/share/classes/sun/misc/FpUtils.java
diff --git a/jdk/src/share/classes/java/lang/Double.java b/jdk/src/share/classes/java/lang/Double.java
index 9ba150e7156..d76c934bc62 100644
--- a/jdk/src/share/classes/java/lang/Double.java
+++ b/jdk/src/share/classes/java/lang/Double.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2014, 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
@@ -26,7 +26,6 @@
package java.lang;
import sun.misc.FloatingDecimal;
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
/**
diff --git a/jdk/src/share/classes/sun/misc/DoubleConsts.java b/jdk/src/share/classes/sun/misc/DoubleConsts.java
index 2c5964b7885..6ee80490102 100644
--- a/jdk/src/share/classes/sun/misc/DoubleConsts.java
+++ b/jdk/src/share/classes/sun/misc/DoubleConsts.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -77,9 +77,7 @@ public class DoubleConsts {
/**
* The exponent the smallest positive double
- * subnormal value would have if it could be normalized. It is
- * equal to the value returned by
- * FpUtils.ilogb(Double.MIN_VALUE).
+ * subnormal value would have if it could be normalized..
*/
public static final int MIN_SUB_EXPONENT = MIN_EXPONENT -
(SIGNIFICAND_WIDTH - 1);
diff --git a/jdk/src/share/classes/sun/misc/FloatConsts.java b/jdk/src/share/classes/sun/misc/FloatConsts.java
index 4345c19fcf3..07396f8bca9 100644
--- a/jdk/src/share/classes/sun/misc/FloatConsts.java
+++ b/jdk/src/share/classes/sun/misc/FloatConsts.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -73,8 +73,7 @@ public class FloatConsts {
/**
* The exponent the smallest positive float subnormal
- * value would have if it could be normalized. It is equal to the
- * value returned by FpUtils.ilogb(Float.MIN_VALUE).
+ * value would have if it could be normalized.
*/
public static final int MIN_SUB_EXPONENT = MIN_EXPONENT -
(SIGNIFICAND_WIDTH - 1);
diff --git a/jdk/src/share/classes/sun/misc/FpUtils.java b/jdk/src/share/classes/sun/misc/FpUtils.java
deleted file mode 100644
index a874c80f628..00000000000
--- a/jdk/src/share/classes/sun/misc/FpUtils.java
+++ /dev/null
@@ -1,931 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, 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.
- */
-
-package sun.misc;
-
-import sun.misc.FloatConsts;
-import sun.misc.DoubleConsts;
-
-/**
- * The class {@code FpUtils} contains static utility methods for
- * manipulating and inspecting {@code float} and
- * {@code double} floating-point numbers. These methods include
- * functionality recommended or required by the IEEE 754
- * floating-point standard.
- *
- * @author Joseph D. Darcy
- */
-
-public class FpUtils {
- /*
- * The methods in this class are reasonably implemented using
- * direct or indirect bit-level manipulation of floating-point
- * values. However, having access to the IEEE 754 recommended
- * functions would obviate the need for most programmers to engage
- * in floating-point bit-twiddling.
- *
- * An IEEE 754 number has three fields, from most significant bit
- * to to least significant, sign, exponent, and significand.
- *
- * msb lsb
- * [sign|exponent| fractional_significand]
- *
- * Using some encoding cleverness, explained below, the high order
- * bit of the logical significand does not need to be explicitly
- * stored, thus "fractional_significand" instead of simply
- * "significand" in the figure above.
- *
- * For finite normal numbers, the numerical value encoded is
- *
- * (-1)^sign * 2^(exponent)*(1.fractional_significand)
- *
- * Most finite floating-point numbers are normalized; the exponent
- * value is reduced until the leading significand bit is 1.
- * Therefore, the leading 1 is redundant and is not explicitly
- * stored. If a numerical value is so small it cannot be
- * normalized, it has a subnormal representation. Subnormal
- * numbers don't have a leading 1 in their significand; subnormals
- * are encoding using a special exponent value. In other words,
- * the high-order bit of the logical significand can be elided in
- * from the representation in either case since the bit's value is
- * implicit from the exponent value.
- *
- * The exponent field uses a biased representation; if the bits of
- * the exponent are interpreted as a unsigned integer E, the
- * exponent represented is E - E_bias where E_bias depends on the
- * floating-point format. E can range between E_min and E_max,
- * constants which depend on the floating-point format. E_min and
- * E_max are -126 and +127 for float, -1022 and +1023 for double.
- *
- * The 32-bit float format has 1 sign bit, 8 exponent bits, and 23
- * bits for the significand (which is logically 24 bits wide
- * because of the implicit bit). The 64-bit double format has 1
- * sign bit, 11 exponent bits, and 52 bits for the significand
- * (logically 53 bits).
- *
- * Subnormal numbers and zero have the special exponent value
- * E_min -1; the numerical value represented by a subnormal is:
- *
- * (-1)^sign * 2^(E_min)*(0.fractional_significand)
- *
- * Zero is represented by all zero bits in the exponent and all
- * zero bits in the significand; zero can have either sign.
- *
- * Infinity and NaN are encoded using the exponent value E_max +
- * 1. Signed infinities have all significand bits zero; NaNs have
- * at least one non-zero significand bit.
- *
- * The details of IEEE 754 floating-point encoding will be used in
- * the methods below without further comment. For further
- * exposition on IEEE 754 numbers, see "IEEE Standard for Binary
- * Floating-Point Arithmetic" ANSI/IEEE Std 754-1985 or William
- * Kahan's "Lecture Notes on the Status of IEEE Standard 754 for
- * Binary Floating-Point Arithmetic",
- * http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps.
- *
- * Many of this class's methods are members of the set of IEEE 754
- * recommended functions or similar functions recommended or
- * required by IEEE 754R. Discussion of various implementation
- * techniques for these functions have occurred in:
- *
- * W.J. Cody and Jerome T. Coonen, "Algorithm 772 Functions to
- * Support the IEEE Standard for Binary Floating-Point
- * Arithmetic," ACM Transactions on Mathematical Software,
- * vol. 19, no. 4, December 1993, pp. 443-451.
- *
- * Joseph D. Darcy, "Writing robust IEEE recommended functions in
- * ``100% Pure Java''(TM)," University of California, Berkeley
- * technical report UCB//CSD-98-1009.
- */
-
- /**
- * Don't let anyone instantiate this class.
- */
- private FpUtils() {}
-
- // Helper Methods
-
- // The following helper methods are used in the implementation of
- // the public recommended functions; they generally omit certain
- // tests for exception cases.
-
- /**
- * Returns unbiased exponent of a {@code double}.
- * @deprecated Use Math.getExponent.
- */
- @Deprecated
- public static int getExponent(double d){
- return Math.getExponent(d);
- }
-
- /**
- * Returns unbiased exponent of a {@code float}.
- * @deprecated Use Math.getExponent.
- */
- @Deprecated
- public static int getExponent(float f){
- return Math.getExponent(f);
- }
-
-
- /**
- * Returns the first floating-point argument with the sign of the
- * second floating-point argument. Note that unlike the {@link
- * FpUtils#copySign(double, double) copySign} method, this method
- * does not require NaN {@code sign} arguments to be treated
- * as positive values; implementations are permitted to treat some
- * NaN arguments as positive and other NaN arguments as negative
- * to allow greater performance.
- *
- * @param magnitude the parameter providing the magnitude of the result
- * @param sign the parameter providing the sign of the result
- * @return a value with the magnitude of {@code magnitude}
- * and the sign of {@code sign}.
- * @author Joseph D. Darcy
- * @deprecated Use Math.copySign.
- */
- @Deprecated
- public static double rawCopySign(double magnitude, double sign) {
- return Math.copySign(magnitude, sign);
- }
-
- /**
- * Returns the first floating-point argument with the sign of the
- * second floating-point argument. Note that unlike the {@link
- * FpUtils#copySign(float, float) copySign} method, this method
- * does not require NaN {@code sign} arguments to be treated
- * as positive values; implementations are permitted to treat some
- * NaN arguments as positive and other NaN arguments as negative
- * to allow greater performance.
- *
- * @param magnitude the parameter providing the magnitude of the result
- * @param sign the parameter providing the sign of the result
- * @return a value with the magnitude of {@code magnitude}
- * and the sign of {@code sign}.
- * @author Joseph D. Darcy
- * @deprecated Use Math.copySign.
- */
- @Deprecated
- public static float rawCopySign(float magnitude, float sign) {
- return Math.copySign(magnitude, sign);
- }
-
- /* ***************************************************************** */
-
- /**
- * Returns {@code true} if the argument is a finite
- * floating-point value; returns {@code false} otherwise (for
- * NaN and infinity arguments).
- *
- * @param d the {@code double} value to be tested
- * @return {@code true} if the argument is a finite
- * floating-point value, {@code false} otherwise.
- * @deprecated Use Double.isFinite.
- */
- @Deprecated
- public static boolean isFinite(double d) {
- return Double.isFinite(d);
- }
-
- /**
- * Returns {@code true} if the argument is a finite
- * floating-point value; returns {@code false} otherwise (for
- * NaN and infinity arguments).
- *
- * @param f the {@code float} value to be tested
- * @return {@code true} if the argument is a finite
- * floating-point value, {@code false} otherwise.
- * @deprecated Use Float.isFinite.
- */
- @Deprecated
- public static boolean isFinite(float f) {
- return Float.isFinite(f);
- }
-
- /**
- * Returns {@code true} if the specified number is infinitely
- * large in magnitude, {@code false} otherwise.
- *
- *
Note that this method is equivalent to the {@link
- * Double#isInfinite(double) Double.isInfinite} method; the
- * functionality is included in this class for convenience.
- *
- * @param d the value to be tested.
- * @return {@code true} if the value of the argument is positive
- * infinity or negative infinity; {@code false} otherwise.
- */
- public static boolean isInfinite(double d) {
- return Double.isInfinite(d);
- }
-
- /**
- * Returns {@code true} if the specified number is infinitely
- * large in magnitude, {@code false} otherwise.
- *
- *
Note that this method is equivalent to the {@link
- * Float#isInfinite(float) Float.isInfinite} method; the
- * functionality is included in this class for convenience.
- *
- * @param f the value to be tested.
- * @return {@code true} if the argument is positive infinity or
- * negative infinity; {@code false} otherwise.
- */
- public static boolean isInfinite(float f) {
- return Float.isInfinite(f);
- }
-
- /**
- * Returns {@code true} if the specified number is a
- * Not-a-Number (NaN) value, {@code false} otherwise.
- *
- *
Note that this method is equivalent to the {@link
- * Double#isNaN(double) Double.isNaN} method; the functionality is
- * included in this class for convenience.
- *
- * @param d the value to be tested.
- * @return {@code true} if the value of the argument is NaN;
- * {@code false} otherwise.
- */
- public static boolean isNaN(double d) {
- return Double.isNaN(d);
- }
-
- /**
- * Returns {@code true} if the specified number is a
- * Not-a-Number (NaN) value, {@code false} otherwise.
- *
- *
Note that this method is equivalent to the {@link
- * Float#isNaN(float) Float.isNaN} method; the functionality is
- * included in this class for convenience.
- *
- * @param f the value to be tested.
- * @return {@code true} if the argument is NaN;
- * {@code false} otherwise.
- */
- public static boolean isNaN(float f) {
- return Float.isNaN(f);
- }
-
- /**
- * Returns {@code true} if the unordered relation holds
- * between the two arguments. When two floating-point values are
- * unordered, one value is neither less than, equal to, nor
- * greater than the other. For the unordered relation to be true,
- * at least one argument must be a {@code NaN}.
- *
- * @param arg1 the first argument
- * @param arg2 the second argument
- * @return {@code true} if at least one argument is a NaN,
- * {@code false} otherwise.
- */
- public static boolean isUnordered(double arg1, double arg2) {
- return isNaN(arg1) || isNaN(arg2);
- }
-
- /**
- * Returns {@code true} if the unordered relation holds
- * between the two arguments. When two floating-point values are
- * unordered, one value is neither less than, equal to, nor
- * greater than the other. For the unordered relation to be true,
- * at least one argument must be a {@code NaN}.
- *
- * @param arg1 the first argument
- * @param arg2 the second argument
- * @return {@code true} if at least one argument is a NaN,
- * {@code false} otherwise.
- */
- public static boolean isUnordered(float arg1, float arg2) {
- return isNaN(arg1) || isNaN(arg2);
- }
-
- /**
- * Returns unbiased exponent of a {@code double}; for
- * subnormal values, the number is treated as if it were
- * normalized. That is for all finite, non-zero, positive numbers
- * x, scalb(x, -ilogb(x)) is
- * always in the range [1, 2).
- *
- * Special cases:
- *
- *
If the argument is NaN, then the result is 230.
- *
If the argument is infinite, then the result is 228.
- *
If the argument is zero, then the result is -(228).
- *
- *
- * @param d floating-point number whose exponent is to be extracted
- * @return unbiased exponent of the argument.
- * @author Joseph D. Darcy
- */
- public static int ilogb(double d) {
- int exponent = getExponent(d);
-
- switch (exponent) {
- case DoubleConsts.MAX_EXPONENT+1: // NaN or infinity
- if( isNaN(d) )
- return (1<<30); // 2^30
- else // infinite value
- return (1<<28); // 2^28
-
- case DoubleConsts.MIN_EXPONENT-1: // zero or subnormal
- if(d == 0.0) {
- return -(1<<28); // -(2^28)
- }
- else {
- long transducer = Double.doubleToRawLongBits(d);
-
- /*
- * To avoid causing slow arithmetic on subnormals,
- * the scaling to determine when d's significand
- * is normalized is done in integer arithmetic.
- * (there must be at least one "1" bit in the
- * significand since zero has been screened out.
- */
-
- // isolate significand bits
- transducer &= DoubleConsts.SIGNIF_BIT_MASK;
- assert(transducer != 0L);
-
- // This loop is simple and functional. We might be
- // able to do something more clever that was faster;
- // e.g. number of leading zero detection on
- // (transducer << (# exponent and sign bits).
- while (transducer <
- (1L << (DoubleConsts.SIGNIFICAND_WIDTH - 1))) {
- transducer *= 2;
- exponent--;
- }
- exponent++;
- assert( exponent >=
- DoubleConsts.MIN_EXPONENT - (DoubleConsts.SIGNIFICAND_WIDTH-1) &&
- exponent < DoubleConsts.MIN_EXPONENT);
- return exponent;
- }
-
- default:
- assert( exponent >= DoubleConsts.MIN_EXPONENT &&
- exponent <= DoubleConsts.MAX_EXPONENT);
- return exponent;
- }
- }
-
- /**
- * Returns unbiased exponent of a {@code float}; for
- * subnormal values, the number is treated as if it were
- * normalized. That is for all finite, non-zero, positive numbers
- * x, scalb(x, -ilogb(x)) is
- * always in the range [1, 2).
- *
- * Special cases:
- *
- *
If the argument is NaN, then the result is 230.
- *
If the argument is infinite, then the result is 228.
- *
If the argument is zero, then the result is -(228).
- *
- *
- * @param f floating-point number whose exponent is to be extracted
- * @return unbiased exponent of the argument.
- * @author Joseph D. Darcy
- */
- public static int ilogb(float f) {
- int exponent = getExponent(f);
-
- switch (exponent) {
- case FloatConsts.MAX_EXPONENT+1: // NaN or infinity
- if( isNaN(f) )
- return (1<<30); // 2^30
- else // infinite value
- return (1<<28); // 2^28
-
- case FloatConsts.MIN_EXPONENT-1: // zero or subnormal
- if(f == 0.0f) {
- return -(1<<28); // -(2^28)
- }
- else {
- int transducer = Float.floatToRawIntBits(f);
-
- /*
- * To avoid causing slow arithmetic on subnormals,
- * the scaling to determine when f's significand
- * is normalized is done in integer arithmetic.
- * (there must be at least one "1" bit in the
- * significand since zero has been screened out.
- */
-
- // isolate significand bits
- transducer &= FloatConsts.SIGNIF_BIT_MASK;
- assert(transducer != 0);
-
- // This loop is simple and functional. We might be
- // able to do something more clever that was faster;
- // e.g. number of leading zero detection on
- // (transducer << (# exponent and sign bits).
- while (transducer <
- (1 << (FloatConsts.SIGNIFICAND_WIDTH - 1))) {
- transducer *= 2;
- exponent--;
- }
- exponent++;
- assert( exponent >=
- FloatConsts.MIN_EXPONENT - (FloatConsts.SIGNIFICAND_WIDTH-1) &&
- exponent < FloatConsts.MIN_EXPONENT);
- return exponent;
- }
-
- default:
- assert( exponent >= FloatConsts.MIN_EXPONENT &&
- exponent <= FloatConsts.MAX_EXPONENT);
- return exponent;
- }
- }
-
-
- /*
- * The scalb operation should be reasonably fast; however, there
- * are tradeoffs in writing a method to minimize the worst case
- * performance and writing a method to minimize the time for
- * expected common inputs. Some processors operate very slowly on
- * subnormal operands, taking hundreds or thousands of cycles for
- * one floating-point add or multiply as opposed to, say, four
- * cycles for normal operands. For processors with very slow
- * subnormal execution, scalb would be fastest if written entirely
- * with integer operations; in other words, scalb would need to
- * include the logic of performing correct rounding of subnormal
- * values. This could be reasonably done in at most a few hundred
- * cycles. However, this approach may penalize normal operations
- * since at least the exponent of the floating-point argument must
- * be examined.
- *
- * The approach taken in this implementation is a compromise.
- * Floating-point multiplication is used to do most of the work;
- * but knowingly multiplying by a subnormal scaling factor is
- * avoided. However, the floating-point argument is not examined
- * to see whether or not it is subnormal since subnormal inputs
- * are assumed to be rare. At most three multiplies are needed to
- * scale from the largest to smallest exponent ranges (scaling
- * down, at most two multiplies are needed if subnormal scaling
- * factors are allowed). However, in this implementation an
- * expensive integer remainder operation is avoided at the cost of
- * requiring five floating-point multiplies in the worst case,
- * which should still be a performance win.
- *
- * If scaling of entire arrays is a concern, it would probably be
- * more efficient to provide a double[] scalb(double[], int)
- * version of scalb to avoid having to recompute the needed
- * scaling factors for each floating-point value.
- */
-
- /**
- * Return {@code d} ×
- * 2{@code scale_factor} rounded as if performed
- * by a single correctly rounded floating-point multiply to a
- * member of the double value set. See section 4.2.3 of
- * The Java™ Language Specification
- * for a discussion of floating-point
- * value sets. If the exponent of the result is between the
- * {@code double}'s minimum exponent and maximum exponent,
- * the answer is calculated exactly. If the exponent of the
- * result would be larger than {@code doubles}'s maximum
- * exponent, an infinity is returned. Note that if the result is
- * subnormal, precision may be lost; that is, when {@code scalb(x,
- * n)} is subnormal, {@code scalb(scalb(x, n), -n)} may
- * not equal x. When the result is non-NaN, the result has
- * the same sign as {@code d}.
- *
- *
- * Special cases:
- *
- *
If the first argument is NaN, NaN is returned.
- *
If the first argument is infinite, then an infinity of the
- * same sign is returned.
- *
If the first argument is zero, then a zero of the same
- * sign is returned.
- *
- *
- * @param d number to be scaled by a power of two.
- * @param scale_factor power of 2 used to scale {@code d}
- * @return {@code d * }2{@code scale_factor}
- * @author Joseph D. Darcy
- * @deprecated Use Math.scalb.
- */
- @Deprecated
- public static double scalb(double d, int scale_factor) {
- return Math.scalb(d, scale_factor);
- }
-
- /**
- * Return {@code f} ×
- * 2{@code scale_factor} rounded as if performed
- * by a single correctly rounded floating-point multiply to a
- * member of the float value set. See section 4.2.3 of
- * The Java™ Language Specification
- * for a discussion of floating-point
- * value sets. If the exponent of the result is between the
- * {@code float}'s minimum exponent and maximum exponent, the
- * answer is calculated exactly. If the exponent of the result
- * would be larger than {@code float}'s maximum exponent, an
- * infinity is returned. Note that if the result is subnormal,
- * precision may be lost; that is, when {@code scalb(x, n)}
- * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
- * x. When the result is non-NaN, the result has the same
- * sign as {@code f}.
- *
- *
- * Special cases:
- *
- *
If the first argument is NaN, NaN is returned.
- *
If the first argument is infinite, then an infinity of the
- * same sign is returned.
- *
If the first argument is zero, then a zero of the same
- * sign is returned.
- *
- *
- * @param f number to be scaled by a power of two.
- * @param scale_factor power of 2 used to scale {@code f}
- * @return {@code f * }2{@code scale_factor}
- * @author Joseph D. Darcy
- * @deprecated Use Math.scalb.
- */
- @Deprecated
- public static float scalb(float f, int scale_factor) {
- return Math.scalb(f, scale_factor);
- }
-
- /**
- * Returns the floating-point number adjacent to the first
- * argument in the direction of the second argument. If both
- * arguments compare as equal the second argument is returned.
- *
- *
- * Special cases:
- *
- *
If either argument is a NaN, then NaN is returned.
- *
- *
If both arguments are signed zeros, {@code direction}
- * is returned unchanged (as implied by the requirement of
- * returning the second argument if the arguments compare as
- * equal).
- *
- *
If {@code start} is
- * ±{@code Double.MIN_VALUE} and {@code direction}
- * has a value such that the result should have a smaller
- * magnitude, then a zero with the same sign as {@code start}
- * is returned.
- *
- *
If {@code start} is infinite and
- * {@code direction} has a value such that the result should
- * have a smaller magnitude, {@code Double.MAX_VALUE} with the
- * same sign as {@code start} is returned.
- *
- *
If {@code start} is equal to ±
- * {@code Double.MAX_VALUE} and {@code direction} has a
- * value such that the result should have a larger magnitude, an
- * infinity with same sign as {@code start} is returned.
- *
- *
- * @param start starting floating-point value
- * @param direction value indicating which of
- * {@code start}'s neighbors or {@code start} should
- * be returned
- * @return The floating-point number adjacent to {@code start} in the
- * direction of {@code direction}.
- * @author Joseph D. Darcy
- * @deprecated Use Math.nextAfter
- */
- @Deprecated
- public static double nextAfter(double start, double direction) {
- return Math.nextAfter(start, direction);
- }
-
- /**
- * Returns the floating-point number adjacent to the first
- * argument in the direction of the second argument. If both
- * arguments compare as equal, the second argument is returned.
- *
- *
- * Special cases:
- *
- *
If either argument is a NaN, then NaN is returned.
- *
- *
If both arguments are signed zeros, a {@code float}
- * zero with the same sign as {@code direction} is returned
- * (as implied by the requirement of returning the second argument
- * if the arguments compare as equal).
- *
- *
If {@code start} is
- * ±{@code Float.MIN_VALUE} and {@code direction}
- * has a value such that the result should have a smaller
- * magnitude, then a zero with the same sign as {@code start}
- * is returned.
- *
- *
If {@code start} is infinite and
- * {@code direction} has a value such that the result should
- * have a smaller magnitude, {@code Float.MAX_VALUE} with the
- * same sign as {@code start} is returned.
- *
- *
If {@code start} is equal to ±
- * {@code Float.MAX_VALUE} and {@code direction} has a
- * value such that the result should have a larger magnitude, an
- * infinity with same sign as {@code start} is returned.
- *
- *
- * @param start starting floating-point value
- * @param direction value indicating which of
- * {@code start}'s neighbors or {@code start} should
- * be returned
- * @return The floating-point number adjacent to {@code start} in the
- * direction of {@code direction}.
- * @author Joseph D. Darcy
- * @deprecated Use Math.nextAfter.
- */
- @Deprecated
- public static float nextAfter(float start, double direction) {
- return Math.nextAfter(start, direction);
- }
-
- /**
- * Returns the floating-point value adjacent to {@code d} in
- * the direction of positive infinity. This method is
- * semantically equivalent to {@code nextAfter(d,
- * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
- * implementation may run faster than its equivalent
- * {@code nextAfter} call.
- *
- *
Special Cases:
- *
- *
If the argument is NaN, the result is NaN.
- *
- *
If the argument is positive infinity, the result is
- * positive infinity.
- *
- *
If the argument is zero, the result is
- * {@code Double.MIN_VALUE}
- *
- *
- *
- * @param d starting floating-point value
- * @return The adjacent floating-point value closer to positive
- * infinity.
- * @author Joseph D. Darcy
- * @deprecated use Math.nextUp.
- */
- @Deprecated
- public static double nextUp(double d) {
- return Math.nextUp(d);
- }
-
- /**
- * Returns the floating-point value adjacent to {@code f} in
- * the direction of positive infinity. This method is
- * semantically equivalent to {@code nextAfter(f,
- * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
- * implementation may run faster than its equivalent
- * {@code nextAfter} call.
- *
- *
Special Cases:
- *
- *
If the argument is NaN, the result is NaN.
- *
- *
If the argument is positive infinity, the result is
- * positive infinity.
- *
- *
If the argument is zero, the result is
- * {@code Float.MIN_VALUE}
- *
- *
- *
- * @param f starting floating-point value
- * @return The adjacent floating-point value closer to positive
- * infinity.
- * @author Joseph D. Darcy
- * @deprecated Use Math.nextUp.
- */
- @Deprecated
- public static float nextUp(float f) {
- return Math.nextUp(f);
- }
-
- /**
- * Returns the floating-point value adjacent to {@code d} in
- * the direction of negative infinity. This method is
- * semantically equivalent to {@code nextAfter(d,
- * Double.NEGATIVE_INFINITY)}; however, a
- * {@code nextDown} implementation may run faster than its
- * equivalent {@code nextAfter} call.
- *
- *
Special Cases:
- *
- *
If the argument is NaN, the result is NaN.
- *
- *
If the argument is negative infinity, the result is
- * negative infinity.
- *
- *
If the argument is zero, the result is
- * {@code -Double.MIN_VALUE}
- *
- *
- *
- * @param d starting floating-point value
- * @return The adjacent floating-point value closer to negative
- * infinity.
- * @author Joseph D. Darcy
- * @deprecated Use Math.nextDown.
- */
- @Deprecated
- public static double nextDown(double d) {
- return Math.nextDown(d);
- }
-
- /**
- * Returns the floating-point value adjacent to {@code f} in
- * the direction of negative infinity. This method is
- * semantically equivalent to {@code nextAfter(f,
- * Float.NEGATIVE_INFINITY)}; however, a
- * {@code nextDown} implementation may run faster than its
- * equivalent {@code nextAfter} call.
- *
- *
Special Cases:
- *
- *
If the argument is NaN, the result is NaN.
- *
- *
If the argument is negative infinity, the result is
- * negative infinity.
- *
- *
If the argument is zero, the result is
- * {@code -Float.MIN_VALUE}
- *
- *
- *
- * @param f starting floating-point value
- * @return The adjacent floating-point value closer to negative
- * infinity.
- * @author Joseph D. Darcy
- * @deprecated Use Math.nextDown.
- */
- @Deprecated
- public static double nextDown(float f) {
- return Math.nextDown(f);
- }
-
- /**
- * Returns the first floating-point argument with the sign of the
- * second floating-point argument. For this method, a NaN
- * {@code sign} argument is always treated as if it were
- * positive.
- *
- * @param magnitude the parameter providing the magnitude of the result
- * @param sign the parameter providing the sign of the result
- * @return a value with the magnitude of {@code magnitude}
- * and the sign of {@code sign}.
- * @author Joseph D. Darcy
- * @since 1.5
- * @deprecated Use StrictMath.copySign.
- */
- @Deprecated
- public static double copySign(double magnitude, double sign) {
- return StrictMath.copySign(magnitude, sign);
- }
-
- /**
- * Returns the first floating-point argument with the sign of the
- * second floating-point argument. For this method, a NaN
- * {@code sign} argument is always treated as if it were
- * positive.
- *
- * @param magnitude the parameter providing the magnitude of the result
- * @param sign the parameter providing the sign of the result
- * @return a value with the magnitude of {@code magnitude}
- * and the sign of {@code sign}.
- * @author Joseph D. Darcy
- * @deprecated Use StrictMath.copySign.
- */
- @Deprecated
- public static float copySign(float magnitude, float sign) {
- return StrictMath.copySign(magnitude, sign);
- }
-
- /**
- * Returns the size of an ulp of the argument. An ulp of a
- * {@code double} value is the positive distance between this
- * floating-point value and the {@code double} value next
- * larger in magnitude. Note that for non-NaN x,
- * ulp(-x) == ulp(x).
- *
- *
Special Cases:
- *
- *
If the argument is NaN, then the result is NaN.
- *
If the argument is positive or negative infinity, then the
- * result is positive infinity.
- *
If the argument is positive or negative zero, then the result is
- * {@code Double.MIN_VALUE}.
- *
If the argument is ±{@code Double.MAX_VALUE}, then
- * the result is equal to 2971.
- *
- *
- * @param d the floating-point value whose ulp is to be returned
- * @return the size of an ulp of the argument
- * @author Joseph D. Darcy
- * @since 1.5
- * @deprecated Use Math.ulp.
- */
- @Deprecated
- public static double ulp(double d) {
- return Math.ulp(d);
- }
-
- /**
- * Returns the size of an ulp of the argument. An ulp of a
- * {@code float} value is the positive distance between this
- * floating-point value and the {@code float} value next
- * larger in magnitude. Note that for non-NaN x,
- * ulp(-x) == ulp(x).
- *
- *
Special Cases:
- *
- *
If the argument is NaN, then the result is NaN.
- *
If the argument is positive or negative infinity, then the
- * result is positive infinity.
- *
If the argument is positive or negative zero, then the result is
- * {@code Float.MIN_VALUE}.
- *
If the argument is ±{@code Float.MAX_VALUE}, then
- * the result is equal to 2104.
- *
- *
- * @param f the floating-point value whose ulp is to be returned
- * @return the size of an ulp of the argument
- * @author Joseph D. Darcy
- * @since 1.5
- * @deprecated Use Math.ulp.
- */
- @Deprecated
- public static float ulp(float f) {
- return Math.ulp(f);
- }
-
- /**
- * Returns the signum function of the argument; zero if the argument
- * is zero, 1.0 if the argument is greater than zero, -1.0 if the
- * argument is less than zero.
- *
- *
Special Cases:
- *
- *
If the argument is NaN, then the result is NaN.
- *
If the argument is positive zero or negative zero, then the
- * result is the same as the argument.
- *
- *
- * @param d the floating-point value whose signum is to be returned
- * @return the signum function of the argument
- * @author Joseph D. Darcy
- * @since 1.5
- * @deprecated Use Math.signum.
- */
- @Deprecated
- public static double signum(double d) {
- return Math.signum(d);
- }
-
- /**
- * Returns the signum function of the argument; zero if the argument
- * is zero, 1.0f if the argument is greater than zero, -1.0f if the
- * argument is less than zero.
- *
- *
Special Cases:
- *
- *
If the argument is NaN, then the result is NaN.
- *
If the argument is positive zero or negative zero, then the
- * result is the same as the argument.
- *
- *
- * @param f the floating-point value whose signum is to be returned
- * @return the signum function of the argument
- * @author Joseph D. Darcy
- * @since 1.5
- * @deprecated Use Math.signum.
- */
- @Deprecated
- public static float signum(float f) {
- return Math.signum(f);
- }
-}
diff --git a/jdk/test/java/lang/Math/HypotTests.java b/jdk/test/java/lang/Math/HypotTests.java
index d48a6f938a0..9582c83daf8 100644
--- a/jdk/test/java/lang/Math/HypotTests.java
+++ b/jdk/test/java/lang/Math/HypotTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -29,7 +29,6 @@
*/
import sun.misc.DoubleConsts;
-import sun.misc.FpUtils;
public class HypotTests {
private HypotTests(){}
@@ -127,7 +126,7 @@ public class HypotTests {
double d = rand.nextDouble();
// Scale d to have an exponent equal to MAX_EXPONENT -15
d = Math.scalb(d, DoubleConsts.MAX_EXPONENT
- -15 - FpUtils.ilogb(d));
+ -15 - Tests.ilogb(d));
for(int j = 0; j <= 13; j += 1) {
failures += testHypotCase(3*d, 4*d, 5*d, 2.5);
d *= 2.0; // increase exponent by 1
diff --git a/jdk/test/java/lang/Math/IeeeRecommendedTests.java b/jdk/test/java/lang/Math/IeeeRecommendedTests.java
index f776bbf5b1c..ce4c6595b4b 100644
--- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java
+++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -28,7 +28,6 @@
* @author Joseph D. Darcy
*/
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
import sun.misc.FloatConsts;
@@ -708,21 +707,21 @@ public class IeeeRecommendedTests {
for(int i = 0; i < testCases.length; i++) {
// isNaN
- failures+=Tests.test("FpUtils.isNaN(float)", testCases[i],
- FpUtils.isNaN(testCases[i]), (i ==0));
+ failures+=Tests.test("Float.isNaN(float)", testCases[i],
+ Float.isNaN(testCases[i]), (i ==0));
// isFinite
failures+=Tests.test("Float.isFinite(float)", testCases[i],
Float.isFinite(testCases[i]), (i >= 3));
// isInfinite
- failures+=Tests.test("FpUtils.isInfinite(float)", testCases[i],
- FpUtils.isInfinite(testCases[i]), (i==1 || i==2));
+ failures+=Tests.test("Float.isInfinite(float)", testCases[i],
+ Float.isInfinite(testCases[i]), (i==1 || i==2));
// isUnorderd
for(int j = 0; j < testCases.length; j++) {
- failures+=Tests.test("FpUtils.isUnordered(float, float)", testCases[i],testCases[j],
- FpUtils.isUnordered(testCases[i],testCases[j]), (i==0 || j==0));
+ failures+=Tests.test("Tests.isUnordered(float, float)", testCases[i],testCases[j],
+ Tests.isUnordered(testCases[i],testCases[j]), (i==0 || j==0));
}
}
@@ -758,21 +757,21 @@ public class IeeeRecommendedTests {
for(int i = 0; i < testCases.length; i++) {
// isNaN
- failures+=Tests.test("FpUtils.isNaN(double)", testCases[i],
- FpUtils.isNaN(testCases[i]), (i ==0));
+ failures+=Tests.test("Double.isNaN(double)", testCases[i],
+ Double.isNaN(testCases[i]), (i ==0));
// isFinite
failures+=Tests.test("Double.isFinite(double)", testCases[i],
Double.isFinite(testCases[i]), (i >= 3));
// isInfinite
- failures+=Tests.test("FpUtils.isInfinite(double)", testCases[i],
- FpUtils.isInfinite(testCases[i]), (i==1 || i==2));
+ failures+=Tests.test("Double.isInfinite(double)", testCases[i],
+ Double.isInfinite(testCases[i]), (i==1 || i==2));
// isUnorderd
for(int j = 0; j < testCases.length; j++) {
- failures+=Tests.test("FpUtils.isUnordered(double, double)", testCases[i],testCases[j],
- FpUtils.isUnordered(testCases[i],testCases[j]), (i==0 || j==0));
+ failures+=Tests.test("Tests.isUnordered(double, double)", testCases[i],testCases[j],
+ Tests.isUnordered(testCases[i],testCases[j]), (i==0 || j==0));
}
}
@@ -1023,8 +1022,8 @@ public class IeeeRecommendedTests {
2*FloatConsts.MIN_EXPONENT, // -252
2*FloatConsts.MIN_EXPONENT+1, // -251
- FpUtils.ilogb(Float.MIN_VALUE)-1, // -150
- FpUtils.ilogb(Float.MIN_VALUE), // -149
+ FloatConsts.MIN_EXPONENT - FloatConsts.SIGNIFICAND_WIDTH,
+ FloatConsts.MIN_SUB_EXPONENT,
-FloatConsts.MAX_EXPONENT, // -127
FloatConsts.MIN_EXPONENT, // -126
@@ -1100,7 +1099,7 @@ public class IeeeRecommendedTests {
failures+=testScalbCase(value,
scaleFactor,
- (FpUtils.ilogb(value) +j > FloatConsts.MAX_EXPONENT ) ?
+ (Tests.ilogb(value) +j > FloatConsts.MAX_EXPONENT ) ?
Math.copySign(infinityF, value) : // overflow
// calculate right answer
twoToTheMaxExp*(twoToTheMaxExp*(scale*value)) );
@@ -1230,8 +1229,9 @@ public class IeeeRecommendedTests {
2*DoubleConsts.MIN_EXPONENT, // -2044
2*DoubleConsts.MIN_EXPONENT+1, // -2043
- FpUtils.ilogb(Double.MIN_VALUE)-1, // -1076
- FpUtils.ilogb(Double.MIN_VALUE), // -1075
+ DoubleConsts.MIN_EXPONENT, // -1022
+ DoubleConsts.MIN_EXPONENT - DoubleConsts.SIGNIFICAND_WIDTH,
+ DoubleConsts.MIN_SUB_EXPONENT,
-DoubleConsts.MAX_EXPONENT, // -1023
DoubleConsts.MIN_EXPONENT, // -1022
@@ -1307,7 +1307,7 @@ public class IeeeRecommendedTests {
failures+=testScalbCase(value,
scaleFactor,
- (FpUtils.ilogb(value) +j > DoubleConsts.MAX_EXPONENT ) ?
+ (Tests.ilogb(value) +j > DoubleConsts.MAX_EXPONENT ) ?
Math.copySign(infinityD, value) : // overflow
// calculate right answer
twoToTheMaxExp*(twoToTheMaxExp*(scale*value)) );
diff --git a/jdk/test/java/lang/Math/Log1pTests.java b/jdk/test/java/lang/Math/Log1pTests.java
index 56a80047aa9..5fe373edc78 100644
--- a/jdk/test/java/lang/Math/Log1pTests.java
+++ b/jdk/test/java/lang/Math/Log1pTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -29,7 +29,6 @@
*/
import sun.misc.DoubleConsts;
-import sun.misc.FpUtils;
public class Log1pTests {
private Log1pTests(){}
@@ -105,7 +104,7 @@ public class Log1pTests {
for(int i = 0; i < 1000; i++) {
double d = rand.nextDouble();
- d = Math.scalb(d, -53 - FpUtils.ilogb(d));
+ d = Math.scalb(d, -53 - Tests.ilogb(d));
for(int j = -53; j <= 52; j++) {
failures += testLog1pCaseWithUlpDiff(d, hp15cLogp(d), 5);
diff --git a/jdk/test/java/lang/Math/Tests.java b/jdk/test/java/lang/Math/Tests.java
index 7dd6d68075f..c06c4ed79e3 100644
--- a/jdk/test/java/lang/Math/Tests.java
+++ b/jdk/test/java/lang/Math/Tests.java
@@ -30,7 +30,8 @@
* and finally the expected result.
*/
-import sun.misc.FpUtils;
+import sun.misc.FloatConsts;
+import sun.misc.DoubleConsts;
public class Tests {
private Tests(){}; // do not instantiate
@@ -59,6 +60,176 @@ public class Tests {
return -Math.nextUp(-d);
}
+ /**
+ * Returns unbiased exponent of a {@code float}; for
+ * subnormal values, the number is treated as if it were
+ * normalized. That is for all finite, non-zero, positive numbers
+ * x, scalb(x, -ilogb(x)) is
+ * always in the range [1, 2).
+ *
+ * Special cases:
+ *
+ *
If the argument is NaN, then the result is 230.
+ *
If the argument is infinite, then the result is 228.
+ *
If the argument is zero, then the result is -(228).
+ *
+ *
+ * @param f floating-point number whose exponent is to be extracted
+ * @return unbiased exponent of the argument.
+ */
+ public static int ilogb(double d) {
+ int exponent = Math.getExponent(d);
+
+ switch (exponent) {
+ case DoubleConsts.MAX_EXPONENT+1: // NaN or infinity
+ if( Double.isNaN(d) )
+ return (1<<30); // 2^30
+ else // infinite value
+ return (1<<28); // 2^28
+
+ case DoubleConsts.MIN_EXPONENT-1: // zero or subnormal
+ if(d == 0.0) {
+ return -(1<<28); // -(2^28)
+ }
+ else {
+ long transducer = Double.doubleToRawLongBits(d);
+
+ /*
+ * To avoid causing slow arithmetic on subnormals,
+ * the scaling to determine when d's significand
+ * is normalized is done in integer arithmetic.
+ * (there must be at least one "1" bit in the
+ * significand since zero has been screened out.
+ */
+
+ // isolate significand bits
+ transducer &= DoubleConsts.SIGNIF_BIT_MASK;
+ assert(transducer != 0L);
+
+ // This loop is simple and functional. We might be
+ // able to do something more clever that was faster;
+ // e.g. number of leading zero detection on
+ // (transducer << (# exponent and sign bits).
+ while (transducer <
+ (1L << (DoubleConsts.SIGNIFICAND_WIDTH - 1))) {
+ transducer *= 2;
+ exponent--;
+ }
+ exponent++;
+ assert( exponent >=
+ DoubleConsts.MIN_EXPONENT - (DoubleConsts.SIGNIFICAND_WIDTH-1) &&
+ exponent < DoubleConsts.MIN_EXPONENT);
+ return exponent;
+ }
+
+ default:
+ assert( exponent >= DoubleConsts.MIN_EXPONENT &&
+ exponent <= DoubleConsts.MAX_EXPONENT);
+ return exponent;
+ }
+ }
+
+ /**
+ * Returns unbiased exponent of a {@code float}; for
+ * subnormal values, the number is treated as if it were
+ * normalized. That is for all finite, non-zero, positive numbers
+ * x, scalb(x, -ilogb(x)) is
+ * always in the range [1, 2).
+ *
+ * Special cases:
+ *
+ *
If the argument is NaN, then the result is 230.
+ *
If the argument is infinite, then the result is 228.
+ *
If the argument is zero, then the result is -(228).
+ *
+ *
+ * @param f floating-point number whose exponent is to be extracted
+ * @return unbiased exponent of the argument.
+ */
+ public static int ilogb(float f) {
+ int exponent = Math.getExponent(f);
+
+ switch (exponent) {
+ case FloatConsts.MAX_EXPONENT+1: // NaN or infinity
+ if( Float.isNaN(f) )
+ return (1<<30); // 2^30
+ else // infinite value
+ return (1<<28); // 2^28
+
+ case FloatConsts.MIN_EXPONENT-1: // zero or subnormal
+ if(f == 0.0f) {
+ return -(1<<28); // -(2^28)
+ }
+ else {
+ int transducer = Float.floatToRawIntBits(f);
+
+ /*
+ * To avoid causing slow arithmetic on subnormals,
+ * the scaling to determine when f's significand
+ * is normalized is done in integer arithmetic.
+ * (there must be at least one "1" bit in the
+ * significand since zero has been screened out.
+ */
+
+ // isolate significand bits
+ transducer &= FloatConsts.SIGNIF_BIT_MASK;
+ assert(transducer != 0);
+
+ // This loop is simple and functional. We might be
+ // able to do something more clever that was faster;
+ // e.g. number of leading zero detection on
+ // (transducer << (# exponent and sign bits).
+ while (transducer <
+ (1 << (FloatConsts.SIGNIFICAND_WIDTH - 1))) {
+ transducer *= 2;
+ exponent--;
+ }
+ exponent++;
+ assert( exponent >=
+ FloatConsts.MIN_EXPONENT - (FloatConsts.SIGNIFICAND_WIDTH-1) &&
+ exponent < FloatConsts.MIN_EXPONENT);
+ return exponent;
+ }
+
+ default:
+ assert( exponent >= FloatConsts.MIN_EXPONENT &&
+ exponent <= FloatConsts.MAX_EXPONENT);
+ return exponent;
+ }
+ }
+
+ /**
+ * Returns {@code true} if the unordered relation holds
+ * between the two arguments. When two floating-point values are
+ * unordered, one value is neither less than, equal to, nor
+ * greater than the other. For the unordered relation to be true,
+ * at least one argument must be a {@code NaN}.
+ *
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @return {@code true} if at least one argument is a NaN,
+ * {@code false} otherwise.
+ */
+ public static boolean isUnordered(float arg1, float arg2) {
+ return Float.isNaN(arg1) || Float.isNaN(arg2);
+ }
+
+ /**
+ * Returns {@code true} if the unordered relation holds
+ * between the two arguments. When two floating-point values are
+ * unordered, one value is neither less than, equal to, nor
+ * greater than the other. For the unordered relation to be true,
+ * at least one argument must be a {@code NaN}.
+ *
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @return {@code true} if at least one argument is a NaN,
+ * {@code false} otherwise.
+ */
+ public static boolean isUnordered(double arg1, double arg2) {
+ return Double.isNaN(arg1) || Double.isNaN(arg2);
+ }
+
public static int test(String testName, float input,
boolean result, boolean expected) {
if (expected != result) {
@@ -237,7 +408,7 @@ public class Tests {
return 1;
} else {
double difference = expected - result;
- if (FpUtils.isUnordered(expected, result) ||
+ if (isUnordered(expected, result) ||
Double.isNaN(difference) ||
// fail if greater than or unordered
!(Math.abs( difference/Math.ulp(expected) ) <= Math.abs(ulps)) ) {
@@ -332,7 +503,7 @@ public class Tests {
double result, double expected, double tolerance) {
if (Double.compare(expected, result ) != 0) {
double difference = expected - result;
- if (FpUtils.isUnordered(expected, result) ||
+ if (isUnordered(expected, result) ||
Double.isNaN(difference) ||
// fail if greater than or unordered
!(Math.abs((difference)/expected) <= StrictMath.pow(10, -tolerance)) ) {
From b0082203739bdb64715ac624242e0779c7f1c07a Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Mon, 3 Feb 2014 10:05:56 -0800
Subject: [PATCH 093/159] 8033181: Fix doclint missing issues in
java.awt.{peer, im[.spi]}
Reviewed-by: alanb
---
jdk/src/share/classes/java/awt/im/InputContext.java | 3 ++-
.../classes/java/awt/im/InputMethodHighlight.java | 5 ++++-
.../classes/java/awt/im/spi/InputMethodContext.java | 10 +++++++++-
.../classes/java/awt/im/spi/InputMethodDescriptor.java | 7 ++++++-
jdk/src/share/classes/java/awt/peer/CanvasPeer.java | 4 +++-
jdk/src/share/classes/java/awt/peer/ComponentPeer.java | 6 ++++--
jdk/src/share/classes/java/awt/peer/MouseInfoPeer.java | 9 ++++++++-
jdk/src/share/classes/java/awt/peer/WindowPeer.java | 7 ++++---
8 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/jdk/src/share/classes/java/awt/im/InputContext.java b/jdk/src/share/classes/java/awt/im/InputContext.java
index 615029120dd..9d6122d2781 100644
--- a/jdk/src/share/classes/java/awt/im/InputContext.java
+++ b/jdk/src/share/classes/java/awt/im/InputContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -87,6 +87,7 @@ public class InputContext {
/**
* Returns a new InputContext instance.
+ * @return a new InputContext instance
*/
public static InputContext getInstance() {
return new sun.awt.im.InputMethodContext();
diff --git a/jdk/src/share/classes/java/awt/im/InputMethodHighlight.java b/jdk/src/share/classes/java/awt/im/InputMethodHighlight.java
index 55905d97708..df09076410d 100644
--- a/jdk/src/share/classes/java/awt/im/InputMethodHighlight.java
+++ b/jdk/src/share/classes/java/awt/im/InputMethodHighlight.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -157,6 +157,7 @@ public class InputMethodHighlight {
/**
* Returns whether the text range is selected.
+ * @return whether the text range is selected
*/
public boolean isSelected() {
return selected;
@@ -174,6 +175,7 @@ public class InputMethodHighlight {
/**
* Returns the variation of the text range.
+ * @return the variation of the text range
*/
public int getVariation() {
return variation;
@@ -181,6 +183,7 @@ public class InputMethodHighlight {
/**
* Returns the rendering style attributes for the text range, or null.
+ * @return the rendering style attributes for the text range, or null
* @since 1.3
*/
public Map getStyle() {
diff --git a/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java b/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java
index 8e06c39299b..45517c37b23 100644
--- a/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java
+++ b/jdk/src/share/classes/java/awt/im/spi/InputMethodContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -52,6 +52,14 @@ public interface InputMethodContext extends InputMethodRequests {
* Creates an input method event from the arguments given
* and dispatches it to the client component. For arguments,
* see {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
+ * @param id the event type
+ * @param text the combined committed and composed text
+ * @param committedCharacterCount the number of committed characters in the text
+ * @param caret the caret (a.k.a. insertion point); null if
+ * there's no caret within current composed text
+ * @param visiblePosition the position that's most important to be
+ * visible; null if there's no recommendation for a visible
+ * position within current composed text
*/
public void dispatchInputMethodEvent(int id,
AttributedCharacterIterator text, int committedCharacterCount,
diff --git a/jdk/src/share/classes/java/awt/im/spi/InputMethodDescriptor.java b/jdk/src/share/classes/java/awt/im/spi/InputMethodDescriptor.java
index d462095bb8f..885e7ad4e09 100644
--- a/jdk/src/share/classes/java/awt/im/spi/InputMethodDescriptor.java
+++ b/jdk/src/share/classes/java/awt/im/spi/InputMethodDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -72,6 +72,8 @@ public interface InputMethodDescriptor {
* Returns whether the list of available locales can change
* at runtime. This may be the case, for example, for adapters
* that access real input methods over the network.
+ * @return whether the list of available locales can change at
+ * runtime
*/
boolean hasDynamicLocaleList();
@@ -92,6 +94,9 @@ public interface InputMethodDescriptor {
*
* @param inputLocale the locale for which text input is supported, or null
* @param displayLanguage the language in which the name will be displayed
+ * @return the user-visible name of the corresponding input method
+ * for the given input locale in the language in which the name
+ * will be displayed
*/
String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage);
diff --git a/jdk/src/share/classes/java/awt/peer/CanvasPeer.java b/jdk/src/share/classes/java/awt/peer/CanvasPeer.java
index ba17df0252c..da1c4c0fe5a 100644
--- a/jdk/src/share/classes/java/awt/peer/CanvasPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/CanvasPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -42,6 +42,8 @@ public interface CanvasPeer extends ComponentPeer {
* from the requested GC passed as the argument to this method. This method
* must return a non-null value (given the argument is non-null as well).
*
+ * @param gc the requested graphics configuration
+ * @return a graphics configuration that best suits this Canvas
* @since 1.7
*/
GraphicsConfiguration getAppropriateGraphicsConfiguration(
diff --git a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
index b34f40f1cdd..8f0366711e5 100644
--- a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -516,6 +516,7 @@ public interface ComponentPeer {
/**
* Applies the shape to the native component window.
+ * @param shape the shape to apply
* @since 1.7
*
* @see Component#applyCompoundShape
@@ -525,12 +526,13 @@ public interface ComponentPeer {
/**
* Lowers this component at the bottom of the above HW peer. If the above parameter
* is null then the method places this component at the top of the Z-order.
+ * @param above the peer to lower this component with respect to
*/
void setZOrder(ComponentPeer above);
/**
* Updates internal data structures related to the component's GC.
- *
+ * @param gc the reference graphics configuration
* @return if the peer needs to be recreated for the changes to take effect
* @since 1.7
*/
diff --git a/jdk/src/share/classes/java/awt/peer/MouseInfoPeer.java b/jdk/src/share/classes/java/awt/peer/MouseInfoPeer.java
index 0594bda78bb..9087810b37d 100644
--- a/jdk/src/share/classes/java/awt/peer/MouseInfoPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/MouseInfoPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -55,6 +55,10 @@ public interface MouseInfoPeer {
* is located.
* See java.awt.GraphicsConfiguration documentation for more
* details about virtual screen devices.
+ * @param point holder for the current coordinates of the mouse
+ * cursor
+ * @return the number of the screen device where the pointer is
+ * located
*/
int fillPointWithCoords(Point point);
@@ -63,6 +67,9 @@ public interface MouseInfoPeer {
* pointer. The window is considered to be under the mouse pointer
* if it is showing on the screen, and the mouse pointer is above
* the part of the window that is not obscured by any other windows.
+ * @param w the window to check
+ * @return whether or not the window is located under the mouse
+ * pointer
*/
boolean isWindowUnderMouse(Window w);
diff --git a/jdk/src/share/classes/java/awt/peer/WindowPeer.java b/jdk/src/share/classes/java/awt/peer/WindowPeer.java
index e181b5b3018..65346489990 100644
--- a/jdk/src/share/classes/java/awt/peer/WindowPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/WindowPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -94,14 +94,15 @@ public interface WindowPeer extends ContainerPeer {
/**
* Sets the level of opacity for the window.
- *
+ * @param opacity the level of opacity
* @see Window#setOpacity(float)
*/
void setOpacity(float opacity);
/**
* Enables the per-pixel alpha support for the window.
- *
+ * @param isOpaque whether or not per-pixel alpha support is
+ * enabled
* @see Window#setBackground(Color)
*/
void setOpaque(boolean isOpaque);
From 6261c40dcaa64104fb4ee2ce6d01b8d6e368dfeb Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Mon, 3 Feb 2014 10:21:58 -0800
Subject: [PATCH 094/159] 8033222: Fix serial lint warnings in sun.awt.*
Reviewed-by: alanb
---
jdk/src/share/classes/sun/awt/CustomCursor.java | 3 ++-
jdk/src/share/classes/sun/awt/FontConfiguration.java | 1 +
jdk/src/share/classes/sun/awt/TimedWindowEvent.java | 3 ++-
jdk/src/share/classes/sun/awt/dnd/SunDropTargetEvent.java | 3 ++-
jdk/src/share/classes/sun/awt/event/IgnorePaintEvent.java | 3 ++-
jdk/src/share/classes/sun/awt/image/BadDepthException.java | 3 ++-
jdk/src/share/classes/sun/awt/image/ImageAccessException.java | 3 ++-
jdk/src/share/classes/sun/awt/image/ImageFormatException.java | 3 ++-
jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java | 3 ++-
jdk/src/share/classes/sun/awt/shell/DefaultShellFolder.java | 4 ++--
jdk/src/share/classes/sun/awt/shell/ShellFolder.java | 4 ++--
11 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/jdk/src/share/classes/sun/awt/CustomCursor.java b/jdk/src/share/classes/sun/awt/CustomCursor.java
index a3863e9b6bd..6dad03c8c71 100644
--- a/jdk/src/share/classes/sun/awt/CustomCursor.java
+++ b/jdk/src/share/classes/sun/awt/CustomCursor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -33,6 +33,7 @@ import java.awt.image.*;
*
* @author ThomasBall
*/
+@SuppressWarnings("serial") // JDK-implementation class
public abstract class CustomCursor extends Cursor {
protected Image image;
diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java
index 5d8b35ebe39..4cdc3d80c94 100644
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java
@@ -2109,6 +2109,7 @@ public abstract class FontConfiguration {
return ret;
}
+ @SuppressWarnings("serial") // JDK-implementation class
class FontProperties extends Properties {
public synchronized Object put(Object k, Object v) {
parseProperty((String)k, (String)v);
diff --git a/jdk/src/share/classes/sun/awt/TimedWindowEvent.java b/jdk/src/share/classes/sun/awt/TimedWindowEvent.java
index 21353f789d7..780b3d572e6 100644
--- a/jdk/src/share/classes/sun/awt/TimedWindowEvent.java
+++ b/jdk/src/share/classes/sun/awt/TimedWindowEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -28,6 +28,7 @@ package sun.awt;
import java.awt.event.WindowEvent;
import java.awt.Window;
+@SuppressWarnings("serial") // JDK-implementation class
public class TimedWindowEvent extends WindowEvent {
private long time;
diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetEvent.java b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetEvent.java
index aff7b8a80d6..64685e571a2 100644
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetEvent.java
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -29,6 +29,7 @@ import java.awt.Component;
import java.awt.dnd.InvalidDnDOperationException;
import java.awt.event.MouseEvent;
+@SuppressWarnings("serial") // JDK-implementation class
public class SunDropTargetEvent extends MouseEvent {
public static final int MOUSE_DROPPED = MouseEvent.MOUSE_RELEASED;
diff --git a/jdk/src/share/classes/sun/awt/event/IgnorePaintEvent.java b/jdk/src/share/classes/sun/awt/event/IgnorePaintEvent.java
index c0d38694381..1f59869027d 100644
--- a/jdk/src/share/classes/sun/awt/event/IgnorePaintEvent.java
+++ b/jdk/src/share/classes/sun/awt/event/IgnorePaintEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -35,6 +35,7 @@ import java.awt.event.PaintEvent;
* Look at javax.swing.SwingPaintEventDispatcher for more.
*
*/
+@SuppressWarnings("serial") // JDK-implementation class
public class IgnorePaintEvent extends PaintEvent {
public IgnorePaintEvent(Component source, int id, Rectangle updateRect) {
super(source, id, updateRect);
diff --git a/jdk/src/share/classes/sun/awt/image/BadDepthException.java b/jdk/src/share/classes/sun/awt/image/BadDepthException.java
index 19adf69fbe6..f9d264f22fb 100644
--- a/jdk/src/share/classes/sun/awt/image/BadDepthException.java
+++ b/jdk/src/share/classes/sun/awt/image/BadDepthException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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,6 +25,7 @@
package sun.awt.image;
+@SuppressWarnings("serial") // JDK-implementation class
public class BadDepthException extends Exception {
public BadDepthException() {
}
diff --git a/jdk/src/share/classes/sun/awt/image/ImageAccessException.java b/jdk/src/share/classes/sun/awt/image/ImageAccessException.java
index 43602f64b66..402e2a26caa 100644
--- a/jdk/src/share/classes/sun/awt/image/ImageAccessException.java
+++ b/jdk/src/share/classes/sun/awt/image/ImageAccessException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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,6 +25,7 @@
package sun.awt.image;
+@SuppressWarnings("serial") // JDK-implementation class
public class ImageAccessException extends Exception {
public ImageAccessException(String s) {
super(s);
diff --git a/jdk/src/share/classes/sun/awt/image/ImageFormatException.java b/jdk/src/share/classes/sun/awt/image/ImageFormatException.java
index 4812efe37c2..6a70d728f8f 100644
--- a/jdk/src/share/classes/sun/awt/image/ImageFormatException.java
+++ b/jdk/src/share/classes/sun/awt/image/ImageFormatException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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,6 +25,7 @@
package sun.awt.image;
+@SuppressWarnings("serial") // JDK-implementation class
public class ImageFormatException extends Exception {
public ImageFormatException(String s) {
super(s);
diff --git a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java
index 69bb984c514..adbdb766da1 100644
--- a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java
+++ b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -231,6 +231,7 @@ public class PNGImageDecoder extends ImageDecoder
}
return true;
}
+ @SuppressWarnings("serial") // JDK-implementation class
public class PNGException extends IOException {
PNGException(String s) { super(s); }
}
diff --git a/jdk/src/share/classes/sun/awt/shell/DefaultShellFolder.java b/jdk/src/share/classes/sun/awt/shell/DefaultShellFolder.java
index 860c980d6aa..b44776228d8 100644
--- a/jdk/src/share/classes/sun/awt/shell/DefaultShellFolder.java
+++ b/jdk/src/share/classes/sun/awt/shell/DefaultShellFolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -34,7 +34,7 @@ import sun.security.action.GetPropertyAction;
* @author Michael Martak
* @since 1.4
*/
-
+@SuppressWarnings("serial") // JDK-implementation class
class DefaultShellFolder extends ShellFolder {
/**
diff --git a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
index 630d4faa9cd..cb9459f1d41 100644
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -37,7 +37,7 @@ import java.util.concurrent.Callable;
* @author Michael Martak
* @since 1.4
*/
-
+@SuppressWarnings("serial") // JDK-implementation class
public abstract class ShellFolder extends File {
private static final String COLUMN_NAME = "FileChooser.fileNameHeaderText";
private static final String COLUMN_SIZE = "FileChooser.fileSizeHeaderText";
From c4f2b88d813409eff4a9a72358ccc260c429c29b Mon Sep 17 00:00:00 2001
From: Roger Riggs
Date: Mon, 3 Feb 2014 16:58:02 -0500
Subject: [PATCH 095/159] 8031737: CHECK_NULL and CHECK_EXCEPTION macros
cleanup
Rename CHECK_EXCEPTION macros with JNU prefix; use the defensive do {...} while (0) macro definition
Reviewed-by: chegar, mchung, ksrini, lancea, alanb
---
jdk/src/share/native/common/jni_util.h | 33 +++++++++++++++++++++----
jdk/src/share/native/sun/misc/Version.c | 20 +++++++--------
2 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/jdk/src/share/native/common/jni_util.h b/jdk/src/share/native/common/jni_util.h
index 0dab24c3392..b8d23cd1c21 100644
--- a/jdk/src/share/native/common/jni_util.h
+++ b/jdk/src/share/native/common/jni_util.h
@@ -279,14 +279,37 @@ JNU_NotifyAll(JNIEnv *env, jobject object);
#define JNU_IsNull(env,obj) ((obj) == NULL)
/************************************************************************
- * Miscellaneous utilities used by the class libraries to check for exceptions
+ * Miscellaneous utilities used by the class libraries to return from
+ * a function if a value is NULL or an exception is pending.
*/
-#define CHECK_NULL(x) if ((x) == NULL) return;
-#define CHECK_NULL_RETURN(x, y) if ((x) == NULL) return (y);
+#define CHECK_NULL(x) \
+ do { \
+ if ((x) == NULL) { \
+ return; \
+ } \
+ } while (0) \
-#define CHECK_EXCEPTION(env) if ((*env)->ExceptionCheck(env)) return;
-#define CHECK_EXCEPTION_RETURN(env, y) if ((*env)->ExceptionCheck(env)) return (y);
+#define CHECK_NULL_RETURN(x, y) \
+ do { \
+ if ((x) == NULL) { \
+ return (y); \
+ } \
+ } while (0) \
+
+#define JNU_CHECK_EXCEPTION(env) \
+ do { \
+ if ((*env)->ExceptionCheck(env)) { \
+ return; \
+ } \
+ } while (0) \
+
+#define JNU_CHECK_EXCEPTION_RETURN(env, y) \
+ do { \
+ if ((*env)->ExceptionCheck(env)) { \
+ return (y); \
+ } \
+ } while (0)
/************************************************************************
* Debugging utilities
diff --git a/jdk/src/share/native/sun/misc/Version.c b/jdk/src/share/native/sun/misc/Version.c
index d37010e15d5..4dbcf1c8089 100644
--- a/jdk/src/share/native/sun/misc/Version.c
+++ b/jdk/src/share/native/sun/misc/Version.c
@@ -60,15 +60,15 @@ Java_sun_misc_Version_getJvmVersionInfo(JNIEnv *env, jclass cls)
(*func_p)(env, &info, sizeof(info));
setStaticIntField(env, cls, "jvm_major_version", JVM_VERSION_MAJOR(info.jvm_version));
- CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
+ JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
setStaticIntField(env, cls, "jvm_minor_version", JVM_VERSION_MINOR(info.jvm_version));
- CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
+ JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
setStaticIntField(env, cls, "jvm_micro_version", JVM_VERSION_MICRO(info.jvm_version));
- CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
+ JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
setStaticIntField(env, cls, "jvm_build_number", JVM_VERSION_BUILD(info.jvm_version));
- CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
+ JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
setStaticIntField(env, cls, "jvm_update_version", info.update_version);
- CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
+ JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
jvm_special_version = info.special_update_version;
return JNI_TRUE;
@@ -91,15 +91,15 @@ Java_sun_misc_Version_getJdkVersionInfo(JNIEnv *env, jclass cls)
JDK_GetVersionInfo0(&info, sizeof(info));
setStaticIntField(env, cls, "jdk_major_version", JDK_VERSION_MAJOR(info.jdk_version));
- CHECK_EXCEPTION(env);
+ JNU_CHECK_EXCEPTION(env);
setStaticIntField(env, cls, "jdk_minor_version", JDK_VERSION_MINOR(info.jdk_version));
- CHECK_EXCEPTION(env);
+ JNU_CHECK_EXCEPTION(env);
setStaticIntField(env, cls, "jdk_micro_version", JDK_VERSION_MICRO(info.jdk_version));
- CHECK_EXCEPTION(env);
+ JNU_CHECK_EXCEPTION(env);
setStaticIntField(env, cls, "jdk_build_number", JDK_VERSION_BUILD(info.jdk_version));
- CHECK_EXCEPTION(env);
+ JNU_CHECK_EXCEPTION(env);
setStaticIntField(env, cls, "jdk_update_version", info.update_version);
- CHECK_EXCEPTION(env);
+ JNU_CHECK_EXCEPTION(env);
jdk_special_version = info.special_update_version;
}
From 3bd9bdd993475b81dc10f1739d29c33072c48a34 Mon Sep 17 00:00:00 2001
From: Eric McCorkle
Date: Mon, 3 Feb 2014 17:19:15 -0500
Subject: [PATCH 096/159] 8033004: Make base TypeAnnotationPosition data
immutable, create better methods for creating base TypeAnnotationPositions
First of a series of major fixes to type annotations; cleans up interface with TypeAnnotationPosition
Reviewed-by: jjg
---
.../sun/tools/javac/code/SymbolMetadata.java | 12 +-
.../javac/code/TypeAnnotationPosition.java | 871 +++++++++++++++++-
.../sun/tools/javac/code/TypeAnnotations.java | 508 +++++-----
.../com/sun/tools/javac/comp/Annotate.java | 8 +-
.../com/sun/tools/javac/jvm/ClassReader.java | 205 +++--
.../com/sun/tools/javac/tree/JCTree.java | 3 +
6 files changed, 1311 insertions(+), 296 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java b/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java
index 3622c5a45a8..f41dae9f5cf 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java
@@ -425,11 +425,15 @@ public class SymbolMetadata {
private final List placeholderFor;
private final Symbol on;
- public Placeholder(Annotate.AnnotateRepeatedContext ctx, List placeholderFor, Symbol on) {
+ public Placeholder(Annotate.AnnotateRepeatedContext ctx,
+ List placeholderFor, Symbol on) {
super(on.type, List.>nil(),
- ctx.isTypeCompound ?
- ((Attribute.TypeCompound)placeholderFor.head).position :
- new TypeAnnotationPosition());
+ ctx.isTypeCompound ?
+ ((Attribute.TypeCompound)placeholderFor.head).position :
+ // TODO: Eventually, we will need to get rid of this
+ // use of unknown, either by using null, or by
+ // throwing an assertion failure here.
+ TypeAnnotationPosition.unknown);
this.ctx = ctx;
this.placeholderFor = placeholderFor;
this.on = on;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
index c481ea5d3e0..0845f121ab8 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
@@ -119,13 +119,20 @@ public class TypeAnnotationPosition {
}
}
- public TargetType type = TargetType.UNKNOWN;
+ public static final List emptyPath = List.nil();
+
+ // NOTE: All of these will be converted to final fields eventually.
+
+ public final TargetType type;
// For generic/array types.
- public List location = List.nil();
+
+ // This field is in the process of being made final. Do not
+ // introduce new mutations.
+ public List location;
// Tree position.
- public int pos = -1;
+ public final int pos;
// For type casts, type tests, new, locals (as start_pc),
// and method and constructor reference type arguments.
@@ -138,13 +145,17 @@ public class TypeAnnotationPosition {
public int[] lvarIndex = null;
// For type parameter bound
- public int bound_index = Integer.MIN_VALUE;
+ public final int bound_index;
// For type parameter and method parameter
- public int parameter_index = Integer.MIN_VALUE;
+ public final int parameter_index;
// For class extends, implements, and throws clauses
- public int type_index = Integer.MIN_VALUE;
+
+ // This field is effectively final. However, it needs to be
+ // modified by Gen for the time being. Do not introduce new
+ // mutations.
+ public int type_index;
// For exception parameters, index into exception table.
// In com.sun.tools.javac.jvm.Gen.genCatch we first set the type_index
@@ -156,9 +167,10 @@ public class TypeAnnotationPosition {
// If this type annotation is within a lambda expression,
// store a pointer to the lambda expression tree in order
// to allow a later translation to the right method.
- public JCLambda onLambda = null;
+ public final JCLambda onLambda;
- public TypeAnnotationPosition() {}
+ // NOTE: This constructor will eventually go away, and be replaced
+ // by static builder methods.
@Override
public String toString() {
@@ -323,4 +335,847 @@ public class TypeAnnotationPosition {
}
return loc.toList();
}
+
+ // These methods are the new preferred way to create
+ // TypeAnnotationPositions
+
+ // Never make this a public constructor without creating a builder.
+ private TypeAnnotationPosition(final TargetType ttype,
+ final int pos,
+ final int parameter_index,
+ final JCLambda onLambda,
+ final int type_index,
+ final int bound_index,
+ final List location) {
+ Assert.checkNonNull(location);
+ this.type = ttype;
+ this.pos = pos;
+ this.parameter_index = parameter_index;
+ this.onLambda = onLambda;
+ this.type_index = type_index;
+ this.bound_index = bound_index;
+ this.location = location;
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method return.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodReturn(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_RETURN, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method return.
+ *
+ * @param location The type path.
+ */
+ public static TypeAnnotationPosition
+ methodReturn(final List location) {
+ return methodReturn(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method return.
+ *
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition methodReturn(final int pos) {
+ return methodReturn(emptyPath, null, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method receiver.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodReceiver(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_RECEIVER, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method receiver.
+ *
+ * @param location The type path.
+ */
+ public static TypeAnnotationPosition
+ methodReceiver(final List location) {
+ return methodReceiver(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method receiver.
+ *
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition methodReceiver(final int pos) {
+ return methodReceiver(emptyPath, null, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method formal parameter.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this parameter.
+ * @param index The index of the parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodParameter(final List location,
+ final JCLambda onLambda,
+ final int parameter_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_FORMAL_PARAMETER,
+ pos, parameter_index, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method formal parameter.
+ *
+ * @param onLambda The lambda for this parameter.
+ * @param index The index of the parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodParameter(final JCLambda onLambda,
+ final int parameter_index,
+ final int pos) {
+ return methodParameter(emptyPath, onLambda,
+ parameter_index, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method formal parameter.
+ *
+ * @param index The index of the parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodParameter(final int parameter_index,
+ final int pos) {
+ return methodParameter(null, parameter_index, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method formal parameter.
+ *
+ * @param location The type path.
+ * @param index The index of the parameter.
+ */
+ public static TypeAnnotationPosition
+ methodParameter(final List location,
+ final int parameter_index) {
+ return methodParameter(location, null, parameter_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method reference.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this method reference.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodRef(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_REFERENCE, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method reference.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this method reference.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodRef(final List location) {
+ return methodRef(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a constructor reference.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this constructor reference.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ constructorRef(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.CONSTRUCTOR_REFERENCE, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a constructor reference.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this constructor reference.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ constructorRef(final List location) {
+ return constructorRef(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a field.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ field(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.FIELD, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a field.
+ *
+ * @param location The type path.
+ */
+ public static TypeAnnotationPosition
+ field(final List location) {
+ return field(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a field.
+ *
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition field(final int pos) {
+ return field(emptyPath, null, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a local variable.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ localVariable(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.LOCAL_VARIABLE, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a local variable.
+ *
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ localVariable(final JCLambda onLambda,
+ final int pos) {
+ return localVariable(emptyPath, onLambda, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a local variable.
+ *
+ * @param location The type path.
+ */
+ public static TypeAnnotationPosition
+ localVariable(final List location) {
+ return localVariable(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for an exception parameter.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ exceptionParameter(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.EXCEPTION_PARAMETER, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for an exception parameter.
+ *
+ * @param onLambda The lambda for this parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ exceptionParameter(final JCLambda onLambda,
+ final int pos) {
+ return exceptionParameter(emptyPath, onLambda, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for an exception parameter.
+ *
+ * @param location The type path.
+ */
+ public static TypeAnnotationPosition
+ exceptionParameter(final List location) {
+ return exceptionParameter(location, null, -1);
+ }
+
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a resource variable.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ resourceVariable(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.RESOURCE_VARIABLE, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a resource variable.
+ *
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ resourceVariable(final JCLambda onLambda,
+ final int pos) {
+ return resourceVariable(emptyPath, onLambda, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a resource variable.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ resourceVariable(final List location) {
+ return resourceVariable(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a new.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ newObj(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.NEW, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a new.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition newObj(final int pos) {
+ return newObj(emptyPath, null, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a new.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ newObj(final List location) {
+ return newObj(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a class extension.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param type_index The index of the interface.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ classExtends(final List location,
+ final JCLambda onLambda,
+ final int type_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.CLASS_EXTENDS, pos,
+ Integer.MIN_VALUE, onLambda,
+ type_index, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a class extension.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param type_index The index of the interface.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ classExtends(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return classExtends(location, onLambda, -1, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a class extension.
+ *
+ * @param location The type path.
+ * @param type_index The index of the interface.
+ */
+ public static TypeAnnotationPosition
+ classExtends(final List location,
+ final int type_index) {
+ return classExtends(location, null, type_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a class extension.
+ *
+ * @param type_index The index of the interface.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition classExtends(final int type_index,
+ final int pos) {
+ return classExtends(emptyPath, null, type_index, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a class extension.
+ *
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition classExtends(final int pos) {
+ return classExtends(-1, pos);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for an instanceof.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ instanceOf(final List location,
+ final JCLambda onLambda,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.INSTANCEOF, pos,
+ Integer.MIN_VALUE, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+ /**
+ * Create a {@code TypeAnnotationPosition} for an instanceof.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ instanceOf(final List location) {
+ return instanceOf(location, null, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a type cast.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param type_index The index into an intersection type.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ typeCast(final List location,
+ final JCLambda onLambda,
+ final int type_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.CAST, pos,
+ Integer.MIN_VALUE, onLambda,
+ type_index, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a type cast.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param type_index The index into an intersection type.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ typeCast(final List location,
+ final int type_index) {
+ return typeCast(location, null, type_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method
+ * invocation type argument.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param type_index The index of the type argument.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodInvocationTypeArg(final List location,
+ final JCLambda onLambda,
+ final int type_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_INVOCATION_TYPE_ARGUMENT,
+ pos, Integer.MIN_VALUE, onLambda,
+ type_index, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method
+ * invocation type argument.
+ *
+ * @param location The type path.
+ * @param type_index The index of the type argument.
+ */
+ public static TypeAnnotationPosition
+ methodInvocationTypeArg(final List location,
+ final int type_index) {
+ return methodInvocationTypeArg(location, null, type_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a constructor
+ * invocation type argument.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param type_index The index of the type argument.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ constructorInvocationTypeArg(final List location,
+ final JCLambda onLambda,
+ final int type_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT,
+ pos, Integer.MIN_VALUE, onLambda,
+ type_index, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a constructor
+ * invocation type argument.
+ *
+ * @param location The type path.
+ * @param type_index The index of the type argument.
+ */
+ public static TypeAnnotationPosition
+ constructorInvocationTypeArg(final List location,
+ final int type_index) {
+ return constructorInvocationTypeArg(location, null, type_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a type parameter.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ typeParameter(final List location,
+ final JCLambda onLambda,
+ final int parameter_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.CLASS_TYPE_PARAMETER, pos,
+ parameter_index, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a type parameter.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ typeParameter(final List location,
+ final int parameter_index) {
+ return typeParameter(location, null, parameter_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method type parameter.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type parameter.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodTypeParameter(final List location,
+ final JCLambda onLambda,
+ final int parameter_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_TYPE_PARAMETER,
+ pos, parameter_index, onLambda,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method type parameter.
+ *
+ * @param location The type path.
+ * @param parameter_index The index of the type parameter.
+ */
+ public static TypeAnnotationPosition
+ methodTypeParameter(final List location,
+ final int parameter_index) {
+ return methodTypeParameter(location, null, parameter_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a throws clause.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param type_index The index of the exception.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodThrows(final List location,
+ final JCLambda onLambda,
+ final int type_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.THROWS, pos,
+ Integer.MIN_VALUE, onLambda,
+ type_index, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a throws clause.
+ *
+ * @param location The type path.
+ * @param type_index The index of the exception.
+ */
+ public static TypeAnnotationPosition
+ methodThrows(final List location,
+ final int type_index) {
+ return methodThrows(location, null, type_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method reference
+ * type argument.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type argument.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodRefTypeArg(final List location,
+ final JCLambda onLambda,
+ final int type_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_REFERENCE_TYPE_ARGUMENT,
+ pos, Integer.MIN_VALUE, onLambda,
+ type_index, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method reference
+ * type argument.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type argument.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodRefTypeArg(final List location,
+ final int type_index) {
+ return methodRefTypeArg(location, null, type_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a constructor reference
+ * type argument.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type argument.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ constructorRefTypeArg(final List location,
+ final JCLambda onLambda,
+ final int type_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
+ pos, Integer.MIN_VALUE, onLambda,
+ type_index, Integer.MIN_VALUE,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a constructor reference
+ * type argument.
+ *
+ * @param location The type path.
+ * @param parameter_index The index of the type argument.
+ */
+ public static TypeAnnotationPosition
+ constructorRefTypeArg(final List location,
+ final int type_index) {
+ return constructorRefTypeArg(location, null, type_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a type parameter bound.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type parameter.
+ * @param bound_index The index of the type parameter bound.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ typeParameterBound(final List location,
+ final JCLambda onLambda,
+ final int parameter_index,
+ final int bound_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.CLASS_TYPE_PARAMETER_BOUND,
+ pos, parameter_index, onLambda,
+ Integer.MIN_VALUE, bound_index,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a type parameter bound.
+ *
+ * @param location The type path.
+ * @param parameter_index The index of the type parameter.
+ * @param bound_index The index of the type parameter bound.
+ */
+ public static TypeAnnotationPosition
+ typeParameterBound(final List location,
+ final int parameter_index,
+ final int bound_index) {
+ return typeParameterBound(location, null, parameter_index,
+ bound_index, -1);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method type
+ * parameter bound.
+ *
+ * @param location The type path.
+ * @param onLambda The lambda for this variable.
+ * @param parameter_index The index of the type parameter.
+ * @param bound_index The index of the type parameter bound.
+ * @param pos The position from the associated tree node.
+ */
+ public static TypeAnnotationPosition
+ methodTypeParameterBound(final List location,
+ final JCLambda onLambda,
+ final int parameter_index,
+ final int bound_index,
+ final int pos) {
+ return new TypeAnnotationPosition(TargetType.METHOD_TYPE_PARAMETER_BOUND,
+ pos, parameter_index, onLambda,
+ Integer.MIN_VALUE, bound_index,
+ location);
+ }
+
+ /**
+ * Create a {@code TypeAnnotationPosition} for a method type
+ * parameter bound.
+ *
+ * @param location The type path.
+ * @param parameter_index The index of the type parameter.
+ * @param bound_index The index of the type parameter bound.
+ */
+ public static TypeAnnotationPosition
+ methodTypeParameterBound(final List location,
+ final int parameter_index,
+ final int bound_index) {
+ return methodTypeParameterBound(location, null, parameter_index,
+ bound_index, -1);
+ }
+
+ // Consider this deprecated on arrival. We eventually want to get
+ // rid of this value altogether. Do not use it for anything new.
+ public static final TypeAnnotationPosition unknown =
+ new TypeAnnotationPosition(TargetType.UNKNOWN, -1,
+ Integer.MIN_VALUE, null,
+ Integer.MIN_VALUE, Integer.MIN_VALUE,
+ emptyPath);
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
index 35ccc58a14e..88bbf4b7830 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
@@ -663,8 +663,15 @@ public class TypeAnnotations {
* type annotations: determine the type annotation positions.
*/
- private void resolveFrame(JCTree tree, JCTree frame,
- List path, TypeAnnotationPosition p) {
+ // This method is considered deprecated, and will be removed
+ // in the near future. Don't use it for anything new.
+ private TypeAnnotationPosition
+ resolveFrame(JCTree tree,
+ JCTree frame,
+ List path,
+ JCLambda currentLambda,
+ int outer_type_index,
+ ListBuffer location) {
/*
System.out.println("Resolving tree: " + tree + " kind: " + tree.getKind());
System.out.println(" Framing tree: " + frame + " kind: " + frame.getKind());
@@ -675,87 +682,101 @@ public class TypeAnnotations {
switch (frame.getKind()) {
case TYPE_CAST:
- JCTypeCast frameTC = (JCTypeCast) frame;
- p.type = TargetType.CAST;
- if (frameTC.clazz.hasTag(Tag.TYPEINTERSECTION)) {
- // This case was already handled by INTERSECTION_TYPE
- } else {
- p.type_index = 0;
- }
- p.pos = frame.pos;
- return;
+ return TypeAnnotationPosition.typeCast(location.toList(),
+ currentLambda,
+ outer_type_index,
+ frame.pos);
case INSTANCE_OF:
- p.type = TargetType.INSTANCEOF;
- p.pos = frame.pos;
- return;
+ return TypeAnnotationPosition.instanceOf(location.toList(),
+ currentLambda,
+ frame.pos);
case NEW_CLASS:
- JCNewClass frameNewClass = (JCNewClass) frame;
+ final JCNewClass frameNewClass = (JCNewClass) frame;
if (frameNewClass.def != null) {
// Special handling for anonymous class instantiations
- JCClassDecl frameClassDecl = frameNewClass.def;
+ final JCClassDecl frameClassDecl = frameNewClass.def;
if (frameClassDecl.extending == tree) {
- p.type = TargetType.CLASS_EXTENDS;
- p.type_index = -1;
+ return TypeAnnotationPosition
+ .classExtends(location.toList(), currentLambda,
+ frame.pos);
} else if (frameClassDecl.implementing.contains(tree)) {
- p.type = TargetType.CLASS_EXTENDS;
- p.type_index = frameClassDecl.implementing.indexOf(tree);
+ final int type_index =
+ frameClassDecl.implementing.indexOf(tree);
+ return TypeAnnotationPosition
+ .classExtends(location.toList(), currentLambda,
+ type_index, frame.pos);
} else {
// In contrast to CLASS below, typarams cannot occur here.
- Assert.error("Could not determine position of tree " + tree +
- " within frame " + frame);
+ throw new AssertionError("Could not determine position of tree " + tree +
+ " within frame " + frame);
}
} else if (frameNewClass.typeargs.contains(tree)) {
- p.type = TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT;
- p.type_index = frameNewClass.typeargs.indexOf(tree);
+ final int type_index =
+ frameNewClass.typeargs.indexOf(tree);
+ return TypeAnnotationPosition
+ .constructorInvocationTypeArg(location.toList(),
+ currentLambda,
+ type_index,
+ frame.pos);
} else {
- p.type = TargetType.NEW;
+ return TypeAnnotationPosition
+ .newObj(location.toList(), currentLambda,
+ frame.pos);
}
- p.pos = frame.pos;
- return;
case NEW_ARRAY:
- p.type = TargetType.NEW;
- p.pos = frame.pos;
- return;
+ return TypeAnnotationPosition
+ .newObj(location.toList(), currentLambda, frame.pos);
case ANNOTATION_TYPE:
case CLASS:
case ENUM:
case INTERFACE:
- p.pos = frame.pos;
if (((JCClassDecl)frame).extending == tree) {
- p.type = TargetType.CLASS_EXTENDS;
- p.type_index = -1;
+ return TypeAnnotationPosition
+ .classExtends(location.toList(), currentLambda,
+ frame.pos);
} else if (((JCClassDecl)frame).implementing.contains(tree)) {
- p.type = TargetType.CLASS_EXTENDS;
- p.type_index = ((JCClassDecl)frame).implementing.indexOf(tree);
+ final int type_index =
+ ((JCClassDecl)frame).implementing.indexOf(tree);
+ return TypeAnnotationPosition
+ .classExtends(location.toList(), currentLambda,
+ type_index, frame.pos);
} else if (((JCClassDecl)frame).typarams.contains(tree)) {
- p.type = TargetType.CLASS_TYPE_PARAMETER;
- p.parameter_index = ((JCClassDecl)frame).typarams.indexOf(tree);
+ final int parameter_index =
+ ((JCClassDecl)frame).typarams.indexOf(tree);
+ return TypeAnnotationPosition
+ .typeParameter(location.toList(), currentLambda,
+ parameter_index, frame.pos);
} else {
- Assert.error("Could not determine position of tree " + tree +
- " within frame " + frame);
+ throw new AssertionError("Could not determine position of tree " +
+ tree + " within frame " + frame);
}
- return;
case METHOD: {
- JCMethodDecl frameMethod = (JCMethodDecl) frame;
- p.pos = frame.pos;
+ final JCMethodDecl frameMethod = (JCMethodDecl) frame;
if (frameMethod.thrown.contains(tree)) {
- p.type = TargetType.THROWS;
- p.type_index = frameMethod.thrown.indexOf(tree);
+ final int type_index = frameMethod.thrown.indexOf(tree);
+ return TypeAnnotationPosition
+ .methodThrows(location.toList(), currentLambda,
+ type_index, frame.pos);
} else if (frameMethod.restype == tree) {
- p.type = TargetType.METHOD_RETURN;
+ return TypeAnnotationPosition
+ .methodReturn(location.toList(), currentLambda,
+ frame.pos);
} else if (frameMethod.typarams.contains(tree)) {
- p.type = TargetType.METHOD_TYPE_PARAMETER;
- p.parameter_index = frameMethod.typarams.indexOf(tree);
+ final int parameter_index =
+ frameMethod.typarams.indexOf(tree);
+ return TypeAnnotationPosition
+ .methodTypeParameter(location.toList(),
+ currentLambda,
+ parameter_index, frame.pos);
} else {
- Assert.error("Could not determine position of tree " + tree +
- " within frame " + frame);
+ throw new AssertionError("Could not determine position of tree " + tree +
+ " within frame " + frame);
}
- return;
}
case PARAMETERIZED_TYPE: {
@@ -766,25 +787,30 @@ public class TypeAnnotations {
} else if (((JCTypeApply)frame).arguments.contains(tree)) {
JCTypeApply taframe = (JCTypeApply) frame;
int arg = taframe.arguments.indexOf(tree);
- p.location = p.location.prepend(new TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg));
+ location = location.prepend(
+ new TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT,
+ arg));
Type typeToUse;
- if (newPath.tail != null && newPath.tail.head.hasTag(Tag.NEWCLASS)) {
- // If we are within an anonymous class instantiation, use its type,
- // because it contains a correctly nested type.
+ if (newPath.tail != null &&
+ newPath.tail.head.hasTag(Tag.NEWCLASS)) {
+ // If we are within an anonymous class
+ // instantiation, use its type, because it
+ // contains a correctly nested type.
typeToUse = newPath.tail.head.type;
} else {
typeToUse = taframe.type;
}
- locateNestedTypes(typeToUse, p);
+ location = locateNestedTypes(typeToUse, location);
} else {
- Assert.error("Could not determine type argument position of tree " + tree +
- " within frame " + frame);
+ throw new AssertionError("Could not determine type argument position of tree " + tree +
+ " within frame " + frame);
}
- resolveFrame(newPath.head, newPath.tail.head, newPath, p);
- return;
+ return resolveFrame(newPath.head, newPath.tail.head,
+ newPath, currentLambda,
+ outer_type_index, location);
}
case MEMBER_REFERENCE: {
@@ -793,117 +819,140 @@ public class TypeAnnotations {
if (mrframe.expr == tree) {
switch (mrframe.mode) {
case INVOKE:
- p.type = TargetType.METHOD_REFERENCE;
- break;
+ return TypeAnnotationPosition
+ .methodRef(location.toList(), currentLambda,
+ frame.pos);
case NEW:
- p.type = TargetType.CONSTRUCTOR_REFERENCE;
- break;
+ return TypeAnnotationPosition
+ .constructorRef(location.toList(),
+ currentLambda,
+ frame.pos);
default:
- Assert.error("Unknown method reference mode " + mrframe.mode +
- " for tree " + tree + " within frame " + frame);
+ throw new AssertionError("Unknown method reference mode " + mrframe.mode +
+ " for tree " + tree + " within frame " + frame);
}
- p.pos = frame.pos;
} else if (mrframe.typeargs != null &&
mrframe.typeargs.contains(tree)) {
- int arg = mrframe.typeargs.indexOf(tree);
- p.type_index = arg;
+ final int type_index = mrframe.typeargs.indexOf(tree);
switch (mrframe.mode) {
case INVOKE:
- p.type = TargetType.METHOD_REFERENCE_TYPE_ARGUMENT;
- break;
+ return TypeAnnotationPosition
+ .methodRefTypeArg(location.toList(),
+ currentLambda,
+ type_index, frame.pos);
case NEW:
- p.type = TargetType.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT;
- break;
+ return TypeAnnotationPosition
+ .constructorRefTypeArg(location.toList(),
+ currentLambda,
+ type_index, frame.pos);
default:
- Assert.error("Unknown method reference mode " + mrframe.mode +
- " for tree " + tree + " within frame " + frame);
+ throw new AssertionError("Unknown method reference mode " + mrframe.mode +
+ " for tree " + tree + " within frame " + frame);
}
- p.pos = frame.pos;
} else {
- Assert.error("Could not determine type argument position of tree " + tree +
- " within frame " + frame);
+ throw new AssertionError("Could not determine type argument position of tree " + tree +
+ " within frame " + frame);
}
- return;
}
case ARRAY_TYPE: {
- ListBuffer index = new ListBuffer<>();
- index = index.append(TypePathEntry.ARRAY);
+ location = location.prepend(TypePathEntry.ARRAY);
List newPath = path.tail;
while (true) {
JCTree npHead = newPath.tail.head;
if (npHead.hasTag(JCTree.Tag.TYPEARRAY)) {
newPath = newPath.tail;
- index = index.append(TypePathEntry.ARRAY);
+ location = location.prepend(TypePathEntry.ARRAY);
} else if (npHead.hasTag(JCTree.Tag.ANNOTATED_TYPE)) {
newPath = newPath.tail;
} else {
break;
}
}
- p.location = p.location.prependList(index.toList());
- resolveFrame(newPath.head, newPath.tail.head, newPath, p);
- return;
+ return resolveFrame(newPath.head, newPath.tail.head,
+ newPath, currentLambda,
+ outer_type_index, location);
}
case TYPE_PARAMETER:
if (path.tail.tail.head.hasTag(JCTree.Tag.CLASSDEF)) {
- JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
- p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
- p.parameter_index = clazz.typarams.indexOf(path.tail.head);
- p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
- if (((JCTypeParameter)frame).bounds.get(0).type.isInterface()) {
- // Account for an implicit Object as bound 0
- p.bound_index += 1;
- }
+ final JCClassDecl clazz =
+ (JCClassDecl)path.tail.tail.head;
+ final int parameter_index =
+ clazz.typarams.indexOf(path.tail.head);
+ final int bound_index =
+ ((JCTypeParameter)frame).bounds.get(0)
+ .type.isInterface() ?
+ ((JCTypeParameter)frame).bounds.indexOf(tree) + 1:
+ ((JCTypeParameter)frame).bounds.indexOf(tree);
+ return TypeAnnotationPosition
+ .typeParameterBound(location.toList(),
+ currentLambda,
+ parameter_index, bound_index,
+ frame.pos);
} else if (path.tail.tail.head.hasTag(JCTree.Tag.METHODDEF)) {
- JCMethodDecl method = (JCMethodDecl)path.tail.tail.head;
- p.type = TargetType.METHOD_TYPE_PARAMETER_BOUND;
- p.parameter_index = method.typarams.indexOf(path.tail.head);
- p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
- if (((JCTypeParameter)frame).bounds.get(0).type.isInterface()) {
- // Account for an implicit Object as bound 0
- p.bound_index += 1;
- }
+ final JCMethodDecl method =
+ (JCMethodDecl)path.tail.tail.head;
+ final int parameter_index =
+ method.typarams.indexOf(path.tail.head);
+ final int bound_index =
+ ((JCTypeParameter)frame).bounds.get(0)
+ .type.isInterface() ?
+ ((JCTypeParameter)frame).bounds.indexOf(tree) + 1:
+ ((JCTypeParameter)frame).bounds.indexOf(tree);
+ return TypeAnnotationPosition
+ .methodTypeParameterBound(location.toList(),
+ currentLambda,
+ parameter_index,
+ bound_index,
+ frame.pos);
} else {
- Assert.error("Could not determine position of tree " + tree +
- " within frame " + frame);
+ throw new AssertionError("Could not determine position of tree " + tree +
+ " within frame " + frame);
}
- p.pos = frame.pos;
- return;
case VARIABLE:
VarSymbol v = ((JCVariableDecl)frame).sym;
- p.pos = frame.pos;
- switch (v.getKind()) {
- case LOCAL_VARIABLE:
- p.type = TargetType.LOCAL_VARIABLE;
- break;
- case FIELD:
- p.type = TargetType.FIELD;
- break;
- case PARAMETER:
- if (v.getQualifiedName().equals(names._this)) {
- // TODO: Intro a separate ElementKind?
- p.type = TargetType.METHOD_RECEIVER;
- } else {
- p.type = TargetType.METHOD_FORMAL_PARAMETER;
- p.parameter_index = methodParamIndex(path, frame);
- }
- break;
- case EXCEPTION_PARAMETER:
- p.type = TargetType.EXCEPTION_PARAMETER;
- break;
- case RESOURCE_VARIABLE:
- p.type = TargetType.RESOURCE_VARIABLE;
- break;
- default:
- Assert.error("Found unexpected type annotation for variable: " + v + " with kind: " + v.getKind());
- }
if (v.getKind() != ElementKind.FIELD) {
v.owner.appendUniqueTypeAttributes(v.getRawTypeAttributes());
}
- return;
+ switch (v.getKind()) {
+ case LOCAL_VARIABLE:
+ return TypeAnnotationPosition
+ .localVariable(location.toList(), currentLambda,
+ frame.pos);
+ case FIELD:
+ return TypeAnnotationPosition.field(location.toList(),
+ currentLambda,
+ frame.pos);
+ case PARAMETER:
+ if (v.getQualifiedName().equals(names._this)) {
+ return TypeAnnotationPosition
+ .methodReceiver(location.toList(),
+ currentLambda,
+ frame.pos);
+ } else {
+ final int parameter_index =
+ methodParamIndex(path, frame);
+ return TypeAnnotationPosition
+ .methodParameter(location.toList(),
+ currentLambda,
+ parameter_index,
+ frame.pos);
+ }
+ case EXCEPTION_PARAMETER:
+ return TypeAnnotationPosition
+ .exceptionParameter(location.toList(),
+ currentLambda,
+ frame.pos);
+ case RESOURCE_VARIABLE:
+ return TypeAnnotationPosition
+ .resourceVariable(location.toList(),
+ currentLambda,
+ frame.pos);
+ default:
+ throw new AssertionError("Found unexpected type annotation for variable: " + v + " with kind: " + v.getKind());
+ }
case ANNOTATED_TYPE: {
if (frame == tree) {
@@ -921,83 +970,89 @@ public class TypeAnnotations {
// class/method as enclosing elements.
// There is actually nothing to do for them.
} else {
- locateNestedTypes(utype, p);
+ location = locateNestedTypes(utype, location);
}
}
List newPath = path.tail;
- resolveFrame(newPath.head, newPath.tail.head, newPath, p);
- return;
+ return resolveFrame(newPath.head, newPath.tail.head,
+ newPath, currentLambda,
+ outer_type_index, location);
}
case UNION_TYPE: {
List newPath = path.tail;
- resolveFrame(newPath.head, newPath.tail.head, newPath, p);
- return;
+ return resolveFrame(newPath.head, newPath.tail.head,
+ newPath, currentLambda,
+ outer_type_index, location);
}
case INTERSECTION_TYPE: {
JCTypeIntersection isect = (JCTypeIntersection)frame;
- p.type_index = isect.bounds.indexOf(tree);
- List newPath = path.tail;
- resolveFrame(newPath.head, newPath.tail.head, newPath, p);
- return;
+ final List newPath = path.tail;
+ return resolveFrame(newPath.head, newPath.tail.head,
+ newPath, currentLambda,
+ isect.bounds.indexOf(tree), location);
}
case METHOD_INVOCATION: {
JCMethodInvocation invocation = (JCMethodInvocation)frame;
if (!invocation.typeargs.contains(tree)) {
- Assert.error("{" + tree + "} is not an argument in the invocation: " + invocation);
+ throw new AssertionError("{" + tree + "} is not an argument in the invocation: " + invocation);
}
MethodSymbol exsym = (MethodSymbol) TreeInfo.symbol(invocation.getMethodSelect());
+ final int type_index = invocation.typeargs.indexOf(tree);
if (exsym == null) {
- Assert.error("could not determine symbol for {" + invocation + "}");
+ throw new AssertionError("could not determine symbol for {" + invocation + "}");
} else if (exsym.isConstructor()) {
- p.type = TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT;
+ return TypeAnnotationPosition
+ .constructorInvocationTypeArg(location.toList(),
+ currentLambda,
+ type_index,
+ invocation.pos);
} else {
- p.type = TargetType.METHOD_INVOCATION_TYPE_ARGUMENT;
+ return TypeAnnotationPosition
+ .methodInvocationTypeArg(location.toList(),
+ currentLambda,
+ type_index,
+ invocation.pos);
}
- p.pos = invocation.pos;
- p.type_index = invocation.typeargs.indexOf(tree);
- return;
}
case EXTENDS_WILDCARD:
case SUPER_WILDCARD: {
// Annotations in wildcard bounds
- p.location = p.location.prepend(TypePathEntry.WILDCARD);
- List newPath = path.tail;
- resolveFrame(newPath.head, newPath.tail.head, newPath, p);
- return;
+ final List newPath = path.tail;
+ return resolveFrame(newPath.head, newPath.tail.head,
+ newPath, currentLambda,
+ outer_type_index,
+ location.prepend(TypePathEntry.WILDCARD));
}
case MEMBER_SELECT: {
- List newPath = path.tail;
- resolveFrame(newPath.head, newPath.tail.head, newPath, p);
- return;
+ final List newPath = path.tail;
+ return resolveFrame(newPath.head, newPath.tail.head,
+ newPath, currentLambda,
+ outer_type_index, location);
}
default:
- Assert.error("Unresolved frame: " + frame + " of kind: " + frame.getKind() +
- "\n Looking for tree: " + tree);
- return;
+ throw new AssertionError("Unresolved frame: " + frame +
+ " of kind: " + frame.getKind() +
+ "\n Looking for tree: " + tree);
}
}
- private void locateNestedTypes(Type type, TypeAnnotationPosition p) {
- // The number of "steps" to get from the full type to the
- // left-most outer type.
- ListBuffer depth = new ListBuffer<>();
-
+ private ListBuffer
+ locateNestedTypes(Type type,
+ ListBuffer depth) {
Type encl = type.getEnclosingType();
while (encl != null &&
encl.getKind() != TypeKind.NONE &&
encl.getKind() != TypeKind.ERROR) {
- depth = depth.append(TypePathEntry.INNER_TYPE);
+ depth = depth.prepend(TypePathEntry.INNER_TYPE);
encl = encl.getEnclosingType();
}
- if (depth.nonEmpty()) {
- p.location = p.location.prependList(depth.toList());
- }
+ return depth;
}
private int methodParamIndex(List path, JCTree param) {
@@ -1048,18 +1103,18 @@ public class TypeAnnotations {
}
if (sigOnly) {
if (!tree.mods.annotations.isEmpty()) {
- // Nothing to do for separateAnnotationsKinds if
- // there are no annotations of either kind.
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.METHOD_RETURN;
if (tree.sym.isConstructor()) {
- pos.pos = tree.pos;
- // Use null to mark that the annotations go with the symbol.
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.methodReturn(tree.pos);
+ // Use null to mark that the annotations go
+ // with the symbol.
separateAnnotationsKinds(tree, null, tree.sym, pos);
} else {
- pos.pos = tree.restype.pos;
- separateAnnotationsKinds(tree.restype, tree.sym.type.getReturnType(),
- tree.sym, pos);
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.methodReturn(tree.restype.pos);
+ separateAnnotationsKinds(tree.restype,
+ tree.sym.type.getReturnType(),
+ tree.sym, pos);
}
}
if (tree.recvparam != null && tree.recvparam.sym != null &&
@@ -1067,22 +1122,22 @@ public class TypeAnnotations {
// Nothing to do for separateAnnotationsKinds if
// there are no annotations of either kind.
// TODO: make sure there are no declaration annotations.
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.METHOD_RECEIVER;
- pos.pos = tree.recvparam.vartype.pos;
- separateAnnotationsKinds(tree.recvparam.vartype, tree.recvparam.sym.type,
- tree.recvparam.sym, pos);
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.methodReceiver(tree.recvparam.vartype.pos);
+ separateAnnotationsKinds(tree.recvparam.vartype,
+ tree.recvparam.sym.type,
+ tree.recvparam.sym, pos);
}
int i = 0;
for (JCVariableDecl param : tree.params) {
if (!param.mods.annotations.isEmpty()) {
// Nothing to do for separateAnnotationsKinds if
// there are no annotations of either kind.
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.METHOD_FORMAL_PARAMETER;
- pos.parameter_index = i;
- pos.pos = param.vartype.pos;
- separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.methodParameter(i, param.vartype.pos);
+ separateAnnotationsKinds(param.vartype,
+ param.sym.type,
+ param.sym, pos);
}
++i;
}
@@ -1119,11 +1174,9 @@ public class TypeAnnotations {
if (!param.mods.annotations.isEmpty()) {
// Nothing to do for separateAnnotationsKinds if
// there are no annotations of either kind.
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.METHOD_FORMAL_PARAMETER;
- pos.parameter_index = i;
- pos.pos = param.vartype.pos;
- pos.onLambda = tree;
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.methodParameter(tree, i,
+ param.vartype.pos);
separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
}
++i;
@@ -1153,28 +1206,24 @@ public class TypeAnnotations {
// Parameters are handled in visitMethodDef or visitLambda.
} else if (tree.sym.getKind() == ElementKind.FIELD) {
if (sigOnly) {
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.FIELD;
- pos.pos = tree.pos;
+ TypeAnnotationPosition pos =
+ TypeAnnotationPosition.field(tree.pos);
separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
}
} else if (tree.sym.getKind() == ElementKind.LOCAL_VARIABLE) {
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.LOCAL_VARIABLE;
- pos.pos = tree.pos;
- pos.onLambda = currentLambda;
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.localVariable(currentLambda,
+ tree.pos);
separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
} else if (tree.sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.EXCEPTION_PARAMETER;
- pos.pos = tree.pos;
- pos.onLambda = currentLambda;
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.exceptionParameter(currentLambda,
+ tree.pos);
separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
} else if (tree.sym.getKind() == ElementKind.RESOURCE_VARIABLE) {
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.RESOURCE_VARIABLE;
- pos.pos = tree.pos;
- pos.onLambda = currentLambda;
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.resourceVariable(currentLambda,
+ tree.pos);
separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
} else if (tree.sym.getKind() == ElementKind.ENUM_CONSTANT) {
// No type annotations can occur here.
@@ -1218,7 +1267,8 @@ public class TypeAnnotations {
private void copyNewClassAnnotationsToOwner(JCNewClass tree) {
Symbol sym = tree.def.sym;
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
+ final TypeAnnotationPosition pos =
+ TypeAnnotationPosition.newObj(tree.pos);
ListBuffer newattrs = new ListBuffer<>();
for (Attribute.TypeCompound old : sym.getRawTypeAttributes()) {
@@ -1226,8 +1276,6 @@ public class TypeAnnotations {
pos));
}
- pos.type = TargetType.NEW;
- pos.pos = tree.pos;
sym.owner.appendUniqueTypeAttributes(newattrs.toList());
}
@@ -1236,16 +1284,16 @@ public class TypeAnnotations {
if (tree.def != null &&
!tree.def.mods.annotations.isEmpty()) {
JCClassDecl classdecl = tree.def;
- TypeAnnotationPosition pos = new TypeAnnotationPosition();
- pos.type = TargetType.CLASS_EXTENDS;
- pos.pos = tree.pos;
+ TypeAnnotationPosition pos;
+
if (classdecl.extending == tree.clazz) {
- pos.type_index = -1;
+ pos = TypeAnnotationPosition.classExtends(tree.pos);
} else if (classdecl.implementing.contains(tree.clazz)) {
- pos.type_index = classdecl.implementing.indexOf(tree.clazz);
+ final int index = classdecl.implementing.indexOf(tree.clazz);
+ pos = TypeAnnotationPosition.classExtends(index, tree.pos);
} else {
// In contrast to CLASS elsewhere, typarams cannot occur here.
- Assert.error("Could not determine position of tree " + tree);
+ throw new AssertionError("Could not determine position of tree " + tree);
}
Type before = classdecl.sym.type;
separateAnnotationsKinds(classdecl, tree.clazz.type, classdecl.sym, pos);
@@ -1273,14 +1321,16 @@ public class TypeAnnotations {
// handle annotations associated with dimensions
for (int i = 0; i < dimAnnosCount; ++i) {
- TypeAnnotationPosition p = new TypeAnnotationPosition();
- p.pos = tree.pos;
- p.onLambda = currentLambda;
- p.type = TargetType.NEW;
+ ListBuffer location =
+ new ListBuffer();
if (i != 0) {
depth = depth.append(TypePathEntry.ARRAY);
- p.location = p.location.appendList(depth.toList());
+ location = location.appendList(depth.toList());
}
+ final TypeAnnotationPosition p =
+ TypeAnnotationPosition.newObj(location.toList(),
+ currentLambda,
+ tree.pos);
setTypeAnnotationPos(tree.dimAnnotations.get(i), p);
}
@@ -1293,12 +1343,14 @@ public class TypeAnnotations {
while (elemType != null) {
if (elemType.hasTag(JCTree.Tag.ANNOTATED_TYPE)) {
JCAnnotatedType at = (JCAnnotatedType)elemType;
- TypeAnnotationPosition p = new TypeAnnotationPosition();
- p.type = TargetType.NEW;
- p.pos = tree.pos;
- p.onLambda = currentLambda;
- locateNestedTypes(elemType.type, p);
- p.location = p.location.prependList(depth.toList());
+ final ListBuffer locationbuf =
+ locateNestedTypes(elemType.type,
+ new ListBuffer());
+ final List location =
+ locationbuf.toList().prependList(depth.toList());
+ final TypeAnnotationPosition p =
+ TypeAnnotationPosition.newObj(location, currentLambda,
+ tree.pos);
setTypeAnnotationPos(at.annotations, p);
elemType = at.underlyingType;
} else if (elemType.hasTag(JCTree.Tag.TYPEARRAY)) {
@@ -1320,9 +1372,9 @@ public class TypeAnnotations {
System.err.println(" tree: " + tree + " kind: " + tree.getKind());
System.err.println(" frame: " + frame + " kind: " + frame.getKind());
*/
- TypeAnnotationPosition p = new TypeAnnotationPosition();
- p.onLambda = currentLambda;
- resolveFrame(tree, frame, frames.toList(), p);
+ final TypeAnnotationPosition p =
+ resolveFrame(tree, frame, frames.toList(), currentLambda, 0,
+ new ListBuffer());
setTypeAnnotationPos(annotations, p);
}
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
index 981d94f4250..fe0b39a885b 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
@@ -299,7 +299,13 @@ public class Annotate {
if (typeAnnotation) {
if (a.attribute == null || !(a.attribute instanceof Attribute.TypeCompound)) {
// Create a new TypeCompound
- Attribute.TypeCompound tc = new Attribute.TypeCompound(a.type, buf.toList(), new TypeAnnotationPosition());
+
+ Attribute.TypeCompound tc =
+ new Attribute.TypeCompound(a.type, buf.toList(),
+ // TODO: Eventually, we will get rid of this use of
+ // unknown, because we'll get a position from
+ // MemberEnter (task 8027262).
+ TypeAnnotationPosition.unknown);
a.attribute = tc;
return tc;
} else {
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index 76a81f72e70..ba6fc9e4cf1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -1469,26 +1469,46 @@ public class ClassReader {
if (!TargetType.isValidTargetTypeValue(tag))
throw this.badClassFile("bad.type.annotation.value", String.format("0x%02X", tag));
- TypeAnnotationPosition position = new TypeAnnotationPosition();
TargetType type = TargetType.fromTargetTypeValue(tag);
- position.type = type;
-
switch (type) {
// instanceof
- case INSTANCEOF:
+ case INSTANCEOF: {
+ final int offset = nextChar();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.instanceOf(readTypePath());
+ position.offset = offset;
+ return position;
+ }
// new expression
- case NEW:
+ case NEW: {
+ final int offset = nextChar();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.newObj(readTypePath());
+ position.offset = offset;
+ return position;
+ }
// constructor/method reference receiver
- case CONSTRUCTOR_REFERENCE:
- case METHOD_REFERENCE:
- position.offset = nextChar();
- break;
+ case CONSTRUCTOR_REFERENCE: {
+ final int offset = nextChar();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.constructorRef(readTypePath());
+ position.offset = offset;
+ return position;
+ }
+ case METHOD_REFERENCE: {
+ final int offset = nextChar();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.methodRef(readTypePath());
+ position.offset = offset;
+ return position;
+ }
// local variable
- case LOCAL_VARIABLE:
- // resource variable
- case RESOURCE_VARIABLE:
- int table_length = nextChar();
+ case LOCAL_VARIABLE: {
+ final int table_length = nextChar();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.localVariable(readTypePath());
+
position.lvarOffset = new int[table_length];
position.lvarLength = new int[table_length];
position.lvarIndex = new int[table_length];
@@ -1498,67 +1518,142 @@ public class ClassReader {
position.lvarLength[i] = nextChar();
position.lvarIndex[i] = nextChar();
}
- break;
+ return position;
+ }
+ // resource variable
+ case RESOURCE_VARIABLE: {
+ final int table_length = nextChar();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.resourceVariable(readTypePath());
+
+ position.lvarOffset = new int[table_length];
+ position.lvarLength = new int[table_length];
+ position.lvarIndex = new int[table_length];
+
+ for (int i = 0; i < table_length; ++i) {
+ position.lvarOffset[i] = nextChar();
+ position.lvarLength[i] = nextChar();
+ position.lvarIndex[i] = nextChar();
+ }
+ return position;
+ }
// exception parameter
- case EXCEPTION_PARAMETER:
- position.exception_index = nextChar();
- break;
+ case EXCEPTION_PARAMETER: {
+ final int exception_index = nextChar();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.exceptionParameter(readTypePath());
+ position.exception_index = exception_index;
+ return position;
+ }
// method receiver
case METHOD_RECEIVER:
- // Do nothing
- break;
+ return TypeAnnotationPosition.methodReceiver(readTypePath());
// type parameter
- case CLASS_TYPE_PARAMETER:
- case METHOD_TYPE_PARAMETER:
- position.parameter_index = nextByte();
- break;
+ case CLASS_TYPE_PARAMETER: {
+ final int parameter_index = nextByte();
+ return TypeAnnotationPosition
+ .typeParameter(readTypePath(), parameter_index);
+ }
+ case METHOD_TYPE_PARAMETER: {
+ final int parameter_index = nextByte();
+ return TypeAnnotationPosition
+ .methodTypeParameter(readTypePath(), parameter_index);
+ }
// type parameter bound
- case CLASS_TYPE_PARAMETER_BOUND:
- case METHOD_TYPE_PARAMETER_BOUND:
- position.parameter_index = nextByte();
- position.bound_index = nextByte();
- break;
+ case CLASS_TYPE_PARAMETER_BOUND: {
+ final int parameter_index = nextByte();
+ final int bound_index = nextByte();
+ return TypeAnnotationPosition
+ .typeParameterBound(readTypePath(), parameter_index,
+ bound_index);
+ }
+ case METHOD_TYPE_PARAMETER_BOUND: {
+ final int parameter_index = nextByte();
+ final int bound_index = nextByte();
+ return TypeAnnotationPosition
+ .methodTypeParameterBound(readTypePath(), parameter_index,
+ bound_index);
+ }
// class extends or implements clause
- case CLASS_EXTENDS:
- position.type_index = nextChar();
- break;
+ case CLASS_EXTENDS: {
+ final int type_index = nextChar();
+ return TypeAnnotationPosition.classExtends(readTypePath(),
+ type_index);
+ }
// throws
- case THROWS:
- position.type_index = nextChar();
- break;
+ case THROWS: {
+ final int type_index = nextChar();
+ return TypeAnnotationPosition.methodThrows(readTypePath(),
+ type_index);
+ }
// method parameter
- case METHOD_FORMAL_PARAMETER:
- position.parameter_index = nextByte();
- break;
+ case METHOD_FORMAL_PARAMETER: {
+ final int parameter_index = nextByte();
+ return TypeAnnotationPosition.methodParameter(readTypePath(),
+ parameter_index);
+ }
// type cast
- case CAST:
+ case CAST: {
+ final int offset = nextChar();
+ final int type_index = nextByte();
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.typeCast(readTypePath(), type_index);
+ position.offset = offset;
+ return position;
+ }
// method/constructor/reference type argument
- case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
- case METHOD_INVOCATION_TYPE_ARGUMENT:
- case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
- case METHOD_REFERENCE_TYPE_ARGUMENT:
- position.offset = nextChar();
- position.type_index = nextByte();
- break;
+ case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: {
+ final int offset = nextChar();
+ final int type_index = nextByte();
+ final TypeAnnotationPosition position = TypeAnnotationPosition
+ .constructorInvocationTypeArg(readTypePath(), type_index);
+ position.offset = offset;
+ return position;
+ }
+ case METHOD_INVOCATION_TYPE_ARGUMENT: {
+ final int offset = nextChar();
+ final int type_index = nextByte();
+ final TypeAnnotationPosition position = TypeAnnotationPosition
+ .methodInvocationTypeArg(readTypePath(), type_index);
+ position.offset = offset;
+ return position;
+ }
+ case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: {
+ final int offset = nextChar();
+ final int type_index = nextByte();
+ final TypeAnnotationPosition position = TypeAnnotationPosition
+ .constructorRefTypeArg(readTypePath(), type_index);
+ position.offset = offset;
+ return position;
+ }
+ case METHOD_REFERENCE_TYPE_ARGUMENT: {
+ final int offset = nextChar();
+ final int type_index = nextByte();
+ final TypeAnnotationPosition position = TypeAnnotationPosition
+ .methodRefTypeArg(readTypePath(), type_index);
+ position.offset = offset;
+ return position;
+ }
// We don't need to worry about these
case METHOD_RETURN:
+ return TypeAnnotationPosition.methodReturn(readTypePath());
case FIELD:
- break;
+ return TypeAnnotationPosition.field(readTypePath());
case UNKNOWN:
throw new AssertionError("jvm.ClassReader: UNKNOWN target type should never occur!");
default:
- throw new AssertionError("jvm.ClassReader: Unknown target type for position: " + position);
+ throw new AssertionError("jvm.ClassReader: Unknown target type for position: " + type);
}
+ }
- { // See whether there is location info and read it
- int len = nextByte();
- ListBuffer loc = new ListBuffer<>();
- for (int i = 0; i < len * TypeAnnotationPosition.TypePathEntry.bytesPerEntry; ++i)
- loc = loc.append(nextByte());
- position.location = TypeAnnotationPosition.getTypePathFromBinary(loc.toList());
- }
+ List readTypePath() {
+ int len = nextByte();
+ ListBuffer loc = new ListBuffer<>();
+ for (int i = 0; i < len * TypeAnnotationPosition.TypePathEntry.bytesPerEntry; ++i)
+ loc = loc.append(nextByte());
+
+ return TypeAnnotationPosition.getTypePathFromBinary(loc.toList());
- return position;
}
Attribute readAttributeValue() {
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
index ccaa833e461..10eae9fcf87 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
@@ -2299,6 +2299,9 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
// Attribute.Compound if tag is ANNOTATION
// Attribute.TypeCompound if tag is TYPE_ANNOTATION
+ //
+ // NOTE: This field is slated for removal in the future. Do
+ // not use it for anything new.
public Attribute.Compound attribute;
protected JCAnnotation(Tag tag, JCTree annotationType, List args) {
From a80e3ed0ee72e396578df5bdfce82041780d8035 Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Mon, 3 Feb 2014 22:26:26 -0800
Subject: [PATCH 097/159] 8033527: Fix raw type lint warning in sun.nio.ch
Reviewed-by: henryjen, mchung
---
jdk/src/share/classes/sun/nio/ch/Reflect.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/src/share/classes/sun/nio/ch/Reflect.java b/jdk/src/share/classes/sun/nio/ch/Reflect.java
index 3ef3d9309f0..fc5276c53c4 100644
--- a/jdk/src/share/classes/sun/nio/ch/Reflect.java
+++ b/jdk/src/share/classes/sun/nio/ch/Reflect.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -75,7 +75,7 @@ class Reflect { // package-private
static Method lookupMethod(String className,
String methodName,
- Class... paramTypes)
+ Class>... paramTypes)
{
try {
Class> cl = Class.forName(className);
From 6c54a7ef11b18d547db38372ab0490f6ab7acde4 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Tue, 4 Feb 2014 10:00:24 +0100
Subject: [PATCH 098/159] 8033236: Update GensrcCharsetMapping.gmk to
build-infra standards
Reviewed-by: erikj, mduigou, sherman
---
jdk/make/GenerateSources.gmk | 1 +
jdk/make/Tools.gmk | 2 +-
.../data/charsetmapping}/standard-charsets | 7 +-
jdk/make/gensrc/GensrcCharsetMapping.gmk | 181 ++++++++++++------
jdk/make/scripts/genCharsetProvider.sh | 131 -------------
.../classes/build/tools/hasher/Hasher.java | 15 +-
.../sun/nio/cs/StandardCharsets.java.template | 48 +++++
7 files changed, 184 insertions(+), 201 deletions(-)
rename jdk/{src/share/classes/sun/nio/cs => make/data/charsetmapping}/standard-charsets (97%)
delete mode 100644 jdk/make/scripts/genCharsetProvider.sh
create mode 100644 jdk/src/share/classes/sun/nio/cs/StandardCharsets.java.template
diff --git a/jdk/make/GenerateSources.gmk b/jdk/make/GenerateSources.gmk
index ba443f7da52..732c0c83f8a 100644
--- a/jdk/make/GenerateSources.gmk
+++ b/jdk/make/GenerateSources.gmk
@@ -29,6 +29,7 @@ include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
+include TextFileProcessing.gmk
# Setup the java compilers for the JDK build.
include Setup.gmk
diff --git a/jdk/make/Tools.gmk b/jdk/make/Tools.gmk
index 1c3b791f621..2336ed4ce98 100644
--- a/jdk/make/Tools.gmk
+++ b/jdk/make/Tools.gmk
@@ -102,7 +102,7 @@ TOOL_JDWPGEN = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
# TODO: Lots of files in jdk/make/tools/CharsetMapping dir
TOOL_CHARSETMAPPING = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
- build.tools.charsetmapping.Main
+ build.tools.charsetmapping.Main $(LOG_INFO)
TOOL_SPP = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
diff --git a/jdk/src/share/classes/sun/nio/cs/standard-charsets b/jdk/make/data/charsetmapping/standard-charsets
similarity index 97%
rename from jdk/src/share/classes/sun/nio/cs/standard-charsets
rename to jdk/make/data/charsetmapping/standard-charsets
index 0785a4edafc..f9f4db12c6a 100644
--- a/jdk/src/share/classes/sun/nio/cs/standard-charsets
+++ b/jdk/make/data/charsetmapping/standard-charsets
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2014, 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
@@ -34,11 +34,6 @@
# compared to the charsets packaged in "ExtendedCharsets" provider,
# which is lazy initialized.
-# This year should only change if the generated source is modified.
-copyright 2000, 2007,
-package sun.nio.cs
-class StandardCharsets
-
charset US-ASCII US_ASCII
# IANA aliases
diff --git a/jdk/make/gensrc/GensrcCharsetMapping.gmk b/jdk/make/gensrc/GensrcCharsetMapping.gmk
index 5624ebfae4b..821f4e03071 100644
--- a/jdk/make/gensrc/GensrcCharsetMapping.gmk
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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,80 +25,151 @@
GENSRC_CHARSETMAPPING :=
-GENSRC_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_DST := $(JDK_OUTPUTDIR)/gensrc/sun/nio/cs
-
-GENSRC_DATA := $(JDK_TOPDIR)/make/data/charsetmapping
-GENSRC_JAVA_SRC := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
-
-GENSRC_TEMPLATES := $(GENSRC_DATA)/SingleByte-X.java.template $(GENSRC_DATA)/DoubleByte-X.java.template
+CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
###
-
-$(GENSRC_TMP)/_the.charsetmapping.dir:
- $(ECHO) Generating charsetmapping classes
- $(MKDIR) -p $(GENSRC_DST)/ext
- $(TOUCH) $@
-
+### Generate files using the charsetmapping tool
###
-GENSRC_SB := $(GENSRC_TMP)/_the.charsetmapping.sbcs
+CHARSET_GENSRC_JAVA_DIR := $(JDK_OUTPUTDIR)/gensrc/sun/nio/cs
+CHARSET_DONE := $(CHARSET_GENSRC_JAVA_DIR)/_the.charsetmapping
+CHARSET_COPYRIGHT_HEADER_BASE := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
+CHARSET_TEMPLATES := \
+ $(CHARSET_DATA_DIR)/SingleByte-X.java.template \
+ $(CHARSET_DATA_DIR)/DoubleByte-X.java.template
-$(GENSRC_SB): $(GENSRC_DATA)/sbcs $(GENSRC_TEMPLATES) $(GENSRC_TMP)/_the.charsetmapping.dir
- $(TOOL_CHARSETMAPPING) $(LOG_INFO) $(GENSRC_DATA) $(GENSRC_DST) sbcs
- $(TOUCH) $@
+# This target should be referenced using the order-only operator (|)
+$(CHARSET_GENSRC_JAVA_DIR)/ext:
+ $(ECHO) "Generating charset mappings"
+ $(MKDIR) -p $(CHARSET_GENSRC_JAVA_DIR)/ext
-GENSRC_CHARSETMAPPING += $(GENSRC_SB)
+$(CHARSET_DONE)-sbcs: $(CHARSET_DATA_DIR)/sbcs \
+ $(CHARSET_TEMPLATES) $(BUILD_TOOLS) | $(CHARSET_GENSRC_JAVA_DIR)/ext
+ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR) sbcs
+ $(TOUCH) '$@'
+
+$(CHARSET_DONE)-extsbcs: $(CHARSET_DATA_DIR)/extsbcs \
+ $(CHARSET_DONE)-sbcs $(CHARSET_TEMPLATES) $(BUILD_TOOLS)
+ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext extsbcs
+ $(TOUCH) '$@'
+
+$(CHARSET_DONE)-dbcs: $(CHARSET_DATA_DIR)/dbcs \
+ $(CHARSET_DONE)-sbcs $(CHARSET_TEMPLATES) $(BUILD_TOOLS)
+ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext dbcs
+ $(TOUCH) '$@'
+
+$(CHARSET_DONE)-hkscs: $(CHARSET_COPYRIGHT_HEADER_BASE)/HKSCS.java \
+ $(CHARSET_DONE)-sbcs $(BUILD_TOOLS)
+ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext hkscs '$<'
+ $(TOUCH) '$@'
+
+$(CHARSET_DONE)-euctw: $(CHARSET_COPYRIGHT_HEADER_BASE)/EUC_TW.java \
+ $(CHARSET_DONE)-sbcs $(BUILD_TOOLS)
+ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR)/ext euctw '$<'
+ $(TOUCH) '$@'
+
+$(CHARSET_GENSRC_JAVA_DIR)/ext/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
+ $(CHARSET_DONE)-sbcs $(BUILD_TOOLS)
+ $(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
+
+GENSRC_CHARSETMAPPING += \
+ $(CHARSET_DONE)-sbcs \
+ $(CHARSET_DONE)-extsbcs \
+ $(CHARSET_DONE)-dbcs \
+ $(CHARSET_DONE)-hkscs \
+ $(CHARSET_DONE)-euctw \
+ $(CHARSET_GENSRC_JAVA_DIR)/ext/sjis0213.dat \
+ #
###
-
-$(GENSRC_DST)/ext/sjis0213.dat: $(GENSRC_DATA)/sjis0213.map $(GENSRC_SB)
- $(TOOL_CHARSETMAPPING) $(LOG_INFO) $< $@ sjis0213
-
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/ext/sjis0213.dat
-
+### Generate the sun/nio/cs/StandardCharsets.java file
###
-$(GENSRC_DST)/ext/EUC_TWMapping.java: $(GENSRC_JAVA_SRC)/EUC_TW.java $(GENSRC_SB)
- $(TOOL_CHARSETMAPPING) $(LOG_INFO) $(GENSRC_DATA) $(GENSRC_DST)/ext euctw $(GENSRC_JAVA_SRC)/EUC_TW.java
+CHARSET_STANDARD_GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc/standardcharsets
+CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets
+CHARSET_STANDARD_JAVA := sun/nio/cs/StandardCharsets.java
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/ext/EUC_TWMapping.java
+CHARSET_ALIASES_TABLES_AWK := ' \
+ BEGIN { n = 1; m = 1; } \
+ /^[ \t]*charset / { \
+ csn = $$2; cln = $$3; \
+ lcsn = tolower(csn); \
+ lcsns[n++] = lcsn; \
+ csns[lcsn] = csn; \
+ classMap[lcsn] = cln; \
+ if (n > 2) \
+ printf " };\n\n"; \
+ printf " static final String[] aliases_%s = new String[] {\n", cln; \
+ } \
+ /^[ \t]*alias / { \
+ acsns[m++] = tolower($$2); \
+ aliasMap[tolower($$2)] = lcsn; \
+ printf " \"%s\",\n", $$2; \
+ } \
+ END { \
+ printf " };\n\n"; \
+ } '
-###
+CHARSET_ALIASES_MAP_AWK := ' \
+ /^[ \t]*charset / { \
+ csn = $$2; \
+ lcsn = tolower(csn); \
+ } \
+ /^[ \t]*alias / { \
+ an = tolower($$2); \
+ printf "%-20s \"%s\"\n", an, lcsn; \
+ } '
-$(GENSRC_DST)/ext/HKSCSMapping.java: $(GENSRC_JAVA_SRC)/HKSCS.java $(GENSRC_SB)
- $(TOOL_CHARSETMAPPING) $(LOG_INFO) $(GENSRC_DATA) $(GENSRC_DST)/ext hkscs $(GENSRC_JAVA_SRC)/HKSCS.java
+CHARSET_CLASSES_MAP_AWK := ' \
+ /^[ \t]*charset / { \
+ csn = $$2; cln = $$3; \
+ lcsn = tolower(csn); \
+ printf "%-20s \"%s\"\n", lcsn, cln; \
+ } '
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/ext/HKSCSMapping.java
+# This target should be referenced using the order-only operator (|)
+$(CHARSET_STANDARD_GENSRC_DIR):
+ $(MKDIR) -p '$@'
-###
+$(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet: $(CHARSET_STANDARD_DATA) \
+ | $(CHARSET_STANDARD_GENSRC_DIR)
+ $(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_TABLES_AWK)
-$(GENSRC_TMP)/gensrc_the.charsetmapping.extsbcs: $(GENSRC_DATA)/extsbcs $(GENSRC_TEMPLATES) $(GENSRC_SB)
- $(TOOL_CHARSETMAPPING) $(GENSRC_DATA) $(LOG_INFO) $(GENSRC_DST)/ext extsbcs
- $(TOUCH) $@
+$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map: $(CHARSET_STANDARD_DATA) \
+ | $(CHARSET_STANDARD_GENSRC_DIR)
+ $(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_MAP_AWK)
-GENSRC_CHARSETMAPPING += $(GENSRC_TMP)/gensrc_the.charsetmapping.extsbcs
+$(CHARSET_STANDARD_GENSRC_DIR)/classes-map: $(CHARSET_STANDARD_DATA) \
+ | $(CHARSET_STANDARD_GENSRC_DIR)
+ $(NAWK) < '$<' > '$@' $(CHARSET_CLASSES_MAP_AWK)
-###
+$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map \
+ $(BUILD_TOOLS) | $(CHARSET_STANDARD_GENSRC_DIR)
+ $(TOOL_HASHER) -i Aliases < '$<' > '$@'
-$(GENSRC_TMP)/gensrc_the.charsetmapping.dbcs: $(GENSRC_DATA)/dbcs $(GENSRC_TEMPLATES) $(GENSRC_SB)
- $(TOOL_CHARSETMAPPING) $(GENSRC_DATA) $(LOG_INFO) $(GENSRC_DST)/ext dbcs
- $(TOUCH) $@
+$(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
+ $(BUILD_TOOLS) | $(CHARSET_STANDARD_GENSRC_DIR)
+ $(TOOL_HASHER) -i Classes < '$<' > '$@'
-GENSRC_CHARSETMAPPING += $(GENSRC_TMP)/gensrc_the.charsetmapping.dbcs
+$(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
+ $(BUILD_TOOLS) | $(CHARSET_STANDARD_GENSRC_DIR)
+ $(TOOL_HASHER) -i -e Cache -t Charset < '$<' > '$@'
-###
+$(eval $(call SetupTextFileProcessing, BUILD_CHARSET_STANDARD, \
+ SOURCE_FILES := $(JDK_TOPDIR)/src/share/classes/$(CHARSET_STANDARD_JAVA).template, \
+ OUTPUT_FILE := $(JDK_OUTPUTDIR)/gensrc/$(CHARSET_STANDARD_JAVA), \
+ INCLUDES := \
+ _INCLUDE_ALIASES_TABLES_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet ; \
+ _INCLUDE_ALIASES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet ; \
+ _INCLUDE_CLASSES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet ; \
+ _INCLUDE_CACHE_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet ; , \
+))
-GENSRC_CHARSET_PROVIDER_CMD := $(JDK_TOPDIR)/make/scripts/genCharsetProvider.sh
+# Processing of template depends on the snippets being generated first
+$(BUILD_CHARSET_STANDARD): \
+ $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet \
+ $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet \
+ $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet \
+ $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet
-$(GENSRC_DST)/StandardCharsets.java: $(JDK_TOPDIR)/src/share/classes/sun/nio/cs/standard-charsets \
- $(GENSRC_CHARSET_PROVIDER_CMD) \
- $(GENSRC_TMP)/_the.charsetmapping.dir
- NAWK="$(NAWK)" TEMPDIR="$(GENSRC_TMP)" SH="$(SH)" \
- HASHER="$(TOOL_HASHER)" \
- SCRIPTS="$(JDK_TOPDIR)/make/scripts" \
- $(SH) -e $(GENSRC_CHARSET_PROVIDER_CMD) $(LOG_INFO) $< $(@D)
-
-GENSRC_CHARSETMAPPING += $(GENSRC_DST)/StandardCharsets.java
-
-$(GENSRC_CHARSETMAPPING): $(BUILD_TOOLS)
+GENSRC_CHARSETMAPPING += $(BUILD_CHARSET_STANDARD)
diff --git a/jdk/make/scripts/genCharsetProvider.sh b/jdk/make/scripts/genCharsetProvider.sh
deleted file mode 100644
index d14527483a4..00000000000
--- a/jdk/make/scripts/genCharsetProvider.sh
+++ /dev/null
@@ -1,131 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 2004, 2012, 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.
-#
-
-# Generate a charset provider class
-
-# Required environment variables
-# NAWK awk tool
-# TEMPDIR temporary directory
-# HASHER Hasher program
-
-SPEC=$1; shift
-DST=$1; shift
-
-eval `$NAWK <$SPEC '
- /^[ \t]*copyright / { printf "COPYRIGHT_YEARS=\"%s %s\"\n", $2, $3; }
- /^[ \t]*package / { printf "PKG=%s\n", $2; }
- /^[ \t]*class / { printf "CLASS=%s\n", $2; }
-'`
-
-OUT=$DST/$CLASS.java
-echo '-->' $OUT
-
-
-# Header
-#
-
-$SH ${SCRIPTS}/addNotices.sh "$COPYRIGHT_YEARS" > $OUT
-
-cat <<__END__ >>$OUT
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package $PKG;
-
-import java.nio.charset.*;
-
-
-public class $CLASS
- extends FastCharsetProvider
-{
-
-__END__
-
-
-# Alias tables
-#
-$NAWK <$SPEC >>$OUT '
- BEGIN { n = 1; m = 1; }
-
- /^[ \t]*charset / {
- csn = $2; cln = $3;
- lcsn = tolower(csn);
- lcsns[n++] = lcsn;
- csns[lcsn] = csn;
- classMap[lcsn] = cln;
- if (n > 2)
- printf " };\n\n";
- printf " static final String[] aliases_%s = new String[] {\n", cln;
- }
-
- /^[ \t]*alias / {
- acsns[m++] = tolower($2);
- aliasMap[tolower($2)] = lcsn;
- printf " \"%s\",\n", $2;
- }
-
- END {
- printf " };\n\n";
- }
-'
-
-
-# Prehashed alias and class maps
-#
-$NAWK <$SPEC >$TEMPDIR/aliases '
- /^[ \t]*charset / {
- csn = $2;
- lcsn = tolower(csn);
- }
- /^[ \t]*alias / {
- an = tolower($2);
- printf "%-20s \"%s\"\n", an, lcsn;
- }
-'
-
-$NAWK <$SPEC >$TEMPDIR/classes '
- /^[ \t]*charset / {
- csn = $2; cln = $3;
- lcsn = tolower(csn);
- printf "%-20s \"%s\"\n", lcsn, cln;
- }
-'
-
-${HASHER} -i Aliases <$TEMPDIR/aliases >>$OUT
-${HASHER} -i Classes <$TEMPDIR/classes >>$OUT
-${HASHER} -i -e Cache -t Charset <$TEMPDIR/classes >>$OUT
-
-
-# Constructor
-#
-cat <<__END__ >>$OUT
- public $CLASS() {
- super("$PKG", new Aliases(), new Classes(), new Cache());
- }
-
-}
-__END__
diff --git a/jdk/make/src/classes/build/tools/hasher/Hasher.java b/jdk/make/src/classes/build/tools/hasher/Hasher.java
index bf041976ef2..058655e767c 100644
--- a/jdk/make/src/classes/build/tools/hasher/Hasher.java
+++ b/jdk/make/src/classes/build/tools/hasher/Hasher.java
@@ -43,9 +43,6 @@ import java.util.*;
public class Hasher {
- // This class cannot, sadly, make use of 1.5 features since it must be
- // compiled and run with the bootstrap JDK, which is 1.4.2.
-
static final PrintStream out = System.out;
static final PrintStream err = System.err;
@@ -184,11 +181,13 @@ public class Hasher {
if (md <= maxDepth) {
// Success
out.flush();
- if (cln != null)
- err.print(cln + ": ");
- err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
- + ", shift " + shift
- + ", max chain depth " + md);
+ if (verbose) {
+ if (cln != null)
+ err.print(cln + ": ");
+ err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
+ + ", shift " + shift
+ + ", max chain depth " + md);
+ }
return this;
}
}
diff --git a/jdk/src/share/classes/sun/nio/cs/StandardCharsets.java.template b/jdk/src/share/classes/sun/nio/cs/StandardCharsets.java.template
new file mode 100644
index 00000000000..468934b017a
--- /dev/null
+++ b/jdk/src/share/classes/sun/nio/cs/StandardCharsets.java.template
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000, 2014, 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.
+ *
+ */
+
+// -- This file was mechanically generated: Do not edit! -- //
+
+package sun.nio.cs;
+
+import java.nio.charset.*;
+
+
+public class StandardCharsets
+ extends FastCharsetProvider
+{
+
+ _INCLUDE_ALIASES_TABLES_
+ _INCLUDE_ALIASES_MAP_
+ _INCLUDE_CLASSES_MAP_
+ _INCLUDE_CACHE_MAP_
+
+ public StandardCharsets() {
+ super("sun.nio.cs", new Aliases(), new Classes(), new Cache());
+ }
+
+}
From f9c28e97a25ae0a75dd77ffd2b11c81f0a32e321 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Tue, 4 Feb 2014 10:01:20 +0100
Subject: [PATCH 099/159] 8033236: Update GensrcCharsetMapping.gmk to
build-infra standards
Reviewed-by: erikj, mduigou, sherman
---
common/autoconf/spec.gmk.in | 2 +
make/common/TextFileProcessing.gmk | 234 +++++++++++++++++++++++++++++
2 files changed, 236 insertions(+)
create mode 100644 make/common/TextFileProcessing.gmk
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 4342d1517ee..b92db9125da 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -37,6 +37,8 @@ X:=
SPACE:=$(X) $(X)
COMMA:=,
HASH:=\#
+LEFT_PAREN:=(
+RIGHT_PAREN:=)
SQUOTE:='
#'
DQUOTE:="
diff --git a/make/common/TextFileProcessing.gmk b/make/common/TextFileProcessing.gmk
new file mode 100644
index 00000000000..f5101626b0d
--- /dev/null
+++ b/make/common/TextFileProcessing.gmk
@@ -0,0 +1,234 @@
+#
+# Copyright (c) 2013, 2014 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.
+#
+
+define EvalDebugWrapper
+ $(if $(DEBUG_$1),
+ $(info -------- <<< Begin expansion of $1)
+ $(info $2)
+ $(info -------- >>> End expansion of $1)
+ )
+
+ $2
+endef
+
+# Helper function for SetupTextFileProcessing; adds a rule for a single file
+# to be processed.
+# param 1 = The namespace argument, e.g. BUILD_VERSION_FILE
+# param 2 = the source file name (full path)
+# param 3 = the target base directory
+# param 4 = the target file name (possibly with a partial path)
+define SetupSingleTextFileForProcessing
+ $(strip $3)/$(strip $4): $2
+ $(ECHO) $(LOG_INFO) "Processing $(strip $4)"
+ $(MKDIR) -p '$$(@D)'
+ $(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp'
+ $$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp'
+ $$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp'
+ $(RM) '$$@.includes.tmp'
+ $(MV) '$$@.replacements.tmp' '$$@'
+
+ $1 += $(strip $3)/$(strip $4)
+endef
+
+# Setup a text file for processing, in which specified markers are replaced with
+# a given text, or with the contents of a given file.
+#
+# param 1 is the name space for this setup, e.g. BUILD_VERSION_FILE
+# param 2, 3, .. etc are named args:
+# SOURCE_DIRS one or more directory roots to search for files to process
+# SOURCE_FILES complete paths to one or more files to process
+# OUTPUT_DIR the directory where we store the processed files.
+# OUTPUT_FILE the name of the resulting file. Only allowed if processing a
+# single file.
+# SOURCE_BASE_DIR a common root to all SOURCE_DIRS.
+# If specified, files will keep the path relative to the base in the
+# OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR.
+# INCLUDE_FILES only include files matching these patterns (used only with
+# SOURCE_DIRS)
+# EXCLUDE_FILES exclude files matching these patterns (used only with
+# SOURCE_DIRS)
+# INCLUDES replace the occurances of a pattern with the contents of a file;
+# one or more such include pattern, using the syntax:
+# PLACEHOLDER => FILE_TO_INCLUDE ; ...
+# Each PLACEHOLDER must be on a single, otherwise empty line (whitespace
+# padding is allowed).
+# REPLACEMENTS one or more text replacement patterns, using the syntax:
+# PATTERN => REPLACEMENT_TEXT ; ...
+#
+# At least one of INCLUDES or REPLACEMENTS must be present. If both are
+# present, then the includes will be processed first, and replacements will be
+# done on the included fragments as well.
+#
+define SetupTextFileProcessing
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk))
+ $(call EvalDebugWrapper,$(strip $1),$(call SetupTextFileProcessingInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
+
+define SetupTextFileProcessingInner
+ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
+ $(call LogSetupMacroEntry,SetupTextFileProcessing($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+ $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk))
+
+ ifeq ($$($1_REPLACEMENTS)$$($1_INCLUDES),)
+ $$(error At least one of REPLACEMENTS or INCLUDES are required for $1)
+ endif
+
+ ifneq ($$($1_SOURCE_FILES),)
+ ifneq ($$($1_SOURCE_DIRS),)
+ $$(error Cannot use both SOURCE_FILES and SOURCE_DIRS (in $1))
+ endif
+ ifneq ($$($1_SOURCE_BASE_DIR),)
+ $$(error Cannot use SOURCE_BASE_DIR without SOURCE_DIRS (in $1))
+ endif
+ ifneq ($$($1_EXCLUDE_FILES)$$($1_INCLUDE_FILES),)
+ $$(error Cannot INCLUDE/EXCLUDE_FILES with SOURCE_FILES (in $1))
+ endif
+ else
+ # Find all files in the source trees. Sort to remove duplicates.
+ $$(foreach src, $$($1_SOURCE_DIRS), $$(if $$(wildcard $$(src)), , \
+ $$(error SOURCE_DIRS contains missing directory $$(src) (in $1))))
+ ifneq ($$($1_SOURCE_BASE_DIR),)
+ $$(foreach src, $$($1_SOURCE_DIRS), \
+ $$(if $$(findstring $$($1_SOURCE_BASE_DIR), $$(src)), , \
+ $$(error SOURCE_DIRS contains directory $$(src) outside \
+ SOURCE_BASE_DIR $$($1_SOURCE_BASE_DIR) (in $1))))
+ endif
+ $1_SOURCE_FILES := $$(sort $$(call CacheFind,$$($1_SOURCE_DIRS)))
+ $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
+ $1_INCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
+ $1_SOURCE_FILES := $$(filter-out $$($1_EXCLUDE_FILES),$$($1_SOURCE_FILES))
+ ifneq (,$$(strip $$($1_INCLUDE_FILES)))
+ $1_SOURCE_FILES := $$(filter $$($1_INCLUDE_FILES),$$($1_SOURCE_FILES))
+ endif
+ ifeq (,$$($1_SOURCE_FILES))
+ $$(info No sources found for $1 when looking inside the dirs $$($1_SRC))
+ endif
+ endif
+
+ ifneq ($$($1_REPLACEMENTS),)
+ # We have a replacement request, prepare it for the recipe
+ ifneq ($$(findstring /,$$($1_REPLACEMENTS)),)
+ # Cannot use / as separator
+ ifneq ($$(findstring @,$$($1_REPLACEMENTS)),)
+ # Cannot use @ as separator
+ ifneq ($$(findstring |,$$($1_REPLACEMENTS)),)
+ # Cannot use | as separator
+ ifneq ($$(findstring !,$$($1_REPLACEMENTS)),)
+ # Cannot use ! as separator. Give up.
+ $$(error No suitable sed separator can be found for $1. Tested /, @, | and !)
+ else
+ $1_SEP := !
+ endif
+ else
+ $1_SEP := |
+ endif
+ else
+ $1_SEP := @
+ endif
+ else
+ $1_SEP := /
+ endif
+
+ # If we have a trailing "=>" (i.e. last rule replaces with empty, and is not
+ # terminated by a ;), add a trailing ; to minimize the number of corner
+ # cases in the hairy subst expression..
+ ifeq ($$(lastword $$($1_REPLACEMENTS)), =>)
+ $1_REPLACEMENTS += ;
+ endif
+
+ # If we have a trailing ";", add a dummy replacement, since there is no easy
+ # way to delete the last word in make.
+ ifeq ($$(lastword $$($1_REPLACEMENTS)), ;)
+ $1_REPLACEMENTS += DUMMY_REPLACEMENT => DUMMY_REPLACEMENT
+ endif
+
+ # Convert the REPLACEMENTS syntax ( A => B ; C => D ; ...) to a sed command
+ # line (-e "s/A/B/" -e "s/C/D/" ...), basically by replacing '=>' with '/'
+ # and ';' with '/" -e "s/', and adjusting for edge cases.
+ $1_REPLACEMENTS_COMMAND_LINE := $(SED) -e "s$$($1_SEP)$$(subst $$(SPACE);$$(SPACE),$$($1_SEP)" \
+ -e "s$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE),$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE);$$(SPACE),//" \
+ -e "s$$($1_SEP),$$(strip $$($1_REPLACEMENTS)))))$$($1_SEP)"
+ else
+ # We don't have any replacements, just pipe the file through cat.
+ $1_REPLACEMENTS_COMMAND_LINE := $(CAT)
+ endif
+
+ ifneq ($$($1_INCLUDES),)
+ # We have a include request, prepare it for the recipe.
+ # Convert an INCLUDE like this PATTERN_1 => file1 ; PATTERN_2 => file2 ;
+ # into an awk script fragment like this:
+ # {
+ # if (matches("PATTERN_1")) { include("file1") } else
+ # if (matches("PATTERN_2")) { include("file2") } else
+ # print
+ # }
+
+ $1_INCLUDES_HEADER_AWK := \
+ function matches(pattern) { return ($$$$0 ~ "^[ \t]*" pattern "[ \t]*$$$$") } \
+ function include(filename) { while ((getline < filename) == 1) print ; close(filename) }
+ $1_INCLUDES_PARTIAL_AWK := $$(subst $$(SPACE);,,$$(subst $$(SPACE)=>$$(SPACE),"$$(RIGHT_PAREN)$$(RIGHT_PAREN) \
+ { include$$(LEFT_PAREN)",$$(subst $$(SPACE);$$(SPACE),"$$(RIGHT_PAREN) } \
+ else if $$(LEFT_PAREN)matches$$(LEFT_PAREN)",$$(strip $$($1_INCLUDES)))))
+ $1_INCLUDES_COMMAND_LINE := $(NAWK) '$$($1_INCLUDES_HEADER_AWK) \
+ { if (matches("$$($1_INCLUDES_PARTIAL_AWK)") } else print }'
+ else
+ # We don't have any includes, just pipe the file through cat.
+ $1_INCLUDES_COMMAND_LINE := $(CAT)
+ endif
+
+ # Reset target list before populating it
+ $1 :=
+
+ ifneq ($$($1_OUTPUT_FILE),)
+ ifneq ($$(words $$($1_SOURCE_FILES)), 1)
+ $$(error Cannot use OUTPUT_FILE for more than one source file (in $1))
+ endif
+
+ # Note that $1 is space sensitive and must disobey whitespace rules
+ $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$($1_SOURCE_FILES), \
+ $$(dir $$($1_OUTPUT_FILE)), $$(notdir $$($1_OUTPUT_FILE))))
+ else
+ ifeq ($$($1_OUTPUT_DIR),)
+ $$(error Neither OUTPUT_FILE nor OUTPUT_DIR was specified (in $1))
+ endif
+
+ # Now call add_native_source for each source file we are going to process.
+ ifeq ($$($1_SOURCE_BASE_DIR),)
+ # With no base dir specified, put all files in target dir, flattening any
+ # hierarchies. Note that $1 is space sensitive and must disobey whitespace
+ # rules.
+ $$(foreach src, $$($1_SOURCE_FILES), \
+ $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \
+ $$($1_OUTPUT_DIR), $$(notdir $$(src)))))
+ else
+ # With a base dir, extract the relative portion of the path. Note that $1
+ # is space sensitive and must disobey whitespace rules, and so is the
+ # arguments to patsubst.
+ $$(foreach src, $$($1_SOURCE_FILES), \
+ $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \
+ $$($1_OUTPUT_DIR), $$(patsubst $$($1_SOURCE_BASE_DIR)/%,%,$$(src)))))
+ endif
+ endif
+endef
From fbe3b00b09724cae6edb1f15b77636c09605717b Mon Sep 17 00:00:00 2001
From: Michael McMahon
Date: Tue, 4 Feb 2014 11:31:27 +0000
Subject: [PATCH 100/159] 8028725: [Parfait] warnings from b116 for
jdk.src.solaris.native.java.net: JNI pending exceptions
Reviewed-by: alanb
---
jdk/src/solaris/native/java/net/Inet6AddressImpl.c | 2 ++
jdk/src/windows/native/java/net/Inet6AddressImpl.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
index 7ac26c0cbb6..1e4e7d684d1 100644
--- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
+++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
@@ -196,6 +196,7 @@ lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6)
}
name = (*env)->NewStringUTF(env, hostname);
+ CHECK_NULL(name);
/* Iterate over the interfaces, and total up the number of IPv4 and IPv6
* addresses we have. Also keep a count of loopback addresses. We need to
@@ -548,6 +549,7 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
if (!error) {
ret = (*env)->NewStringUTF(env, host);
+ CHECK_NULL(ret);
}
#endif /* AF_INET6 */
diff --git a/jdk/src/windows/native/java/net/Inet6AddressImpl.c b/jdk/src/windows/native/java/net/Inet6AddressImpl.c
index f77d5ab79c7..24176b29278 100644
--- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c
+++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c
@@ -347,6 +347,7 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
if (!error) {
ret = (*env)->NewStringUTF(env, host);
+ CHECK_NULL(ret);
}
if (ret == NULL) {
From 28e1b6ccf23461bc43840e72826f977bcf379a48 Mon Sep 17 00:00:00 2001
From: Alan Bateman
Date: Tue, 4 Feb 2014 12:05:13 +0000
Subject: [PATCH 101/159] 8033372: Check jdk/src/share/native/java/lang for JNI
pending exception issues 8033371:
jdk/src/solaris/native/java/lang/ProcessEnvironment.c environ doesn't check
for JNI pending exceptions 8030116: (process) Check Parfait warnings in
src/solaris/native/java/lang/* 8028769: Check src/share/native/java/lang/*.c
for cases when JNI calls are used with pending warnings
Reviewed-by: chegar
---
jdk/src/share/native/java/io/io_util.c | 1 +
jdk/src/share/native/java/lang/ClassLoader.c | 3 -
jdk/src/share/native/java/lang/System.c | 109 +++++++++++-------
.../native/java/lang/ProcessEnvironment_md.c | 7 +-
.../solaris/native/java/lang/UNIXProcess_md.c | 1 +
.../solaris/native/java/lang/java_props_md.c | 3 +
.../native/java/lang/ProcessEnvironment_md.c | 11 +-
7 files changed, 82 insertions(+), 53 deletions(-)
diff --git a/jdk/src/share/native/java/io/io_util.c b/jdk/src/share/native/java/io/io_util.c
index 5dd822382f0..f256af4074b 100644
--- a/jdk/src/share/native/java/io/io_util.c
+++ b/jdk/src/share/native/java/io/io_util.c
@@ -216,6 +216,7 @@ throwFileNotFoundException(JNIEnv *env, jstring path)
#else
why = JNU_NewStringPlatform(env, buf);
#endif
+ CHECK_NULL(why);
}
x = JNU_NewObjectByName(env,
"java/io/FileNotFoundException",
diff --git a/jdk/src/share/native/java/lang/ClassLoader.c b/jdk/src/share/native/java/lang/ClassLoader.c
index f6d0583990c..8e0b950406a 100644
--- a/jdk/src/share/native/java/lang/ClassLoader.c
+++ b/jdk/src/share/native/java/lang/ClassLoader.c
@@ -132,7 +132,6 @@ Java_java_lang_ClassLoader_defineClass1(JNIEnv *env,
if (name != NULL) {
utfName = getUTF(env, name, buf, sizeof(buf));
if (utfName == NULL) {
- JNU_ThrowOutOfMemoryError(env, NULL);
goto free_body;
}
VerifyFixClassname(utfName);
@@ -143,7 +142,6 @@ Java_java_lang_ClassLoader_defineClass1(JNIEnv *env,
if (source != NULL) {
utfSource = getUTF(env, source, sourceBuf, sizeof(sourceBuf));
if (utfSource == NULL) {
- JNU_ThrowOutOfMemoryError(env, NULL);
goto free_utfName;
}
} else {
@@ -519,7 +517,6 @@ Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib
procHandle = getProcessHandle();
cname = JNU_GetStringPlatformChars(env, name, 0);
if (cname == NULL) {
- JNU_ThrowOutOfMemoryError(env, NULL);
return NULL;
}
// Copy name Skipping PREFIX
diff --git a/jdk/src/share/native/java/lang/System.c b/jdk/src/share/native/java/lang/System.c
index 660b21e68e1..9c2f591fab4 100644
--- a/jdk/src/share/native/java/lang/System.c
+++ b/jdk/src/share/native/java/lang/System.c
@@ -56,44 +56,56 @@ Java_java_lang_System_identityHashCode(JNIEnv *env, jobject this, jobject x)
return JVM_IHashCode(env, x);
}
-#define PUTPROP(props, key, val) \
- if (1) { \
- jstring jkey = (*env)->NewStringUTF(env, key); \
- jstring jval = (*env)->NewStringUTF(env, val); \
- jobject r = (*env)->CallObjectMethod(env, props, putID, jkey, jval); \
- if ((*env)->ExceptionOccurred(env)) return NULL; \
- (*env)->DeleteLocalRef(env, jkey); \
- (*env)->DeleteLocalRef(env, jval); \
- (*env)->DeleteLocalRef(env, r); \
+#define PUTPROP(props, key, val) \
+ if (1) { \
+ jstring jkey, jval; \
+ jobject r; \
+ jkey = (*env)->NewStringUTF(env, key); \
+ if (jkey == NULL) return NULL; \
+ jval = (*env)->NewStringUTF(env, val); \
+ if (jval == NULL) return NULL; \
+ r = (*env)->CallObjectMethod(env, props, putID, jkey, jval); \
+ if ((*env)->ExceptionOccurred(env)) return NULL; \
+ (*env)->DeleteLocalRef(env, jkey); \
+ (*env)->DeleteLocalRef(env, jval); \
+ (*env)->DeleteLocalRef(env, r); \
} else ((void) 0)
/* "key" is a char type string with only ASCII character in it.
"val" is a nchar (typedefed in java_props.h) type string */
-#define PUTPROP_ForPlatformNString(props, key, val) \
- if (1) { \
- jstring jkey = (*env)->NewStringUTF(env, key); \
- jstring jval = GetStringPlatform(env, val); \
- jobject r = (*env)->CallObjectMethod(env, props, putID, jkey, jval); \
- if ((*env)->ExceptionOccurred(env)) return NULL; \
- (*env)->DeleteLocalRef(env, jkey); \
- (*env)->DeleteLocalRef(env, jval); \
- (*env)->DeleteLocalRef(env, r); \
+#define PUTPROP_ForPlatformNString(props, key, val) \
+ if (1) { \
+ jstring jkey, jval; \
+ jobject r; \
+ jkey = (*env)->NewStringUTF(env, key); \
+ if (jkey == NULL) return NULL; \
+ jval = GetStringPlatform(env, val); \
+ if (jval == NULL) return NULL; \
+ r = (*env)->CallObjectMethod(env, props, putID, jkey, jval); \
+ if ((*env)->ExceptionOccurred(env)) return NULL; \
+ (*env)->DeleteLocalRef(env, jkey); \
+ (*env)->DeleteLocalRef(env, jval); \
+ (*env)->DeleteLocalRef(env, r); \
} else ((void) 0)
-#define REMOVEPROP(props, key) \
- if (1) { \
- jstring jkey = JNU_NewStringPlatform(env, key); \
- jobject r = (*env)->CallObjectMethod(env, props, removeID, jkey); \
- if ((*env)->ExceptionOccurred(env)) return NULL; \
- (*env)->DeleteLocalRef(env, jkey); \
- (*env)->DeleteLocalRef(env, r); \
+#define REMOVEPROP(props, key) \
+ if (1) { \
+ jstring jkey; \
+ jobject r; \
+ jkey = JNU_NewStringPlatform(env, key); \
+ if (jkey == NULL) return NULL; \
+ r = (*env)->CallObjectMethod(env, props, removeID, jkey); \
+ if ((*env)->ExceptionOccurred(env)) return NULL; \
+ (*env)->DeleteLocalRef(env, jkey); \
+ (*env)->DeleteLocalRef(env, r); \
} else ((void) 0)
-#define GETPROP(props, key, jret) \
- if (1) { \
- jstring jkey = JNU_NewStringPlatform(env, key); \
+#define GETPROP(props, key, jret) \
+ if (1) { \
+ jstring jkey = JNU_NewStringPlatform(env, key); \
+ if (jkey == NULL) return NULL; \
jret = (*env)->CallObjectMethod(env, props, getPropID, jkey); \
- if ((*env)->ExceptionOccurred(env)) return NULL; \
- (*env)->DeleteLocalRef(env, jkey); \
+ if ((*env)->ExceptionOccurred(env)) return NULL; \
+ (*env)->DeleteLocalRef(env, jkey); \
} else ((void) 0)
#ifndef VENDOR /* Third party may overwrite this. */
@@ -169,23 +181,31 @@ JNIEXPORT jobject JNICALL
Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
{
char buf[128];
- java_props_t *sprops = GetJavaProperties(env);
- jmethodID putID = (*env)->GetMethodID(env,
- (*env)->GetObjectClass(env, props),
- "put",
- "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
- jmethodID removeID = (*env)->GetMethodID(env,
- (*env)->GetObjectClass(env, props),
- "remove",
- "(Ljava/lang/Object;)Ljava/lang/Object;");
- jmethodID getPropID = (*env)->GetMethodID(env,
- (*env)->GetObjectClass(env, props),
- "getProperty",
- "(Ljava/lang/String;)Ljava/lang/String;");
+ java_props_t *sprops;
+ jmethodID putID, removeID, getPropID;
jobject ret = NULL;
jstring jVMVal = NULL;
- if (sprops == NULL || putID == NULL ) return NULL;
+ sprops = GetJavaProperties(env);
+ CHECK_NULL_RETURN(sprops, NULL);
+
+ putID = (*env)->GetMethodID(env,
+ (*env)->GetObjectClass(env, props),
+ "put",
+ "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+ CHECK_NULL_RETURN(putID, NULL);
+
+ removeID = (*env)->GetMethodID(env,
+ (*env)->GetObjectClass(env, props),
+ "remove",
+ "(Ljava/lang/Object;)Ljava/lang/Object;");
+ CHECK_NULL_RETURN(removeID, NULL);
+
+ getPropID = (*env)->GetMethodID(env,
+ (*env)->GetObjectClass(env, props),
+ "getProperty",
+ "(Ljava/lang/String;)Ljava/lang/String;");
+ CHECK_NULL_RETURN(getPropID, NULL);
PUTPROP(props, "java.specification.version",
JDK_MAJOR_VERSION "." JDK_MINOR_VERSION);
@@ -382,6 +402,7 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
GETPROP(props, "sun.locale.formatasdefault", jVMVal);
if (jVMVal) {
const char * val = (*env)->GetStringUTFChars(env, jVMVal, 0);
+ CHECK_NULL_RETURN(val, NULL);
fmtdefault = !strcmp(val, "true");
(*env)->ReleaseStringUTFChars(env, jVMVal, val);
(*env)->DeleteLocalRef(env, jVMVal);
diff --git a/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c b/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
index f597bff742d..54aa7142a36 100644
--- a/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
+++ b/jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
@@ -53,6 +53,7 @@ Java_java_lang_ProcessEnvironment_environ(JNIEnv *env, jclass ign)
jsize i, j;
jobjectArray result;
jclass byteArrCls = (*env)->FindClass(env, "[B");
+ CHECK_NULL_RETURN(byteArrCls, NULL);
for (i = 0; environ[i]; i++) {
/* Ignore corrupted environment variables */
@@ -61,7 +62,7 @@ Java_java_lang_ProcessEnvironment_environ(JNIEnv *env, jclass ign)
}
result = (*env)->NewObjectArray(env, 2*count, byteArrCls, 0);
- if (result == NULL) return NULL;
+ CHECK_NULL_RETURN(result, NULL);
for (i = 0, j = 0; environ[i]; i++) {
const char * varEnd = strchr(environ[i], '=');
@@ -72,9 +73,9 @@ Java_java_lang_ProcessEnvironment_environ(JNIEnv *env, jclass ign)
jsize varLength = varEnd - environ[i];
jsize valLength = strlen(valBeg);
var = (*env)->NewByteArray(env, varLength);
- if (var == NULL) return NULL;
+ CHECK_NULL_RETURN(var, NULL);
val = (*env)->NewByteArray(env, valLength);
- if (val == NULL) return NULL;
+ CHECK_NULL_RETURN(val, NULL);
(*env)->SetByteArrayRegion(env, var, 0, varLength,
(jbyte*) environ[i]);
(*env)->SetByteArrayRegion(env, val, 0, valLength,
diff --git a/jdk/src/solaris/native/java/lang/UNIXProcess_md.c b/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
index ec85b685dc6..da5be2257d0 100644
--- a/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
+++ b/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
@@ -206,6 +206,7 @@ JNIEXPORT void JNICALL
Java_java_lang_UNIXProcess_init(JNIEnv *env, jclass clazz)
{
parentPathv = effectivePathv(env);
+ CHECK_NULL(parentPathv);
setSIGCHLDHandler(env);
}
diff --git a/jdk/src/solaris/native/java/lang/java_props_md.c b/jdk/src/solaris/native/java/lang/java_props_md.c
index 1830b20fd0c..df55fd32b5b 100644
--- a/jdk/src/solaris/native/java/lang/java_props_md.c
+++ b/jdk/src/solaris/native/java/lang/java_props_md.c
@@ -546,6 +546,9 @@ GetJavaProperties(JNIEnv *env)
sprops.display_country = sprops.country;
sprops.display_variant = sprops.variant;
+ /* ParseLocale failed with OOME */
+ JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+
#ifdef MACOSX
sprops.sun_jnu_encoding = "UTF-8";
#else
diff --git a/jdk/src/windows/native/java/lang/ProcessEnvironment_md.c b/jdk/src/windows/native/java/lang/ProcessEnvironment_md.c
index e64d30b74af..3b73dd1d326 100644
--- a/jdk/src/windows/native/java/lang/ProcessEnvironment_md.c
+++ b/jdk/src/windows/native/java/lang/ProcessEnvironment_md.c
@@ -32,10 +32,15 @@ static jstring
environmentBlock9x(JNIEnv *env)
{
int i;
- jmethodID String_init_ID =
- (*env)->GetMethodID(env, JNU_ClassString(env), "", "([B)V");
+ jmethodID String_init_ID;
jbyteArray bytes;
- jbyte *blockA = (jbyte *) GetEnvironmentStringsA();
+ jbyte *blockA;
+
+ String_init_ID =
+ (*env)->GetMethodID(env, JNU_ClassString(env), "", "([B)V");
+ CHECK_NULL_RETURN(String_init_ID, NULL);
+
+ blockA = (jbyte *) GetEnvironmentStringsA();
if (blockA == NULL) {
/* Both GetEnvironmentStringsW and GetEnvironmentStringsA
* failed. Out of memory is our best guess. */
From 579b11a884524a6895985ee7ae210e7e3d245160 Mon Sep 17 00:00:00 2001
From: Staffan Larsen
Date: Tue, 4 Feb 2014 15:25:10 +0100
Subject: [PATCH 102/159] 8029808: com/sun/jdi/ProcessAttachTest.sh times out
Reviewed-by: alanb, dsamersoff
---
jdk/test/com/sun/jdi/ProcessAttachTest.sh | 68 ++++++++++++++---------
1 file changed, 43 insertions(+), 25 deletions(-)
diff --git a/jdk/test/com/sun/jdi/ProcessAttachTest.sh b/jdk/test/com/sun/jdi/ProcessAttachTest.sh
index 76a531bad38..739b53abb10 100644
--- a/jdk/test/com/sun/jdi/ProcessAttachTest.sh
+++ b/jdk/test/com/sun/jdi/ProcessAttachTest.sh
@@ -29,7 +29,7 @@
# @summary Unit test for ProcessAttachingConnector
#
# @build ProcessAttachDebugger ProcessAttachDebuggee ShutdownDebuggee
-# @run shell ProcessAttachTest.sh
+# @run shell/timeout=120 ProcessAttachTest.sh
if [ "${TESTJAVA}" = "" ]
then
@@ -69,8 +69,8 @@ esac
startDebuggee()
{
- OUTPUTFILE=${TESTCLASSES}/Debuggee.out
- ${JAVA} "$@" > ${OUTPUTFILE} &
+ rm -f ${OUTPUTFILE}
+ ${JAVA} "$@" > ${OUTPUTFILE} 2>&1 &
startpid="$!"
pid="${startpid}"
@@ -93,11 +93,11 @@ startDebuggee()
echo "Waiting for Debuggee to initialize..."
attempts=0
while true; do
- sleep 1
out=`tail -1 ${OUTPUTFILE}`
if [ ! -z "$out" ]; then
break
fi
+ sleep 1
attempts=`expr $attempts + 1`
echo "Waiting $attempts second(s) ..."
done
@@ -107,9 +107,23 @@ startDebuggee()
stopDebuggee()
{
- $JAVA -classpath "${TESTCLASSES}" ShutdownDebuggee $1
+ # We have to make sure the debuggee has written the portfile before
+ # trying to read it.
+
+ echo "Waiting for port file to be written..."
+ attempts=0
+ while true; do
+ attempts=`expr $attempts + 1`
+ if [ -f ${PORTFILE} ]; then
+ break
+ fi
+ sleep 1
+ echo "Waiting $attempts second(s) ..."
+ done
+
+ $JAVA -classpath "${TESTCLASSES}" ShutdownDebuggee $1 2>&1
if [ $? != 0 ] ; then
- echo "Error: ShutdownDebuggee failed"
+ echo "Error: ShutdownDebuggee failed: $?"
failures=`expr $failures + 1`
kill -9 ${startpid}
fi
@@ -120,7 +134,8 @@ failures=0
#########################################################
echo "Test 1: Debuggee start with suspend=n"
-PORTFILE="${TESTCLASSES}"/shutdown1.port
+PORTFILE=shutdown1.port
+OUTPUTFILE=Debuggee1.out
DEBUGGEEFLAGS=
if [ -r $TESTCLASSES/@debuggeeVMOptions ] ; then
@@ -136,17 +151,27 @@ startDebuggee \
$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
ProcessAttachDebugger $pid 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+
+if [ $? != 0 ]; then
+ echo "Error: ProcessAttachDebugger failed: $?"
+ failures=`expr $failures + 1`
+fi
# Note that when the debugger disconnects, the debuggee picks another
# port and outputs another 'Listening for transport ... ' msg.
stopDebuggee "${PORTFILE}"
+echo "${OUTPUTFILE}:"
+cat $OUTPUTFILE
+echo "-----"
+
#########################################################
echo "\nTest 2: Debuggee start with suspend=y"
-PORTFILE="${TESTCLASSES}"/shutdown2.port
+PORTFILE=shutdown2.port
+OUTPUTFILE=Debuggee2.out
+
startDebuggee \
$DEBUGGEEFLAGS \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y \
@@ -155,27 +180,20 @@ startDebuggee \
$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
ProcessAttachDebugger $pid 2>&1
-# The debuggee is suspended and doesn't run until the debugger
-# disconnects. We have to give it time to write the port number
-# to ${PORTFILE}
+if [ $? != 0 ]; then
+ echo "Error: ProcessAttachDebugger failed: $?"
+ failures=`expr $failures + 1`
+fi
-echo "Waiting for port file to be written..."
-attempts=0
-while true; do
- sleep 1
- attempts=`expr $attempts + 1`
- if [ -f ${PORTFILE} ]; then
- break
- fi
- echo "Waiting $attempts second(s) ..."
-done
-
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
stopDebuggee "${PORTFILE}"
+echo $OUTPUTFILE :
+cat $OUTPUTFILE
+echo -----
+
###
if [ $failures = 0 ];
then echo "All tests passed.";
- else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
+ else echo "$failures test(s) failed."
fi
exit $failures
From 5fc6cd2aa9fc755ace96d48fc12fefe8cd5628fd Mon Sep 17 00:00:00 2001
From: Sean Coffey
Date: Tue, 4 Feb 2014 15:39:40 +0000
Subject: [PATCH 103/159] 8029020: Check src/share/native/java/util/zip code
for JNI pending exceptions
Reviewed-by: alanb, chegar
---
jdk/src/share/native/java/util/zip/Deflater.c | 16 ++++++++++++----
jdk/src/share/native/java/util/zip/Inflater.c | 13 +++++++++----
jdk/src/share/native/java/util/zip/ZipFile.c | 14 +++++++++-----
3 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/jdk/src/share/native/java/util/zip/Deflater.c b/jdk/src/share/native/java/util/zip/Deflater.c
index a9f403db172..d7f751d37a9 100644
--- a/jdk/src/share/native/java/util/zip/Deflater.c
+++ b/jdk/src/share/native/java/util/zip/Deflater.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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,13 +49,21 @@ JNIEXPORT void JNICALL
Java_java_util_zip_Deflater_initIDs(JNIEnv *env, jclass cls)
{
levelID = (*env)->GetFieldID(env, cls, "level", "I");
+ CHECK_NULL(levelID);
strategyID = (*env)->GetFieldID(env, cls, "strategy", "I");
+ CHECK_NULL(strategyID);
setParamsID = (*env)->GetFieldID(env, cls, "setParams", "Z");
+ CHECK_NULL(setParamsID);
finishID = (*env)->GetFieldID(env, cls, "finish", "Z");
+ CHECK_NULL(finishID);
finishedID = (*env)->GetFieldID(env, cls, "finished", "Z");
+ CHECK_NULL(finishedID);
bufID = (*env)->GetFieldID(env, cls, "buf", "[B");
+ CHECK_NULL(bufID);
offID = (*env)->GetFieldID(env, cls, "off", "I");
+ CHECK_NULL(offID);
lenID = (*env)->GetFieldID(env, cls, "len", "I");
+ CHECK_NULL(lenID);
}
JNIEXPORT jlong JNICALL
@@ -132,14 +140,14 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
if (in_buf == NULL) {
// Throw OOME only when length is not zero
- if (this_len != 0)
+ if (this_len != 0 && (*env)->ExceptionOccurred(env) == NULL)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
if (out_buf == NULL) {
(*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
- if (len != 0)
+ if (len != 0 && (*env)->ExceptionOccurred(env) == NULL)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
@@ -158,7 +166,7 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
this_off += this_len - strm->avail_in;
(*env)->SetIntField(env, this, offID, this_off);
(*env)->SetIntField(env, this, lenID, strm->avail_in);
- return len - strm->avail_out;
+ return (jint) (len - strm->avail_out);
case Z_BUF_ERROR:
(*env)->SetBooleanField(env, this, setParamsID, JNI_FALSE);
return 0;
diff --git a/jdk/src/share/native/java/util/zip/Inflater.c b/jdk/src/share/native/java/util/zip/Inflater.c
index 3778ff4e40c..2e21d084b39 100644
--- a/jdk/src/share/native/java/util/zip/Inflater.c
+++ b/jdk/src/share/native/java/util/zip/Inflater.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -50,10 +50,15 @@ JNIEXPORT void JNICALL
Java_java_util_zip_Inflater_initIDs(JNIEnv *env, jclass cls)
{
needDictID = (*env)->GetFieldID(env, cls, "needDict", "Z");
+ CHECK_NULL(needDictID);
finishedID = (*env)->GetFieldID(env, cls, "finished", "Z");
+ CHECK_NULL(finishedID);
bufID = (*env)->GetFieldID(env, cls, "buf", "[B");
+ CHECK_NULL(bufID);
offID = (*env)->GetFieldID(env, cls, "off", "I");
+ CHECK_NULL(offID);
lenID = (*env)->GetFieldID(env, cls, "len", "I");
+ CHECK_NULL(lenID);
}
JNIEXPORT jlong JNICALL
@@ -127,14 +132,14 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
if (in_buf == NULL) {
- if (this_len != 0)
+ if (this_len != 0 && (*env)->ExceptionOccurred(env) == NULL)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
if (out_buf == NULL) {
(*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
- if (len != 0)
+ if (len != 0 && (*env)->ExceptionOccurred(env) == NULL)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
@@ -154,7 +159,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
this_off += this_len - strm->avail_in;
(*env)->SetIntField(env, this, offID, this_off);
(*env)->SetIntField(env, this, lenID, strm->avail_in);
- return len - strm->avail_out;
+ return (jint) (len - strm->avail_out);
case Z_NEED_DICT:
(*env)->SetBooleanField(env, this, needDictID, JNI_TRUE);
/* Might have consumed some input here! */
diff --git a/jdk/src/share/native/java/util/zip/ZipFile.c b/jdk/src/share/native/java/util/zip/ZipFile.c
index d66cccb747a..5fd4936a803 100644
--- a/jdk/src/share/native/java/util/zip/ZipFile.c
+++ b/jdk/src/share/native/java/util/zip/ZipFile.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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,11 +71,13 @@ ThrowZipException(JNIEnv *env, const char *msg)
if (msg != NULL) {
s = JNU_NewStringPlatform(env, msg);
}
- x = JNU_NewObjectByName(env,
+ if (s != NULL) {
+ x = JNU_NewObjectByName(env,
"java/util/zip/ZipException",
"(Ljava/lang/String;)V", s);
- if (x != NULL) {
- (*env)->Throw(env, x);
+ if (x != NULL) {
+ (*env)->Throw(env, x);
+ }
}
}
@@ -367,8 +369,10 @@ Java_java_util_jar_JarFile_getMetaInfEntryNames(JNIEnv *env, jobject obj)
/* If some names were found then build array of java strings */
if (count > 0) {
- jclass cls = (*env)->FindClass(env, "java/lang/String");
+ jclass cls = JNU_ClassString(env);
+ CHECK_NULL_RETURN(cls, NULL);
result = (*env)->NewObjectArray(env, count, cls, 0);
+ CHECK_NULL_RETURN(result, NULL);
if (result != 0) {
for (i = 0; i < count; i++) {
jstring str = (*env)->NewStringUTF(env, zip->metanames[i]);
From 8d903056f3403ccb6742b169350d5191c4c30063 Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Tue, 4 Feb 2014 08:58:06 -0800
Subject: [PATCH 104/159] 8033525: Fix raw and unchecked lint warnings in
sun.swing.*
Reviewed-by: alexsch
---
.../classes/sun/swing/BakedArrayList.java | 4 +--
jdk/src/share/classes/sun/swing/FilePane.java | 31 ++++++++++---------
.../classes/sun/swing/SwingLazyValue.java | 12 +++----
.../classes/sun/swing/SwingUtilities2.java | 16 +++++-----
.../swing/plaf/synth/DefaultSynthStyle.java | 28 ++++++++---------
.../plaf/synth/SynthFileChooserUIImpl.java | 4 +--
6 files changed, 48 insertions(+), 47 deletions(-)
diff --git a/jdk/src/share/classes/sun/swing/BakedArrayList.java b/jdk/src/share/classes/sun/swing/BakedArrayList.java
index 0d4670878db..8f9377b81fe 100644
--- a/jdk/src/share/classes/sun/swing/BakedArrayList.java
+++ b/jdk/src/share/classes/sun/swing/BakedArrayList.java
@@ -44,7 +44,7 @@ import java.util.*;
* @author Scott Violet
*/
@SuppressWarnings("serial") // JDK-implementation class
-public class BakedArrayList extends ArrayList {
+public class BakedArrayList extends ArrayList