@@ -65,26 +65,13 @@ public abstract class DynamicMethod {
65
65
/** Flags for builtin, notimpl, etc */
66
66
protected byte flags ;
67
67
/** The simple, base name this method was defined under. May be null.*/
68
- protected String name ;
68
+ protected final String name ;
69
69
/** An arbitrarily-typed "method handle" for use by compilers and call sites */
70
70
protected Object handle ;
71
71
72
72
private static final int BUILTIN_FLAG = 0x1 ;
73
73
private static final int NOTIMPL_FLAG = 0x2 ;
74
74
75
- /**
76
- * Base constructor for dynamic method handles.
77
- *
78
- * @param implementationClass The class to which this method will be
79
- * immediately bound
80
- * @param visibility The visibility assigned to this method
81
- * pre/post invocation logic.
82
- */
83
- protected DynamicMethod (RubyModule implementationClass , Visibility visibility ) {
84
- assert implementationClass != null ;
85
- init (implementationClass , visibility );
86
- }
87
-
88
75
/**
89
76
* Base constructor for dynamic method handles with names.
90
77
*
@@ -94,15 +81,19 @@ protected DynamicMethod(RubyModule implementationClass, Visibility visibility) {
94
81
* @param name The simple name of this method
95
82
*/
96
83
protected DynamicMethod (RubyModule implementationClass , Visibility visibility , String name ) {
97
- this (implementationClass , visibility );
84
+ assert implementationClass != null ;
85
+ assert name != null ;
98
86
this .name = name ;
87
+ init (implementationClass , visibility );
99
88
}
100
89
101
90
/**
102
91
* A no-arg constructor used only by the UndefinedMethod subclass and
103
92
* CompiledMethod handles. instanceof assertions make sure this is so.
104
93
*/
105
- protected DynamicMethod () {
94
+ protected DynamicMethod (String name ) {
95
+ this .visibility = (byte ) Visibility .PUBLIC .ordinal ();
96
+ this .name = name ;
106
97
// assert (this instanceof UndefinedMethod ||
107
98
// this instanceof CompiledMethod ||
108
99
// this instanceof );
@@ -491,15 +482,6 @@ public String getName() {
491
482
return name ;
492
483
}
493
484
494
- /**
495
- * Set the base name for this method.
496
- *
497
- * @param name the name to set
498
- */
499
- public void setName (String name ) {
500
- this .name = name ;
501
- }
502
-
503
485
/**
504
486
* Get the "handle" associated with this DynamicMethod.
505
487
*
@@ -568,4 +550,12 @@ public CallConfiguration getCallConfig() {
568
550
@ Deprecated
569
551
public void setCallConfig (CallConfiguration callConfig ) {
570
552
}
553
+
554
+ /**
555
+ * @deprecated Use {@link DynamicMethod#DynamicMethod(RubyModule, Visibility, String)}
556
+ */
557
+ @ Deprecated
558
+ protected DynamicMethod (RubyModule implementationClass , Visibility visibility ) {
559
+ this (implementationClass , visibility , "(anonymous)" );
560
+ }
571
561
}
0 commit comments