changeset 48623:812478fb30e5 condy-folding

Fix previous broken commit
author briangoetz
date Tue, 02 Jan 2018 18:05:15 -0500
parents 534504612399
children 25adfa59cdfa
files src/java.base/share/classes/java/lang/Class.java src/java.base/share/classes/java/lang/Enum.java src/java.base/share/classes/java/lang/invoke/MethodHandle.java src/java.base/share/classes/java/lang/invoke/MethodType.java src/java.base/share/classes/java/lang/sym/Constable.java src/java.base/share/classes/java/lang/sym/SymbolicRef.java
diffstat 6 files changed, 44 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Class.java	Fri Dec 22 13:06:32 2017 -0500
+++ b/src/java.base/share/classes/java/lang/Class.java	Tue Jan 02 18:05:15 2018 -0500
@@ -134,7 +134,7 @@
                               GenericDeclaration,
                               Type,
                               AnnotatedElement,
-                              Constable<Class<?>, ClassRef> {
+                              Constable<Class<?>> {
     private static final int ANNOTATION= 0x00002000;
     private static final int ENUM      = 0x00004000;
     private static final int SYNTHETIC = 0x00001000;
--- a/src/java.base/share/classes/java/lang/Enum.java	Fri Dec 22 13:06:32 2017 -0500
+++ b/src/java.base/share/classes/java/lang/Enum.java	Tue Jan 02 18:05:15 2018 -0500
@@ -61,7 +61,7 @@
 @SuppressWarnings("serial") // No serialVersionUID needed due to
                             // special-casing of enum types.
 public abstract class Enum<E extends Enum<E>>
-        implements Constable<E, EnumRef<E>>, Comparable<E>, Serializable {
+        implements Constable<E>, Comparable<E>, Serializable {
     /**
      * The name of this enum constant, as declared in the enum declaration.
      * Most programmers should use the {@link #toString} method rather than
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Fri Dec 22 13:06:32 2017 -0500
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Tue Jan 02 18:05:15 2018 -0500
@@ -431,7 +431,7 @@
  * @author John Rose, JSR 292 EG
  * @since 1.7
  */
-public abstract class MethodHandle implements Constable<MethodHandle, MethodHandleRef> {
+public abstract class MethodHandle implements Constable<MethodHandle> {
 
     /**
      * Internal marker interface which distinguishes (to the Java compiler)
--- a/src/java.base/share/classes/java/lang/invoke/MethodType.java	Fri Dec 22 13:06:32 2017 -0500
+++ b/src/java.base/share/classes/java/lang/invoke/MethodType.java	Tue Jan 02 18:05:15 2018 -0500
@@ -94,7 +94,7 @@
  * @since 1.7
  */
 public final
-class MethodType implements Constable<MethodType, MethodTypeRef>, java.io.Serializable {
+class MethodType implements Constable<MethodType>, java.io.Serializable {
     private static final long serialVersionUID = 292L;  // {rtype, {ptype...}}
 
     // The rtype and ptypes fields define the structural identity of the method type:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/lang/sym/Constable.java	Tue Jan 02 18:05:15 2018 -0500
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 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.
+ */
+package java.lang.sym;
+
+import java.lang.invoke.MethodHandles;
+import java.util.Optional;
+
+/**
+ * Constable
+ */
+public interface Constable<T> {
+    default Optional<? extends SymbolicRef<T>> toSymbolicRef() {
+        return toSymbolicRef(MethodHandles.publicLookup());
+    }
+
+    Optional<? extends SymbolicRef<T>> toSymbolicRef(MethodHandles.Lookup lookup);
+}
--- a/src/java.base/share/classes/java/lang/sym/SymbolicRef.java	Fri Dec 22 13:06:32 2017 -0500
+++ b/src/java.base/share/classes/java/lang/sym/SymbolicRef.java	Tue Jan 02 18:05:15 2018 -0500
@@ -118,7 +118,7 @@
      *
      * @author Brian Goetz
      */
-    interface OfSelf<T extends SymbolicRef<T>> extends SymbolicRef<T>, Constable<T, T> {
+    interface OfSelf<T extends SymbolicRef<T>> extends SymbolicRef<T>, Constable<T> {
         @Override
         @SuppressWarnings("unchecked")
         default Optional<T> toSymbolicRef(MethodHandles.Lookup lookup) {