# HG changeset patch # User lana # Date 1434648273 25200 # Node ID d3d7f5a45a5cf187c8be1528b98805a15a98460a # Parent 5a9da1cf6a5d2e628045184d381f2df5ce8eb7ee# Parent 1ed0333a7723ad76ccbf24e3f4f7ed5bd8cdc94e Merge diff -r 5a9da1cf6a5d -r d3d7f5a45a5c jdk/make/lib/Awt2dLibraries.gmk --- a/jdk/make/lib/Awt2dLibraries.gmk Thu Jun 18 01:43:13 2015 -0700 +++ b/jdk/make/lib/Awt2dLibraries.gmk Thu Jun 18 10:24:33 2015 -0700 @@ -54,7 +54,7 @@ OPTIMIZATION := HIGHEST, \ CFLAGS := $(CFLAGS_JDKLIB) \ $(BUILD_LIBMLIB_CFLAGS), \ - DISABLED_WARNINGS_gcc := parentheses, \ + DISABLED_WARNINGS_gcc := parentheses array-bounds, \ DISABLED_WARNINGS_clang := parentheses, \ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \ MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \ @@ -491,10 +491,10 @@ SRC := $(LIBJAVAJPEG_SRC), \ INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \ OPTIMIZATION := HIGHEST, \ - CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \ + CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \ $(LIBJAVA_HEADER_FLAGS) \ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \ - DISABLED_WARNINGS_gcc := clobbered parentheses, \ + DISABLED_WARNINGS_gcc := clobbered parentheses array-bounds, \ DISABLED_WARNINGS_clang := logical-op-parentheses, \ DISABLED_WARNINGS_microsoft := 4267, \ MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \ diff -r 5a9da1cf6a5d -r d3d7f5a45a5c jdk/src/java.base/share/classes/java/lang/SecurityManager.java --- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java Thu Jun 18 01:43:13 2015 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java Thu Jun 18 10:24:33 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1447,7 +1447,7 @@ throw new NullPointerException("package name can't be null"); } - String[] pkgs; + String[] restrictedPkgs; synchronized (packageAccessLock) { /* * Do we need to update our property array? @@ -1457,8 +1457,7 @@ AccessController.doPrivileged( new PrivilegedAction<>() { public String run() { - return java.security.Security.getProperty( - "package.access"); + return Security.getProperty("package.access"); } } ); @@ -1468,14 +1467,33 @@ // Using a snapshot of packageAccess -- don't care if static field // changes afterwards; array contents won't change. - pkgs = packageAccess; + restrictedPkgs = packageAccess; } /* * Traverse the list of packages, check for any matches. */ - for (String restrictedPkg : pkgs) { - if (pkg.startsWith(restrictedPkg) || restrictedPkg.equals(pkg + ".")) { + final int plen = pkg.length(); + for (String restrictedPkg : restrictedPkgs) { + final int rlast = restrictedPkg.length() - 1; + + // Optimizations: + // + // If rlast >= plen then restrictedPkg is longer than pkg by at + // least one char. This means pkg cannot start with restrictedPkg, + // since restrictedPkg will be longer than pkg. + // + // Similarly if rlast != plen, then pkg + "." cannot be the same + // as restrictedPkg, since pkg + "." will have a different length + // than restrictedPkg. + // + if (rlast < plen && pkg.startsWith(restrictedPkg) || + // The following test is equivalent to + // restrictedPkg.equals(pkg + ".") but is noticeably more + // efficient: + rlast == plen && restrictedPkg.startsWith(pkg) && + restrictedPkg.charAt(rlast) == '.') + { checkPermission( new RuntimePermission("accessClassInPackage." + pkg)); break; // No need to continue; only need to check this once diff -r 5a9da1cf6a5d -r d3d7f5a45a5c jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java --- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java Thu Jun 18 01:43:13 2015 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java Thu Jun 18 10:24:33 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ * Returns the potentially annotated generic component type of this array type. * * @return the potentially annotated generic component type of this array type + * @see GenericArrayType#getGenericComponentType() */ AnnotatedType getAnnotatedGenericComponentType(); } diff -r 5a9da1cf6a5d -r d3d7f5a45a5c jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java --- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java Thu Jun 18 01:43:13 2015 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java Thu Jun 18 10:24:33 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,7 @@ * Returns the potentially annotated actual type arguments of this parameterized type. * * @return the potentially annotated actual type arguments of this parameterized type + * @see ParameterizedType#getActualTypeArguments() */ AnnotatedType[] getAnnotatedActualTypeArguments(); } diff -r 5a9da1cf6a5d -r d3d7f5a45a5c jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java --- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java Thu Jun 18 01:43:13 2015 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java Thu Jun 18 10:24:33 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,8 +36,11 @@ /** * Returns the potentially annotated bounds of this type variable. + * If no bound is explicitly declared, the bound is unannotated + * {@code Object}. * * @return the potentially annotated bounds of this type variable + * @see TypeVariable#getBounds() */ AnnotatedType[] getAnnotatedBounds(); } diff -r 5a9da1cf6a5d -r d3d7f5a45a5c jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java --- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java Thu Jun 18 01:43:13 2015 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java Thu Jun 18 10:24:33 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,15 +36,22 @@ /** * Returns the potentially annotated lower bounds of this wildcard type. + * If no lower bound is explicitly declared, the lower bound is the + * type of null. In this case, a zero length array is returned. * - * @return the potentially annotated lower bounds of this wildcard type + * @return the potentially annotated lower bounds of this wildcard type or + * an empty array if no lower bound is explicitly declared. + * @see WildcardType#getLowerBounds() */ AnnotatedType[] getAnnotatedLowerBounds(); /** * Returns the potentially annotated upper bounds of this wildcard type. + * If no upper bound is explicitly declared, the upper bound is + * unannotated {@code Object} * * @return the potentially annotated upper bounds of this wildcard type + * @see WildcardType#getUpperBounds() */ AnnotatedType[] getAnnotatedUpperBounds(); } diff -r 5a9da1cf6a5d -r d3d7f5a45a5c jdk/src/java.base/share/classes/java/lang/reflect/TypeVariable.java --- a/jdk/src/java.base/share/classes/java/lang/reflect/TypeVariable.java Thu Jun 18 01:43:13 2015 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/reflect/TypeVariable.java Thu Jun 18 10:24:33 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ public interface TypeVariable extends Type, AnnotatedElement { /** * Returns an array of {@code Type} objects representing the - * upper bound(s) of this type variable. Note that if no upper bound is + * upper bound(s) of this type variable. If no upper bound is * explicitly declared, the upper bound is {@code Object}. * *

For each upper bound B: