OpenJDK 11: Merging java.lang.reflect.* trivial changes

This is a part of merging upstream changes from OpenJDK 11.28. It
updates classes with trivial changes (most of them are javadoc
changes), and a test for an added API.

There is a new API added in MalformedParameterizedTypeException:
 * public MalformedParameterizedTypeException(String message);

Bug: 198640665
Test: m droid
atest MalformedParameterizedTypeExceptionTest
Change-Id: I19f3fe90315047b8f0f7925d144fbfbbacf2c18f
diff --git a/api/current.txt b/api/current.txt
index 75d9907..2037ee0 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -4644,6 +4644,7 @@
 
   public class MalformedParameterizedTypeException extends java.lang.RuntimeException {
     ctor public MalformedParameterizedTypeException();
+    ctor public MalformedParameterizedTypeException(String);
   }
 
   public class MalformedParametersException extends java.lang.RuntimeException {
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
index 04266d5..fa27f12 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
@@ -31,4 +31,9 @@
         assertNull(e.getMessage());
     }
 
+    public void testMalformedParameterizedTypeExceptionWithMessage() {
+        MalformedParameterizedTypeException e = new MalformedParameterizedTypeException("message");
+        assertNotNull(e);
+        assertEquals(e.getMessage(), "message");
+    }
 }
diff --git a/ojluni/src/main/java/java/lang/reflect/Array.java b/ojluni/src/main/java/java/lang/reflect/Array.java
index db7e9a2..9bf81c4 100644
--- a/ojluni/src/main/java/java/lang/reflect/Array.java
+++ b/ojluni/src/main/java/java/lang/reflect/Array.java
@@ -37,6 +37,7 @@
  * conversion would occur.
  *
  * @author Nakul Saraiya
+ * @since 1.1
  */
 public final
 class Array {
diff --git a/ojluni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java b/ojluni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java
index a9efc55..31fbcb4 100644
--- a/ojluni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java
+++ b/ojluni/src/main/java/java/lang/reflect/MalformedParameterizedTypeException.java
@@ -36,4 +36,21 @@
  */
 public class MalformedParameterizedTypeException extends RuntimeException {
     private static final long serialVersionUID = -5696557788586220964L;
+
+    /**
+     * Constructs a {@code MalformedParameterizedTypeException} with
+     * no detail message.
+     */
+    public MalformedParameterizedTypeException() {
+        super();
+    }
+
+    /**
+     * Constructs a {@code MalformedParameterizedTypeException} with
+     * the given detail message.
+     * @param message the detail message; may be {@code null}
+     */
+    public MalformedParameterizedTypeException(String message) {
+        super(message);
+    }
 }
diff --git a/ojluni/src/main/java/java/lang/reflect/Modifier.java b/ojluni/src/main/java/java/lang/reflect/Modifier.java
index 28d89bb..f27f14e 100644
--- a/ojluni/src/main/java/java/lang/reflect/Modifier.java
+++ b/ojluni/src/main/java/java/lang/reflect/Modifier.java
@@ -26,6 +26,8 @@
 
 package java.lang.reflect;
 
+import java.util.StringJoiner;
+
 /**
  * The Modifier class provides {@code static} methods and
  * constants to decode class and member access modifiers.  The sets of
@@ -49,8 +51,7 @@
      *  packages
      *
     static {
-        sun.reflect.ReflectionFactory factory =
-            AccessController.doPrivileged(
+        ReflectionFactory factory = AccessController.doPrivileged(
                 new ReflectionFactory.GetReflectionFactoryAction());
         factory.setLangReflectAccess(new java.lang.reflect.ReflectAccess());
     }
@@ -241,27 +242,24 @@
      * represented by {@code mod}
      */
     public static String toString(int mod) {
-        StringBuilder sb = new StringBuilder();
-        int len;
+        StringJoiner sj = new StringJoiner(" ");
 
-        if ((mod & PUBLIC) != 0)        sb.append("public ");
-        if ((mod & PROTECTED) != 0)     sb.append("protected ");
-        if ((mod & PRIVATE) != 0)       sb.append("private ");
+        if ((mod & PUBLIC) != 0)        sj.add("public");
+        if ((mod & PROTECTED) != 0)     sj.add("protected");
+        if ((mod & PRIVATE) != 0)       sj.add("private");
 
         /* Canonical order */
-        if ((mod & ABSTRACT) != 0)      sb.append("abstract ");
-        if ((mod & STATIC) != 0)        sb.append("static ");
-        if ((mod & FINAL) != 0)         sb.append("final ");
-        if ((mod & TRANSIENT) != 0)     sb.append("transient ");
-        if ((mod & VOLATILE) != 0)      sb.append("volatile ");
-        if ((mod & SYNCHRONIZED) != 0)  sb.append("synchronized ");
-        if ((mod & NATIVE) != 0)        sb.append("native ");
-        if ((mod & STRICT) != 0)        sb.append("strictfp ");
-        if ((mod & INTERFACE) != 0)     sb.append("interface ");
+        if ((mod & ABSTRACT) != 0)      sj.add("abstract");
+        if ((mod & STATIC) != 0)        sj.add("static");
+        if ((mod & FINAL) != 0)         sj.add("final");
+        if ((mod & TRANSIENT) != 0)     sj.add("transient");
+        if ((mod & VOLATILE) != 0)      sj.add("volatile");
+        if ((mod & SYNCHRONIZED) != 0)  sj.add("synchronized");
+        if ((mod & NATIVE) != 0)        sj.add("native");
+        if ((mod & STRICT) != 0)        sj.add("strictfp");
+        if ((mod & INTERFACE) != 0)     sj.add("interface");
 
-        if ((len = sb.length()) > 0)    /* trim trailing space */
-            return sb.toString().substring(0, len-1);
-        return "";
+        return sj.toString();
     }
 
     /*
diff --git a/ojluni/src/main/java/java/lang/reflect/Parameter.java b/ojluni/src/main/java/java/lang/reflect/Parameter.java
index 4dc32b4..0dfbbb9 100644
--- a/ojluni/src/main/java/java/lang/reflect/Parameter.java
+++ b/ojluni/src/main/java/java/lang/reflect/Parameter.java
@@ -176,7 +176,7 @@
      *         a name.
      */
     public String getName() {
-        // Note: empty strings as paramete names are now outlawed.
+        // Note: empty strings as parameter names are now outlawed.
         // The .equals("") is for compatibility with current JVM
         // behavior.  It may be removed at some point.
         if(name == null || name.equals(""))
@@ -208,7 +208,7 @@
         return tmp;
     }
 
-    private transient volatile Type parameterTypeCache = null;
+    private transient volatile Type parameterTypeCache;
 
     /**
      * Returns a {@code Class} object that identifies the
diff --git a/ojluni/src/main/java/java/lang/reflect/ReflectPermission.java b/ojluni/src/main/java/java/lang/reflect/ReflectPermission.java
index a5e5be1..6d5459f 100644
--- a/ojluni/src/main/java/java/lang/reflect/ReflectPermission.java
+++ b/ojluni/src/main/java/java/lang/reflect/ReflectPermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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/ojluni/src/main/java/java/lang/reflect/TypeVariable.java b/ojluni/src/main/java/java/lang/reflect/TypeVariable.java
index 4e29a94..1c06c09 100644
--- a/ojluni/src/main/java/java/lang/reflect/TypeVariable.java
+++ b/ojluni/src/main/java/java/lang/reflect/TypeVariable.java
@@ -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
@@ -53,7 +53,7 @@
 public interface TypeVariable<D extends GenericDeclaration> 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}.
      *
      * <p>For each upper bound B: <ul> <li>if B is a parameterized
@@ -69,7 +69,7 @@
      *     for any reason
      * @return an array of {@code Type}s representing the upper
      *     bound(s) of this type variable
-    */
+     */
     Type[] getBounds();
 
     /**
@@ -95,11 +95,11 @@
      * Returns an array of AnnotatedType objects that represent the use of
      * types to denote the upper bounds of the type parameter represented by
      * this TypeVariable. The order of the objects in the array corresponds to
-     * the order of the bounds in the declaration of the type parameter.
+     * the order of the bounds in the declaration of the type parameter. Note that
+     * if no upper bound is explicitly declared, the upper bound is unannotated
+     * {@code Object}.
      *
-     * Returns an array of length 0 if the type parameter declares no bounds.
-     *
-     * @return an array of objects representing the upper bounds of the type variable
+     * @return an array of objects representing the upper bound(s) of the type variable
      * @since 1.8
      *
      AnnotatedType[] getAnnotatedBounds();